Reputation: 11
I come from a world of thermodynamic cycle design using EcoSimPro's Proosis, so bear with me if I'm trying to mimick too much another software using Modelica.
I have a thermodynamic model for a Brayton cycle built with Dymola and Modelica.
My model has a certain number of unknowns which I choose to apply manually by filling in (or not) the equation in the parameter tab for each component. I've declared my variables with the following method :
This functions fine when running a design point (ie solving for a single point) provided I input the necessary values for the missing equations. I can also dynamically change my closing equations by removing the value on PR for instance, and applying a value for the temperature at the end of compression. So far so good.
However, I can't run sweeps because it's not declared as a parameter...
I've tried switching my variables to parameters, but this doesn't work because once I set them to parameters the model sees them as fixed even though the values are empty and should be computed by the model.
I want to be able to switch rapidly between my closure equations rather than have to dive into the code and declare (or not) a variable to be a parameter.
Is there any way to go about it with Dymola ?
Upvotes: 1
Views: 151
Reputation: 5612
A MWE of what you are trying to accomplish might help, but I think what you are looking for is parameters with the fixed=false
attribute set, see the paragraph on that here.
parameter Real p1(fixed=false);
parameter Real p2(fixed=false);
initial equation
p1 = p2 * 2 ; //closure relation between the two parameters.
When using this model, you have to give a value for one of the parameters, and the other will be computed during initialisation. Same concept with N such fixed-false parameters and M equations, you have to give N-M values.
Also, you then shouldn't need that dialog annotation.
Upvotes: 2