Repeat Until - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Repeat Until (/thread-22367.html) |
Repeat Until - Onieh - 09-19-2024 11:31 AM Hallo zusammen, ich habe ein Verständnisproblem mit der Repeat Until Anweisung! Das Programm soll mir aus einer Tabelle, hier eine Liste einen Wert KS Wert zu einer Betongüte ermitteln. Nur habe ich eine Problem mit der Repeat Until Schleife! Wer kann mir da weiterhelfen? Das Programm habe ich hier reingestellt. Es ist aber noch nicht ganz fertig. Gruß Heino EXPORT erfAs_kd_Verfahren() BEGIN LOCAL N,M,A1,A2,A3,A4,A5,A6; LOCAL A7,A8,C,I,F,KS; LOCAL Md:=45,H1:=50,b:=1,∅Bew:=16,∅Büg:=0,d,as; LOCAL cnom:=3,Nd:=0,kd; //LOCAL m,m1,mx,my; //LOCAL Ende, Weiter, Zurück; STARTVIEW(-1); STARTVIEW(6,1); INPUT({{Md,[0],{30,17,0}}, {Nd,[0],{30,17,1}}, {H1,[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:=H1-cnom-∅Büg/10-∅Bew/20; kd:=d/√((Md/b)); //Main loop //REPEAT // kd; //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"}; 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"}; //ks; //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"}; 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"}; KS:=A8; CHOOSE (N,"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 N==1 THEN M:=A1; C:="C 20/25"; END; IF N==2 THEN M:=A2; C:="C 25/30"; END; IF N==3 THEN M:=A3; C:="C 30/37"; END; IF N==4 THEN M:=A4; C:="C 35/45"; END; IF N==5 THEN M:=A5; C:="C 40/50"; END; IF N==6 THEN M:=A6; C:="C 45/55"; END; IF N==7 THEN M:=A7; C:="C 50/60"; END; IF N==8 THEN END; I:=1; REPEAT PRINT (M(I)); I:=I+1; UNTIL (M(I))>kd END; PRINT ("BETONGUETE = "+(C)); PRINT ("kd ="+(ROUND(kd,2))); PRINT (M(I)); PRINT(I); PRINT ("KS ="+(KS(I))); END; RE: Repeat Until - roadrunner - 09-19-2024 12:44 PM Two things i noticed: First, M(I) is a string and kd is a float. That generates an error when compared in line 79. Changing this: UNTIL (M(I))>kd to this: UNTIL (EXPR(M(I)))>kd will fix that. Second, using reserved variables (like M and C) as strings or matrices is generally considered bad PPL programming practice. Doing that normally works fine, but is frond upon by some. Hope this helps. -road RE: Repeat Until - Onieh - 09-19-2024 01:11 PM (09-19-2024 12:44 PM)roadrunner Wrote: Two things i noticed: RE: Repeat Until - Onieh - 09-19-2024 01:14 PM Vielen Dank Road! :-) Es funktioniert. Bis zum nächsten mal! Gruß Heino RE: Repeat Until - Onieh - 09-19-2024 01:17 PM Zweitens gilt die Verwendung reservierter Variablen (wie M und C) als Strings oder Matrizen allgemein als schlechte PPL-Programmierpraxis. Normalerweise funktioniert das einwandfrei, wird aber von manchen missbilligt. Was meinst Du damit genau. Ich bin kein Programmieren, lerne aber gerne dazu! Gruß Heino RE: Repeat Until - rprosperi - 09-21-2024 04:44 AM @Onieh: Use English please! Foreign language can be included, and online translations from native to English are also fine, but do refrain from posting exclusively in foreign languages. Thanks |