Page 317 - Dynamics and Control of Nuclear Reactors
P. 317
320 APPENDIX G Matlab and Simulink: A brief tutorial
▪ Model Verification
▪ Ports & Subsystems
▪ Signal Attributes
▪ Signal Routing
▪ Sinks
▪ Sources
▪ User-defined Functions.
We will use some of these features to build our models and display the results.
Explore the details of these features by clicking on each. Use the help feature in each
to learn more about Simulink functions.
G.3 Simulation of a single-input single-output
(SISO) system
Consider the following example to illustrate some of the features of Simulink.
• Click on +Continuous. Drag the Transfer Fcn icon into the work space. A
default transfer function is shown. Double click on this block. Change the
second coefficient in the denominator to 0.02. Now the transfer function block
has the form
12
G p sðÞ ¼ (G.1)
s +0:02
• Click on the +Sources button and drag the function Step to the work area.
Connect the step block to the Gp(s) block. In the step block, use step time
equal to zero, so that there is no delay in the step input.
• Click on the +Sinks button and drag Scope and To Workspace buttons to the
work area. Connect the output of the main block to both Scope and To
Workspace blocks.
• If necessary, adjust the parameters of the Scope and To Workspace blocks.
For example, change the name of the workspace block to level. Changes to
any of the blocks may be made by double-clicking on the block and adjusting the
parameters. Use ‘array’ for structure of data.
• Fig. G.1 shows the model diagram and the above blocks (this is not an executable
block). After the model is completed you may save this in a file.
Hint: Connecting one block to another: Select the source block; then hold down
the Ctrl key while left clicking on the destination block.
• Run the simulation by clicking on simulation and then click start. Set the stop
time equal to 300. By clicking on the Scope you may view the simulation.
The output may also be plotted using the MATLAB plot command plot
(tout, level) as shown in Fig. G.2. Note that the time points are stored in the
array ‘tout’.