Simulink 7.4
Simulink Introduction and Key Features
Simulink is a platform for multidomain simulation and Model-Based Design for dynamic systems. It provides an interactive graphical environment and a customizable set of block libraries that let you accurately design, simulate, and test control, signal processing, communications, and other time-varying systems.
The following examples introduce the key capabilities of Simulink. (See the Additional Information section for more in-depth Simulink demonstrations.)
Contents
Figure 1: Automotive powertrain system modeled in Simulink. Click on image to see enlarged view.
Creating and Working with Models
With Simulink, you can quickly create, model, and maintain a detailed block diagram of your system using a comprehensive set of predefined blocks. Simulink includes more than 1000 blocks that implement functions commonly used to model a system. You can customize these built-in blocks or create your own. Additional blocksets (available separately) extend Simulink with specific functionality for aerospace, communications, signal processing, and other applications.
Watch a video on the Simulink block library and add-on blocksets. (3 minutes, 58 seconds)
Building and Editing Your Model
With Simulink, you build models by dragging and dropping blocks from the library browser onto the graphical editor and connecting them with lines that establish mathematical relationships between the blocks.
In the video that follows, we will model a rubber ball that is thrown in the air with an initial velocity of 15 m/s from a height of 10 m. We will model the dynamics of the ball as it bounces, under the influence of gravity. We will assume that 20% of the energy is lost on each bounce. (That is, after each impact, the ball will travel at 80% of its prior velocity, but in the opposite direction.)
We can model this example by integrating g (g = -9.81m/s^2) over time with the initial condition set to 15 m/s. We reset the integrator each time the position reaches zero meters and set the new initial condition to -80% of the impact velocity. Position is modeled by integrating the velocity over time with the initial condition set to 10m/s.
Watch a video on building the model below with the block library. (3 minutes, 1 second)
Figure 2: A model of the dynamics of a bouncing ball.
Organizing Your Model
Simulink lets you organize your model into clear, manageable levels of hierarchy by using subsystems, which encapsulate a group of blocks and signals in a single block. Simulink provides additional methods that enable large teams or multiple organizations to work on components, and then integrate them into a single system.
Watch a video on the hierarchical features in a powertrain model. (3 minutes, 56 seconds)
Defining and Managing Signals and Parameters
Simulink enables you to define and control the attributes of data, signals, and parameters associated with your model. Signals are time-varying quantities represented by the lines connecting blocks. Parameters are coefficients that help define the dynamics and behavior of the system.
Using the Model Explorer (shown in Figure 3), you can manage your data dictionary and quickly repurpose a model by incorporating different data sets.
Watch a video on managing and creating data and parameters. (2 minutes, 8 seconds)
Figure 3: The Simulink Model Explorer. Click on image to see enlarged view.
Integrating Handwritten Code
With Simulink, you can incorporate MATLAB, C, Fortran, and Ada code directly into a model, enabling you to include handwritten code and create custom blocks, and providing an alternative way to represent algorithms in your model. We will look at two models that show different ways to incorporate handwritten code into Simulink. Depending on what the code does, one technique may be more appropriate than the other.
Example 1: Incorporating MATLAB Algorithms The first technique uses Embedded MATLAB Function blocks to implement matrix-oriented algorithms and take advantage of MATLAB graphics. It uses a subset of the MATLAB language that can be compiled into C code with Real-Time Workshop. The graphics components that are implemented with Embedded MATLAB are only used during simulation and do not result in embedded code for embedded graphics.
Watch a video on integrating a MATLAB algorithm into Simulink. (1 minute, 44 seconds)
Example 2: Incorporating C Code The second model uses a C code S-function to implement a single input, two output continuous state-space system. S-function is short for Simulink function and is the method for creating your own blocks using C, MATLAB, Fortran, or Ada. The S-Function Builder, which we will demonstrate, provides a convenient way to create C code S-Functions from algorithms written in C. We will copy and paste the prewritten algorithm from a text file.
Watch a video on integrating C code into Simulink. (2 minutes, 17 seconds)
Using Solvers
Solvers are numerical integration algorithms that compute the system dynamics over time using information contained in the model. Simulink provides solvers to support the simulation of a broad range of systems, including continuous-time (analog), discrete-time (digital), hybrid (mixed-signal), and multirate systems of any size. These solvers can simulate stiff systems and systems with state events, such as discontinuities, including instantaneous changes in system dynamics.
Watch a video on Simulink solvers. (1 minute, 43 seconds)
Inputting Signals and Visualizing Results
So far we have seen ways to input and visualize signals by connecting additional blocks to our model. We will now look at other ways to input and visualize signals.
The following video demonstrates the use of a flight controller for the longitudinal motion of a Grumman Aerospace F-14, and looks at some of the built-in visualization in the Signal Processing Blockset. You can build similar complex visualizations by writing your own visualization routines in MATLAB.
Watch a video on inputting and visualizing signals. (3 minute, 53 seconds)
Store
