向 Stateflow 子系统添加仪表
一个使用 Stateflow® 模块的 Simulink® Real-Time™ 模型,可以在您对模型进行仿真或运行实时应用程序时,直观地确认图表是否按预期工作。
该过程使用模型
slrt_ex_sf_car。要打开示例模型及其相关的 MAT 文件,请在 MATLAB 命令行窗口中输入:openExample('slrealtime/SlrtCreateUpdateInstPanelForStateflowCarExample'); open_system('slrt_ex_sf_car'); load('slrt_ex_user_inputs.mat');
要在“仿真数据检查器”中显示 Stateflow 状态,请选中它们并将其标记为 Log Self Activity。
打开
slrt_ex_sf_car模型。双击
shift_logic图。
在 gear_state 图中,选择 first 状态
点击 Log Self Activity 按钮和 Test Point 按钮。
对 gear_state 的值 second、third 和 fourth,重复步骤 3–4。
编译实时应用程序,并将其下载到目标计算机上。在 Real-Time 选项卡上,点击 Run on Target。
使用“仿真数据检查器”可视化 Stateflow 的状态。有关详细信息,请参阅在仿真数据检查器中查看仿真数据和View State Activity by Using the Simulation Data Inspector (Stateflow)。