An Introduction to Simulink®

advertisement
An Introduction to Simulink®
Michael Balchanos
Bassem Nairouz
Modeling & Simulation
• Modeling in engineering is the process of creating a mathematical formulation that can describe the behavior of a physical system
• Simulation is the application of computational models to the study and prediction of physical events or the behavior of engineered systems
– Allows engineers to better predict and optimize systems
– Determining factor in product or system design
– Basis for further scientific discovery
Simulation‐based Engineering
•
Modeling and Simulation capability will allow
– Replace physical tests to ensure product performance, reliability and quality
– Shorter design cycle due to the reduced need for physical prototyping
– Innovative and radical departures from traditional designs
– The creation of a library of validated and verified simulation components on which to build future systems
•
This enhanced M&S capability can also be used to provide realistic training and optimize operations
What is Simulink
•
Simulink® is a graphical extension to MATLAB for the modeling and simulation of dynamic systems
–
–
–
–
•
•
•
linear and nonlinear systems
continuous , discrete, or hybrid time domains
multirate, namely subsystems with different simulation time steps
Implementation as interconnected block diagrams
Simulink is also useful for modeling control systems
Simulink is integrated with MATLAB and data can be easily transferred between the programs
Capability of solving real problems in a variety of scientific and engineering fields, including:
–
–
–
–
–
–
–
–
Aerospace and Defense
Automotive
Mechanical Communications
Electronics and Signal Processing
Biomedical
Finance
Industrial
Simulink and MATLAB
• Simulink is tightly integrated with the MATLAB environment
• It requires MATLAB to run, depending on it to define and evaluate model and block parameters
• Simulink can also utilize many MATLAB scripting features
– Define model inputs
– Store model outputs for analysis and visualization
– Perform functions within a model, through integrated calls to MATLAB operators and functions
Why Simulink over MATLAB?
•
MATLAB (with file extension “*.m”)
–
–
–
–
•
Simulink (with file extension “*.mdl”)
–
–
–
–
–
–
•
Only text code
Not easy for modeling complicated systems
Runs usually faster
Requires numerical solver implementation
Visual with model schematic
Easy to model complicated systems
Not easy to change parameters
Usually requires more CPU time than MATLAB (large vector dimensions)
Includes numerical solvers that can be selected according to the nature of the problem considered
Issues with algebraic loops and numerical singularities
Combining MATLAB and Simulink can lead to a more efficient simulation
–
–
–
–
Visual model
Easy to change parameters and good for parametric studies
Create many instances of a subsystem
Hierarchical model
How Simulink works
• A Simulink model is composed of
– Blocks
– Connections
• Each block has these general characteristics
– A vector of inputs u
– A vector of outputs y
– A vector of states x
• The state vector may consist of
– Continuous states
– Discrete states
– A combination of both
Modeling options in Simulink
• Given a physical system, there are two main alternatives for developing a modeling and simulation(M&S) environment in Simulink
1) Block diagram of system of governing Differential Equations (D.E.)
– System is defined and a mathematical formulation that describes the system is developed
– System of DEs implemented and solved by using Simulink basic blocks and connections 2) Simulation using subsystem component models from library
– System is physically and functionally defined
– Components are dragged and dropped from the library and are connected based on physical architecture
• Electric circuit example: First option would lead to an M&S that explicitly solves the system of equations that describes the circuit, but second option would be the implementation of the circuit itself
Simulink libraries
• Simulink includes several built‐in toolboxes for easier implementation of a dynamic system model
Basic Elements
•
There are two major classes of elements in Simulink:
–
–
•
Blocks are used to generate, modify, combine, output, and display signals
•
Continuous: Linear, continuous‐time system elements
•
Discrete: Linear, discrete‐time system elements •
Functions & Tables: User‐defined functions and tables for interpolating function values
•
Math: Mathematical operators •
Nonlinear: Nonlinear operators •
Signals & Systems: Blocks for controlling/monitoring signal(s) and for creating subsystems
•
Sinks: Used to output or display signals •
Sources: Used to generate various signals Lines are used to transfer signals from one block to another
•
Lines transmit signals in the direction indicated by the arrow
•
Lines must always transmit signals from the output terminal of one block to the input terminal of another block
•
Lines can never inject a signal into another line; lines must be combined through the use of a block such as a summing junction.
A signal can be either a scalar signal or a vector signal
Creating a Simulink Model
The modeling process can be completed in the following six steps:
1.
2.
3.
4.
5.
6.
Define the system
Identify system components
Model the System with equations
Build the Simulink® block diagram
Run the simulation
Validate the simulation results
Starting Simulink
• At the command prompt for matlab type “simulink”. This will open up the window for Simulink
References
• Simulink tutorial links by Mathworks.com
– http://www.mathworks.com/academia/student_cent
er/tutorials/simulink‐launchpad.html
• Simulink Basics Tutorial by University of Michigan
– http://www.engin.umich.edu/group/ctm/working/ma
c/simulink_basics/index.htm
• “Simulink,” Beate Oswald‐Tranta, Institute for Automation, University of Leoben, Austria 2005
• “How to use Simulink,” Jin‐Woo Jung, Department of Electrical and Computer Engineering, The Ohio State University, 2005
Download