GENERAL SIMULINK TIPS
Next: TABLE OF SIMULINK
Up: No Title
Previous: BLOCK DIAGRAM CONSTRUCTION
The following are general tips and should be used often.
- In order to save your work, select Save from the file menu and give
the file that you want to save a name (or choose an old name if you are
``writing over'' an old version), and click the ok button (using the left-most
mouse button). Realize that you have a choice of the ``folder'' that the file
is saved in.
- The PID Controller block parameters are entered in as:
,
,
.
- The following transfer function (in the Laplace domain)

is entered into the transfer function icon by double clicking on the
transfer function icon and entering the numerator and denominator
polynomial coefficients. The numerator coefficients would be entered as
[2 1] and the denominator coefficients are entered as [10 5 1].
- The following state-space A matrix

is entered into the state space icon as [1.0 -2.8;-3.1 0.2].
- The results of a simulation can be sent to the MATLAB window
by the use of the to workspace icon from the Sinks window.
Open the to workspace icon and select the variable name that you want
the results stored in the MATLAB workspace.
- If your simulation has n state (or output) variables and you want to
save them as different names, then you have to use a special connection called
a Demux (as in demultiplexer) icon which is found in the Connections
window. Basically, it takes a vector input and converts it into
several scalar lines. You can set the number of outputs (scalar lines) by
double clicking on the icon and changing the number of outputs. A Mux
icon takes several scalar inputs and multiplexes those in a vector (useful
sometimes in transferring the results of a simulation to the MATLAB
workspace, for example).
- You can generate white (random) noise by selecting the white
noise icon from the Source window.
- You can use a Gain icon from the Linear window if you need to
multiple a signal by a constant number.
- You can convert back to physical variables after a state-space or
transfer function simulation by using the Constant icon from the Sources
window and a Sum icon from the Sources window. To do this for a scalar
output signal, just enter the value of the steady-state into the
Constant icon and add this to the scalar output using the Sum
icon. For a vector output, you must first "break-up" the vector into scalar
outputs using the Demux icon and then add the steady-state value to each
scalar output.
- The signs of the Sum icon may be changed to negative (in order to
subtract) by double clicking on the Sum icon and changing the sign from
a positive to a negative sign. The number of inputs to the Sum icon may
be changed by double clicking on the Sum icon and setting the number of
inputs in the window.
- Make sure to set the integration parameters in the simulation menu.
In particular, the default minimum and maximum step sizes must be changed
(they should be around 1/100 to 1/10 of the dominant (slowest) time constant of your system).
- Parameters can be "passed" to SIMULINK from the MATLAB
window by using the parameter in a SIMULINK block or parameter box and
defining the parameter in the MATLAB window. For example, say that one
wants to run the simulation with many different process gains, then in the
transfer function icon the gain (in the numerator) can be given the
symbol k (or any
symbol) and then at the MATLAB prompt define k = 1.0. Run the
simulation, then at the MATLAB prompt redefine k = 1.5, etc. This is
very useful if the student wants to study the influence of a parameter on the
dynamic behavior of a process (important in determining stability).
- In order to print the block diagram, first save the block diagram. Then,
at the MATLAB prompt, type:
print -sname-of-simulink-block
where name-of-simulink-block is the name that you saved the block
diagram under. For example, if you saved the block diagram as
homework1.m, then you would type:
print -shomework1
- Time delays (deadtimes) can be simulated in SIMULINK easily by
using a transport delay icon from the Nonlinear window. Double click on
the transport delay icon to set the value of the deadtime.
- Nonlinear systems can be simulated in SIMULINK using an
s-function icon from the Extras window. The nonlinear ordinary
differential
equations must be specified in an m-file, and the name of this m-file is
specified in the s-function by the user. We will generally supply the
student with the m-file containing the nonlinear ordinary differential
equations.
Next: TABLE OF SIMULINK
Up: No Title
Previous: BLOCK DIAGRAM CONSTRUCTION
Lou Russo, Howard P. Isermann Dept. of Chemical Engineering