I tried use global parameter in code like this:
model testModel
outer parameter Integer par;
outer Integer var;
equation
for i in 1:par loop
var[i] = 5 * i;
end for;
end testModel;
model test
inner parameter Integer par = 3;
inner Integer var[par];
testModel mod;
end test;
simulate(test)
And I got the following error:
Error: The iteration range 1:par is not a constant or parameter expression
All works fine if not using global parameter:
model test
inner parameter Integer par = 3;
inner Integer var[par];
testModel mod(par = par);
end test;
How can I use the global parameter in "for", or why can't I? Thank you in advance
This should work: