计算机仿真教案08第五4SIMULINK.pptVIP

  • 3
  • 0
  • 约4.59千字
  • 约 80页
  • 2017-03-23 发布于江苏
  • 举报
计算机仿真教案08第五4SIMULINK

Continuous (连续系统模块) Discrete (离散系统模块) Functions Table (函数与表格模块) Math (数学模块) Non-linear (非线性模块) Signals Systems (信号与系统) Sinks (终端/显示模块) Sources (源模块) Subsystems (子系统模块) The 2nd-order differential equation of the mass-spring-damping system can be re-written as: In Simulink, create a new model window and drag the following blocks from the Simulink library window: sum, step, integrator, integrator1, gain,gain1,gain2, scope, simout (to workspace). 5.4 子系统的建立与封装 5.4.1 子系统的建立 1. 通过Subsystem模块建立子系统 操作步骤为: (1)先打开Simulink模块库浏览器,新建一个仿真模型。 (2)打开Simulink模块库中的Signals Systems模块库,复制Subsystem模块到新的模型窗口中。 (3)用鼠标左键双击Subsystem模块打开一个空白的Subsystem窗口,将要组合的模块添加到该窗口中,另外还要根据需要复制一个或多个Input和Output模块,表示子系统的输入和输出端口。这样,一个子系统就建好了。 2. 通过已有的模块建立子系统 操作步骤为: (1)先选择要建立子系统的模块,不包括输入端口和输出端口。 (2)选择模型窗口Edit菜单中的Create Subsystem 命令,这样,子系统就建好了。在这种情况下,系统会自动把Input模块和Output模块添加到子系统中,并把原来的模块变为子系统的图标。 5.4.2 子系统的条件执行 1. 使能子系统 建立使能子系统的方法是: 打开Simulink模块库中的Signals Systems模块库,将Enable模块复制到子系统模型中,则系统的图标发生了变化。 2. 触发子系统 触发子系统是指当触发事件发生时开始执行子系统。与使能子系统相类似,触发子系统的建立要把Signals Systems模块库中的Trigger模块拷贝到子系统中。 5.2.1 如何创建一个SIMULINK模型 Under menu ‘File’, use ‘New’ create a new simulink model; Selecting object from the different modules by clicking on the corresponding icon; Construct the block diagram of simulated system by copying the objects and making proper connection between objects; Define the input block and output terminal; Save the model in a file using command ‘Save’, or ‘Save as’ , the file has an extension .mdl, indicating a model file. 5.3 仿真模型的参数设置 5.3.1 通过菜单命令设置仿真模型参数 选择模型窗口Simulation菜单中的Parameter命令,将出现仿真参数对话框。对话框分五个选项卡:Solver(算法)、Workspace I/O(工作空间输入输出)、Diagnostics(诊断)、Advanced (高级选项)和Real-Time Workshop(实时工作间)。 仿真算法选择 定步长算法 变步长算法 仿真区间设置 可以设置仿真的初始时间和终止时间 工作空间设置 仿真时间 可以设置仿真的初始时间和终止时间 一般情况下,仿真时间和输出信号会写入MATLAB的工作空间,变量名为tout 和 yout. 用户也可以自己选择输出变量名. 此外用户可以设定输出向量的长度. 利用传递函数模块(Transfer Function) 建模。 步骤如下: (1) 根据系统传递函数构造系统模型; (2) 仿真操作。 Example 5.1. Analyze the close-loop response of the f

文档评论(0)

1亿VIP精品文档

相关文档