Documentation |
Whether you model your control system in MATLAB^{®} or Simulink^{®}, you can use analysis points to gain access to internal signals, perform open-loop analysis, or specify requirements for controller tuning. Analysis points mark points of interest in the model. In the block diagram representation, a point of interest is a signal flowing from one block to another. In Simulink, analysis points are attached to the outports of Simulink blocks. For example, the reference signal, r, and the control signal, u, are analysis points of the following simple feedback loop model, ex_scd_analysis_pts1:
Analysis points serve three purposes:
Input: The software interprets an additive input signal at a point, for example, to model a disturbance at the plant input, u
Output: The software measures the signal value at a point, for example, to study the impact of this disturbance on the plant output, y
Loop Opening: The software interprets a break in the signal flow (opening) at a point, for example, to study the open-loop response at the plant input, u
You can apply these purposes concurrently, for example, to compute the open-loop response from u to y. When used concurrently, the software always applies the purposes in a specific sequence: output (measurement), then loop opening, then input (see Figure 2).
Analysis points provide convenient access to open-loop and closed-loop responses. For example, suppose T is a model of the closed-loop system in the model ex_scd_analysis_pts1, and u and y are marked as analysis points. You can plot the closed-loop response to a step disturbance, du, at the plant input using
getIOTransfer(T,'u','y');
Analysis points are also useful to specify design requirements when tuning control systems with the systune function (requires a Robust Control Toolbox™ license). For example, you can create a requirement that attenuates disturbances at the plant input by a factor of 10 (20 dB) or more.
Req = TuningGoal.Rejection('u',10);
Construct an LTI model of the block diagram in Figure 1.
G = tf(10,[1 3 10]); C = pid(0.2,1.5); T = feedback(G*C,1);
With this model, you can simulate the closed-loop response from r to y. However, you cannot analyze the open-loop response at the plant input or simulate the rejection of a step disturbance at the plant input. To enable such analysis, mark the signal u as an analysis point by inserting an AnalysisPoint block between the plant and controller.
AP = AnalysisPoint('u');
T = feedback(G*AP*C,1);
The location, u, is now available for analysis, and you can plot the open-loop response at u.
bodeplot(getLoopTransfer(T,'u',-1))
Recall that the AnalysisPoint block includes an implied open/closed switch that behaves as shown in Figure 2 for analysis purposes. By default, this switch is closed when computing closed-loop responses. For example, plot the closed-loop response to a step disturbance at the plant input.
T.OutputName = 'y'; stepplot(getIOTransfer(T,'u','y'))
In Simulink, you can mark analysis points either explicitly in the block diagram, or programmatically using the addPoint command for slLinearizer or slTuner interfaces.
To mark an analysis point explicitly in the block diagram, right-click on the signal and use the Linear Analysis Points menu. Select one of the closed-loop analysis types, unless you also need to add a permanent opening at this location. Closed-loop analysis types include Input Perturbation, Output Measurement, Sensitivity, and Complementary Sensitivity. The selected type does not affect analysis functions, like getIOTransfer, and tuning goals, like TuningGoal.StepTracking.
Figure 3: Marking Analysis Points in a Simulink Model
To mark analysis points programmatically, use addPoint for the slLinearizer or slTuner interfaces. Specify the point of interest using the block path, port number, and bus element, if applicable. For example, consider the ex_scd_analysis_pts2 model.
Figure 4: Simple Feedback Loop in Simulink
Figure 5: 2DOF Controller Subsystem
Mark the u and Feedfordward term signals as analysis points.
open_system('ex_scd_analysis_pts2'); ST = slLinearizer('ex_scd_analysis_pts2'); addPoint(ST,'ex_scd_analysis_pts2/2DOF Controller',1) addPoint(ST,'ex_scd_analysis_pts2/2DOF Controller/Kff',1)
For convenience, you can also designate points of interest as analysis points using one of the following abbreviations:
Signal name, for example:
addPoint(ST,{'u','r'})
Block name and port number, for example:
addPoint(ST,'ex_scd_analysis_pts2/Plant/1')
Block name and outport name, for example:
addPoint(ST,'ex_scd_analysis_pts2/2DOF Controller/Control')
End of the full block name when unambiguous, for convenience, for example:
addPoint(ST,'Controller/1') addPoint(ST,{'Setpoint','Noise'})
Finally, you can specify analysis points using linearization I/O objects (see linio). For example:
ios = [... linio('ex_scd_analysis_pts2/Setpoint',1,'input'),... linio('ex_scd_analysis_pts2/Plant',1,'output')]; addPoint(ST,ios)
As when you use the Linear Analysis Points to mark analysis points, the actual I/O type is ignored by analysis functions, like getIOTransfer, and tuning goals, like TuningGoal.StepTracking. However, an I/O type that implies a loop opening, for instance loopbreak or openinput, imposes a permanent loop opening at the point. This permanent opening remains in force throughout analysis and tuning.
Once you have marked analysis points, you can analyze the response at any of these points using functions like getIOTransfer and getLoopTransfer. You can also create tuning goals that constraint the system response at these points. The tools to perform these operations operate in a similar manner for models created at the command line and models created in Simulink.
Use the getPoints function to get a list of all available analysis points.
getPoints(T) % Model created at the command line getPoints(ST) % Model created in Simulink
For closed-loop models created at the command line, you can also use the model input and output names as inputs to functions such as getIOTransfer. For example:
stepplot(getIOTransfer(T,'u','y'))
Similarly, you can use these names to compute open-loop responses or create tuning goals for systune.
L = getLoopTransfer(T,'u',-1); R = TuningGoal.Margins('u',10,60);
The same applies to models created in Simulink, with the added convenience that you can use any unambiguous abbreviation of the analysis point names returned by getPoints. For example:
L = getLoopTransfer(ST,'u',-1); stepplot(getIOTransfer(ST,'r','Plant')) s = tf('s'); R = TuningGoal.Gain('Noise','Feedforw',1/(s+1));
Finally, if some analysis points are vector-valued signals or multi-channel locations, you can use indices to select particular entries or channels. For example, suppose u is a two-entry vector in the model of Figure 2. You can compute the open-loop response of the second channel and measure the impact of a disturbance on the first channel using:
% Build closed-loop model of MIMO feedback loop G = ss([-1 0.2;0 -2],[1 0;0.3 1],eye(2),0); C = pid(0.2,0.5); AP = AnalysisPoint('u',2); T = feedback(G*AP*C,eye(2)); T.OutputName = 'y'; L = getLoopTransfer(T,'u(2)',-1); stepplot(getIOTransfer(T,'u(1)','y'))