Linearize - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : MapleSim Application Programming Interface : API Commands : MapleSim/LinkModel/Linearize

Linearize

linearize the equations of an active MapleSim model

 

Calling Sequence

Parameters

Returns

Options

Description

Examples

Calling Sequence

A := MapleSim:-LinkModel();

A:-Linearize(options)

Parameters

options

-

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

Returns

• 

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 xt=0 defining the linearization point

– 

dsobject - a DynamicSystems object created using linearized equations

– 

params - parameter definitions

• 

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.

– 

linpoint - a set of equations of the form xt=0 defining the linearization point

– 

dsobject - a DynamicSystems object created using linearized expressions

– 

params - parameter definitions

Options

• 

ics = set

  

Specifies the system's initial condition override equations of the form variable = value, for example xt=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 its value is substituted into the system prior to linearization since that value is not free to change. If the 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 even though changing their values may make the linearized system invalid. 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 xt=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.

• 

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.

Description

• 

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:

ⅆⅆtxt=fxt,ut

yt=gxt,ut

  

where:

xt represents the state variables;

ut represents the input variables specified by inputs;

yt 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:

ⅆⅆtxt=Axtx0+Butu0+fx0,u0

yt=Cxtx0+Dutu0+gx0,u0

  

where A=xf, B=uf, C=xg, and D=ug are the Jacobian matrices evaluated at the linearization point (x0,u0), which is the equilibrium or initial point.  At the equilibrium point fx0,u0=0 and gx0,u0=0.  At the initial point fx0,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 yt=Dut 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.

Examples

withMapleSim:

Linearization point of a MapleSim model

AMapleSim:-LinkModel'filename'=catkernelopts'toolboxdir'=MapleSim,/data/examples/RLCcircuit.msim:

A:-ListSubsystems

RLC

(1)

A:-SetSubsystemNameRLC

• 

Call Linearize to generate a linearized, DynamicSystems model, using all the parameters in the subsystem.

sysA:-Linearize'params'=A:-GetParameters:

sys:-parameters

C=1,L=1

(2)

withDynamicSystems:

PrintSystemsys

Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable=InputSignaltoutputvariable=OutputSignaltde={[x1.t=x2tL, x2.t=x1tu1t+x2tC, y1t=x2t, x1t=I1_p_it, x2t=SC1_n_vt, u1t=InputSignalt, y1t=OutputSignalt]

(3)

BodePlotsys,parameters=C=10

• 

Call Linearize with format=all option to obtain the linearization point.

sysA:-Linearize'params'=A:-GetParameters,'format'='all':

sys:-linpoint

I1_p_it=0.,SC1_n_vt=0.,InputSignalt=0,OutputSignalt=0.

(4)

Modal analysis of a MapleSim model

• 

Consider a MapleSim model of a double mass-spring-damper system

AMapleSim:-LinkModel'filename'=catkernelopts'toolboxdir'=MapleSim,/data/examples/MassSpringDamper.msim:

• 

Call Linearize with paramcheck=false option to keep all symbolic parameters.

linsysA:-Linearize'params'=A:-GetParameters,'format'='all','paramcheck'=false:

• 

Obtain the parameter values.

plinsys:-params

p:=c1=10,c2=1,k1=10000,k2=1000,m1=2,m2=1

(5)
• 

Analyze the system matrix A.

alinsys:-A

a:=0100k1+k2m1c1+c2m1k2m1c2m10001k2m2c2m2k2m2c2m2

(6)
• 

Get its characteristic polynomial.

LinearAlgebra:-CharacteristicPolynomiala,s

s4+c1m2+c2m1+c2m2s3m2m1+c1c2+k1m2+k2m1+k2m2s2m2m1+c1k2+c2k1sm1m2+k1k2m1m2

(7)
• 

Get the system matrix with numeric parameters.

Anevallinsys:-A,linsys:-params

An:=010055001125001200011000110001

(8)
• 

Get the eigenvalues.

eigsevalfLinearAlgebra:-EigenvaluesAn

eigs:=0.445752358+29.85474874I0.44575235829.85474874I2.804247642+74.83736686I2.80424764274.83736686I

(9)
• 

The damping ratios of the two modes are given by:

damprat111+ℑeigs1ℜeigs12

damprat1:=0.01492903810

(10)

damprat211+ℑeigs3ℜeigs32

damprat2:=0.03744494387

(11)
• 

The natural frequencies of the two modes are:

natfreq1ℜeigs1damprat1

natfreq1:=29.85807625

(12)

natfreq2ℜeigs3damprat2

natfreq2:=74.88988772

(13)
• 

The periods of the two modes are given by:

T1evalf2πnatfreq11damprat12

T1:=0.2104584890

(14)

T2evalf2πnatfreq21damprat22

T2:=0.08395786184

(15)

See Also

DynamicSystems

DynamicSystems[SystemObject]

MapleSim

MapleSim[LinkModel]

MapleSim[LinkModel][GetICs]

MapleSim[LinkModel][GetSettings]

module

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam