Simulink Control Design™ - MathWorks

(Tuis.) #1
% BLOCKLIN = 0 when |U| > saturation limit
% BLOCKLIN = 1 when |U| < saturation limit
% BLOCKLIN = 1/2 when U = saturation limit

% Get saturation limit.
satlimit = BlockData.Parameters.Value;

% Compute linearization based on the input signal
% level to the block.
if abs(BlockData.Inputs(1).Values) > satlimit
blocklin = 0;
elseif abs(BlockData.Inputs(1).Values) < satlimit
blocklin = 1;
else
blocklin = 1/2;
end

This configuration function defines the saturation block linearization based on the
level of the block input signal. For input values outside the saturation limits, the
block linearizes to zero. Inside the limits, the block linearizes to 1. Right on the
boundary values, the block linearizes to the interpolated value of 0.5. The input to the
function, BlockData, is a structure that the software creates automatically when you
configure the linearization of the Saturation block to use the function. The
configuration function reads the saturation limits from that data structure.

(^4) In the Simulink model, right-click the Saturation block, and select Linear Analysis >
Specify Selected Block Linearization.
The Block Linearization Specification dialog box opens.
(^5) Check Specify block linearization using one of the following. Choose
Configuration Function from the list.
Configure the linearization function:
a Enter the name you gave to your saturation function. In this example, the
function name is mySaturationLinearizationFcn.
b Specify the function parameters. mySaturationLinearizationFcn requires
the saturation limit value, which the user must specify before linearization.
Enter the variable name satlimit in Parameter Value. Enter the
corresponding descriptive name in the Parameter Name column,
SaturationLimit.
2 Linearization

Free download pdf