Modify value of Control Design Block in Generalized Model
M = setBlockValue(M0,blockname,val)
M = setBlockValue(M0,blockvalues)
M = setBlockValue(M0,Mref)
the value of several Control Design Blocks at once. The structure
M = setBlockValue(
the blocks and replacement values. Blocks of
blockvalues are unchanged.
replacement values from Control Design blocks in the Generalized
M = setBlockValue(
Mref. This syntax modifies the
Control Design Blocks in
M0 to match the current
values of all corresponding blocks in
Use this syntax to propagate block values, such as tuned parameter values, from one parametric model to other models that depend on the same parameters.
Model containing the blocks whose current or nominal value
is modified to
To get a list of the Control Design Blocks in
Replacement value for the current or nominal value of the Control
Structure specifying Control Design Blocks of
Generalized Model that shares some Control Design Blocks with
Propagate the values of tuned parameters to other Control Design Blocks.
You can use tuning commands such as
looptune, or the Robust Control Toolbox™ command
hinfstruct to tune blocks in a closed-loop model of a control system. If you do so, the tuned controller parameters are embedded in a generalized model. You can use
setBlockValue to propagate those parameters to a controller model.
Create a tunable model of the closed-loop response of a control system, and tune the parameters using
s = tf('s'); num = 33000*(s^2 - 200*s + 90000); den = (s + 12.5)*(s^2 + 25*s + 63000); G = num/den; C0 = tunablePID('C0','pi'); a = realp('a',1); F0 = tf(a,[1 a]); T0 = feedback(G*C0,F0); T0.InputName = 'r'; T0.OutputName = 'y';
T0 is a generalized model of the closed-loop control system and contains two tunable blocks:
C0 - Tunable PID controller
a - Real tunable parameter
Create a tuning requirement for the output
y to track the input
r, and tune the system to meet that requirement.
Req = TuningGoal.Tracking('r','y',0.05); [T,fSoft,~] = systune(T0,Req);
Final: Soft = 1.43, Hard = -Inf, Iterations = 60
The generalized model
T contains the tuned values of
Propagate the tuned values of the controller in
T to the controller model
C = setBlockValue(C0,T)
C = Parametric continuous-time PID controller "C0" with formula: 1 Kp + Ki * --- s and tunable parameters Kp, Ki. Type "pid(C)" to see the current value and "get(C)" to see all properties.
C is still a
tunablePID controller. The current PID gains in
C are set to the values of the controller in
Obtain a numeric LTI model of the tuned controller using
CVal = getValue(C,T);
This command returns a numerical state-space model of the tuned controller.