GetEquations

get the equations of the active MapleSim subsystem

Parameters

 options - (optional) equation(s) of the form name = value

Returns

 • list : list of the subsystem's equations

Options

 • toplevel : true or false
 Specifies whether the top-level equations should be returned regardless of the active subsystem setting.  Default is false.
 • output : one of the following: 'daes','definitions','events','relations','functions','all','aes','odes'; or a list of one or more of these names
 Specifies the types of the equations of the linked model to be returned. Default is 'daes'.
 – Continuous definitions equations ('definitions'):
 • This set contains equations that were algebraically simplified out from the rest of the model equations according to simplification rules based on, for example, linearity or uniqueness of the variables. These equations are not used in the remaining stages of the simulation engine.
 – Core continuous equations ('daes'):
 • This represents a set of continuous equations that remain after simplification.  These equations are processed further by the engine and used for simulation.
 – Set of inequality/boolean definitions ('relations'):
 • This set contains definitions for boolean and inequality variables.  They may represent relations or Maple logic operators such as And, Or, Not.  They are also used for simulation but often require special handling.
 – Set of event handling definitions ('events'):
 • This set contains all the specifications for events.  It can contain internal MapleSim engine data types. These definitions are used internally by the integration engine for event handling.
 – Function/data definitions ('functions'):
 • This last set contains equations that define black-box procedures used in the model.  There are two types of specifications that can occur here.  The fist one can be a definition of Matrix type that stores numeric data values.  The second can be a Maple procedure.  These types are used, for example, to define lookup tables in MapleSim.  The procedure names can appear in equations contained in the previous sets, thus they must be assigned their definitions at any time the procedures are to be evaluated.  Note that the procedures will fail to evaluate if their input arguments do not evaluate to numeric types.
 – Ordinary differential equations ('odes'):
 • This subset of 'daes' contains equations which have derivatives.
 – Algebraic equations ('aes'):
 • This subset of 'daes' contains equations without derivatives.
 – All subsystem's equations ('all'):
 • This set contains all the subsystem's equations. It is an ordered list of the five above described sets:'daes', 'definitions', 'relations', 'events', and 'functions'.
 • params : one of the following: set, list or 'all'
 Specifies which parameters to leave symbolic in the returned equations.  By default, only parameters explicitly defined on the active subsystem are left symbolic.
 • simplify : true or false
 Specifies whether to simplify the returned equations using Maple's simplify command. For large sets of equations this can take significant amounts of time and memory. Default is false.
 • filter : list, set, string, name, or function
 Used to select equations that contain particular variables or parameters. If no variables or parameters are specified, no filtering is applied. Each string may be a wildcard pattern, see StringTools[WildcardMatch] for the format.  Any equation that contains a variable or parameter that matches an element of filter is returned.  Matching is made both before and after substitution; equations with elements that match either are accepted. The default is the empty set, which does no filtering.
 • inputs : list or set
 Specifies which variables should be treated as inputs when equations are simplified. Input signal port variables are always treated as inputs. In addition, by default, the across (potential) variables of acausal ports are treated as inputs. If the inputs option is passed, only the signal inputs and the variables specified by inputs are treated as inputs.
 • prefvars : list
 Specifies a list of preferred variables that should remain part of the core equation system. The equation simplification algorithm will avoid isolating for these variables when possible. The list is ordered in decreasing preference: the variables appearing on the left have stronger preference than the ones on the right. This list is empty by default.

Description

 • A:-GetEquations returns the list of the linked model A subsystem's equations.
 • If a subsystem, for which the equations are requested, contains acausal ports, the flow variables on this ports are treated as input variables, when equations are simplified. To overwrite this behavior, use the inputs option.
 • The A := MapleSim:-LinkModel() statement needs to be run prior to successfully using any of the ModelObject A's export functions.

Notes

 • The following internal data types can occur in the set of the event handling definitions (these specifications correspond to Modelica constructs):

 Internal Data Type Name Definition msim/WHEN A wrapper for an event specification of the form msim/WHEN(conditions,equations) that contains event number of arguments alternating between conditions and equations (or a sequence of equations).  It is used to specify equations that are valid only at event instants. msim/SEQ Represents a wrapper for zero, two, or more Maple expressions.  It can be used to specify a sequence of expressions inside msim/WHEN that are valid at a particular event instant. _msim_change Used to detect changes of the discrete-time variables.  _msim_change(discretevariable) returns true for an instant when the variable discretevariable changes value. _msim_edge Used to detect changes of boolean variables.  _msim_edge(booleanvariable) is true for a time instant when the boolean variable booleanvariable changes value from false to true. _msim_initial The function _msim_initial() returns true at an event instant just before the beginning of simulation (usually t=0). It can be used as a condition in msim/WHEN to specify additional initialization information for discrete-time variables. _msim_noEvent Wrapping an expression in _msim_noEvent(expression) prevents that expression from generating events. This can be used to guard expressions from going outside of their domain of validity (for example, a square root of a negative value). _msim_pre This function is used to obtain predecessor values of a discrete-time variable.  The function _msim_pre(discretevariable) returns, at an event instant, a value of discretevariable immediately preceding the event. _msim_reinit Used to reinitialize a state variable.  A call to _msim_reinit(statevariable,expression) reinitializes a state variable statevariable with expression at an event instant and deactivates any existing assignment to statevariable. _msim_sample Used to periodically trigger events when used in combination with msim/WHEN.  The function _msim_sample(first,interval) returns true at time instants first + i*interval, where i=0,1,..,N. _msim_terminate Invoking _msim_terminate() causes the integration to terminate.  It can be used to terminate a simulation when it goes outside the domain where the model is valid.

 • Any black-box function with multiple outputs that is present in the equations has been reformatted to make it easier to read. Instead of an internal format, such functions will have all the output variables on the left side of the definition equation followed by a function call with the input arguments on the right side.

Examples

 > $A≔\mathrm{MapleSim}:-\mathrm{LinkModel}\left('\mathrm{filename}'=\mathrm{cat}\left(\mathrm{kernelopts}\left('\mathrm{toolboxdir}'=\mathrm{MapleSim}\right),"/data/examples/RLCcircuit.msim"\right)\right):$

Getting the equations of the active subsystem's equations:

 > $A:-\mathrm{GetEquations}\left('\mathrm{output}'='\mathrm{daes}'\right)$
 $\left\{{\mathrm{C1_p_i}}{}\left({t}\right){+}{\mathrm{I1_p_i}}{}\left({t}\right){-}{\mathrm{SC1_v}}{}\left({t}\right){-}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){=}{0}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{I1_p_i}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{SC1_v}}{}\left({t}\right){=}{-}{\mathrm{C1_p_i}}{}\left({t}\right)\right\}$ (1)
 > $A:-\mathrm{GetEquations}\left('\mathrm{output}'='\mathrm{all}'\right)$
 $\left[\left\{{\mathrm{C1_p_i}}{}\left({t}\right){+}{\mathrm{I1_p_i}}{}\left({t}\right){-}{\mathrm{SC1_v}}{}\left({t}\right){-}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){=}{0}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{I1_p_i}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{SC1_v}}{}\left({t}\right){=}{-}{\mathrm{C1_p_i}}{}\left({t}\right)\right\}{,}\left\{{\mathrm{C1_i}}{}\left({t}\right){=}{\mathrm{C1_p_i}}{}\left({t}\right){,}{\mathrm{C1_n_i}}{}\left({t}\right){=}{-}{\mathrm{C1_p_i}}{}\left({t}\right){,}{\mathrm{C1_n_v}}{}\left({t}\right){=}{0}{,}{\mathrm{C1_p_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{C1_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{G2_p_i}}{}\left({t}\right){=}{\mathrm{C1_p_i}}{}\left({t}\right){+}{\mathrm{I1_p_i}}{}\left({t}\right){-}{\mathrm{SC1_v}}{}\left({t}\right){-}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{G2_p_v}}{}\left({t}\right){=}{0}{,}{\mathrm{I1_i}}{}\left({t}\right){=}{\mathrm{I1_p_i}}{}\left({t}\right){,}{\mathrm{I1_n_i}}{}\left({t}\right){=}{-}{\mathrm{I1_p_i}}{}\left({t}\right){,}{\mathrm{I1_n_v}}{}\left({t}\right){=}{0}{,}{\mathrm{I1_p_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{I1_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{NP1_i}}{}\left({t}\right){=}{0}{,}{\mathrm{NP1_v}}{}\left({t}\right){=}{0}{,}{\mathrm{NP2_i}}{}\left({t}\right){=}{0}{,}{\mathrm{NP2_v}}{}\left({t}\right){=}{0}{,}{\mathrm{PP1_i}}{}\left({t}\right){=}{0}{,}{\mathrm{PP1_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{PP2_i}}{}\left({t}\right){=}{0}{,}{\mathrm{PP2_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{PP3_i}}{}\left({t}\right){=}{0}{,}{\mathrm{PP3_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{PS1_p_i}}{}\left({t}\right){=}{0}{,}{\mathrm{PS1_p_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{PS1_y}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_i}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_n_i}}{}\left({t}\right){=}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_n_v}}{}\left({t}\right){=}{0}{,}{\mathrm{R1_p_i}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_p_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{S1_y}}{}\left({t}\right){=}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{SC1_i}}{}\left({t}\right){=}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{SC1_n_i}}{}\left({t}\right){=}{-}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{SC1_n_v}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{SC1_p_i}}{}\left({t}\right){=}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{SC1_p_v}}{}\left({t}\right){=}{0}{,}{\mathrm{Vout}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{InputSignal}}{}\left({t}\right){=}{\mathrm{sin}}{}\left({2}{}{\mathrm{\pi }}{}{t}\right){,}{\mathrm{OutputSignal}}{}\left({t}\right){=}{-}{\mathrm{SC1_v}}{}\left({t}\right){,}{\mathrm{R1_LossPower}}{}\left({t}\right){=}{{\mathrm{SC1_v}}{}\left({t}\right)}^{{2}}{,}{\mathrm{R1_R_actual}}{}\left({t}\right){=}{1}{,}{\mathrm{R1_T_heatPort}}{}\left({t}\right){=}\frac{{6003}}{{20}}\right\}{,}{\varnothing }{,}{\varnothing }{,}{\varnothing }\right]$ (2)

Get differential equations that use parameter C (keep parameter symbolic).

 > $A:-\mathrm{GetEquations}\left('\mathrm{output}=\mathrm{daes}','\mathrm{params}=\mathrm{all}','\mathrm{filter}'=C\right)$
 $\left\{\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{SC1_v}}{}\left({t}\right){=}{-}\frac{{-}{\mathrm{I1_p_i}}{}\left({t}\right){+}\frac{{\mathrm{SC1_v}}{}\left({t}\right)}{{R}}{+}{\mathrm{S1_y}}{}\left({t}\right)}{{C}}\right\}$ (3)