Hello everyone in this video tutorial we will look
how to use neural network concept for designing
model predictive controller
 
 
 
so in the 1st step you develop a neural network
model plant you want to control
as you can see in the figure u is our control parameter
so it is input to our plant
which will give some output
we can create this
neural network model which will be time series neural network
then the error is calculated using the usual method
and then apply back propagation using any of the learning algorithm
that we have already discussed
this is what our neural network will look like
as you can see this is similar to our time series neural network
so this is the complete model that we will be looking into
so in the 1st step we have created
neural network model of our plant
2nd step we will be use this neural network model to predict the future value
 
optimization block is also
which is the reference signal which we want from plant
optimization block using some optimization  algorithm
that optimizes the future plant performance
so basically we will have our output from the plant
which matches nearly with the reference signal
 
 
so these 2 are basically same
1 is input to neural network model and 2nd input
to plant to predict
the optimization to the controller required the significant
online computation because
the optimization is performed at each single time step
to compute the optimal control
the optimization block tries to minimize
the performance which is shown in the equation in the screen
as you can see the 1st term is basically
difference between required signal and the signal
predicted by the neural network model, and the 2nd term represent
sum of square of the control increment value
 
 
 
 
 
 
 
 
coming back to matlab
type
in the command window and press enter
this will open up the simulink model
which may use of predictive model
so 1st let's look which plant we are using
plant is basically a set of equation
that represent dynamic model of our system
as seen in the figure
we are using the plant
 
and the equation of the system are shown on the screen
the 1st equation represent the rate of change of height of
our model
 
 
and for 2nd equation we have the rate of change of the
product concentration at the output of the process
so we will built these equation in our plant model in the simulink
 
 
 
 
 
 
 
 
and we are not concerned with the change of h(t)
 
so let's double click on plant
and this is the same equation that we have already discussed
you can confirm this by comparing this model
with the equation then we have our predictive
controller so it is
we are taking any random reference signal
but in our real life we would know what our reference should be
or we would know what output of our plant should be
it is also with the plant output
and model so right click on the
predictive controller and open it in a new tab
so as you can see there is a block
name
this is basically optimization algorithm
it is with the reference signal
and 2 signal from the model
and the plant output it then uses the optimization algorithm
to calculates the control input
which gives it to the control signal
actual plant
right click on the model and open it in a new tab
as you can see this is how our
time series look like
there are few differences which are
1st we are using this block this are used when we are normalizing our input
and output
and then we are using the discrete state
so we are converting what our input into discrete state
and other then that this is similar
to usual time series neural network
note that 2 output from this block
 
 
 
so let's see how our predictive model
controlling the inputs to the plants
and making sure that the output from the plant is similar to
that of our random reference
double click on predictive model
it will open up a new window
this window will basically consist parameters for our optimization block
let's discuss these parameters
 
 
 
 
 
 
 
 
 
if you want to know how
these parameters are used in optimization
algorithm you can search in matlab directly
 
it contains all the algorithm
we can also select different minimization routine
so we will be continuing the default routine
and the iteration part samples select the number of
iteration of the optimization algorithm
to be performed at each sample time
but this is the 2nd step
so before this we need to perform the 1st step
and this can be performed by clicking on plant identification
in this we will create the neural network model
of our plant so we can select the size of
the hidden layer we can change it let's say to 10
 
basically we will be generating the random training sample
if we have the actual data you can click on import data
to import it from the work space
but for this example we will be generating 8000 random training sample
and those training sample will be selected
random number generation which will have the
minimum value 0 and maximum value of 4
and the interval in which it will be selected randomly
will vary from 5 to 20
you can also specify the limit for the output of the plant
we keep it from 20 to 23
simulink model
you can provide the name of the simulink model
as it is save in matlab directly
so we will provide it to
we can specify the training
so let's keep it as default
we can also use the normalizing data
so this will activate the block which we will activate in our simulink model
this is the number of plant delay
input and output
after all these parameters are set
click on generate data
as you can see a new windows comes up
so it is taking any random number from 0 to 4
in any random time step that is 5 to 20
as specified in parameters in the previous window
and the bottom is the plant output window
so it shows the actual plant output
so basically what we are generating
is the input data and target data
so we will wait for this data generation to complete
after the simulation is complete
the window will look like this
so if you know how your plant will look like
then you can compare it with plant output window
if it does not match you can reach the simulink model
but for this example we will except the data
by clicking on except data
after the data is excepted
we have our input data set the target data set
so we can click on train network or trainee using train lm training function
so after the training is complete
you will get a window like this
this will show our input our plant output and the neural network output
this neural network output plant output will look similar
for a proper training
if these 2 look similar then you can
except data by clicking on ok
so click on ok
and as these parameters are already
so click on ok here then click on run
the model is simulated
so after the simulation is complete
the graph will look like this so in these red line
is our reference signal and blue line is our output of our plant
 
so as you can see with time the output
of plant tries to copy the pattern of our random
reference
you can change the parameter of optimization algorithm
to make this process is faster or slower
here is the plant model of
you can directly select the nm predictive controller
from the simulink library
so go to the
neural network toolbox the control system
and here you can select the nm predictive controller
so that's it every one this is it for this video
hope you like it please like subscribe and share
thanks for watching
