I want to set a default variable name T (=xx) inside a model - drag that model into a new model and define there the variable xx. I get the error message: Use of undeclared variable xx.
This is the sub-model
model test
parameter Real T = xx;
Real f;
equation
f = T + time;
end test;
this is the full model
model fullmodel
parameter Real xx = 12;
Test Test1;
end fullmodel;
My question: How would you do that in Modelica? I need for my model 100 of the same models and i want to set a few parameters (diamter, lenghts, etc.) per default to a variable name and then define just this variables. I know i could propagate the variable - but it would be nice, if i just have to drag the model and then defining the parameters. Thank you for your help!
Alternatively you can do this using inner/outer:
model Test
outer parameter Real xx;
parameter Real T = xx;
Real f;
equation
f = T + time;
end Test;
model fullmodel
inner parameter Real xx = 12;
Test test1;
end fullmodel;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With