I got the following, quiet fundamental, problem with JModelica. Consider a rather simple model:
model TEST
Real Dum(start = 0);
parameter Integer It = 5;
algorithm
Dum := 0;
for i in 1:It loop
Dum := Dum + 1;
end for;
end TEST;
I compile that with python and it runs, of course, and the variable Dum has always the value 5 as it is supposed to be. The problem is now that when I want to change to parameter "It" after loading the compiled fmu ( test.fmu ) with:
test = load_fmu("test.fmu");
test.set("It",4);
and then run the simulation, it still gives 5 for "Dum" and not 4 as it should. Although "It" gets changed to 4 actually as can be seen by plotting the time-curve of "It" after simulation. Does anybody know if there is a way to change It on the fly so that it actually effects the loop?
This is of course a toy example, but I need that functionality for a much bigger project where I desperately need to loop over a varying range and where re-compiling is just to time consuming.
Thanks so much