Modify value of Control Design Block in Generalized Model
M = setBlockValue(M0,blockname,val)
M = setBlockValue(M0,blockvalues)
M = setBlockValue(M0,Mref)
M = setBlockValue(M0,blockvalues) modifies the value of several Control Design Blocks at once. The structure blockvalues specifies the blocks and replacement values. Blocks of M0 not listed in blockvalues are unchanged.
M = setBlockValue(M0,Mref) takes replacement values from Control Design blocks in the Generalized Model Mref. This syntax modifies the Control Design Blocks in M0 to match the current values of all corresponding blocks in Mref.
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.
Generalized Model containing the blocks whose current or nominal value is modified to val. For the syntax M = setBlockValue(M0,Mref) M0 can be a single Control Design Block whose value is modified to match the value of the corresponding block in Mref.
To get a list of the Control Design Blocks in M0, enter M0.Blocks.
Replacement value for the current or nominal value of the Control Design Block, blockname. The value val can be any value that is compatible with blockname without changing the size, type, or sampling time of blockname.
Structure specifying Control Design Blocks of M0 to modify, and the corresponding replacement values. The fields of the structure are the names of the blocks to modify. The value of each field specifies the replacement current or nominal value for the corresponding block.
Generalized Model that shares some Control Design Blocks with M0. The values of these blocks in Mref are used to update their counterparts in M0.
Propagate the values of tuned parameters to other Control Design Blocks.
You can use the Robust Control Toolbox™ tuning commands such as systune, looptune, or 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 LTI 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 hinfstruct.
G = tf([1,0.0007],[1,0.00034,0.00086]); Cpi = ltiblock.pid('Cpi','pi'); a = realp('a',10); F0 = tf(a,[1 a]); C0 = Cpi*F0; T0 = feedback(G*C0,1); T = hinfstruct(T0);
The controller model C0 is a Generalized LTI model with two tunable blocks, Cpi and a. The closed-loop model T0 is also a Generalized LTI model with the same blocks. The model T contains the tuned values of these blocks.
Propagate the tuned values of the controller in T to the controller model C0.
C = setBlockValue(C0,T)
C = Generalized continuous-time state-space model with 1 outputs, 1 inputs, 2 states, and the following blocks: Cpi: Parametric PID controller, 1 occurrences. a: Scalar parameter, 2 occurrences. Type "ss(C)" to see the current value, "get(C)" to see all properties, and "C.Blocks" to interact with the blocks.
C is still a Generalized model. The current value of the Control Design Blocks in C are set to the values the corresponding blocks of T.
Obtain a Numeric LTI model of the controller with the tuned values using getValue.
CVal = getValue(C0,T);
This command returns a numerical state-space model of the tuned controller.