Introduction to Simulink - Simulation


Related Documents Contents

Introduction

In this part of the tutorial you will enter the remaining model parameters, enter the simulation parameters, and then produce some results. Some pointers on how to make print-outs are given.

Model Parameters

So far you have examined the parameters of only one block, namely the Mux block. Recall that the Inputs and Outputs section described how to change for the Multiplexer block, the number of input ports from 3 to 2. Now it is time to examine the other blocks in the model.

The Sine Wave Block
Double click on the Sine Wave block and examine the data fields, make changes so that the fields match the following parameters. Then with the mouse click the Apply button, and then click the Close button.

Sine Wave Block Parameters
Amplitude = 1
Frequency(rad/sec) = 0.25 * 2*pi
Phase(rad) = 0
Sample Time = 0

A small bit of explanation is needed. First, the amplitude given here is unit-less. You must remember whether the signal is a current, voltage, torque, volume, or whatever. Next, note that the standard units of frequency that Simulink understands are radians per second. To make things easier for ourselves and satisfy Simulink at the same time, we can make use of the built-in variable "pi". Simply stated, to convert from Hertz to radians per second, multiply by 2*pi. Thus 60 Hertz is 60 * 2*pi radians per second.

The term phase angle refers to the phase of the resultant sine wave, at time zero. Lastly, the idea of sample time in a Sine Wave generator is an odd thing. Since we wish to have the block model a continuous sine wave generator, the value zero "0" is used.

The Integrator Block
Double click on the Integrator block and examine the fields to make sure they match the list given below. Of all the parameters it is most important that the initial conditions field is set equal to zero. Use the mouse to click the Close button.

Integrator Block Parameters
External Reset = None
Initial Conditions = 0
Limit output = Not Checked
Show saturation point = Not Checked
Show state port = Not Checked
Absolute tolerance = auto
Don't open the scope block yet. A discussion of the scope block follows a discussion of the simulation parameters.

Simulation Parameters

In this next step you will set the simulation parameters. In the model window, select the following with the mouse;
Simulation => Parameters
The simulation time units are seconds. Set the simulation start time to `0' (zero) and the stop time to `8' Since the Sine Wave block is set to produce a 1/4 Hertz signal, this setting will produce two complete sine wave periods. For the Solver and Output options, leave the default settings shown in the figure below. With the mouse, click the Apply button, then click the Close button.

Run the Simulation

Now you can run the simulation. This simulation is fairly simple in that it runs all-at-once. In the model window, select the following with the mouse;
Simulation => Start

To view the results of the simulation, double click on the Scope block. To better fit the display in the Scope window, click on the `Fit View' button . The Scope window should look similar to the following.

Labels and Printing

Congratulations, your simulation works. One problem that springs to mind is how to apply labels to the diagram. Another problem is how to produce a print-out. While the model window has a print option, the Scope display does not appear to have one. These details are solved on the PC by performing a selective screen dump and then using the Paint program. Use the mouse to select the Scope display window. Next on the keyboard hold down the `Alt' key and press the `Print Screen' key. This key combination performs a screen dump of only the active window. Next, start up the `Paint' program by selecting the following;

Start => Programs => Accessories => Paint

Inside the Paint program, select the following

Edit => Paste

Now with the image loaded into Paint, you can add annotations and print the figure and produce something similar to the following. As always, make sure to sign and date your work.


This document was written by Jonathan M Hill (jmhill@ece.wpi.edu), using HTML Standard 3.2.
Revised: Sun Mar 11 20:57:45 EST 2001