Teddy: using variable for name of text file and 'DUMP' item in 'HIST' record


I am running a large number of simulations, each of which having its own unique ID. I’ve defined a variable which contains this ID, which is used for some calculations of other variables:

sto#simulation_id 185

After each simulation, I also write the acceleration data into a file with the ‘DUMP’ item of the ‘HIST’ record in the ‘DYNR’ program, as well as a .txt file which contains some other values. The names of these files should contain the simulation ID, as can be seen below.

HIST LCS 801 TYPE A-Z NO0 #node_neighbor C0 1001 DUMP Simulation185


This works fine like this, although it requires me to manually replace the ID at 3 places every time I run a new simulation (the value of the #simulation_id variable, the HIST record and the name of the .txt). I’d like to know if there’s a way to use the variable to create the correct names for the latter two records somehow, so that I only need to change the ID once per simulation. I’ve already done some tests with a second variable #simulation_name, but this doesn’t seem to work.

Any advice is very welcome!


You can use #define, in your case:

#Define my_id=185
Sto#simulation_id $(my_id)
HIST LCS 801 TYPE A-Z NO0 #node_neighbor C0 1001 DUMP Simulation$(my_id)
1 Like

Awesome, thanks for the quick reply and the simple fix! I got to work immediately and it works perfectly. Now I only have to change one number (the simulation ID) in my script and the number of pedestrians on my bridge model is automatically determined (which is specific to each simulation), and at the same time the output files have the correct corresponding names.