Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Repeating a simulation in a for-loop

Repeating a simulation in a for-loop

Hi,
I try to reach a pseudo-steady state to run simulations of a biological system. The idea is to rerun a certain time period several times and always use the latest result as starting point. I first run the model and save the results in mymodel_start.mat:

Code:


system("mymodel -override startTime=255,stopTime=260 -r mymodel_start.mat")

The following also works, using the startfile to run the same model again and writing the results back to that file:

Code:


system("mymodel -override startTime=255,stopTime=260 -iif C:\\OpenModelica1.9.2\\tmp\\mymodel_start.mat -r mymodel_start.mat")

But when I put this simulation in a for-loop, I get an error (see below)

Code:


for i in 1:20 loop
  system("mymodel -override startTime=255,stopTime=260 -iif C:\\OpenModelica1.9.2\\tmp\\mymodel_start.mat -r mymodel_start.mat")
end for;

Error occurred building AST
Syntax Error
[<interactive>:1:0-1:3:writable] Error: Parser error: Unexpected token near: for (FOR)

Any suggestions?

Thank you.
Andre

Re: Repeating a simulation in a for-loop

Missing semicolon.

Re: Repeating a simulation in a for-loop

oh, that was easy. It seems, R messed up even my few programming skills.
Thank you so much. And incredibly quick.

There are 0 guests and 0 other users also viewing this topic
You are here: