// Calculates the Wheatstone bridge's resistors' values // // Author: Marcelo M. David B. // e-mail: marcelod@cin.edu.uy // sun may 28th 2006 23:51 GMT-0300 Uruguay // // Use under GNU License only function aver_ensayo1() r12t=TK_GetVar('r12'); r34t=TK_GetVar('r34'); r13t=TK_GetVar('r13'); r14t=TK_GetVar('r14'); r23t=TK_GetVar('r23'); r24t=TK_GetVar('r24'); execstr("r12="+r12t); execstr("r34="+r34t); execstr("r13="+r13t); execstr("r14="+r14t); execstr("r23="+r23t); execstr("r24="+r24t); R=[0 0 0 0]; Ra=[r14 r24 r13 r23]; Ra=[r14 r24 r13 r23]./(1-R/sum(Ra)); while (norm(R-Ra)>0.01) R=Ra; Ra=[r14 r24 r13 r23]./(1-R/sum(Ra)); end buttondialog("R14="+string(Ra(1))+"\nR24="+string(Ra(2))+"\nR13="+string(Ra(3))+"\nR23="+string(Ra(4))+"\n","Thank you","info"); endfunction function ensayo1() TK_EvalStr('toplevel .foo1'); TK_EvalStr('label .foo1.l -text ""Tests of aparent resistances""'); TK_EvalStr('pack .foo1.l'); TK_EvalStr('label .foo1.l2 -text """"'); TK_EvalStr('pack .foo1.l2'); TK_EvalStr('label .foo1.l13 -text ""Ap. Resist between terminals 1-3:""'); TK_EvalStr('pack .foo1.l13'); TK_EvalStr('entry .foo1.e13 -textvariable r13'); TK_EvalStr('pack .foo1.e13'); TK_EvalStr('label .foo1.l14 -text ""Ap. Resist between terminals 1-4:""'); TK_EvalStr('pack .foo1.l14'); TK_EvalStr('entry .foo1.e14 -textvariable r14'); TK_EvalStr('pack .foo1.e14'); TK_EvalStr('label .foo1.l23 -text ""Ap. Resist between terminals 2-3:""'); TK_EvalStr('pack .foo1.l23'); TK_EvalStr('entry .foo1.e23 -textvariable r23'); TK_EvalStr('pack .foo1.e23'); TK_EvalStr('label .foo1.l24 -text ""Ap. Resist between terminals 2-4:""'); TK_EvalStr('pack .foo1.l24'); TK_EvalStr('entry .foo1.e24 -textvariable r24'); TK_EvalStr('pack .foo1.e24'); TK_EvalStr('button .foo1.b2 -text ""Do the calculations please"" -command {ScilabEval ""aver_ensayo1()""}'); TK_EvalStr('pack .foo1.b2'); endfunction buttondialog("You will need to do four tests on aparent resistances\nLabel the terminals so terminals 1 - 2 will be the source\nand terminals 3 - 4 will be the output","Listo","info"); ensayo1