How to access time variable in modelica

I would like to model an explicitly time-dependent differential equation in Modelica.

Let's say I would like to simulate

Real x(start=1);
der(x) = t;

in Modelica. What is the correct way to access time variable t?

+5
source share
1 answer

A temporary variable in Modelica is called timeand available in any model or block (but not in packages, records, connectors or functions).

In addition, instead of using the attribute, startI suggest using the initial equations. So your complete model would look like this:

model FirstOrder
  Real x;
initial equation
  x = 1;
equation
  der(x) = time;
end FirstOrder;

initial equation . , , , :

model FirstOrder_IC2
  Real x;
initial equation
  x*x*x = 3.0*time+7.0;
equation
  der(x) = time;
end FirstOrder_IC2;

, , , . "" , , , (.. ).

+11

All Articles