Simulink Control Design
The Simulink® Control Design™ software provides blocks that you can add to Simulink® models to compute and plot linear systems during simulation. In this demo, a linear system of a continuous-stirred chemical reactor is computed and plotted on a Bode plot as the reactor transitions through different operating points.
Open the Simulink model of the chemical reactor:
The reactor has three inputs and two outputs:
This demo focuses on the response from coolant temperature, Coolant Temp, to residual concentration, CA, when the feed concentration and feed temperature are constant.
For more information on modeling reactors, see Seborg, D.E. et al., "Process Dynamics and Control", 2nd Ed., Wiley, pp.34-36.
The reactor model contains a Bode Plot block from the Simulink Control Design Linear Analysis Plots library. The block is configured with:
The block is also configured to perform linearizations on the rising edges of an external trigger signal. The trigger signal is computed in the Linearization trigger signal block which produces a rising edge when the residual concentration is:
Double-clicking the Bode Plot block lets you view the block configuration.
Clicking Show Plot in the Block Parameters dialog box opens a Bode Plot window which shows the response of the computed linear system from Coolant Temp to CA. To compute the linear system and view its response, simulate the model using one of the following:
The Bode plot shows the linearized reactor at three operating points corresponding to the trigger signals defined in the Linearization trigger signal block:
The linearizations at low and high residual concentrations are similar but the linearization during the transition has a significantly different DC gain and phase characteristics. At low frequencies, the phase differs by 180 degrees, indicating the presence of either an unstable pole or zero.
The Logging tab in the Bode Plot block specifies that the computed linear systems be saved as a workspace variable.
The linear systems are logged in a structure with time and values fields.
LinearReactor = time: [3x1 double] values: [4-D ss] blockName: 'scdcstr/Bode Plot'
The values field stores the linear systems as an array of LTI state-space systems (see Arrays of LTI Models) in Control System Toolbox documentation for more information).
You can retrieve the individual systems by indexing into the values field.
P1 = LinearReactor.values(:,:,1); P2 = LinearReactor.values(:,:,2); P3 = LinearReactor.values(:,:,3);
The Bode plot of the linear system at time 27 sec, when the reactor transitions from low to high residual concentration, indicates that the system could be unstable. Displaying the linear systems in pole-zero format confirms this:
zpk(P1) zpk(P2) zpk(P3)
ans = From input "Coolant Temp" to output "CSTR/2": -0.1028 ---------------------- (s^2 + 2.215s + 2.415) Continuous-time zero/pole/gain model. ans = From input "Coolant Temp" to output "CSTR/2": -0.07514 --------------------- (s+0.7567) (s-0.3484) Continuous-time zero/pole/gain model. ans = From input "Coolant Temp" to output "CSTR/2": -0.020462 --------------------- (s+0.8542) (s+0.7528) Continuous-time zero/pole/gain model.
Close the Simulink model: