New Problem with Repeat Until
|
09-24-2024, 10:27 AM
Post: #1
|
|||
|
|||
New Problem with Repeat Until
Hello everyone, here is another request in English!
I have divided my program listed below into subprograms. However, I get an error in the Repeat Until statement. What is the problem? System();Beton();Berechnung();Ausgabe(); Tabelle(); A1;A2;A3;A4;A5;A6;A7;A8;A9;A10; KS;AS;Md;h;b;∅Bew;∅Büg;d;as; cnom;Nd;kd;XI;ZETA;BET;W1;N1; m;m1;mx;my; Ende;Weiter;Zurück; EXPORT Bemessung() BEGIN STARTVIEW(-1); AFormat:=0; INPUT({{Md,[0],{30,17,0}}, {Nd,[0],{30,17,1}}, {h,[0],{30,17,2}}, {b,[0],{30,17,3}}, {cnom,[0],{77,17,0}}, {∅Büg,[0],{77,17,1}}, {∅Bew,[0],{77,17,2}}}, "Ermittlung von kd", {"MEds [kNm]","NEd [kN]","h [cm] ","b [m] ","cnom [cm] ","∅Büg [mm]","∅Bew [mm]"}, {"Bemessungsmoment","Zugkraft","Höhe des Betonquerschnittes","breite des Betonquerschnittes [m]","Betondeckung [cm]","Bügeldurchmesser [mm]","Bewehrungsdurchmesser [mm]"}); d:=h-cnom-∅Büg/10-∅Bew/20; kd:=d/√((Md/b)); Tabelle(); END; Tabelle() BEGIN LOCAL A1,A2,A3,A4,A5,A6,A7,A8; LOCAL A9,A10; A1:={"1.54","1.57","1.60","1.62","1.65","1.69","1.73","1.77","1.82","1.86","1.91","1.97","2.03","2.11","2.21","2.30","2.43","2.60","2.81","3.10","3.40","3.82","4.55","6.12","11.13"}; A2:={"1.38","1.40","1.43","1.45","1.48","1.51","1.54","1.58","1.63","1.67","1.71","1.76","1.82","1.89","1.97","2.06","2.18","2.32","2.51","2.78","3.04","3.42","4.07","5.47","9.95"}; A3:={"1.26","1.28","1.30","1.33","1.35","1.38","1.41","1.44","1.49","1.52","1.56","1.61","1.66","1.72","1.80","1.88","1.99","2.12","2.29","2.53","2.77","3.12","3.71","5.00","9.09"}; A4:={"1.17","1.19","1.21","1.25","1.28","1.30","1.34","1.38","1.41","1.44","1.49","1.54","1.54","1.59","1.67","1.74","1.84","1.96","2.12","2.35","2.57","2.89","3.44","4.63","8.41"}; A5:={"1.09","1.11","1.13","1.15","1.17","1.19","1.22","1.25","1.29","1.32","1.35","1.39","1.44","1.49","1.56","1.63","1.72","1.84","1.99","2.20","2.40","2.70","3.22","4.33","7.87"}; A6:={"1.03","1.05","1.07","1.08","1.10","1.13","1.15","1.18","1.21","1.24","1.27","1.31","1.36","1.41","1.47","1.53","1.62","1.73","1.87","2.07","2.26","2.55","3.03","4.08","7.42"}; A7:={"0.98","0.99","1.01","1.03","1.05","1.07","1.09","1.12","1.15","1.18","1.21","1.24","1.29","1.33","1.40","1.46","1.54","1.64","1.78","1.96","2.15","2.42","2.88","3.87","7.04"}; A8:={"3.09","3.04","2.99","2.95","2.91","2.87","2.83","2.79","2.75","2.72","2.69","2.66","2.63","2.60","2.57","2.54","2.51","2.48","2.45","2.42","2.40","2.38","2.36","2.34","2.32"}; A9:={"0.617","0.585","0.555","0.530","0.504","0.477","0.450","0.422","0.393","0.371","0.350","0.325","0.302","0.277","0.2507","0.227","0.201","0.174","0.147","0.120","0.104","0.087","0.069","0.048","0.025"}; A10:={"0.743","0.757","0.769","0.780","0.790","0.801","0.813","0.824","0.836","0.846","0.854","0.865","0.875","0.855","0.896","0.906","0.916","0.927","0.939","0.950","0.958","0.966","0.975","0.983","0.991"}; KS:=A8; XI:=A9; ZETA:=A10; Beton(); END; //A1:={"11.13","6.12","4.55","3.82","3.40","3.10","2.81","2.60","2.43","2.30","2.21","2.11","2.03","1.97","1.91","1.86","1.82","1.77","1.73","1.69","1.65","1.62","1.60","1.57","1.54"}; //A2:={"9.95","5.47","4.07","3.42","3.04","2.78","2.51","2.32","2.18","2.06","1.97","1.89","1.82","1.76","1.71","1.67","1.63","1.58","1.54","1.51","1.48","1.45","1.43","1.40","1.38"}; //A3:={"9.09","5.00","3.71","3.12","2.77","2.53","2.29","2.12","1.99","1.88","1.80","1.72","1.66","1.61","1.56","1.52","1.49","1.44","1.41","1.38","1.35","1.33","1.30","1.28","1.26"}; //A4:={"8.41","4.63","3.44","2.89","2.57","2.35","2.12","1.96","1.84","1.74","1.67","1.59","1.54","1.49","1.44","1.41","1.38","1.34","1.30","1.28","1.25","1.23","1.21","1.19","1.17"}; //A5:={"7.87","4.33","3.22","2.70","2.40","2.20","1.99","1.84","1.72","1.63","1.56","1.49","1.44","1.39","1.35","1.32","1.29","1.25","1.22","1.19","1.17","1.15","1.13","1.11","1.09"}; //A6:={"7.42","4.08","3.03","2.55","2.26","2.07","1.87","1.73","1.62","1.53","1.47","1.41","1.36","1.31","1.27","1.24","1.21","1.18","1.15","1.13","1.10","1.08","1.07","1.05","1.03"}; //A7:={"7.04","3.87","2.88","2.42","2.15","1.96","1.78","1.64","1.54","1.46","1.40","1.33","1.29","1.24","1.21","1.18","1.15","1.12","1.09","1.07","1.05","1.03","1.01","0.99","0.98"}; //A8:={"2.32","2.34","2.36","2.38","2.40","2.42","2.45","2.48","2.51","2.54","2.57","2.60","2.63","2.66","2.69","2.72","2.75","2.79","2.83","2.87","2.91","2.95","2.99","3.04","3.09"}; Beton() BEGIN STARTVIEW(6,1); CHOOSE (N1,"Betongüte",{"C 20/25","C 25/30","C 30/37","C 35/45","C 40/50","C 45/55","C 50/60","Ende"}); IF N1==1 THEN W1:=A1; BET:="C 20/25"; END; IF N1==2 THEN W1:=A2; BET:="C 25/30"; END; IF N1==3 THEN W1:=A3; BET:="C 30/37"; END; IF N1==4 THEN W1:=A4; BET:="C 35/45"; END; IF N1==5 THEN W1:=A5; BET:="C 40/50"; END; IF N1==6 THEN W1:=A6; BET:="C 45/55"; END; IF N1==7 THEN W1:=A7; BET:="C 50/60"; END; IF N1==8 THEN END; Berechnung(); END; Berechnung() BEGIN LOCAL I:=0,kd,AS; REPEAT I:=I+1; UNTIL (EXPR(W1(I)))>kd or kd>(EXPR(W1(25))) or kd<(EXPR(W1(1))) END; RECT_P(0,0,320,220,RGB(0,255,255)); IF kd>(EXPR(W1(25))) THEN KS:=EXPR((KS(25))); END; IF kd<(EXPR(W1(1))) THEN KS:=EXPR((KS(1))); END; AS:=(EXPR(KS(I-1)))*Md/d+Nd/43.5; Ausgabe(); END; Ausgabe() BEGIN RECT_P(0,0,320,35,RGB(0,34,174));//BLAU TEXTOUT_P("erf.As nach dem kd-Verfahren",30,5,5,RGB(255,255,255)); TEXTOUT_P("Betongüte",10,40,4); TEXTOUT_P(":",85,40,4); TEXTOUT_P(BET,93,40,4); TEXTOUT_P("cnom",180,40,4); TEXTOUT_P(":",220,40,4); TEXTOUT_P(ROUND(cnom,2)+" cm",240,40,4); TEXTOUT_P("MEd",10,70,4); TEXTOUT_P("=",50,70,4); TEXTOUT_P(ROUND(Md,2)+" kNm",70,70,4); TEXTOUT_P("NEd",180,70,4); TEXTOUT_P("=",220,70,4); TEXTOUT_P(ROUND(Nd,2)+" kN",240,70,4); TEXTOUT_P("h",10,95,4); TEXTOUT_P("=",50,95,4); TEXTOUT_P(ROUND(H,2)+" cm",70,95,4); TEXTOUT_P("d",180,95,4); TEXTOUT_P("=",220,95,4); TEXTOUT_P(ROUND(d,2)+" cm",240,95,4); TEXTOUT_P("kd",10,120,4); TEXTOUT_P("=",50,120,4); TEXTOUT_P(ROUND(kd,2),70,120,4); TEXTOUT_P("ks",180,120,4); TEXTOUT_P("=",220,120,4); TEXTOUT_P(EXPR((KS(I-1))),240,120,4); TEXTOUT_P("ξ",10,145,4); TEXTOUT_P("=",50,145,4); TEXTOUT_P(EXPR((XI(I-1))),70,145,4); TEXTOUT_P("ζ",180,145,4); TEXTOUT_P("=",220,145,4); TEXTOUT_P(EXPR((ZETA(I-1))),240,145,4); RECT_P(0,170,320,240,RGB(0,34,174));//BLAU TEXTOUT_P("erf.as",85,180,6,RGB(255,255,255)); TEXTOUT_P("=",150,180,6,RGB(255,255,255)); TEXTOUT_P(ROUND(AS,2)+" cm²",175,180,6,RGB(255,255,255)); DRAWMENU("ENDE","","weiter","","","zurück"); REPEAT // Get mouse data REPEAT m:=MOUSE; m1:=m(1); UNTIL SIZE(m1)>0; mx:=m1(1); my:=m1(2); Ende:=(my≥220 AND my≤319) AND (mx≥0 AND mx≤51); Weiter:=(my≥220 AND my≤319) AND (mx≥106 AND mx≤160); Zurück:=(my≥220 AND my≤319) AND (mx≥265 AND mx≤319); UNTIL (Ende or Weiter or Zurück); // wait for a soft key //UNTIL (Ende or Weiter); // exit Main loop with "ENDE" or "weiter" // weiter IF Weiter THEN //do what you need for weiter END; // ENDE IF Ende THEN STARTVIEW(-1); //do what you need for ENDE END; //Zurück IF Zurück THEN Md:=Md; Nd:=Nd; h:=h; b:=b; cnom:=cnom; ∅Büg:=∅Büg; ∅Bew:=∅Bew; Bemessung(); END; END; |
|||
09-24-2024, 12:13 PM
Post: #2
|
|||
|
|||
RE: New Problem with Repeat Until
The UNTIL in the "Berechnung" function is missing a ";" on the end.
Chris |
|||
09-24-2024, 01:17 PM
Post: #3
|
|||
|
|||
RE: New Problem with Repeat Until
Hello Chris, thanks for your answer, but that doesn't solve the problem.
|
|||
09-24-2024, 03:02 PM
Post: #4
|
|||
|
|||
RE: New Problem with Repeat Until
Which REPEAT block is it objecting to? Is it just saying "Syntax error"?
Chris |
|||
09-24-2024, 03:50 PM
Post: #5
|
|||
|
|||
RE: New Problem with Repeat Until
The program runs perfectly, even without " ; " behind the UNTIL, when I write everything in one program. The program aborts here: REPEAT
I:=I+1; UNTIL (EXPR(W1(I)))>kd or kd>(EXPR(W1(25))) or kd<(EXPR(W1(1))) END; |
|||
09-24-2024, 04:46 PM
Post: #6
|
|||
|
|||
RE: New Problem with Repeat Until
So it's a runtime error - thanks. Is it failing the first time through the loop, or on a later iteration? Really all you can do in this situations is to add diagnostic output statements (display the values of loop counters, etc) to try to track down the cause of the problem.
Chris |
|||
09-24-2024, 05:30 PM
Post: #7
|
|||
|
|||
RE: New Problem with Repeat Until
I slightly reformatted the src text using some indents,
so you can _see_ loops and dependencies more clearly... In you functon "Berechnung()" there seems to be an END too much, after the UNTIL, and a missing colon (";") after the test clause. However it compiles w/o errors, so maybe this construct is valid. But since you wrote the program errors out after the UNTIL, it more looks like an error. Interesting that the program checker of the Prime doesn't see that potential error. If it ist an error, which the checker lets pass, then your function "Berechnung()" ends after the test clause of the UNTIL, leaving floating code which is never reachable. Removing the said END and adding a colon after the test clause also compiles. So maybe you could give it a try. Code: System();Beton();Berechnung();Ausgabe(); -- Ray |
|||
09-24-2024, 07:20 PM
(This post was last modified: 09-25-2024 02:08 AM by gehakte_bits.)
Post: #8
|
|||
|
|||
RE: New Problem with Repeat Until
Correct your duplicate named global and local variables...
Your tables (A1~A10) are local to Tabelle as well as global, yet you assign them to W1 in Beton (which turns W1 not in a list, just to '0' and will fail your repeat-until W1(index) access) Tabelle() BEGIN LOCAL A1,A2,A3,A4,A5,A6,A7,A8; Also Berechnung() BEGIN LOCAL I:=0,kd,AS; here kd and AS are redefined as locals, yet else where used as globals. there is more .. but this should get you going... |
|||
09-25-2024, 08:20 AM
Post: #9
|
|||
|
|||
RE: New Problem with Repeat Until
Many thanks to everyone who helped me with their knowledge. The program is running! :-)
Heino |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)