This example shows how to use a combination of Simulink® Control Design™ and Simulink verification blocks, to assert that the linear system characteristics satisfy one of the following bounds:
Phase margin greater than 60 degrees
Phase margin less than 60 degrees and the velocity less than or equal to 90% of the cruise velocity.
Open the Simulink model of an aircraft.
The aircraft model is based on a long-haul passenger aircraft flying at cruising altitude and speed. The aircraft starts with a full fuel load and follows a pre-specified 8-hour velocity profile. The model is a simplified version of a velocity control loop, which adjusts the fuel flow rate to control the aircraft velocity.
The model includes blocks to model:
Fuel consumption and resulting changes in aircraft mass
Nonlinear draft effects limiting aircraft velocity
Constants used in the model, such as the drag coefficient, are defined in the model workspace and initialized from a script.
The v <= 0.9*vCruise and Assert that: PM >= 60 or if PM < 60 then v <= 0.9*vCruise blocks are Check Static Upper Bound and Assertion blocks, respectively, from the Simulink Model Verification library. In this example, you use these blocks with the Check Gain and Phase Margins block to design a complex logic for assertion.
View the linearization input, output and settings in the Linearizations tab of the Check Gain and Phase Margins block parameters dialog box.
The model has already been configured with:
Linearization input and output for computing gain and phase margins
Settings to compute the linear system
The software linearizes the loop seen by the Velocity Controller block every 30 minutes of simulated time and computes the gain and phase margins.
Specify phase margin bounds in the Bounds tab of the Check Gain and Phase Margins block.
In this example, the linearization input and output include the summation block with negative feedback. Change the Feedback sign, used to compute the margin, to positive feedback.
To view the phase margins to be computed later during simulation, specify Tabular in Plot type, and click Show Plot.
Design assertion logic that causes the verification blocks to assert when the phase margin is greater than 60 degrees or if the phase margin is less than 60 degrees, the velocity is less than or equal to 90% the cruise velocity.
In the Check Gain and Phase Margins Block Parameters dialog box, select Output assertion signal and click Apply.
This action adds an output port z-1 to the block.
Double-click the v <= 0.9*vCruise block and specify the block parameters, as shown in the following figure. After setting the parameters, click Apply.
These parameters configure the block to:
Check if the aircraft velocity exceeds the cruise velocity by 0.9 times
Add an output port to the block
Connect the Check Gain and Phase Margins, v <= 0.9*vCruise and Assert that: PM >= 60 or if PM < 60 then v <= 0.9*vCruise blocks, as shown in the following figure.
This connection causes the Assert that: PM >= 60 or if PM < 60 then v <= 0.9*vCruise block to assert and stop the simulation if the phase margin is less than 60 degrees and the velocity is greater than 90% of the cruise velocity.
Alternatively, you can type scdmultiplechecks_final at the MATLAB® prompt to open a Simulink model already configured with these settings.
Simulate the model by selecting Simulation > Run in the Simulink Editor.
The v <= 0.9*vCruise block asserts multiple times.
The Check Gain and Phase Margins block asserts two times. You can view the phase margins that violate the bound in the plot window.
The Assert that: PM >= 60 or if PM < 60 then v <= 0.9*vCruise does not encounter the assertion condition. Therefore, the simulation does not stop.
Click the link at the bottom of the Simulink model to open the Diagnostic Viewer window.
When a block asserts, warnings appear in this window. You can view the details of the assertions by clicking the link in this window.