
上QQ阅读APP看书,第一时间看更新
3.9 控制和指示模块
在Simulink中,Dashboard模块库包括各种与仿真进行交互的控制和指示模块,如图3-41所示。该模块库中的各子模块功能见表3-4。
表3-4 Dashboard子库

(续)


图3-41 控制和指示模块库
1.控制和可视化模型中的信号
在Dashboard模块库选择放置“Slider(滑块)”模块,在模块上单击Connect图标按钮,如图3-42所示,Simulink编辑窗口将进入连接模式,可以连接模型中的信号和参数,如图3-43所示。
在模型图中选择与可视化模块“Slider(滑块)”相连的模块,这里选择Gain模块,在该模块上单击,显示浮动的Connect面板,如图3-44所示,单击选中面板中的选项,如图3-45所示,完成可视化模块“Slider(滑块)”与Gain模块的连接。完成连接后,单击右上角按钮,退出连接模式。

图3-42 显示浮动图标

图3-43 进入模块连接模式

图3-44 显示连接选项

图3-45 选择连接选项
2.参数设置
双击“Slider(滑块)”模块,弹出“Block Parameters:Slider”对话框,在Minimum、Maxi-mum文本框中设置滑块显示的最小值与最大值,如图3-46所示。
仿真运行过程中,“Slider(滑块)”模块与Gain模块显示相同值,如图3-47所示。

图3-46 “Block Parameters:Slider”对话框

图3-47 完成参数设置
3.仿真并调整参数
当仿真运行时,拖动“Slider(滑块)”模块上的指针,Gain模块的值将发生变化,仿真结果发生变化,如图3-48所示。

图3-48 参数调整结果