Linearize
linearize the equations of an active MapleSim model
Calling Sequence
Parameters
Returns
Options
Description
Examples
A := MapleSim:-LinkModel();
A:-Linearize(options)
options
-
(optional) equation(s) of the form name = value
By default, the Linearize command returns a DynamicSystems object that is a linearized form of a linked subsystem. Alternatively, the user can specify format=all to return a Maple record containing complete linearization information.
If format = all then Linearize returns a record with the following fields:
stateeqs - a set of linearized state equations
outeqs - a set of linearized output equations
A - state-space Matrix A
B - state-space Matrix B
C - state-space Matrix C
D - state-space Matrix D
varsubs - a list of variable name substitutions: a state, input, and output remapping list
linpoint - a set of equations of the form x⁡t=0 defining the linearization point
dsobject - a DynamicSystems object created using linearized equations
params - parameter definitions
protected - subset of parameters in params that may change the structure of the model; an empty set if paramcheck is false
err - string containing error raised during generation of dsobject
If implicitform=true and format=all then Linearize returns the following fields:
linres - a list of two sets: first set has linearized implicit expressions including those for output variables, and the second set contains all the input variables. The presence of input variables makes the resulting system non-square (number of equations does not match the number of variables) thus the user is made aware of their presence.
dsobject - a DynamicSystems object created using linearized expressions
ics = set
Specifies the system's initial condition override equations of the form variable = value, for example x⁡t=5. These will be used as overrides during the computation of the initial point for the model. The default initial value stored in a model will be used for any variables for which an override value is not provided. The model is then initialized with default and override values. Note that the only case where an override value is guaranteed to match the computed initial value is when the corresponding variable has a fixed initial condition. Any default or override values for fixed initial conditions must be consistent.
inputs = list
A list of the system's inputs. The default value is the linked model A subsystem's inputs.
outputs = list
A list of the system's outputs. The default value is the linked model A subsystem's outputs.
params = list
Specifies a list of parameter equations of the form name = value for parameters that should be left in symbolic form in the linearized equations. The numerical value of the parameter (the right hand side) will be used to compute the initial and equilibrium points.
paramcheck = true or false
Specifies if parameter analysis should be performed on the linked subsystem. If set to true, then each of the params occurring in the equations is analyzed for its effect on the model. If it is determined to affect the structure of the linearized equations then a warning is issued listing these parameters as "protected"; the set of protected parameters is assigned to the protected field of the returned record. It is not advisable to leave these parameters as symbolic since changing their value may make the linearized system invalid. If a parameter does not affect the structure of the linearized equations then it is free to appear as a symbolic parameter in the linearized system. If this option is set to false then this check is skipped and all parameters will be left in their symbolic form in the linearized equations. The default is true.
baumgarte = list
Specifies derivative (alpha) and proportional (beta) gains for Baumgarte constraint stabilization in the form baumgarte=[alpha,beta]. These values are scale factors used for the constraints during the linearization process. If this option is set to an empty list, the default, then the Baumgarte stabilization is not used and the constraint equations are used to reduce the order of the system.
format = 'DynamicSystems' or 'all'
Specifies whether the linearized subsystem should be returned as a DynamicSystems object or a record containing complete linearization information. The default is DynamicSystems. See the Return section for the description of these output forms.
implicitform = true or false
Specifies if the linearization process should skip an explicit solve of the linearized equations and return an implicit set of linearized expressions. This option should be used when the system has symbolic parameters and thus obtaining an explicit form can be expensive. When the system has constraints and the baumgarte option is not used, additional dummy variables will be introduced to account for higher order constraints. These are algebraic variables starting with "_derN_" where N is the order of the derivative variable that was eliminated. This option is set to false by default.
inputdata = set or list
Specifies a set or list of equations of the form x⁡t=value that should be used as overrides for input values. These values are then used in the equilibrium point computation and linearization instead of the values specified in the linked subsystem. Adding many input overrides may result in an inconsistent set of equations if the values are not consistent to within an appropriate precision.
linpoint = one of 'icpoint' or 'eqpoint'
Specifies whether the equations should be linearized around an equilibrium point or the initial point. The default is icpoint. If linearizing a subsystem around an equilibrium point, the inputs are assigned their initial or override values.
nosubs = true or false
Specifies whether the parameters and initial conditions are entered as the original model names or the shortened, substituted names. Setting nosubs=true avoids substitution and returns long form names. The default is false.
useoffset = true or false
Specifies if offsets (linearization points as they appear in the variable substitution lists) should be included in the DynamicSystems object creation. The default is true.
The Linearize command returns a DynamicSystems model that is a linearized form of a linked subsystem, one that can be represented in first-order form:
ⅆⅆtx⁡t=f⁡x⁡t,u⁡t
y⁡t=g⁡x⁡t,u⁡t
where:
x⁡t represents the state variables;
u⁡t represents the input variables specified by inputs;
y⁡t represents the output variables specified by outputs;
f and g are functions to be linearized;
The output of Linearize can also be represented in state-space form:
ⅆⅆtx⁡t=A⁢x⁡t−x0+B⁢u⁡t−u0+f⁡x0,u0
y⁡t=C⁢x⁡t−x0+D⁢u⁡t−u0+g⁡x0,u0
where A=ⅆfⅆx, B=ⅆfⅆu, C=ⅆgⅆx, and D=ⅆgⅆu are the Jacobian matrices evaluated at the linearization point (x0,u0), which is the equilibrium or initial point. At the equilibrium point f⁡x0,u0=0 and g⁡x0,u0=0. At the initial point f⁡x0,u0 may not be zero but this offset value will be returned in the equations.
The linearization algorithm uses an initial point of the system in order to compute its equilibrium point (where derivatives of states are set to zero). If no equilibrium point can be found then the user is invited to linearize the system around the initial point. The ics option can be used to affect the computation of the initial point.
The system must have state variables or output equations in order for linearization to occur. If there are output equations but no states then the state-space matrices A, B, and C will be empty and only the D matrix representing the y⁡t=D⁢u⁡t part of the linearized system will be populated.
The Linearize command provides information about the linearized model that can be used for various purposes, including model analysis and control design. For example, a MapleSim model with no inputs or outputs will be represented by its system matrix after linearization and this information can be used for modal analysis as shown in the Examples section.
The A := MapleSim:-LinkModel() statement needs to be run prior to successfully using any of the ModelObject A's export functions.
with⁡MapleSim:
Linearization point of a MapleSim model
A≔MapleSim:-LinkModel⁡filename=cat⁡kernelopts⁡toolboxdir=MapleSim,/data/examples/RLCcircuit.msim:
A:-ListSubsystems⁡
RLC
A:-SetSubsystemName⁡RLC
Call Linearize to generate a linearized, DynamicSystems model, using all the parameters in the subsystem.
sys≔A:-Linearize⁡params=A:-GetParameters⁡:
sys:-parameters
C=1,L=1,R=1
with⁡DynamicSystems:
PrintSystem⁡sys
Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable=InputSignal⁡toutputvariable=OutputSignal⁡tde={[ⅆⅆtx1⁡t=−x2⁡tL, ⅆⅆtx2⁡t=x1⁡t⁢R−u1⁡t⁢R−x2⁡tR⁢C, y1⁡t=−x2⁡t, x1⁡t=I1_p_i⁡t, x2⁡t=SC1_v⁡t, u1⁡t=InputSignal⁡t, y1⁡t=OutputSignal⁡t]
BodePlot⁡sys,parameters=C=10
Call Linearize with format=all option to obtain the linearization point.
sys≔A:-Linearize⁡params=A:-GetParameters⁡,format=all:
sys:-linpoint
I1_p_i⁡t=0.,SC1_v⁡t=0.,InputSignal⁡t=0,OutputSignal⁡t=−0.
Modal analysis of a MapleSim model
Consider a MapleSim model of a double mass-spring-damper system
A≔MapleSim:-LinkModel⁡filename=cat⁡kernelopts⁡toolboxdir=MapleSim,/data/examples/MassSpringDamper.msim:
Call Linearize with paramcheck=false option to keep all symbolic parameters.
linsys≔A:-Linearize⁡params=A:-GetParameters⁡,format=all,paramcheck=false:
Obtain the parameter values.
p≔linsys:-params
p≔c1=10,c2=1,k1=10000,k2=1000,m1=2,m2=1
Analyze the system matrix A.
a≔linsys:-A
a≔0100−k1+k2m1−c1+c2m1k2m1c2m10001k2m2c2m2−k2m2−c2m2
Get its characteristic polynomial.
LinearAlgebra:-CharacteristicPolynomial⁡a,s
s4+m2⁢c1+c2⁢m1+m2⁢c2⁢s3m2⁢m1+c2⁢c1+m2⁢k1+k2⁢m1+m2⁢k2⁢s2m2⁢m1+c1⁢k2+c2⁢k1⁢sm1⁢m2+k1⁢k2m1⁢m2
Get the system matrix with numeric parameters.
An≔eval⁡linsys:-A,linsys:-params
An≔0100−5500−11250012000110001−1000−1
Get the eigenvalues.
eigs≔evalf⁡LinearAlgebra:-Eigenvalues⁡An
eigs≔−0.445752358+29.85474874⁢I−0.445752358−29.85474874⁢I−2.804247642+74.83736686⁢I−2.804247642−74.83736686⁢I
The damping ratios of the two modes are given by:
damprat1≔1sqrt⁡1+ℑ⁡eigs1ℜ⁡eigs12
damprat1≔0.01492903810
damprat2≔1sqrt⁡1+ℑ⁡eigs3ℜ⁡eigs32
damprat2≔0.03744494387
The natural frequencies of the two modes are:
natfreq1≔−ℜ⁡eigs1damprat1
natfreq1≔29.85807625
natfreq2≔−ℜ⁡eigs3damprat2
natfreq2≔74.88988772
The periods of the two modes are given by:
T1≔evalf⁡2⁢πnatfreq1⁢sqrt⁡1−damprat12
T1≔0.2104584890
T2≔evalf⁡2⁢πnatfreq2⁢sqrt⁡1−damprat22
T2≔0.08395786184
See Also
DynamicSystems
DynamicSystems[SystemObject]
MapleSim
MapleSim[LinkModel]
MapleSim[LinkModel][GetICs]
MapleSim[LinkModel][GetSettings]
module
Download Help Document