GetEquations(deprecated) - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

 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.

Options

 • is_immediate = truefalse
 The is_immediate keyword parameter specifies whether the optional parameter modelFile is interpreted as the file name of the Modelica source file or as the Modelica model code string.
 When is_immediate=true, the modelFile parameter is interpreted as containing the actual Modelica code. Otherwise, it is interpreted as the name of the Modelica source file.
 • mbaumgarte = list(nonnegative,nonnegative)

The mbaumgarte keyword parameter specifies the value of the Baumgarte constraint stabilization parameters ([$\mathrm{\alpha }$, $\mathrm{\beta }$]) applied to the multibody portion of the system. If the value is greater than 0, the position-level constraints are removed from the multibody system and replaced by Baumgarte stabilized acceleration constraints, effectively transforming the multibody DAEs to pure ODEs. The default value is [0,0].

 • symbolicname =  Or( list(name), all )
 The symbolicname keyword parameter specifies a list of parameter names to be kept as symbolic in the returned equations.  For example, if the system has two parameters J=1 and C=2, having symbolicname=[J] will keep the parameter J in the returned equations while the value of C will be substituted in.
 With the default setting of symbolicname=[], the returned equations will have all of the parameter values substituted in.
 The special case of symbolicname=all specifies that all of the parameter names in the system are kept symbolic in the returned equations.
 • start_time = numeric
 If specified then it is used by the flattener to override the default start time (which is 0). Note that non-zero start times are currently not supported by the simulation engine.
 • timefunction = truefalse
 The timefunction keyword parameter specifies whether the variables in the returned equations are expressed as a function of time, for example, x(t), or simply as inert names, for example, x.
 When timefunction=true, the default setting, the function of time form is returned. Otherwise, the inert name form is returned.
 The name of the independent time variable is specified by the time field of the flattened record.
 • simplify =  Or( truefalse, tryhard )
 The simplify keyword parameter specifies the type of simplification to apply to the system equations.
 The simplify=false option returns the equations without any simplification.
 The simplify=true option simplifies the system model by eliminating redundant variables and equations in the system. This is the default setting.
 The simplify=tryhard option applies redundant variable removal and index reduction to the system.
 • This command is part of the MapleSim package. It can be used in the form GetEquations(...) only after executing the command with(MapleSim). However, it can always be accessed through the long form of the command by using MapleSim[GetEquations](...).

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}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{0}{,}{\mathrm{Main.z}}{}\left({t}\right){-}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{sin}}{}\left({t}\right){=}{0}{,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}\left\{\begin{array}{cc}{t}& {t}{<}{1}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\\right\}$ (2)

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

 > $\mathrm{bool}$
 ${\varnothing }$ (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}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}{0}{,}{\mathrm{Main.z}}{}\left({t}\right){-}{\mathrm{Main.y}}{}\left({t}\right){-}{\mathrm{sin}}{}\left({t}\right){=}{0}{,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}\left\{\begin{array}{cc}{t}& {t}{<}{1}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\\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(\left\{\begin{array}{cc}\frac{{{t}}^{{2}}}{{2}}& {t}{\le }{1}\\ \frac{{{t}}^{{3}}}{{3}}{+}\frac{{1}}{{6}}& {1}{<}{t}\end{array}\right\\right){+}\mathrm{c__1}{,}{\mathrm{Main.z}}{}\left({t}\right){=}\left(\left\{\begin{array}{cc}\frac{{{t}}^{{2}}}{{2}}& {t}{\le }{1}\\ \frac{{{t}}^{{3}}}{{3}}{+}\frac{{1}}{{6}}& {1}{<}{t}\end{array}\right\\right){+}\mathrm{c__1}{+}{\mathrm{sin}}{}\left({t}\right){,}{\mathrm{msim/CVAR1}}{}\left({t}\right){=}\left\{\begin{array}{cc}{t}& {t}{<}{1}\\ {{t}}^{{2}}& {\mathrm{otherwise}}\end{array}\right\\right\}$ (5)