User`s guide
Code Validation
2-25
Comparing Simulation and
Generic Real-Time Results
Your Simulink simulations and generic real-time code should produce nearly
identical output. Let’s compare the
f14 model output from Simulink to the
results achieved by the Real-Time Workshop. Follow these steps to do a correct
comparison:
• First, make sure that you’ve selected the same (fixed-step) integration
scheme for both the Simulink run and the Real-Time Workshop build process
(for example,
ode5 (Dormand-Prince). Also, set the Fixed step size to the
same number (for example, 0.05).
• Set the Scope blocks to log the input and outputs of the
f14 simulation (for
example, you can set the Angle of Attack Scope block output to
Angle_of_attack, the Pilot G Force Scope block output to Pilot_G_Force,
and the Stick Input Scope block output to
Stick_input).
• Run the
f14 simulation.
• Build the
f14 generic real-time system, run it, and load the MAT-file.
You should now have two sets of data, one generated by Simulink and one
generated by the Real-Time Workshop. At the MATLAB prompt, type:
who
You should see among the variables in your workspace:
Angle_of_attack rt_Stick_input
Pilot_G_force Stick_input
rt_Angle_of_attack
rt_Pilot_G_force
Comparing Angle_of_attack to rt_Angle_of_attack produces:
max(abs(rt_Angle_of_attack-Angle_of_attack))
ans =
1.0e-015 *
0 0.5551