WSMLink`
WSMLink`

WSMLinearize

WSMLinearize is being phased out in favor of SystemModelLinearize, which was introduced experimentally in Version 11.3.

WSMLinearize["mmodel"]

gives a linearized state-space to the model "mmodel" at an equilibrium.

WSMLinearize["mmodel",{{{x1,x10},},{{u1,u10},}}]

linearizes at state values {x10,} and input values {u10,}.

Details and Options

  • WSMLinearize linearizes a continuous-time system designed in Wolfram System Modeler.
  • WSMLinearize returns a StateSpaceModel object.
  • WSMLinearize["mmodel",spec] allows the following symbolic values for spec:
  • "EquilibriumValues"uses WSMFindEquilibrium["mmodel"]
    "InitialValues"uses WSMModelData["mmodel","GroupedInitialValues"]
  • WSMLinearize["mmodel",vals,spec] uses spec to add missing values in vals.
  • The default spec is taken to be "EquilibriumValues".
  • The resulting StateSpaceModel has states xi, inputs uj, and outputs yk as defined in "mmodel".
  • The list of states, inputs, and outputs can be found from WSMModelData["mmodel",spec]:
  • "StateVariables"state variables xi
    "InputVariables"input variables uj
    "OutputVariables"output variables yk
  • WSMLinearize reduces a system of DAEs to a system of ODEs and linearizes the resulting ODEs.
  • A system of ODEs with state equations and output equations is linearized at a point and .
  • The linearized system has state , input , and output , with state equations and output equation . The matrices are given by , , , and , all evaluated at and .
  • The returned StateSpaceModel corresponds to the system , .
  • The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.
  • The following options can be given:
  • Method "NumericDerivative"methods for linearization algorithm
    WSMProgressMonitorAutomaticcontrol display of progress
  • The option Method has the following possible settings:
  • "NumericDerivative"uses System Modeler linearization
    "SymbolicDerivative"uses StateSpaceModel linearization

Examples

open allclose all

Basic Examples  (4)

Load Wolfram System Modeler Link:

Linearize a DC-motor model around an equilibrium:

Linearize a mixing tank model around equilibrium with given state and input constraints:

Use the diagram representation of a model as input:

Copy and paste the output above:

Scope  (13)

Model Types  (5)

Linearize a textual RLC circuit model:

Linearize an RLC circuit block diagram model:

Linearize an acausal RLC circuit:

Linearize a DAE model:

Linearize a DAE model symbolically:

Limiting Cases  (3)

Linearize a model without inputs:

Linearize a model without states:

Linearize a model without outputs:

Linearization Values  (5)

Linearize around an equilibrium:

Linearize around initial values:

Linearize around equilibrium with given state and input constraints:

Linearize around equilibrium with state constraints:

Linearize around given partial states and inputs, using initial values for remaining values:

Generalizations & Extensions  (1)

Hide labels in the resulting StateSpaceModel:

Options  (4)

Method  (4)

By default, the "NumericDerivative" method is used:

The method "SymbolicDerivative" uses StateSpaceModel to linearize system equations:

Linearize symbolically, keeping some parameters symbolic:

Linearize symbolically, using a partially symbolic linearization point:

Applications  (9)

Analyzing Linearized System  (5)

Compare responses from a model and its linearization at an equilibrium point:

Linearize around the equilibrium point:

Compare the stationary output response with a nonlinear model:

Compare the y1 output:

Test the stability of a linearized system from eigenvalues of the system matrix:

Since there is an eigenvalue with a positive real part, the system is unstable:

Plotting the output response also indicates an unstable system:

Test the stability of a linearized system from poles of the transfer function:

Since there is a pole with a positive real part, the system is unstable:

Do a frequency analysis using a linear model:

By plotting TemplateBox[{{H, (, {ⅈ,  , omega}, )}}, Abs] for the linearized transfer function :

Verify the result using Fourier on simulated data:

Compute TemplateBox[{{H, (, {ⅈ,  , omega}, )}}, Abs] from :

Alternatively, the imaginary parts of the eigenvalues give the resonance peaks:

Linearization takes place at time 0:

Linearize with the switch connecting at time 0:

If the switch is not connected at time 0, the result is different:

Controller Design for Linearized System  (4)

Design a lead-based controller for a DC motor based on its linearization:

Define a PI-lead controller transfer function:

Open-loop transfer function:

Select controller parameters:

Use selected parameters and close the loop with the PI-lead controller:

Design a controller using pole placement:

Place the closed-loop poles:

Compute the closed-loop state-space model:

Show the step response:

Design an LQ controller:

Define state and input weight matrices:

Define LQ controller gain:

Closed-loop state-space model:

Closed-loop step response:

Design a state estimator:

Compute estimator gains and the estimator state-space model:

The state and output response to a unit step on the inputs:

Observer state response:

Compare each state and its estimate:

Properties & Relations  (8)

Linearize around initial values using WSMModelData:

Compare results:

Linearize around equilibrium using WSMFindEquilibrium:

Compare results:

Compare responses from a model and its linearization at an equilibrium point:

Linearize around the equilibrium point:

Compare the stationary output response with a nonlinear model:

Compare the first output:

Compare responses from a model and its linearization at a non-equilibrium point:

Linearize around the given point:

Compare the stationary output response with a nonlinear model:

Get the output equations:

Compute the stationary output:

Compare the first output:

Use TransferFunctionModel to convert to a transfer function representation:

Use ToDiscreteTimeModel to discretize a linearized model:

Discretize using sample time 0.10:

The linearized state-space model is not unique:

Change the order in which the variables x1 and x2 are declared:

The models are equivalent and have identical transfer functions:

StateSpaceModel can linearize systems of ordinary differential equations:

Using approximate numeric parameter values:

Using System Modeler to linearize a model of the same system:

Possible Issues  (1)

Some models cannot be linearized symbolically:

Use "NumericDerivative" to linearize numerically: