32. Lab 12: System Simulation with Simulink
To model control systems using Simulink.
Simulink is a tool in Matlab (like Scilab) that allows users to simulate system behavior using block diagrams.
1. Follow the Simulink tutorial linked to the course web page. Note that the ’s’ in the tutorial is equivalent to the ’D’ operator.
2. Use ’Help/Demos’ then select ’Simulink’ and try some of the demos.
A computer with Matlab and Simulink installed
1. Run Matlab, and enter ’simulink’ on the command line to start Simulink. Create a new simulation file by selecting ’File/New/Model’. You will see a blank programming window.
2. Select a ’Sources/Step’ block and drag it to the blank window. This will be a step input to the system. By default it is a unit step that starts at t=0s. This can be changed by right-clicking, or double clicking, on the icon and selecting new parameters.
3. Create a summation block, so that we can use negative feedback, using ’Math/Sum’. The default block will sum both inputs. Change this by changing the parameters from ’I++’ to ’I+-’. This will be reflected on the main window as a negative feedback summation block.
4. Connect the step input to the positive terminal of the summation block by clicking on one of the small arrows on the summation block and dragging it to the step input.
5. Add a proportional gain to the system with ’Math/Gain’. The default gain for this is ’1’, but this can be changed by changing the properties. Connect this to the output of the summation block. (Note: the ’s’ and ’D’ operators are equivalent so 1/(s+1) = 1/(D+1).)
6. Add a system model using ’Continuous/Transfer Fcn’. Use the transfer function ’1/(s+1)’ for a first order response. Connect the input of this function to the output of the gain function.
7. Create an output display using ’Sinks/Scope’ and connect the output of the transfer function to the scope.
8. Connect the output of the transfer function back to the negative input of the summation block. At this point the system diagram should look like Figure 32.1 A simple feedback system in Simulink.
Figure 32.1 A simple feedback system in Simulink
9. Right-click on the scope block and open it. A new window should appear on the screen. Use ’Simulation/Start’ to run the simulation.
10. Change the gain from 1 to 20 and run the simulation again. Print and attach the output graph in your lab book.
11. Verify the results found in the last step by explicitly integrating the differential equation and plotting the results.
12. Enter the simulation for the second order differential equation, as shown in Figure 32.2 Simulation of a differential equation. Enter different values for the coefficients and verify the system behavior. Print and include graphs in your lab book.
Figure 32.2 Simulation of a differential equation
13. Verify the results in the previous section by explicitly integration the differential equation for one set of values used in the previous step. Plot the function and compare it to the response found with Simulink.
14. Create a simulation of a position feedback control system with deadband compensation. Include a graph of the response.
[an error occurred while processing this directive]