return the system of equations for the input system - MapleSim Help

MapleSim[GetEquations(deprecated)] - return the system of equations for the input system

 Calling Sequence GetEquations( modelFile, modelName, opts )

Parameters

 modelFile - (optional) string; Modelica model code string or file name modelName - (optional) string; Modelica model name opts - (optional) equation(s) of the form option = value; specify options for GetEquations

Returns

 • GetEquations returns an expression sequence with the following sets: eqs, ics, constrs, params, vars, aux, probes,Boolean, Discrete, Function.
 – eqs contains the core continuous equations.
 – ics contains the initial conditions for the system.
 – constrs contains the constraint equations obtained from the index reduction process. If simplify<>tryhard, constrs is an empty set.
 – params contains the parameter substitution equations that define the values of the symbolic parameters remaining in the system equations in eqs.
 – vars contains the system variables in eqs.
 – aux contains the auxiliary equations defining the auxiliary variables in terms of the system variables found in vars.  Auxiliary variables are variables that have been eliminated from the system through the simplification process.
 – probes contains the variable names to which probes are attached.
 – Boolean contains the Boolean equations.
 – Discrete contains the discontinuous equations.
 – Functions contains the procedures defined in the system.

Description

 • Important: The GetEquations command has been deprecated.
 • The GetEquations command returns a list of equations that describe the behavior of the system model.
 • You can specify the input systems in two ways: by using a Modelica model source file name or a Modelica model code string.
 To specify the input system using the file name of a Modelica model source, set the modelFile parameter to the file name and the modelName parameter to the name of the model.
 To specify the input system using the Modelica code string, set the modelFile parameter, which passes the code string, and set the keyword parameter option is_immediate to true.

The options parameters are optional parameters of the form option = value, where option is one of the names listed below. These are keyword parameters; the left side of the equation is the keyword and the right side is the value. Each keyword parameter has a default value that is assigned if the parameter is not passed.

Examples

 > $\mathrm{with}\left(\mathrm{MapleSim}\right):$

Assign a string that corresponds to a simple Modelica deck.

 > $\mathrm{model}:="model Main Real y,z;initial equation y = 0;equation der\left(y\right) = if time < 1 then time else time^2; z = y + sin\left(time\right); annotation\left(probes = \left\{y,z\right\}\right);end Main;"$
 ${\mathrm{model}}{:=}{"model Main Real y,z;initial equation y = 0;equation der\left(y\right) = if time < 1 then time else time^2; z = y + sin\left(time\right); annotation\left(probes = \left\{y,z\right\}\right);end Main;"}$ (1)

Call GetEquations, using the is_immediate option to indicate that the input is a literal Modelica deck.

 > $\mathrm{eqs},\mathrm{ics},\mathrm{constrs},\mathrm{params},\mathrm{vars},\mathrm{aux},\mathrm{probes},\mathrm{bool},\mathrm{disc},\mathrm{func}:=\mathrm{MapleSim}:-\mathrm{GetEquations}\left(\mathrm{model},'\mathrm{is_immediate}'\right):$

The eqs set contains the core differential equations of the system.

 > $\mathrm{eqs}$
 $\left\{\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{0}{,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{{}\begin{array}{cc}{t}& {\mathrm{msim/RVAR1}}{}\left({t}\right){=}{\mathrm{true}}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\}$ (2)

The msim/RVAR1(t) variable represents a boolean relation; it is defined in bool.

 > $\mathrm{bool}$
 $\left\{{\mathrm{msim/RVAR1}}{}\left({t}\right){=}\left({t}{<}{1}\right)\right\}$ (3)

Given the simplicity of the equations, we can substitute bool into eqs after calling subsindets to change the condition in the piecewise expression to the proper form.

 > $\mathrm{deqs}:=\mathrm{subs}\left(\mathrm{bool},\mathrm{subsindets}\left(\mathrm{eqs},'\mathrm{anything}=\mathrm{identical}\left(\mathrm{true}\right)',\mathrm{lhs}\right)\right)$
 ${\mathrm{deqs}}{:=}\left\{\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{0}{,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{{}\begin{array}{cc}{t}& {t}{<}{1}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\}$ (4)

Pass the set of differential equations to dsolve for a symbolic solution.

 > $\mathrm{dsol}:=\mathrm{dsolve}\left(\mathrm{deqs}\right)$
 ${\mathrm{dsol}}{:=}\left\{{\mathrm{Main.y}}{}\left({t}\right){=}\left({{}\begin{array}{cc}\frac{{1}}{{2}}{}{{t}}^{{2}}& {t}{\le }{1}\\ \frac{{1}}{{3}}{}{{t}}^{{3}}{+}\frac{{1}}{{6}}& {1}{<}{t}\end{array}\right){+}{\mathrm{_C1}}{,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{{}\begin{array}{cc}{t}& {t}{<}{1}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\}$ (5)