Closed tbeu closed 10 years ago
In fact almost all simple domain models use start values and fixed attributes. Also start values are easier to implement than initial equations for a Modelica compiler vendor.
There is one more strong argument for using the start/fixed attributes in preference. You can modify them, i.e. set them by dialog.
Mike, can you please commenr on this issue. I consider it as an important issue not just a matter of taste.
Thomas, I agree with you in general on this point and I think more discussion on this topic is required in the book. I simply haven't had the time to invest in that part just yet. I have a conference coming up so I'm pretty busy with that at the moment. Hopefully once that is done I'll have a bit more time to think about this.
Thomas, I've added some further discussion about fixed
. I don't discuss the modification of start attributes because, frankly, if you really want to allow users to change such things, you should make them parameters (and that works with both initial equations and fixed=true
).
Maybe you also want to add a model that makes use of it. E.g. BasicEquations\LotkaVolterra\ClassicModelFixedStartValues.mo
This is what I mean
within ModelicaByExample.BasicEquations.LotkaVolterra;
model ClassicModelFixedStartValues "This is the typical equation-oriented model"
parameter Real alpha=0.1 "Reproduction rate of prey";
parameter Real beta=0.02 "Mortality rate of predator per prey";
parameter Real gamma=0.4 "Mortality rate of predator";
parameter Real delta=0.02 "Reproduction rate of predator per prey";
parameter Real x0=10 "Initial prey population";
parameter Real y0=10 "Initial predator population";
Real x(start=x0, fixed=true) "Prey population";
Real y(start=y0, fixed=true) "Predator population";
equation
der(x) = x*(alpha-beta*y);
der(y) = y*(delta*x-gamma);
end ClassicModelFixedStartValues;
When you speak about start values first time (in Lotka-Volterra Systems) you compare advantages and disadvantages with initial equations. What I miss here is the introduction of the fixed attribute which means - if set to fixed - that the start attribute is no longer just a hint but a fixed initial assignment.