Alright everyone, welcome to Simulink for ChemE's. This first screencast will just
help us get the lay of the land when we're using the Simulink software. The first thing
to do is open the program. If you're watching this at Lafayette, click on the CHE software
folder and double click on the Matlab icon. The command window should come up. Simulink
is a powerful tool which allows you to model and analyze dynamic systems just by moving
boxes around and connecting arrows. You can see how changes in one or more parameters
can affect the system without having to go through all of the complicated pen and paper
mathematics. It has a graphical user interface which makes everything easier to see, and
you don't actually need to know how to code in Matlab in order to use it. So we'll open
up a new Simulink model. In the command window click on new and then scroll down and click
on Simulink model. Click the icon with the four colored squares to access the Simulink
library. This can found either on the main command screen right here, or in the menus
on the Simulink model screen. Simulink is used for many different dynamic systems not
related to process control, so there are over two hundred blocks to choose form. Therefore,
the aspects of interest for this course are spread out all over the place. Most of the
blocks that we're going to be using for process control problems are housed in the continuous
section. These include transfer functions, PID controllers, and transport delays, which
are used to add dead time to your model. Sources houses a whole host of forcing functions,
including steps, ramps, and sinusoidal waves. These are used to create disturbances and
set point changes in your process model. The signal routing subsection houses the mux
block. The mux block is often used to combine the signals that come from different places,
which will be useful in doing such things as plotting both the input and the output
function simultaneously. Sinks contains the scope function, which enables you to see plots
of your functions. Finally, if you go into math operations you can find things like add blocks,
subtract blocks, and scalar gain multipliers. Now the question that we're going to try and
solve using Simulink is how does the first-order transfer function six over four s plus one
respond to a step input of two? First we have to put all the right blocks down on the drawing
board. The first rule of Simulink is that all signals must start at a source and end
at a sink. So when solving this problem the source is a step input block,
and the sink is a scope block. And we want to see how a particular transfer function is affected by
the step. So we can go into continuous and grab a transfer function here. We're also
going to need a mux block from signal routing so that we can read multiple signals on the
scope at the same time. So I think that's everything that we'll need. We can maximize this and
lay everything out. So even though the blocks are on the drawing board nothing is being
modeled yet. Signals have to be sent from one place to the other, and this is done by
drawing arrows between all of the blocks. To add an arrow just click and drag from the
output of one block to the input of another block. So we have an arrow going from the
mux to the scope. We have an arrow going from the transfer function, and then we have
an arrow going from the step. And we can edit the transfer function by doubling clicking
on it. In Simulink transfer functions have to be typed in based on their coefficients.
So to model six over four s plus one, we'll type six is the numerator, and then four space
one into the denominator, the one's already there. We'll apply that and it changes, and
then we'll double click on the step change and it's going to be at a step time of zero
at an initial value of zero, and a final value of two because we're dealing with a step change
of two. And we're reading the output signal from the process block, but it would also
be helpful to read the input signal of the step function because currently that's not
being read. So we're going to take this extra port on the mux and connect it to the input
signal. And you can drag the arrows around too and move them in order to make your diagram
look cleaner if you so choose. And then we can set the simulation time to forty minutes,
save our progress. We'll save this as firstorder. And then we can press run, and in order to
see what happened we have to double clock on the scope block. And we'll go to auto scale,
and there we go. Here's our step change in input, it goes from zero to two, and because
the gain of our process transfer function is six the change in input is two, so that
means that the change in output is going to be six times two, or twelve. Also, the step
input is instantaneous, but the process output is not instantaneous, its got very strong
time dependence. And it will reach its final steady state value of twelve after roughly
five times the time constant, which is four. So after twenty minutes you can see that it
is nearly at its final steady state value. If you want learn more about using Simulink
to solve process control problems you can watch my other videos and subscribe to the Lafayette
CHBE YouTube playlist.