Block-by-Block Analytic Linearization

www.kxcad.net Home > CAE Software Index > MATLAB Index >



What Is Block-by-Block Analytic Linearization?

Block-by-block analytic linearization is the default linearization method in Simulink Control Design. Through this method, each block within the linearization path is first linearized individually.

There are two methods that Simulink Control Design uses to linearize the individual blocks in a model:

Each method has options that you can control to create accurate linearized models.

The following section gives details of the methods used to linearize each block, with suggestions for controlling the linearizations to create more accurate linearized models.

Linearizing Individual Blocks Using Analytic Linearization

Many Simulink blocks contain analytic Jacobians for exact linearization. When linearizing a system using block-by-block analytic linearization, you can use these analytic linearizations instead of numerically perturbing the block. This approach is especially useful for blocks that contain discontinuities and do not give good results using numerical perturbation.

Blocks that Support Analytic Linearization

The following table lists Simulink blocks and whether they contain analytic Jacobians for linearization.

Several blocks include options to control the linearization that you can adjust in the Block Parameters window. For example, you can change the order of the Padé approximation used in the Transport Delay block or select the Treat as gain when linearizing option in the Saturation block. The Notes column in the following table gives details on blocks that include options to control the linearization.

For more information on individual blocks, see the reference page for each block.

Blocks with Analytic Jacobians and Linearization Options

BlockAnalytic Jacobian (Y/N)Notes
Continuous Library
DerivativeYAllows control of the time constant for the filter constant
IntegratorYIncludes option to exclude saturation and resets from linearization
State-SpaceY 
Transfer FcnY 
Transport DelayYAllows control of Padé order. Supports linearization of models with internal delays, see Linearizing Models with Time Delays.
Variable Transport Delay/Variable Time DelayYAllows control of Padé order. Supports linearization of models with internal delays, see Linearizing Models with Time Delays.
Zero-PoleY 
Discontinuities Library
BacklashN 
Coulomb and Viscous FrictionN 
Dead ZoneYIncludes option to treat as gain when linearizing
Dead Zone DynamicY 
Hit CrossingN 
QuantizerYIncludes option to treat as gain when linearizing
Rate LimiterYIncludes option to treat as gain when linearizing
Rate Limiter DynamicN 
RelayN 
SaturationYIncludes option to treat as gain when linearizing
Saturation DynamicN 
Wrap to ZeroN 
Discrete Library
DifferenceY 
Discrete DerivativeN 
Discrete FilterN 
Discrete State-SpaceY 
Discrete Transfer FcnY 
Discrete Zero-PoleY 
Discrete-Time IntegratorYIncludes option to ignore saturation and resets during linearization. Jacobian not supported for nondouble data types.
First-Order HoldN 
Integer DelayNSupports linearization of models with internal delays, see Linearizing Models with Time Delays.
MemoryYLinearizes to a gain of 1 when driven by a continuous signal. Includes option to linearize to a Unit Delay when driven by a discrete signal.
Tapped DelayN 
Transfer Fcn First OrderY 
Transfer Fcn Lead or LagY 
Transfer Fcn Real ZeroY 
Unit DelayYJacobian does not support frame-based signals. Supports linearization of models with internal delays, see Linearizing Models with Time Delays.
Weighted Moving AverageN 
Zero-Order HoldN 
Logic and Bit Operations Library
Bit ClearN 
Bit SetN 
Bitwise OperatorN 
Combinatorial LogicN 
Compare To ConstantN 
Compare To ZeroN 
Detect ChangeN 
Detect DecreaseN 
Detect Fall NegativeN 
Detect Fall NonpositiveN 
Detect IncreaseN 
Detect Rise NonnegativeN 
Detect Rise PositiveN 
Extract BitsY 
Interval TestN 
Interval Test DynamicN 
Logical OperatorN 
Relational OperatorN 
Shift ArithmeticN 
Lookup Tables Library
CosineN 
Direct Lookup Table (n-D)N 
Interpolation using PreLookupY 
Lookup TableN 
Lookup Table (2-D)N 
Lookup Table (n-D)N 
Lookup Table DynamicN 
PreLookupY 
SineN 
Math Operations Library
AbsY 
AddY 
Algebraic ConstraintN 
AssignmentN 
BiasY 
Complex to Magnitude-AngleN 
Complex to Real-ImagN 
ConcatenateN 
DivideY 
Dot ProductN 
GainY 
Magnitude-Angle to ComplexN 
Math FunctionN 
MinMaxN 
MinMax Running ResettableN 
PolynomialN 
ProductY 
Product of ElementsY 
Real-Imag to ComplexN 
ReshapeN 
Rounding FunctionN 
SignYLinearizes to Inf at zero, linearizes to zero otherwise
Sine Wave FunctionN 
Slider GainY 
SubtractY 
SumY 
Sum of ElementsY 
Trigonometric FunctionN 
Unary MinusN 
Weighted Sample Time MathN 
Model Verification Library
AssertionN/ADoes not contain outputs
Check Discrete GradientN/ADoes not contain outputs
Check Dynamic GapN/ADoes not contain outputs
Check Dynamic Lower BoundN/ADoes not contain outputs
Check Dynamic RangeN/ADoes not contain outputs
Check Dynamic Upper BoundN/ADoes not contain outputs
Check Input ResolutionN/ADoes not contain outputs
Check Static GapN/ADoes not contain outputs
Check Static Lower BoundN/ADoes not contain outputs
Check Static RangeN/ADoes not contain outputs
Check Static Upper BoundN/ADoes not contain outputs
Model Wide Utilities Library
Block Support TableN/ADoes not contain outputs
DocBlockN/ADoes not contain outputs
Model InfoN/ADoes not contain outputs
Time-Based LinearizationN/ADoes not contain outputs
Trigger-Based LinearizationN/ADoes not contain outputs
Ports and Subsystems Library
Configurable SubsystemN/AOnly the blocks within the subsystem are part of the linearization
Atomic SubsystemN/AOnly the blocks within the subsystem are part of the linearization
CodeReuse SubsystemN/AOnly the blocks within the subsystem are part of the linearization
EnableN 
Enabled and Triggered SubsystemN/AOnly the blocks within the subsystem are part of the linearization
Enabled SubsystemN/AOnly the blocks within the subsystem are part of the linearization
For Iterator SubsystemN/AOnly the blocks within the subsystem are part of the linearization
Function-Call GeneratorN/AOnly the blocks within the subsystem are part of the linearization
Function-Call SubsystemN/AOnly the blocks within the subsystem are part of the linearization
IfN 
If Action SubsystemN/AOnly the blocks within the subsystem are part of the linearization
InportN/ADoes not contain outputs
ModelN/ASee Model Reference Blocks.
OutportN/ADoes not contain inputs
SubsystemN/AOnly the blocks within the subsystem are part of the linearization
Switch CaseN 
Switch Case Action SubsystemN/AOnly the blocks within the subsystem are part of the linearization
TriggerN 
Triggered SubsystemN/AOnly the blocks within the subsystem are part of the linearization
While Iterator SubsystemN/AOnly the blocks within the subsystem are part of the linearization
Signal Attributes Library
Data Type ConversionY 
Data Type Conversion InheritedY 
Data Type DuplicateN/ADoes not contain outputs
Data Type PropagationN/ADoes not contain outputs
Data Type Scaling StripY 
ICN 
ProbeN 
Rate TransitionY 
Signal ConversionY 
Signal SpecificationY 
Weighted Sample TimeN 
WidthN 
Signal Routing Library
Bus AssignmentY 
Bus CreatorY 
Bus SelectorY 
Data Store MemoryN/ADoes not contain inputs or outputs
Data Store ReadYLinearizes to a gain of 1. Assumes that there is no delay between data store read and data store write.
Data Store WriteYLinearizes to a gain of 1. Assumes that there is no delay between data store read and data store write.
DemuxN/A 
Environment ControllerY 
FromN/A 
GotoN/A 
Goto Tag VisibilityN/A 
Index VectorY 
Manual SwitchY 
MergeN 
Multiport SwitchY 
MuxN/A 
SelectorY 
SwitchY 
Sources Library - N/A No Inputs
Sinks Library - N/A No Outputs
User Defined Functions Library
Embedded MATLAB FunctionN 
FcnN 
Level-2 M-File S-FunctionN 
MATLAB FcnN 
S-FunctionN 
S-Function BuilderN 
Additional Math and Discrete Library
Fixed-Point State-SpaceY 
Transfer Fcn Direct Form IIN 
Transfer Fcn Direct Form II Time VaryingN 
Unit Delay EnabledY 
Unit Delay Enabled External ICY 
Unit Delay Enabled ResettableY 
Unit Delay Enabled Resettable External ICY 
Unit Delay External ICY 
Unit Delay ResettableY 
Unit Delay Resettable External ICY 
Unit Delay With Preview EnabledY 
Unit Delay With Preview Enabled ResettableY 
Unit Delay With Preview Enabled Resettable External RVY 
Unit Delay With Preview ResettableY 
Unit Delay With Preview Resettable External RVY 
Decrement Real WorldY 
Decrement Stored IntegerY 
Decrement Time To ZeroY 
Decrement To ZeroY 
Increment Real WorldY 
Increment Stored IntegerY 

Linearizing Individual Blocks Using Block Perturbation

When you cannot use a preprogrammed block linearization, Simulink Control Design automatically computes the block linearization by numerically perturbing the states and inputs of the block about the operating point of the block. As opposed to the numerical-perturbation linearization method, this perturbation is local and its propagation through the rest of the model is restricted.

Block Perturbation Algorithm

The block perturbation algorithm introduces a small perturbation to the nonlinear block and measuring the response to this perturbation. Both the perturbation and the resulting response are used to create the matrices in the linear state-space model of this block. Changing the size of the perturbations changes the resulting linearized model.

As described in Linearizing Models, you can write a nonlinear Simulink block as a state-space system:

In these equations, x(t) represents the states of the block, u(t) represents the inputs of the block, and y(t) represents the outputs of the block.

A linearized model of this system is valid in a small region around the operating point t=t0, x(t0)=x0, u(t0)=u0, and y(t0)=g(x0,u0,t0)=y0. Subtracting the operating point values from the states, inputs, and outputs defines a set of variables centered about the operating point:

You can write the linearized model in terms of these new variables. The representation is usually valid when the variables are small, i.e., when the departure from the operating point is small:

The state-space matrices A, B, C, and D of this linearized model represent the Jacobians of the block, as defined in Linearizing Models. To compute the matrices, the states and inputs are perturbed, one at a time, and the response of the system to this perturbation is measured by computing and δy. The perturbation and response are then used to compute the matrices in the following way:

where

Linearized models of discrete-time are computed in a similar way. For more information, see Linearizing Models in the Simulink Control Design Getting Started documentation for the equations of linearized discrete-time and multirate systems.

Changing Perturbation Size

Changing the size of the perturbations changes the linearization results. The default perturbation size is 10-5(1+|x|), where x is the operating point value of the state or input being perturbed. For example, to change the perturbation size of the states in the Magnetic Ball Plant block in the magball model to , type

blockname='magball/Magnetic Ball Plant'
set_param(blockname,'StatePerturbationForJacobian','1e-7')

To change the perturbation size of the input of the Magnetic Ball Plant block to , where u is the input signal level, follow these steps:

  1. Get the block's port handles:

    ph=get_param('magball/Magnetic Ball Plant','PortHandles')
    
  2. Next, get the inport:

    pin=ph.Inport(1)
    
  3. Finally, set the perturbation level for this inport:

    set_param(pin,'PerturbationForJacobian','1e-7')
    

Blocks Containing Two Inputs

If there is more than one inport, you can choose to assign a different perturbation level to each. The following figure shows an S-Function block with two input signals, the actual signal and an index variable. To avoid perturbing the index signal, you can assign a perturbation level of 0 to this inport.

Model Reference Blocks

When linearizing model reference blocks with accelerated mode, Simulink Control Design automatically uses block perturbation. If you instead want to linearize these referenced models using block-by-block analytical linearization, then change the block mode from accelerated to normal.

Blocks with Nondouble Data Types

Blocks that have nondouble data type signals as either inputs or outputs, and which do not have a preprogrammed exact linearization, automatically linearize to zero as they cannot be numerically perturbed. For example, many logical operator blocks have Boolean outputs and therefore linearize to 0.

Workarounds for Blocks with Nondouble Data Types.   To work around the problem of blocks with nondouble data types linearizing to zero, you can use a Data Type Conversion block. This block has a preprogrammed exact linearization, to convert your signals to doubles before linearizing the model. The following example illustrates this concept. The model in this example is configured to linearize the Square block at an operating point where the input is 1. The resulting linearized model should be 2, but the input to the Square block is Boolean and the linearization is zero.

However, by inserting a Data Type Conversion block before the linearization input point, you can make the input signal to the Square block a double. Thus, the linearized model gives the correct response of 2.

Overriding Nondouble Data Types.   When you linearize a model that contains nondouble data types but still runs correctly in full double precision, you can choose to override all data types with doubles. To perform this override, in the model window select Tools > Fixed-Point Settings from the menu. This selection opens the Fixed-Point Settings window. Within this window select True doubles from the Data type override menu. Now, when you linearize and simulate the model, it uses doubles for all data types.

Linearizing Models with Time Delays

You can linearize models with time delays using:

Blocks with Delays

The delays in your model can arise from any of the following Simulink blocks:

For more information on time delays, see Time Delays in the Control System Toolbox documentation.

Finding Linearized Models with Padé Approximation of Delays

To find linearized models with Padé approximations of delays, first adjust the order of the Padé approximation in the Block Parameters window for any block with delay. Then, perform the linearization.

For more information on Padé approximations, see Eliminating Time Delays: Padé Approximation in the Control System Toolbox documentation.

Finding Linearized Models with Exact Delays

You can use block-by-block analytic linearization to find linear models with exact time delays. You can do this in the following ways:

Blocks with Discontinuities

There are several Simulink blocks that contain discontinuities, such as the Sign block, whose behavior is shown in the following figure.

The very large derivatives that occur at the point of discontinuity can cause problems with linearization. For example, the Sign block has the following linearization

where D is a state-space matrix, and u is the input signal to the block.

When these blocks are within the linearization path of your model, the resulting linearized model could potentially have very large values. There is no obvious solution to this problem and it is recommended that you remove or replace these blocks. However, when your model operates in a region away from the point of discontinuity, the linearization will be zero. This should not cause any problems, although when the linearizations of several blocks are multiplied together (as in a feedback path) it can cause the linearization of the system to be zero.

When these blocks are outside the linearization path, they can still contribute to the definition of the operating point of the model but will not otherwise affect the linearization. It is safe to use them for reference signals, disturbances, and any other signals and blocks that are not being linearized.

Other examples of blocks with discontinuities include

Integrator Blocks Near Saturation or a Reset Point

When an Integrator block has an external reset condition or output limitations (saturation) and the model is operating near the point where the Integrator is reset or the output is limited, it might be more meaningful for the linearization to ignore the effect of the saturation or reset. To linearize a model around an operating point that causes the integrator to reset or saturate, select Ignore limit and reset when linearizing in the Integrator block parameters dialog box. Selecting this option causes the linearization to treat this block as unresettable and as having no limits on its output, regardless of the settings of the block's reset and output limitation (saturation) options.

Event-Based Models and Triggered Subsystems

The linearization of triggered subsystems and other event-based models can be particularly difficult because of the system's dependence on previous events. In particular, the execution of a triggered system depends on previous signal events such as zero crossings. Therefore, for linearization, which takes place at a particular moment in time, a trigger event will never happen. Thus, while the event-based dynamics contribute to the definition of the system's operating point, this information is not captured by the list of values of states and inputs that typically describe the operating point for linearization.

Triggered events describe many different systems. One such system is an internal combustion (IC) engine. When an engine piston approaches the top of a compression stroke, a spark is introduced and combustion occurs. The timing of the spark for combustion is dependent on the speed and position of the engine crankshaft. An example of a Simulink model that models this behavior is engine.mdl which is included as a demonstration model in Simulink.

In engine.mdl, triggered subsystems generate events when the pistons reach both the top and bottom of the compression stroke. The linearization will not be meaningful because of the presence of these triggered subsystems. However, you can get a meaningful linearization while still preserving the simulation behavior by recasting the event-based dynamics. For example, you can use curve fitting to approximate the event-based behavior. This is done in scdspeed.mdl, a demonstration model included in Simulink Control Design and shown in the figure below:

The basic functional approximation in scdspeed is included within the Convert to mass charge block inside the subsystem scdspeed/Throttle & Manifold/Intake Manifold where a quadratic polynomial is used to approximate the relationship between the Air Charge, the Manifold Pressure, and the Engine Speed.

The approximation has the following form:

Simulation data from the original model is used to compute the unknown parameters p1, p2, p3, p4, and p5 using a least squares fitting technique.

When measured data for internal signals is available, you can use Simulink Parameter Estimation to compute the unknown parameters. This method is outlined in the Simulink Parameter Estimation demo called Engine Speed Model Parameter Estimation. The demo also shows how to linearize this model and use the linearization to design a feedback controller.

The approximated model can now accurately simulate and linearize the engine from approximately 1500 to 5500 RPM. The following figure shows the comparison between a simulation of the original event-based model, and a simulation of the new approximated model.

  


© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments