You are on page 1of 8

c c 

The objective of this tutorial is to acquaint the student with the basic tools needed to use the
c 
c package on the Unix workstations of the Rensselaer Computing System (RCS).
c 
c is an extension to 
which uses a icon-driven interface for the
construction of a block diagram representation of a process. A block diagram is simply a
graphical representation of a process (which is composed of an input, the system, and an output).

Typically, the 
m-file  is used to solve sets of linear and nonlinear ordinary
differential equations. The ``traditional'' numerical methods approach is used, e.g. supply the
equations to be solved in a function file, and use a general purpose equation solver (linear or
nonlinear algebraic, linear or nonlinear differential equation, etc.) which ``calls'' the supplied
function file to obtain the solution. One of the reasons why 
is `   easy to use is
that the ``equation solvers'' are supplied for us, and we access these through a command line
interface (CLI) (aka the 
prompt, >>). However, c 
c uses a graphical user
interface (GUI) for solving process simulations. Instead of writing 
code, we simply
connect the necessary ``icons'' together to construct the block diagram. The ``icons'' represent
possible inputs to the system, parts of the systems, or outputs of the system. c 
c allows
the user to easily simulate systems of linear and nonlinear ordinary differential equations. A
good background in matrix algebra and lumped parameter systems as well as an understanding of

is required, and we highly recommend that the student thoroughly reads and works
through this tutorial. Many of the features of c 
c are user-friendly due to the icon-
driven interface, yet it is important to spend some time experimenting with c 
c and its
many features. Dynamic simulation packages (such as 
, c 
c , etc.) are being
used more and more frequently in the chemical process industries for process simulation and
control system design. After completing this tutorial, the student should be able to ``build'' and
simulate block diagram representations of dynamic systems.

c  c c 


c 
c 
c is an icon-driven state of the art dynamic simulation package that allows the user to
specify a block diagram representation of a dynamic process. Assorted sections of the block
diagram are represented by icons which are available via various "windows" that the user opens
(through double clicking on the icon). The block diagram is composed of icons representing
different sections of the process (inputs, state-space models, transfer functions, outputs, etc.) and
connections between the icons (which are made by "drawing" a line connecting the icons). Once
the block diagram is "built", one has to specify the parameters in the various blocks, for example
the gain of a transfer function. Once these parameters are specified, then the user has to set the
integration method (of the dynamic equations), stepsize, start and end times of the integration,
etc. in the simulation menu of the block diagram window.

In order to use c 
c the student must ``start'' a 
session (click on the

button). Once 
has started up, type  (SMALL LETTERS!) at the

prompt (>>) followed by a carriage return (press the return key). A c 
c
window should appear shortly, with the following icons: Sources, Sinks, Discrete, Linear,
Nonlinear, Connections, Extras (this window is shown in Figure 2). Next, go to the file menu in
this window and choose New in order to begin building the block diagram representation of the
system of interest.


 c   c 
As mentioned previously, the block diagram representation of the system is made up of various
type of icons. Basically, one has to specify the model of the system (state space, discrete, transfer
functions, nonlinear ODE's, etc), the input (source) to the system, and where the output (sink) of
the simulation of the system will go. Open up the Sources, Sinks, and Linear windows by
clicking on the appropriate icons. Note the different types of sources (step function, sinusoidal,
white noise, etc.), sinks (scope, file, workspace), and linear systems (transfer function, state
space model, etc.).

For example, you may be interested in simulating a step input to a first-order transfer function in
the Laplace domain and viewing the result graphically in 
. The resulting block
diagram is shown in Figure 3. To do this, you would "drag" a  icon from the
Sources window, a  !  icon from the Linear window, two " ! icons
from the Sinks window, and a  icon from the Source window to the blank block diagram
window.
The next step is to connect these icons together by drawing lines connecting the icons using the
left-most mouse button (hold the button down and drag the mouse to draw a line). Connect the
 icon to the input of the  !  icon, then connect the output of the
 !  icon to first " ! icon. Then, connect the  icon to the second 
" ! icon. ``Open'' the icons (by double clicking on them with the left-most mouse button)
and set the values of the various parameters; for example the step size and step time in the 
 icon, the transfer function coefficients in the  !  icon, and the variable
names in the " ! icons (generally, the clock variable is denote as time, whereas the
output variable is denoted y). Select the parameter field from the simulation menu (in the block
diagram window) and set the proper integration details (min and max stepsizes, start and stop
integration times, integration code, etc.). Finally, select start from the simulation menu to start
the simulation. The output of the simulation will be sent to the 
command line
interface (CLI) (aka the 
prompt, >>). The result can be plotted as one would normally
plot ( e.g. plot(time,y) ), since the variables  and  are now defined in the 

workspace. The result is shown in Figure 4, for a first-order transfer function with a time
constant = 2, and a unit step input at time = 1.
 
c 
c c#
The following are general tips and should be used often.

1.? 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.
2.? The PID Controller block parameters are entered in as: , , .
3.? The following transfer function (in the Laplace domain)

is entered into the  !  icon by double clicking on the  ! 
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].

4.? The following state-space A matrix


is entered into the !! icon as [1.0 -2.8;-3.1 0.2].

5.? The results of a simulation can be sent to the 


window by the use of the 
" ! icon from the Sinks window. Open the " ! icon and select the
variable name that you want the results stored in the 
workspace.
6.? 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 $ (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 $ icon takes
several scalar inputs and multiplexes those in a vector (useful sometimes in transferring
the results of a simulation to the 
workspace, for example).
7.? You can generate white (random) noise by selecting the "% icon from the Source
window.
8.? You can use a ! icon from the Linear window if you need to multiple a signal by a
constant number.
9.? You can convert back to physical variables after a state-space or transfer function
simulation by using the ! icon from the Sources window and a  icon from
the Sources window. To do this for a scalar output signal, just enter the value of the
steady-state into the ! icon and add this to the scalar output using the  icon.
For a vector output, you must first "break-up" the vector into scalar outputs using the
$ icon and then add the steady-state value to each scalar output.
10.?The signs of the  icon may be changed to negative (in order to subtract) by double
clicking on the  icon and changing the sign from a positive to a negative sign. The
number of inputs to the  icon may be changed by double clicking on the  icon
and setting the number of inputs in the window.
11.?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).
12.?Parameters can be "passed" to c 
c from the 
window by using the
parameter in a c 
c block or parameter box and defining the parameter in the

window. For example, say that one wants to run the simulation with many
different process gains, then in the  !  icon the gain (in the numerator) can
be given the symbol k (or any symbol) and then at the 
prompt define k = 1.0.
Run the simulation, then at the 
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).
13.?In order to print the block diagram, first save the block diagram. Then, at the 

prompt, type:

ë`



 
where 


  is the name that you saved the block diagram under. For
example, if you saved the block diagram as    `, then you would type:

ë`
   `

14.?Time delays (deadtimes) can be simulated in c 


c easily by using a  ! 
!& icon from the Nonlinear window. Double click on the  ! !& icon to set
the value of the deadtime.
15.?Nonlinear systems can be simulated in c 
c using an ' 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 ' by the user. We will
generally supply the student with the m-file containing the nonlinear ordinary differential
equations.


(c 
c 
 
?

You might also like