So in our last lecture we are discussing about multivariable control, multivariable decoupling. I talked about introducing two new elements, dynamic elements into my controller. So this T21 and this T12 these two are two new elements that I want to introduce into my dynamics of controller. So now controller block will be 1, 2, 3 and 4 there are four elements in the controller just like your process has four elements which interact, specifying the interaction between both the inputs and both the outputs likewise the error which is for with respect to the first measurement and the error with respect to second measurement is actually used through two different blocks okay is used to two different blocks. So it is a multivariable controller and the idea is to introduce these two blocks T12 and T21 in such a way that effectively you have two decoupled loops okay. I want to do it in such a way that the two loops are not connected effectively okay. So this is called dynamic decoupling and if you can achieve dynamic decoupling then you can have easier or better control of the process because now how do you design a decoupler. So I am going to do this in very simple case for a 2x2 case there too we will see that we will end up into some problems but nevertheless this is a good step before going to really advance control if you can realize these kind of decouplers through conventional digital control hardware like PLC or DCS then you can improve the closed loop performance okay. So now what I want to do is to introduce this new element I want to introduce this new element in such a way that let us go back and see what is U11 here, U11 is influencing through T21 it is adding to U2 okay it is adding to U2 and this U22 is adding to U1 okay. So this U11 plus additional element which is coming here that is my U1 and this U11 which is coming out of this first controller that goes through here it adds to this another element another U22 which is coming from here and then that together forms that so what I want to do is to introduce this element in such a way that as if this is a separate loop. So this coupling I want to remove okay I want to remove this coupling so if you do the algebra okay you want to see to it that the effect of cross linking of that is effect of U22 U11 should be so I want to choose this element in such a way that the effect which is traveling here back on U11 that should be 0 and the effect which is traveling here the effect of the first controller on the second loop should be 0 effect of second controller on the first loop should be 0 and that gives me these 2 equations I want to choose T11 and T12 such that you cancel the dynamics the cross dynamics okay I want to choose T11 and T12 such that you cancel the cross dynamics now this should be T12 okay so I want to have these 2 decouplers designed in such a way that the effectively 2 loops become decoupled you have to do a little bit of algebra to come up with these 2 equations you can do that by substituting and trying to find out the closed loop equation I am skipping the in between steps it is just simple algebra so what the trouble here is that I am designing these 2 decoupling elements T12 and T21 so which are functions of the process model okay so it is very very important that if I want perfect decoupling between the loops my model is perfect okay now perfect model is actually only a concept in you know in book there is no perfect model okay only if you are doing computer simulation you will have a perfect model because the plan is perfectly simulated and you can have perfect decoupling so there is a trouble when you want to do this implement this kind of decoupling but nevertheless it is a even if you have approximate models it can do good amount of decoupling if you employ this simple approach yeah if they are right at zeros there is I will come to that so this is not this is not see this is I am introducing this more as you know before I go to multivariable control I want to talk about something which has been done historically this has been a step in between okay so I will talk about the fact that this is many times not possible to do so what you say is right if it is right hand zeros then this becomes unrealizable if it has dead time I will show that it will become unrealizable if there is a dead time you will get when you divide 2 transfer functions you will get sometimes dead time which is positive which means the present value will depend upon the future value so it is not realizable okay so many times like the problem which is talking about is what if when you do this inversion here that is G21 upon G22 it may happen that this T21 has some poles which are unstable okay if this happens okay then it is not possible to realize a unstable transfer function through unstable means you know the behavior can become unbounded the output can be unbounded it is not possible to realize this so there are very trouble when you have to actually physically cancel the dynamics like this okay you are trying to introduce 2 additional elements which will nullify the cross dynamics that is what you are trying to do and that makes things difficult because it is not possible to cancel dynamics always it is difficult to cancel dynamics now one intermediate way which is which I would say is not perfect decoupling but you know you can do something called gain decoupling which means do not worry about the dynamics okay just look at the steady state gain of this 2 elements look at steady state gain of these 2 elements and then do decoupling then it is not going to be then if you do gain decoupling you are not going to get into this situation it is not possible you are not going to have perfect decoupling but it is something is better than nothing so you know this gain decoupling is something which you can try if this T21 T12 are not realizable or you do not have perfect models for whatever reasons you do not want to do this let us go back to this wooden berry column just as an example in this case if I do steady state decoupling okay I just have to look at the gains okay and then I can introduce 2 cross elements T11 T12 and then I get these 2 decoupling gains okay these decoupling gains will try to reduce the interaction they will not really eliminate interactions okay so this is only a little bit you can say ad hoc way of getting over the problem of but nevertheless you can do this also you can in this particular case you can actually design 2 decoupling elements and if you implement these decouplers together with 2 PID controllers then you will get perfect separation between 2 loops which means what is the meaning of that if you change one set point okay the other loop will not get disturbed at all okay only one if I want to change the distillate composition only distillate composition will change nothing will happen to the loop for bottom composition that is what it means so for this particular case it is possible to realize these realize this particular decoupler. Now I just want to point out the same concern which one of you had what if the decoupler is not realizable that can happen okay so now all that I have done is I have just shuffled the rows here okay so now the input is S earlier it was RS okay the first input here was R second input was S now I decide to do couple you know decoupling the other way around which means I will look at this transfer function now so my T1 what is my T11 T12 changes now okay and I decide to do controller pairing the other way around XD and S and SS, XB and R that means bottom composition control using top reflex flow rate and steam flow rate used to control the top composition this is in reality you are not going to do this okay but I am just going to give I just want to you give an example where things can become not I mean the decoupler can be unrealizable if I take this particular configuration and then design the decoupler using this formula which we have arrived at you get this you get this here decoupler which is if you notice here okay here you have e to the power 6S right here plus 6X what does it mean it means that you know the current output will depend upon the future input which is not possible which is not possible to compute okay we cannot compute something which is now based on something that is going to happen in future so well as human beings we keep doing that and we will be looking at something called predictive controller later but to realize a differential equation which depends upon you know the present behavior depends upon the future behavior is difficult it is not possible. So these two decouplers are not realizable the previous case the decouplers are realizable in this particular case the decouplers are not realizable because you get here positive dead time and which would mean that the current value will depend upon the future if you convert this into differential equation you will realize that the current value will depend upon the future value and then you cannot implement this decoupler okay. So decoupling I just do not want to get too much into detail we probably will have some problems to solve in the assignment but and you will get some idea but decoupling probably you can use for some small system 2 input 2 output or maybe 3 input 3 output but this decoupling is a limited it has limited power because the model has to be perfect you can do this gain decoupling in simple situations and then you can implement this the main power of this is that you do not need any special software for doing advance control you can implement this ideas of decoupling through a normal distributed digital control system hardware DCS hardware or programmable logic controllers of the shelf which you get in the market you can use them and actually implement this decoupling ideas okay that is nice about this and you can deal with some small dimensional systems in terms of multiple input multiple output 2 by 2 or 3 by 3 but beyond the point this does not help us okay. I just want to give an example I want to move now to multi variable control before I move to multi variable control I want to give a motivating example as to what is the difference between single loop controllers and multi variable controllers does it pay off going for some advance control we are going to look at a set of advance control algorithms which are very very popular in the industry what I am trying to do is after we do all this I am going to call one of my hostel mate who works with Yoko Goa and he will present case studies of whatever we study here in the class so he will present industrial case studies one or two industrial case studies depending upon the time where he has actually implemented these model based controllers for control of chemical plants. So to set the background let us look at a very simple problem this is a problem of a reactor and do not bother if you are not a chemical engineer you can appreciate the control problem very easily in this particular system you have a reactor in which some field is continuously being fed in you are drawing the product okay you are drawing the product let me draw a simple diagram here so this CSTR stands for continuously stirred tank reactor so this is a system which is like this this is a cooling jacket now I feed in some okay now this is my this is my CSTR stirred tank reactor so you normally show a stirrer here which indicates that all the contents in this in this reacting mixture are well mixed and the properties are uniform so temperature is temperature of entire mixture is same concentration inside the entire mixture is same what I am doing is I am pumping in some fluid here at the rate of F and whatever overflow in this tank goes out so flow which comes in F it goes out let us assume that there is a very simple reaction here simplest of the reaction will be A going to B isomerization okay and then you have this cooling jacket there is a coolant which is being pumped in here okay this coolant is being pumped in here and the coolant temperature is PCIN there is a this inlet flow rate is of component A whose concentration is A0 and reaction occurs here it gets converted into B and what you get out is concentration A okay so this is my simple system a very idealized representation of what happens in a chemical reactor and what I can measure here what I can measure here is temperature inside this reacting chamber so I can measure temperature okay I can measure temperature here okay the level is constant level is constant actually I would like to know what is concentration of the product this is my product which is coming out okay and I would like to know what is the concentration of the product okay that is my key variable but the trouble is many times it is very difficult to have online measurement of concentrations it can be very costly temperature can be measured very easily it is very cheap you can buy a good commercial temperature measurement system inside about 20,000 rupees I mean I am talking about from a very you know good company if you if your application is does not demand very high accuracy and you can even get for 5000 rupees you can get a good temperature measurement system whereas the cost for concentration analyzer just concentration analyzer offline would go to something like 4 to 5 lakhs and if you want to go it to online it could be 10 lakhs or 15 lakhs it will be very very high and that too is possible only for certain variables okay so I have temperature measurement here and then this in this particular system you can you know you need to there are control outputs are too that is control outputs are well the simplest case is that control output is temperature but ideally I would like to control concentration and temperature these are the two control outputs let us not right now bother about the fact that concentration measurement is very costly temperature measurement is very cheap let us assume that you know both of them are measured and available to us somehow how they are measured let us not worry okay so these are control outputs there are two manipulated variables this inlet flow rate here and the cooling water flow rate this FC which is here so these are manipulated variables and then the disturbances are so these are my disturbance variables okay so the concentration of the feed which is coming in is a disturbance it can be fluctuating the inlet temperature of cooling fluid this could be just tank water over a tank and it could be fluctuating it could be changing with time as in a during the day the tank water is not going to be constant so this could be changing so these two are disturbances I can manipulate the inlet flow rate I can manipulate the cooling water flow rate okay and I want to control concentration and temperature inside the reactor very very simple problem okay so now I decide to put two controllers okay so this is my system CSTR system there are governed by two differential equations rate of change of concentration and rate of change of temperature I have listed here the variables that we need to typically typically we will have only temperature measurement but right now we will not worry about that right now we will worry about we will say that both concentration and temperature are somehow available for doing closed loop control well what if temperature measurement is only what is available and concentration measurement is not available what do you do I am going to answer that question soon I will be starting on something called soft sensors model based sensors and that will start today itself so we will be going to that but for the time being assume that both the measurements are somehow available I decide to put two PID controllers okay I have chosen one consideration here CA concentration is controlled by manipulating cooling water flow rate temperature is controlled by manipulating the inlet flow rate I could have done the other way round I have chosen one particular configuration okay now I am just showing you what happens I am just what happens if I give a step change first of all what is the meaning of two loops are coupled see here I am comparing two different performances one performance is when I am not taking care of any thing for decoupling between the two loops okay that is this blue line okay and this black line is when I have implemented decoupling steady state decoupling gain decoupling I have implemented okay so I just want to show that implementing gain decoupling gives you a huge improvement in the closed loop performance now this is concentration profile this is temperature profile what I have done is I have kept I have put two PID controllers now two PI controllers to be precise they are the tuning parameters for PI controllers and if you see here I have given a set point change at time five minutes in concentration but I want to keep the temperature constant I want to keep the temperature constant okay I want to manage this change I want to manage the transition in such a way that ideally I want to manage transition such that temperature should remain constant and only concentration should change that is my ideal behavior okay now that of course when the two loops are interacting that is not going to happen because of the interactions there are oscillations also the system has some other reasons to have oscillations so this particular system you see that the time it requires to settle when there is no decoupling is very large okay it takes about 25 minutes 30 minutes to settle for the temperature perturbation concentration perturbation also settles up after about 25 or 20 minutes after you have introduced a change what if I introduce decoupling if I introduce decoupling steady state decoupling okay only gain decoupling then you see there is significant improvement in the performance. The departure from the temperature from 94 to you know 6 degree departure which occurred here does not happen here it is perfectly you know around the desired set point there are oscillations they died down little faster okay so just doing this gain decoupling simple measure which you can implement through DCS or through a programmable logic controller will improve your performance to some extent okay now this is how the two if you introduce decoupling and do not introduce decoupling this is this one is with decoupling and this one is without decoupling I should have color coded this so these are the manipulate input variables how okay now I want to control I want to actually I want to compare multivariable controllers and show that you know how much improvement you can get through multivariable controllers so it is like you know telling you the end of the novel right in the beginning that this is where we want to reach okay this is the kind of improvements that you get if you implement multivariable controllers and then we will again start looking at the story from the beginning. So I want to implement a multivariable controller I am putting a little unknown name here linear quadratic optimal control which is what I am going to cover as a part of the course so right now we saw two things we saw the comparison of two multi loop controllers no decoupling and two multi loop controllers with decoupling with gain decoupling with gain decoupling we got some improvement in the closed loop performance okay now this is one more experiment in which what I have done is again you know right now first time what I am looking at is multi loop PI controller no decoupling okay I have given I have decided upon one experiment is give a set point change at K equal to 50 and give a step disturbance in one of the disturbance variables at K equal to 150 okay so there are two things the controller is expected to do reject the disturbance and move the system to the new set point okay so this is the point where I introduced step change in the set point and at this point when this concentration is about to settle okay I have introduced disturbance now the simulations which I have done here are I mean I have tried to make it more realistic by putting in measurement noise okay so actuations that can occur in the flow so I have tried to do a realistic simulation okay because the measurements which you get are always corrupted with some noise then there are always some unknown inputs in the plan so I have introduced all that to make it realistic and see how it looks okay so you can see that when the disturbance is introduced you know there are lot of fluctuations here and obviously just looking at this even if you are not a planned operator you will say well I do not like this response because first of all here it takes long time to come to settle to a value and then disturbance rejection gets into some kind of oscillatory behavior we do not like this controller okay these are the input which are what if I do decoupling if I just do gain decoupling there is some improvement okay if I do the same experiment with the gain decoupling then you know it is reaching here faster just compare here it is reaching faster and then this oscillation seems to have reduced to some extent so this oscillations this oscillations are little less right and here too this is dying faster okay so if you just do gain decoupling you have some advantage over what you know just having two loops so it definitely helps and if you do not have resources to implement a very complex multivariable controller gain decoupling is a good solution so I do not want to reject gain decoupling but I want to improve the gain decoupling when I go to multivariable controllers okay these are the inputs which are so this is the disturbance which was given at point 15 minutes or sampling instead equal to 150 and well what I have done here till now I simulated the plant using linear differential equations I took non-linear differential equations linearize them took the linear differential equations and called it as a plant okay and then I did all this two PI controllers PI controllers with gain decoupling or whatever simple gain decouplers things seems to work the real plant is non-linear okay in my simulation what I have done next is I took the same decoupling controller and change the plant to non-linear simulations more realistic I am trying to be more and more realistic okay if I try to be more and more realistic in my simulations well gain decoupling which seems to work in the ideal world of linear models does not seem to work when I go to non-linear plant okay see when I am doing this simulations we will be doing now simulations I am putting that up whole thing so you have a choice how do you simulate the plant behavior in the computer I can simulate the plant behavior using linear differential equations I can perturbation model I can simulate the plant behavior using original non-linear differential equations which is much more realistic than actually simulating the plant using linear differential equations so linear differential equations if you do everything your algebra is nice everything works fine okay moment I go to non-linear differential equations and the controller is still linear control is not non-linear you are still PI controllers with some simple gain decoupling okay you have trouble when you want to implement this so what it means see when I design a controller what I would do is first I will simulate the plant using linear differential equations perturbation model design the controller do simulations after that before I go to the real system what I will do is I will remove the linear simulation put non-linear simulation that is more realistic and see whether this controller which is based on linear system theory does it work if it works it gives me confidence to go to the real plant okay that is how I would step by step check my controller but if I try to do this for the decoupling does not seem to work okay so I have trouble here PI with gain decoupling just do not even think about two decoupled two PI controllers which are independent and not talking to each other if I go to non-linear plant it becomes a chaos it starts oscillating okay so model of the story is that if I design two independent PI controllers without them talking to each other you can have trouble in a real plant okay with this simple example just two variables to control and two variables to manipulate you can imagine what happens when you have large number of inputs and large number of outputs I want to move to this state feedback controllers that is what I am going to start doing from today well by the time we reach state feedback controller design it will take probably end of this month we have to do lot of things in between but what is the basic idea here look at what I am going to do here well this is my plant this is my plant this is model which I got you know this model I could have got from either from physics linearization discretization or I could I got this model from data time series modeling state realization and then I got this model whichever way I got this model I have this model now I want to design what is called as a state feedback controller state feedback controller is this is a gain matrix okay this is the target state where I want to reach and I want to put a negative feedback for the state so I am assuming here for the time being at a state is perfectly measured okay now we will have to relax this assumption because in reality the state is not measured only why is measured but for the time being just leave that aside why am I going to do this because this way when I do this is a model which is multiple input multiple output model if I design a controller of this form it will be a multiple input controller okay it will simultaneously change all the inputs okay when you ask it to do something it will not change one input at a time one there are it is not like end drivers there is one driver one gain matrix which simultaneously modifies all the inputs simultaneously that is very very important okay so there are three steps here when you do this you design this controller by assuming that x is available then you design something called as a state estimator will start talking about state estimation today the state estimator will construct estimate of state from the measurements of y and then you merge the two you marry two you know you take the controller you take the state estimator merge them into one big controller so state estimator provides estimate of the state a nice word for state estimator would be soft sensor it creates an estimate of the state using measurements available and then you use that you use those estimated state to implement the control law so this is a method which we are going to look at is called as quadratic optimal control which has been used now just as I said you know end of the novel I am just putting it in the flashing it in the beginning this is what I get if I implement the LQG controller how am I going to do LQG controller you know that is a mystery that will solve over next whatever 15 10 15 hours but you can see the difference here okay this is a perfectly decoupled kind of a response you know when I asked it to give a set point change it just went from here to here as if it is a there is no dynamics okay and there was a small blip here but then it returns to the state this is like ideal control what you can think of this is perfectly coupling okay if I give a step change here in loop one okay only variable one changes to the new value and this there is a small blip but then it comes back okay just compare this behavior with this this behavior or same experiment mind you same set of experiments step change followed by a disturbance okay exactly same experiment but now I have used the controller which is of this form okay I have designed a controller of this form and you can see the benefits when I gave a disturbance here you can see a blip here when I introduce the disturbance is just a blip I again as if nothing happened you know you have a perfect control here well you might say well you have linear plant simulation linear controller everything is nice that is why it is working what if I go to non-linear plant okay I move to non-linear plant not too much difference it is still able to handle the situation okay there is some offset you can see here looks like there is some small offset it will take care of that that is not an issue but you know the behavior this has slightly changed see this has slightly changed when we moved from linear plant simulation to non-linear plant simulation there is slight are you getting what I am saying about linear plant simulation and non-linear plant simulation I just draw a diagram here so I am simulating this closed loop I am simulating this closed loop this is my plant there are two inputs and there are two outputs and this is my controller block so this is my y1 y2 u1 u2 this is u1 u2 this gets the disturbance D and this also gets two set points r1 r2 and this is y1 y2 so it gets the controller gets y1 y2 feedback okay I am not drawing those lines because it will look little complex here but you can imagine y1 going here and y2 going here there are two set point which are fed to the controller my controller is kept constant how do I simulate this plant how do I simulate the plant behavior I have a choice okay I can do it either by doing you know xk plus 1 is equal to phi xk plus gamma uk and yk is equal to c xk this will be my linear plant simulation if I if I solve this difference equations together with the controller equations it will be linear plant simulation other alternative is I can actually solve dx by dt is equal to f of x u and whatever f of x u d so this I can and y is equal to some h of x so this I can solve using ODE solver so these are non-linear differential equations and I directly simulate the non-linear differential equations of the reactor okay if I do that it is non-linear plant simulation if I simulate this linearized model here as a plant is a linear plant simulation that is what I mean okay everyone everyone with me on this okay okay so look at this if I if I do linear plant simulation okay linear quadratic optimal control gives me near perfect control nothing can be better than this okay there is there is settling time is almost you know one twentieth of what you get to PID controller okay so actually actually what you can achieve through advanced control multivariable control is far far superior than what you can do with multiple PID controls you just cannot you just cannot go there with multiple PID controls okay of course to implement advanced control you need much more knowledge about modeling estimation control and so on so even though now those tools are available they are not being used because you know lack of awareness and lack of you know background required to implement those advanced tools how it is being used no no so what then you know what we do is we retune the PI controllers when you actually go to the see so you have to keep keep changing the PID tuning parameters till even after decoupling they are kind of satisfied now how do you do that because you know there is a mismatch between the plant and a model and then it is not what you see in simulation is not working in reality so that is you know that is where the operator experience will come into picture or ingenious experience you will just go and say okay I know you release this gain by ten times and you know you will put some conservative value that will work yeah I mean people do it iteratively so that is not a great way of going about okay even here maybe you know if I had done some trial and error I could have made it settle to demonstrate I have just you know not tried to do any tuning I have just said that take two loops do decoupling and see what happens okay so if I blindly apply the method which I have in the literature it is not working when I go to non-linear simulation okay so maybe I can do something more you know add some more masala and then try to make it a little what do you say more cautious controller and then it might somehow work but it is very difficult to get this response whatever I do yeah for this one PID controllers I have used standard design methods given in the so this each one of them each one of them have been you know designed using some one of the standard PI controller tuning methods I took the transfer function then you know you look at pole placement or whatever there are methods of tuning PI controllers I have used them faithfully and then okay so so this is what I want to get this is where I want to get I want to get a near perfect control I want to get very good decoupling between the loops so you know so that is so even when I go to normally see when I go from linear you know there is a this one short you know step here and then it comes back but then here when you go to non-linear plant simulation there is more oscillation little more oscillation but still it is able to control it is not the controller is as good so now how do we go here starting from multi-loop PID controllers as I said I do not want to spend too much time in this multi-loop strategies decoupling I just want you to make aware you should be aware of such things exist and in case you do not have access to you know implementing model based controllers you should you can totally think of doing this so multiple processes are difficult to control that is the first message from these two lectures because of loop interactions okay so life becomes very very difficult when you move from your first course in control where you only worry about one loop to multiple loops okay it is not it is not so easy to design a controller things like RGA SVD yeah they will give you some help okay they provide some systematic way of pairing and you know handling reducing the interactions and so on but of course they have their own limitations it is not many of these tools are based on gain they do not take into consideration time constant and so on and then simple measures may not always work like decoupling may not always work so there is a motivation to go for you know something much better something much superior okay so I want to get a controller which gives me this near perfect behavior and that is what okay so these are the two references which have used for this part of lectures and now with this very brief introduction to multiple control mainly as you know motivation for what we want to do next and also to keep you aware of you know other tools what if you do not have what going to come in if you do at the steady state but then damage is done during dynamics anyway to some extent right you are not nullifying the line the damage during the dynamics you are only nullifying the damage long-term damage you are trying to nullify okay so that does help it is I am not saying it does not help so as I said if you if you do not have we cannot implement some very advanced control strategy this is this is this will improve over existing multiple PID controllers because decoupling together with multiple PID controllers is like a multivariable control okay it is a it is a intermediate between a full-fledged multivariable control and decoupled PIDs which do not talk to each other here when you put those cross gains there is a see there is a there is a attempt to communicate information between two loops right and somehow try to compensate for action of one loop on the other okay that is the basic idea that is what you should the take-off message is that when there are decoupler is implemented there is attempt to develop a dialogue between two loops okay which is which is not there when you have just two loops which do not talk to each other so introducing decoupling whether it is steady state or dynamic or whether it is even steady state forget about just using gains is still better than not doing it at all okay and as I said you do not require any special hardware for that if you go to plant now and you will get a standard hardware which can actually implement this steady state decoupling it is not big deal what is the advantage of decoupling state decoupling I am not discarding it totally computations are very simple you just multiply by a gain and add to the other value you know when we go to this multivariable controllers you will realize that they are very very computation intensive I am going to solve an optimization problem online okay and it is going to be very very computation intensive it is not going to be easy okay so implementing those multivariable controllers getting to what I showed you LQG or whatever it is not going to be easy task it is going to take me at least you know till mid April by the time we reach all the things that are involved but so it has its own place it can be implemented and particularly if you have a system which is very very fast dynamics okay for example you are looking at automobile control problems right it might be worth doing decoupling because you do not have time to compute online you know you need computations in fraction of a second if you need to decouple two loops just by putting some gains which you know create a dialogue between two loops nothing like it okay it is very very simple so it has its power it is simple at the same time it has its limitations you cannot do you know best decoupling that is possible okay so now I am going to start on this new topic and this will take me at least five more lectures and this is an integral part of modern control that is soft sensing is a I would say is a nice word to understand the that is why I have put it here soft sensing but actually technical term for this is state estimation okay so what is state estimation let us start looking at this and this is one of the main building blocks of my state feedback controller okay so I have a state space model I have a state space model somehow I have got the state space model I want to develop a controller based on the state space model but the states are not measurable okay the states are not measurable I want to estimate the states using whatever is measurable that is my that is my first task okay so well of course I will talk about why you want to do state estimation I will move about a fundamental property of a system called observability I will talk about when fundamentally you can estimate or you can reconstruct a state just given the measurements can you do that that is a fundamental problem and that that relates to some properties of the matrices that are involved will form a problem of estimating state using a batch of data and will find soon that it is not useful in online context if you collect a batch of data and estimate the states in online the batch size will keep growing and then you cannot manage it so you need what are called as recursive estimators so we will spend time on development of this recursive estimators will move on to optimal recursive estimators what is the best way of designing the recursive estimators so here what I will come to what are called as Kalman filters Kalman estimators is a celebrator algorithm developed in early 60s actually this is culmination of research over many many years started with Gauss so the batch estimation problem was formulated by Gauss and then you know the later developments which were more computers have we appeared obviously when the computers became available and then started being used that was in 60s early 60s so Kalman filtering is nothing but the original v2 estimation problem recast for doing online estimation so a elegant solution recursive solution I am not going to talk about excellent Kalman filtering I will show you some simulation examples about so what is the motivation okay so just now I was talking about this reactor and in this reactor we said that concentrations are not measurable are not measurable many times online even if they are measurable they could be very very costly okay they are very very costly and I do not have money to this by you know there are so many concentrations which are required in a plant I do not have money to buy a you know concentration sensor everywhere and then there are variables which are very difficult to you know measure directly for example if you have if you are controlling you know you are producing a polymer of certain quality you would want to control its molecular weight estimating molecular weight or measuring molecular weight online is not a trivial task okay you can measure viscosity you can measure density you can measure temperature but you cannot measure molecular weight online no that is difficult but nevertheless your property that you want to control is molecular weight okay so that will decide the property of your polymer which is coming out so what is desired is something different but what you can measure is something different now can I estimate what is desired that is a thing that is a main so sometimes you may have measurements but they are irregular offline and developed you know found once in a while okay so in such case I want a continuous measurement I want a measurement which is coming at every sampling instance so that my controller can take action okay now there are other problems which are modern problems which did not exist for 20 years back now you have wireless sensors right and a wireless sensor has packet losses and I am sure every day you experience packet losses and you try to use your mobile phone okay there are packet losses signal leakage instruction is bad and you do not hear what the other fellow is saying at the other end so packet losses in a wireless transmission is a inherent problem same thing is true when if you try to do now many people are going for wireless plants okay sounds good but there are dangers the data packet losses are there okay we have one such beta site in our lab we tested it wireless control for any well about 3-4 years back so all the temperature sensors all the walls everything were fitted with a device which would transmit and receive data and you have a wireless controller sitting somewhere I have a computer which is far off and then we are just communicating through wireless in the room and then trying to control but there are packet losses there are packet losses there is information loss and then there is a trouble because you know my all control theory works with regular interval sampling this is possible when you are dedicated lines data lines okay but moment you have wireless you have uncertainty clipping in so there is a gain because you know you are cutting on the wiring cost huge cost reduction because of wiring but uncertainty increases the price to pay now that is where this state estimation come into picture if you have irregular measurements and if you have a model then you can reconstruct missing measurements that is the idea of soft sensor that okay I do not have a measurement right now but I have a model I can reconstruct I can predict and estimate and I can use the estimated value for control other than the measured value so that is what I am going to do in soft sensor yep you need a wireless transmitter yes wireless transmitters probably can be then cheaply they are not so I mean if you can have a mobile phone fifty hundred rupees wireless transmission may not be that costly just look at the mouse you have wireless mouse or keyboards now which are wireless mouse with some 300 rupees so they are able to have a wireless transmitter receiver in the mouse okay which is must be less than 20 rupees otherwise you cannot afford to sell that thing for which was no no but wired also you know you have to maintain all those wires and then wires have all kinds of problems you know a real mice can come and eat the wires right so maintaining those wires is a big problem it is not so easy so I mean each one has its own pros and cons some some cases it is good to have see in some cases you have very hazardous environments okay so where wiring can be difficult so wireless transmission can help so no I do not know I do not think I do not know this to give a completely opinion whether wireless is faster or wireless faster so there are always parameters that are not directly estimable but you would like to measure them okay so if you have a model you can actually construct so what is the remedy what is the cost effective remedy you have a model use the model in a computer and estimate the missing measurements from use of model the main thing is some measurements are available so I should make use of those measurements and use the model use them together to construct this soft sensor okay how to merge the model and data that is what I am going to do next that is the soft sensing all about okay so what is the state feedback controller that we just go over it again the aim is to develop a state feedback controller so the way we design this way we do this we assume first when we design the controller the controller design we are going to do little later but at that time we are going to say somehow the states are going to be available they are measurable I design the controller okay so that is controller design step then I design a stable observer what is the stable observer I will come to that state estimator so only certain measurements are available can I reconstruct the states from these measurements and the model that is observer design so actually step one step two step three which order they should come as no meaning probably one should design the observer first so I am choosing to design I am choosing to do step two first and I do step one later okay so that one and two has no meaning what is what of course has to happen is the step three has to happen after step one and so I can after I design the observer and controller then only I can merge them and then you know see observer is mathematically when you try to put it it looks very very formidable but observer or estimation of unmeasured state is something which happens you know we also keep doing every day all the time for example doctor you know he is trying to estimate what is the you know what is the faulty condition inside your body he will ask you to do some measurements right go and take some blood sample and then he will take blood pressure and he will put tethoscope and ask you to breathe so these are the measurements which are coming and from this he has to back calculate the state of the body okay now it is not an easy task because same measurements same faulty measurements can be obtained for different diseases and so you need more and more measurements of course to separate the thing but state estimation is basically this you have some measurements and is what you want to know is whether it is malaria or typhoid or whether it is you know bronchitis and then you take some measurements and then from that you estimate the now what guarantees that you can design an estimator separately and controller separately and then merge the two and work there is something called separation principle we will look at that later so which guarantees that at least in the nominal case in the perfect model case you can design controller separately observer separately merge them together still the closed loop will be stable so so let us start with this as I said of these two components one of them how to do first I choose to do observer first then I will move to controller design okay so let us begin with this model this model we have okay and as I said right now I am not worried about how this model has come from it could have come from linearization of mechanistic model it could have come from data completely and toolbox some time series modeling toolbox and state realization so so these are the three steps which are this repeat of the site and then I want to do the state feedback controller design which is of this form this is where I want to reach okay finally so the major question is like this I am going to separate measurements coming from a plant into primary measurements and secondary measurements okay primary measurements are one which can be done at a fast rate okay a secondary measurement would be one which is done intermittent see for example let us take the doctor and patient analogy if you admit a patient in say I see you can keep track of pulse rate continuously BP you can you know have some monitoring system that measures BP but if you want to measure blood glucose you know you may not have an online blood glucose measurement I mean now people are moving towards that but it is right now not so cost effective that we have online blood glucose measurement so you will take samples in between so the samples which you take for blood glucose will be secondary measurements but pulse rate or BP which you are measuring suppose by putting some device continuously you will get online measurement of BP okay for your plant plant is now a patient who is sleeping out there yeah so we will have to worry about can we increase the samples can we so there are many many issues ideally you should but even if you are not you can develop models which are which can take into account variable time delays see we are not getting into all those multirate systems variable time delays in this first course I mean I probably have to teach one more course if I want to start talking about those issues in practice see what actually I am doing here is 101 of advanced control when you actually go to plant it is much more complex you will have to build upon what I am teaching okay so many of these things are too simplistic easy to understand mathematics but then for example you may not have a situation where the time gap between two samples is constant they might be variable then you can develop discrete time models with time varying it is possible to do that okay I am not talking about it because you know those are too much of details you can once you know this you can you know graduate to something it is more complex okay so what we know is that let us take a distillation column chemical engineer or let us take this reactor which we are talking about we know that the temperature and concentrations are related okay so if I just measure concentration can I exploit the fact that temperature and concentration are related through a model and reconstruct my concentration measurement that is what I want to do okay so basic idea here is to merge online data with model and create an estimate of unmeasured variables quality variables and well there are different ways of doing this okay just an overview you can do it using there is a way of handling this through you know neural networks and algebraic maps like what you are looking at PCA and PLS and those kind of things the other way is of course using dynamic models what you can do through dynamic models is much more rich and complex these are simplistic solutions like correlations you know you develop a correlation between temperature and concentration by some doing some offline experiments and then online you just put that correlation and say that if temperature is this concentration is this so these are those simplistic approaches which are clubbed into one side okay but those things have limitations cannot do it beyond well we are going to look at two classes of dynamic model based soft sensing one is using stochastic approaches okay and the other one is using deterministic approaches the stochastic approaches one is so-called celebrated Kalman filter which was developed by Kalman I think 62 or 63 to a seminal work and at the same time almost at the same time this work by Luhlenberger which appeared in the literature completely deterministic approach completely different way of looking at the problem okay to people have looked at the same problem with two different tools okay and by now these two are major research areas in control okay stochastic observers and deterministic observers people of course are not still looking at linear system they are looking at nonlinear systems so these actually here this represents a branch of modern control and this represents another branch of model I am going to talk about the first two developments that occurred right in the beginning okay so as I said we are just going to look at 101 okay so going back 50 years so let us go back to our old CSTR system we will have there are two measurements there is only one measurement there are two states concentration and temperature I only want to measure temperature I cannot afford to measure concentration okay there are two manipulated variables but manipulated values are known to me I am giving them from my computer okay so my controller is whether my controller is advanced controller whether my controller is PID controller I know manipulate input values okay so these two feet flow rate and coolant flow rate are known to me okay there are two disturbances inlet concentration fluctuation this one is an or feed concentration that is a unmeasured disturbance I cannot afford to measure this I cannot afford to measure the product concentration forget about measuring the inlet concentration so concentrations I am not able to measure well the temperature of the coolant which is coming in that is also fluctuating that is also a disturbance but I can afford to measure it okay temperature measurement is cheap I can measure inlet coolant temperature I can put a tank in my overhead reservoir and measure the temperature not an issue okay so my question is if I have a perfect model okay can I reconstruct or can I estimate concentration from temperature alone so these are the parameters and then what I am going to do is of course I am going to do linearization of this model and then you know how to get this model okay I at some operating point I got this the operating point is given in the previous slide and then you get this linear perturbation model where the two states are perturbation in the concentration perturbation in the temperature two inputs are perturbation in the flows and so on and then I will discretize this model I will get this discrete state space model okay now I have this discrete state space model with me let us assume that it is very good model it matches very well with the plant behavior in the small region in which I am operating there is not too much of plant model mismatch the model is good okay and my why here is only temperature measurement see it is 0 1 only temperature is being measured okay and now here I want to do a state estimator that will reconstruct concentration from measurements of temperature alone let us move on to the problem which we are familiar with as I promised I will take you to the lab and show you this system in this particular system I have four tanks again you know level measurement is costly each level measurement device cost now well in when I am obligated this system in 2005 it was 30,000 so I am sure it is now 60,000 you know so good quality I think those are Yokohama or some very good quality level transmitters each one is 60,000 I cannot afford to buy two transmitters four transmitters but I want to measure I want to have an estimate of I am measuring level here I am measuring level here and I want to have an estimates of level in tank three and tank four just using the model this is the cost effective solution running a model in my computer does not take too much no I just have to buy one laptop which is or some control computer which is anyway going to be there so I will use that computer to reconstruct okay. So given this model I have this model now okay well of course there are troubles because the measurements can have error measurements can have error here okay measurements are not perfect and then we have talked a lot about measurement errors sometime back when we talked about system identification okay and colored noise and colored disturbances and all kinds of things so even if you take a very simplified view that this V here is a white noise even then it is there right so there is some error in the measurement you never get perfect measurements this D here is unmeasured disturbance okay there are concentration fluctuations in the reactor at the inlet I am not measuring them but they are affecting the dynamics and then I need to estimate the state so estimating the state in presence of these two troublemakers one is the measurement noise and other one is inputs unmeasured inputs that are going into the state dynamics is not an easy task going to be quite tough so what is the problem the problem is I have a model now see earlier the model the problem that we are looking at what are the problem that we are looking at earlier the problem that we are looking at earlier was given input and output data okay we wanted to estimate Phi gamma Psi and C matrices that was a modeling problem identification problem okay now I am just turning it around I am saying that well I know Phi I know gamma okay I probably know Psi I know C okay and I know why and you why and you are known input is known output is known okay can I reconstruct X related problem okay in one case what was known and one case what is known is just turning around now I am saying I have the model okay I have data for input and output I want to reconstruct can I estimate the state this is the abstract way of saying can I develop a soft sensor for the system okay as I said grand old problem being studied from the days of Gauss you know even before that if Gauss came up with a solution people were looking at this problem much before and the classic example or classic system which human race was bothered about was planetary positions you know exact knowledge of planetary positions by the time Gauss worked on this problem you of course knew the differential equation that governs the system okay and you have measurements coming from telescope can you estimate the state of each planet okay that is so let us take a situation let us go by let us go very very slowly I am going to take a situation initially where there are no disturbances okay I am not going to worry about measurement noise too much in the beginning I will systematically go towards that point how to deal with measurement noise so let us take the most ideal case most ideal cases there are no disturbances zero disturbances there are no measurement errors okay now I have a perfect model okay everything is perfect model is perfect no disturbances no measurement errors now the first question that I ask is given this model given this model and then measurements under the scenario that there is perfect model okay no measurement noise no state disturbances can I reconstruct x0 can I reconstruct x0 from measurements of y okay so let us start answering this question okay now let us call this initial C to use this model what is known here in this model ? is known now we have done modeling u is known u is known now suppose I want to do a simple online estimator a simplest online estimator is use this model online you will say use this model online okay you know you know what is u okay keep giving u to this model this model will predict what is x that is a soft sensor isn't it a very very and you would be wrong it is fine it will give you a very crude soft sensor yes if you just use this model in my computer I just program this model in my computer now the trouble is when I start this model what should be x0 what is the initial state see I do not know what is the initial state of the plant if I give a wrong initial state this model will go somewhere the plant will go somewhere okay I do not know I am not measuring x0 I am only measuring why okay so to kick off this model minimum information that I need is x0 if I have x0 okay and if I know input sequence u I can just use model and then I will get x0 is known u0 is known ? and ? is known I will get x1 okay then if I know x1 and u1 I can get x2 and I have a soft sensor isn't it this is fine I mean in ideal world computer world you will get this okay so I can get this x1 if I happen to know x0 then I can compute x1 then I can compute x2 okay but what you will realize is that x2 actually depends on x0 okay it depends upon u1 and u0 u0 and u1 okay what about x3 you will see that x3 also depends upon it is a dynamic system dynamic system as a memory it also admits new inputs you can modify its behavior you can give inputs u1 u2 they will have influence on what happens in future but the past also will have its effect on the future okay very very important. So now the question is how do I find out x0 okay but if you guess then no in this case there is no measurement error there is so I do not have to guess I want to come up with an exact value and which is possible okay so that is what I am going to say now that see I can write this first equation c0 is equal to why cx0 is equal to right then my second equation will be cx1 I am just using those previous equations okay now see and this equation I am going to rearrange because what is not known to me x0 is not known to me okay now y1 is known to me c gamma u0 is known to me okay so that I have taken on the right hand side okay I can just go on doing this okay so I have collected all the terms on x0 on the left hand side all the known quantities y is known u is known all the y and u terms that appear in my equations I am them taking them on the right hand side okay so now okay so what happens here is I think it is 11 let us do it in the next class let us stop here so we have these equations we have these equations I can stack them together because see what is the coefficient here c here it is c5 and it will be c5 square c5 cube and finally it will be c5 n-1 okay so I can stack all the equations together what is not c is known phi is known only x0 is not on the left hand side okay and everything on the right hand side is known okay so it is like solving n equations in unknowns you know when does the solution exist okay we will find a fundamental property of the model here called observability which comes down to rank of this particular matrix this particular matrix will appear and you can show that if this matrix has rank n then alone you can reconstruct state from the measurements if the rank is not equal to n then you cannot get all the states from the measurements you may have to add more measurements to make system observable so this is the fundamental property of the system called observability we will look at it again starting from the next class so you can design an observer for a system if this fundamental property is satisfied by the system equations otherwise you cannot okay.