Load input and increment using variable in loop

I want to determine my load ordinate in load case 3 using a variable (#LFK). This variable should be incremented within the loop (currently commented out). Even though I save the variable using STO and explicitly specify the data source, the following error appears:

+++++ Fehler Nr. 12130 ; Eingabezeile: 6
Diese vordefinierten Variablen nicht in der CDB gefunden :
+++++ Fehler Nr. 10141 in Programm SOF_VAR
Variable LFK undefiniert oder mit ungültigem Index 0
+++++ Fehler Nr. 10141 in Programm SOF_VAR
Variable LFK undefiniert oder mit ungültigem Index 0

When I generate the loads with a specific value, everything works fine, including the load combination and the nonlinear calculation. Only when I try to use the variable for load definition does the program crash. Below is my code, with the part containing the error highlighted in bold:

+PROG SOFILOAD urs:18.1 $ Lasten kombinieren
KOPF Lasten kombinieren
SEIT UNIE 0
LF 1001 TYP (D) BEZ ‘G_1’
COPY NR 1 FAKT 1.0 $ 1: G_1 Eg_MW
ENDE

+PROG ASE urs:25.1 $ Berechnung der kombinierten Lastfälle
KOPF Berechnung der kombinierten Lastfälle
SEIT UNIE 0
STEU OPT WARP WERT 0
SYST PROB th2 ITER 200
DEHN KMOD sn KSV UL KMIN 0.05 KMAX 1 FMAX 0.9 CHKC
LF 1001
ENDE

+PROG SOFILOAD urs:26.5 $ Lasten kombinieren
KOPF Lasten kombinieren
SEIT UNIE 0
LF 1002 TYP (D) BEZ ‘G_1+L’
COPY NR 1 FAKT 1.0 $ 1: G_1 Eg_MW
COPY NR 2 FAKT 30.0 $ 2: L Konz_Einzellast_50_60 (Verkehrslast)
ENDE

+PROG ASE urs:26.6 $ Berechnung der kombinierten Lastfälle
KOPF Berechnung der kombinierten Lastfälle
SEIT UNIE 0
STEU OPT WARP WERT 0
SYST PROB th2 ITER 200
DEHN KMOD sn KSV UL KMIN 0.05 KMAX 1 FMAX 0.9 CHKC
LF 1002
ENDE

$ Schleife zur Erhöhung der Verkehrslast bis zum Erreichen der Druckfestigkeit → Gelenkbildung
$ STO anstatt LET, damit Variablen in Datenbasis gespeichert und von verschiedenen Programmen aufgerufen werden können
STO#i 1 ‘Vergleichsrechnung.cdb’ $ Laufvariable für Laststeigerung
STO#pmax 33 ‘Vergleichsrechnung.cdb’ $ Maximale Verkehrslast [kN/m]
STO#nmax 100 ‘Vergleichsrechnung.cdb’ $ Maximale Anzahl an Laststeigerungen
STO#LFK 20 ‘Vergleichsrechnung.cdb’ $ Lastfaktor für den 1.Iterationsschritt

$LOOP
** +PROG SOFILOAD urs:26.3 $ Lastfall erzeugen und iterativ erhöhen**
** KOPF Text Editor für Lasten**
** LF NR 3 TYP DEL**
** RCL#LFK ‘Vergleichsrechnung.cdb’**
** LF NR 3 TYP ‘L’ FAKT 1 BEZ “Konz_Einzellast_50_60_iterativ”**
** LINE REF SLN NR ‘7’ BEZ ‘Konz_Einzell’ WIDE 0 TYP PZP P1 #LFK -3.213938 -2.47022E-16 -3.830222 P2 #LFK -2.867882 -2.79541E-16 -4.09576**
** LINE REF SLN NR ‘8’ BEZ ‘Konz_Einzell’ WIDE 0 TYP PZP P1 #LFK -2.867882 -2.79541E-16 -4.09576 P2 #LFK -2.5 -3.08243E-16 -4.330127**
** SEIT UNIE 0**
** ENDE**

** +PROG ASE urs:9 $ Berechnung Einzellastfälle**
** KOPF Berechnung von Schnittkräften**
** SEIT UNIE 0**
** STEU OPT WARP WERT 0**
** LF NR 3**
** ENDE**

** +PROG SOFILOAD urs:26.4 $ Lasten kombinieren**
** KOPF Lasten kombinieren**
** LF 1003 TYP (D) BEZ ‘G_1+L’**
** COPY NR 1 FAKT 1.0 $ 1: G_1 Eg_MW (Grundlast)**
** COPY NR 3 FAKT 1.0 $ 2: L Konz_Einzellast_50_60 (Verkehrslast)**
** ENDE**

** +PROG ASE urs:25.2 $ Berechnung der kombinierten Lastfälle**
** KOPF Berechnung der kombinierten Lastfälle**
** SEIT UNIE 0**
** STEU OPT WARP WERT 0**
** SYST PROB th2 ITER 200**
** DEHN KMOD sn KSV UL KMIN 0.05 KMAX 1 FMAX 0.9 CHKC**
** LF 1003**
** ENDE**

$ RCL#ALL ‘Vergleichsrechnung.cdb’
$ STO#i (#i+1) ‘Vergleichsrechnung.cdb’ $ Schleife hochzählen
$ STO#LFK (#pmax(#i/#nmax)^(0.5)) ‘Vergleichsrechnung.cdb’ $ Neuer Lastfaktor (=neue Last, da Grundlastfall = 1kN/m)*
$ENDLOOP #i<=(#nmax-1)

I thank you in advance for the help and remain with kind regards,
Felix.

PS: Antworten gerne auch auf Deutsch oder Englisch :wink:

1 Like

The RCL/STO commands need to be inside a program or they won’t execute, e.g.:

+Prog Template
$ Schleife zur Erhöhung der Verkehrslast bis zum Erreichen der Druckfestigkeit → Gelenkbildung
$ STO anstatt LET, damit Variablen in Datenbasis gespeichert und von verschiedenen Programmen aufgerufen werden können
STO#i 1 ‘Vergleichsrechnung.cdb’ $ Laufvariable für Laststeigerung
STO#pmax 33 ‘Vergleichsrechnung.cdb’ $ Maximale Verkehrslast [kN/m]
STO#nmax 100 ‘Vergleichsrechnung.cdb’ $ Maximale Anzahl an Laststeigerungen
STO#LFK 20 ‘Vergleichsrechnung.cdb’ $ Lastfaktor für den 1.Iterationsschritt
End

I also don’t think the STO#i 1 ‘Vergleichsrechnung.cdb’ syntax is valid.
You can get a value from a different cdb with RCL, but I don’t think you can store it anywhere but the current cdb.

Also, you won’t be able to implement a loop over programs like that.
LOOP → iterate within a program

Your looking for the iter keyword, e.g. (check the basics manual for “Iterative Analysis with Multiple Modules”):

+Prog Sofiload iter
...
End
+Prog Ase iter
...
End
+Prog Template iter
If "some_target"
   Exit_Iteration
Else
   "Do something if need be"
EndIf
End

Thank you very much for the quick and competent assistance. I programmed a loop in TEDDY for the first time, and the “iter” hint for the modules was invaluable – otherwise, I had only made minor adjustments in TEDDY after converting the tasks. This was a significant step in my project for “maximum-load calculation”. Here is the final code, in case someone encounters a similar task in the future. By the way, in retrospect, I wouldn’t increase the load itself with the loop; instead, I would raise the load factor for Load Case 3 in the “Lasten kombinieren” task within the copy command. This way, you save an ASE calculation in each iteration. I might adjust it later, and if I do, I will also share the code here.

+Prog Template urs:26.7
KOPF
$Initialisierung der Variablen für die Iteration (Speichern für ersten Iterationsschritt)
$ STO anstatt LET, damit Variablen in Datenbasis gespeichert und von verschiedenen Programmen aufgerufen werden können
STO#i 1 $ Laufvariable für Laststeigerung
STO#pmax 31 $ Maximale Verkehrslast [kN/m]
STO#nmax 20 $ Maximale Anzahl an Laststeigerungen
STO#LFK 1 $ Lastfaktor für den 1.Iterationsschritt
ENDE

LOOP
$ Schleife zur Erhöhung der Verkehrslast bis zum Erreichen der Druckfestigkeit → Gelenkbildung

+Prog Template iter urs:26.8
KOPF
RCL#ALL                              $Alle Variablen aus Datenbasis holen
STO#LFK (#pmax*(#i/#nmax)^(0.5))     $Last erhöhen (Wurzelfunktion)
ENDE

+PROG SOFILOAD iter    urs:26.9 $ Lastfall erzeugen und iterativ erhöhen
KOPF Text Editor für Lasten
LF NR 3 TYP DEL
LF  NR 3 TYP 'L' FAKT 1 BEZ "Konz_Einzellast_50_60_iterativ"
LINE REF SLN NR '7' BEZ 'Konz_Einzell' WIDE 0 TYP PZP P1 #LFK -3.213938 -2.47022E-16 -3.830222 P2 #LFK -2.867882 -2.79541E-16 -4.09576
LINE REF SLN NR '8' BEZ 'Konz_Einzell' WIDE 0 TYP PZP P1 #LFK -2.867882 -2.79541E-16 -4.09576  P2 #LFK -2.5      -3.08243E-16 -4.330127
SEIT UNIE 0
ENDE

+PROG ASE iter urs:26.10 $ Berechnung Einzellastfälle
KOPF Berechnung von Schnittkräften
SEIT UNIE 0
STEU OPT WARP WERT 0
LF NR 3
ENDE

+PROG SOFILOAD iter  urs:26.11 $ Lasten kombinieren
KOPF Lasten kombinieren
LF 1003 TYP (D) BEZ 'G_1+L'
COPY NR 1 FAKT 1.0          $ 1: G_1  Eg_MW (Grundlast)
COPY NR 3 FAKT 1.0          $ 2: L  Konz_Einzellast_50_60 (Verkehrslast)
ENDE

+PROG ASE iter            urs:26.12 $ Berechnung der kombinierten Lastfälle
KOPF Berechnung der kombinierten Lastfälle
SEIT UNIE 0
STEU OPT WARP WERT 0
SYST PROB th2 ITER 200
DEHN KMOD sn KSV UL KMIN 0.05 KMAX 1 FMAX 0.9  CHKC
LF 1003
ENDE

+PROG TEMPLATE iter urs:26.13
KOPF
RCL#i
STO#i (#i+1)    $ Schleife hochzählen
ENDE

ENDLOOP #i<=(#nmax-1)