I would like to model an explictly time dependent differential equation in Modelica.
Say I would like to model
Real x(start=1);
der(x) = t;
in Modelica. What is the correct way to access the time variable t?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The time variable in Modelica is called
timeand it is accessible in any model or block (but not packages, record, connectors or functions).Also, instead of using the
startattribute I suggest using initial equations. So your complete model would look like this:The equations in the
initial equationsection are only applied to solve for initial values of states. The equation shown above is trivial, but you can do interesting stuff like:The point here is that you can use other equations besides ones that directly specify the value of the state. The above initial equation is not “physically” interesting, but mathematically it is because it is both non-linear and time-varying (i.e. sensitive to the start time of the simulation).