 So we have been looking at linear perturbation models which are developed from mechanistic models by linearization. So you have a good mechanistic model you want to use it for control we have chosen an operating point where we want to control the system linearized the differential equation discretize them we may not know the first principle model accurately in that case I said well you probably know at least the structure of the linearized matrices and then you can identify elements some kind of an optimization problem and the structure is known a priori for simple systems you can come up with this structure by arguing from your you know engineering knowledge about the process. So the system has some three or four states and two inputs two with outputs are three inputs three outputs three measurements simple systems can argue from physics a very complex system it becomes difficult to with lot of feedback loops it becomes very difficult to come up with a structure which is anyway the other problem we said is that we are just looking at deterministic effects what about stochastic effect what about effects which are disturbances which are unmeasured which are not exactly quantifiable through a first principle model how do you model them and I said the possible remedy is a black box model so in conclusion before I move on to next part I will just say that reliable mechanistic model is available then one can always linearize develop a perturbation model and use it for further control the synthesis if you do not know all the parameters if you just know the structure you can develop perturbation model from data now I want to move to this new topic the new topic is estimation of models directly from data without knowing any structure okay. So I am going to call it completely black box model and analogy I gave is to a correlation okay so it correlations we are actually not using any physics we are just saying that this is a dependent variable this is an independent variable they are correlated through some polynomial likewise I am going to say measurements are dependent variables inputs are independent variables and they are correlated through a differential equation or a difference equation what is the difference equation is what I want to find out okay. Before I move on to that I need to do lot of preparation one of them is to say a few things about stability okay so I am just going to do a quick review of stability of linear dynamic systems I am going to revisit this again after some time but here this concept one particular concept I need when I move to these time series models and that is why I need to quickly review some concepts that now all of you are done first course in control right what is the condition for stability if you are given a transfer function of the denominator polynomial is what is the behavior of the solutions and then what is so powerful about transfer function idea is that just look at the roots and you can say how the things are going to behave asymptotically we just look at in the roots and say that if they have negative real part you know you will get asymptotically behavior if you have one of the roots which is on the right half plane in the s plane you have trouble the solutions will go to infinity and then there are marginally stable systems on the imaginary axis this all of you know about this I just want to quickly review this connected with what we have done just now state space models and then I also want to relate this to discrete time models because some stability ideas we need as we move on to and as I said after I have done with modeling I am going to revisit the concept of stability again because it is very very it is a central concept to control okay so this is what I am going to do the very quick review of stability ideas we will consider a single input single output system see so is single input and single output one measurement one input simple system okay we know that the transfer function for a single input single output system will be given by some numerator polynomial see here you know I have this numerator polynomial by denominator polynomial and I want to relate this to this state space model we developed a linearized state space model if you remember right so X here are the perturbations in the states a is the coupling matrix b is the input coupling matrix a is the coupling matrix with the current states I bring in the information about the past and what is the relationship between this state space model and transfer function model I have just given here on the right hand side the state space model is related to the transfer function through c into si-a inverse b okay I have just rewritten this as c into adjoint of si-a cofactor transpose right into b this is the numerator this will be a single polynomial why it is a single polynomial you have one output one input okay what will be the denominator polynomial the denominator polynomial will be determinant of si-a okay so if I transfer function relating y and u okay roots of denominator polynomial is nothing but eigenvalues of do you see that what is determinant of si-a equal to 0 roots of the characteristic polynomial which is same as eigenvalues of okay which is same as eigenvalues of matrix a so the roots of ds denominator polynomial which is same as eigenvalues of matrix a okay they determine how the solution yt behaves asymptotically let us quickly review what we know what is the first case one case is that all of you said this that if the roots have negative real part the roots can be complex eigenvalues can be complex roots can be complex okay so we have to work in complex s plane and we have to locate where the roots are lying the roots are real okay you may have and negative you will have exponential decays if you have roots which are negative but complex negative real part but complex you will have oscillatory decays all of this you have studied in your first course in control okay so first thing is of course if the roots are in strictly left of plane or LHP of then the transient of the system are asymptotically stable well what if some roots are on the imaginary axis called it a marginally stable system system may have transient which never die but which never grow okay so you have bounded transients okay so such system as marginally stable systems and this of course you know that if anyone of the roots is on the right of plane you have trouble okay please keep in mind this is analysis of a linear perturbation model linear perturbation model is an approximation in neighborhood of some operating point okay when I am showing here that the solutions go to infinity does not mean instability actually of a linear system you know tells you that the solution will go to infinity in reality this is not going to happen all it means is that the system has a tendency not to stay at that point that is how you should interpret take this going to infinity with a pinch of salt so unstable means you know it is like the pendulum a pendulum you know has a stable state if it is you know pendulum is moving like this there is a stable state here but talk about inverted pendulum okay inverted pendulum this is an unstable state you try to put a bit from this it will try to go to the next stable state okay it is not the solution truly does not go to infinity what it means is that locally the solution has tendency to move away from that point okay if you are at that point you will stay at that point but which is very difficult okay what is analog of this when you come to discrete time systems okay now some of you probably have done this course on discrete time systems for them just quick review now just consider a CISO discrete time linear perturbation model okay we have done this already right we have seen that this state space model which is actually discretized from the continuous time model okay is equivalent to this transfer function here okay can you say something by analogy now what would determine the dynamic behavior determinant of determinant okay determinant of zi-5 which is the denominator polynomial okay roots of this denominator polynomial will determine how asymptotic behavior of this dynamic system is okay so this is right now purely by analogy I will try to give you logic why this is happening okay so just if I draw analogy then I should just look at the roots of the denominator polynomial okay let us try to see why dynamics is governed by Eigen values of so what does it what does govern the Eigen values of the system sorry what governs the stability of okay so how do Eigen values of phi influence the dynamic behavior okay so let us look at a scenario I am looking at a scenario where x0 initial state is not equal to 0 but the inputs are 0 okay let us look at a simple very simple scenario all the inputs from time 0 to infinity are 0 okay initial state is not equal to 0 okay it is saying I have a model for a pendulum okay 0 means this stable state okay perturbed states means you are here okay so I am now looking at a system which is perturbed okay and then how is it going to progress in time okay is it going to go and die or the oscillations are going to grow okay that is what I am interested in going okay so or let us go back to our quadruple tank okay you have a scenario that there is some the system was perfectly at steady state okay the system was perfectly at steady state and then somehow for some reason no the inputs are constant for some reason the levels are perturbed from the initial steady state okay I am holding the inputs constant somehow the levels have become perturbed from the initial steady state question is okay if you are perturbed from the initial steady state will you return to the steady state okay or will you go away from the steady state okay so that is governed by Eigen values of phi why is it governed by Eigen values of phi now see look at model here I am starting with time 0 x0 is the initial state which is non-zero what will be at time 1 sampling time 1 phi times x0 right what will be at sampling time 2 phi times x1 which is actually is phi square times x0 okay likewise if you just write these equations you can very easily show that at any time instant k okay the state at time instant k is phi to the power k x0 solution of linear difference equation okay I am just recursively solving substituting one after another I will get phi to the power is everyone with me on this phi to the power k okay so now we have to understand how it is phi to power k behavior okay now I am looking at the look at this here let us look at a special case right now well general case of course the slight modification the same idea works let us take a special case where phi is diagonalizable what do you mean by phi is diagonalizable Eigen vectors are linearly independent okay Eigen vectors are linearly independent okay so I can write my phi as psi lambda psi inverse this we have done earlier right and then phi square becomes psi lambda square psi inverse phi to the power k becomes psi lambda to the power k psi inverse right. So these are linear difference equations well if you have done stability analysis in course on numerical methods now we have done this in numerical methods we had a similar equation except in time we had iteration index right and we were analyzing error of iterative systems we had exactly same equation okay so what is lambda to the power k lambda to the power k lambda is a diagonal matrix okay so lambda to the power k is simply lambda 1 to power k lambda 2 to power k lambda 3 to power k so what is going to really see psi is not going to change once you decide the Eigen directions psi and psi inverse are constant once you choose Eigen directions or Eigen vectors these two matrices psi and psi inverse they remain constant so as k as time progresses what changes lambda to the power k right lambda to the power k changes as time progresses okay. So now first case is that you know all the roots of the denominator polynomial okay are strictly inside unit circle okay are strictly inside the unit circle in the complex plane what happens if lambda is strictly less than 1 if is less than 1 lambda to power k as k goes to infinity see if my lambda is mod lambda is strictly less than 1 then what I know is lambda square lambda cube progressively this will go to 0 as okay so lambda to power k will tend to 0 as k goes to infinity okay lambda to power k will go to now what will happen if all the Eigen values are inside the unit circle what is the unit circle actually I am looking at z plane complex z plane and I am looking at this unit circle okay so this is plus 1 this is minus 1 this is plus 1 this is minus 1 okay this is the unit circle if lambda is lying somewhere here or here or here or here or here or here wherever if it is inside the unit circle lambda is a number lying inside the unit circle lambda to power k is always going to diminish as k increases okay is always going to diminish as k increases okay. So what happens lambda to power k is going to go to 0 as k goes to infinity so which means matrix lambda to power k is going to go to 0 null matrix is going to go to null matrix as time goes to infinity well which means phi to the power k is go to 10 to null matrix as time goes to infinity okay so if my system is asymptotically stable that is if consider a full time I am just put up from the initial point my inputs are constant okay the system is asymptotically stable if all Eigen values of the discrete time model are inside the unit circle then you know the levels are going to decay and settle at original steady state okay they are going to settle at the original steady state this will happen provided all the Eigen values of matrix phi are inside unit circle in the complex z plane okay so this is very very critical such a system we will call as asymptotically stable system so what is an equivalent what is an equivalent thing what is an equivalent stability condition for a z transfer function the roots of the denominator polynomial if it is a transfer function it should be inside unit circle in z plane or for a discrete time state space model Eigen values of phi should be in unit circle two things are one and the same because transfer function is only a representation in z domain state space model is representation in time domain okay so what Eigen values convey you there in time domain same thing is convey to you by the roots of dz okay in the z domain okay yeah thanks for this correction so phi to phi k which is phi to power k times x0 okay phi to power k times x0 this will tend to okay this is yeah phi to the power k x0 will tend to 0 vector okay and the perturbations will die so the stability is decided by roots of the characteristic equation or roots of the denominator polynomial okay which is same as Eigen values of matrix phi okay we have to look at the relative location see the same power which you have in continuous time what is the power of analysis in the continuous time just look at the Eigen values you can say how it is going to be here same thing is here just look at the Eigen values of phi or look at the Eigen value of the denominator polynomial it will tell you how the dynamic system is going to behave asymptotically okay as time goes to infinity how will the system behave okay now what if you know you have a scenario where Eigen value is located here or it is located here somewhere outside if it is 1.0001 okay if it is 1.001 suppose lambda is equal to 1.0001 then lambda to the power k will go to infinity as k goes to infinity okay even if the value is slightly greater than 1 okay that to the power k will go to infinity so the solution will diverge okay the solution will diverge even if one Eigen value is outside unit circle what about if the Eigen value is on the unit circle it will neither diverge nor converge it will be bounded the system is marginally stable okay. So equivalent to the continuous time case now we have result which talks about a discrete time case stability okay roots of the denominator polynomial if you have a transfer function look at Eigen values of phi if you have a state space model the relative location inside unit circle or outside unit circle or on the unit circle will tell you how is the dynamic system is behaving okay okay let me just quickly do one more thing what is the relationship between a pole in the continuous time what is the pole roots of the denominator polynomial in well we have created different terminology we call it poles okay but they are nothing but roots of the denominator polynomial okay which are Eigen values of phi matrix or A matrix or whatever the case now we are looking at continuous time pole. So suppose you have this A matrix which is coming from a continuous time system and its Eigen values are lambda i i equal to 1 to n okay and you have this matrix phi let us call its Eigen values as mu i i goes from 1 to n okay what is the relationship between Eigen values of A and Eigen values of phi okay first of all you should understand one thing if your original system is stable in continuous time it will be stable in discrete time stability asymptotic behavior of solutions is a fundamental property that is not going to change because you change you know from differential equation or difference equation okay if a system is stable it is stable if it is unstable it is unstable okay that is not going to be changing because of change in the you know mathematical description of the system continuous time discrete time these are mathematical convenient descriptions under different context in the computer control systems we use discrete time representation that is why it is convenient to work with okay. So the relationship between this is mu i is exponential lambda i t where t is sampling time sampling interval okay now how does this how does this relate to the stability aspect see my lambda i let us say is equal to alpha i plus j beta i say in general Eigen value lambda i can be a complex okay it can be complex so mu i is equal to e to the power alpha i t plus j beta i t everyone with me on this okay so which is equal to e alpha i t into cos is that okay okay so what can you say about this quantity modulus of this quantity is always bounded between plus or minus 1 sin and cos okay it is never going to exceed plus or minus 1 okay so how does mu behave will be decided by e to the power alpha i t okay do you agree with this okay if alpha i is strictly less than 0 okay alpha is strictly less than 0 then e to the power alpha i t for any positive t of course any positive sampling time is never going to be negative okay you cannot sample with negative sampling time you will have to have sampling time positive so if alpha i t is negative e to the power alpha i t will be strictly less than 1 or mod of actually e to the power alpha i will be positive number I do not put mod will be strictly less than 1 okay and so what happens here is you know e to the power alpha i t into cos beta i t plus j sin beta i t mod of this is also strictly less than 1 do you agree okay so a stable eigen value in continuous time maps to a stable eigen value in discrete time very very important okay fundamental characteristics of stability does not change because you go from continuous time representation. Pardon me always well conversion there is some problem because discrete time systems are some values for which there is no equivalent continuous time system okay so see what if what if alpha i is equal to minus 0.5 you cannot find an equivalent continuous time representation on particularly see the trouble is here you take this unit circle okay and what you can show see this is my z plane okay and let us say this is my s plane so what I am saying is that this left of plane it actually maps inside the unit circle the left of plane entire left of plane maps inside the unit circle okay but there is one problem problem in the sense that this line this part 0 to minus 1 okay there is a problem you cannot find a continuous time analog which will map to a pole on 0 to minus 1 e to the power of t is never going to be minus right so rest of the plane will map everywhere except that except this segment okay so if you have a discrete time system which has a pole here you cannot find a continuous time analog but okay so otherwise it maps inside here this continuous time stable part maps inside here where does the imaginary axis map see this is the imaginary axis this is the real axis circle the imaginary axis maps to the circle boundary and where does the right of plane map outside the unit circle okay if alpha i is greater than 0 then e to the power alpha i t is greater than 1 okay so this is just a brief review of stability of dynamical system will visit stability again yeah you cannot find an equivalent continuous time system which is yeah on the right hand on 0 to 1 there is no problem 0 to minus 1 there is a problem but complex time constant does not have meaning in the okay you mean to say the complex ij will map into that line single will not pair will in continuous time you cannot have a system which has a single time constant which is complex if complex appears it will appear in pair so 2 can map but not 1 okay a pair can map but single negative time constant mapping into a single is not possible okay that is the problem yeah no that is that cannot be said the choice of different continuous time systems with it depends upon actually very very that is a good question with see let us take a simple system which is you know tau s plus 1 okay let us take a simple system transfer function so gs is equal to tau s plus 1 so this will map into a discrete time system okay where you know the discrete time pole is e to the power minus t by tau okay the discrete time pole of if you convert this to discrete time systems you will get the pole of the discrete time system to be this now this ratio t by tau okay can come from see this ratio can come from different systems okay see suppose this is 1 second and this is 10 seconds the ratio will be 0.1 if this is 1 minute and this is 10 minutes ratio will be 0.1 okay so multiple continuous time systems will map into same discrete time systems the map is not unique okay so when you go from it is many to 1 map so when you go from discrete time to continuous time there can be infinite possibilities if you have to fix something if you fix say sampling time then you get a unique okay so the other way is very difficult to say when you go from discrete time to continuous time which is giving you this particular system okay we will have this kind of a thing in the exercises so that is why I am not doing it here on the board so you will do it on the okay so now we are ready to move into the next thing is everyone with me on this stability aspect okay inside unit circle outside unit circle I will be referring to this inside unit circle business throughout okay because and you should not be confused so now let us move on to progressively the concepts are going to be fairly complex well we will you keep asking doubts wherever you have problems just stop me okay because till now whatever we did was okay okay there are certain things which I am going to talk about you know are going to be fairly complex I am going to talk about something called stochastic processes and the maths will not be fairly complex conceptually it is fairly difficult to understand what we are going to do and I do not expect that only this Python lectures it is only sensitizing you we are just touching tip of the iceberg and eventually if you keep working in this area someday you will understand what all these things are I am trying to going to make my attempt make it as simple as possible okay now we are getting into data driven models okay why data driven models because well I do not know anything about the system I have gone to some industry I am given some plan I can play with it I can tweak I can change some input I can record outputs okay just think of developing a control system for a car okay you have been asked to develop a control system for a car and you do not have mechanistic model for the car okay it is not quite for the I mean you may have some mechanistic model for the car given in the literature but that model and your car are different right you have say Maruti car and then tomorrow you may have to work with Tata Indica and so each one will have a different model and developing a model for Suzuki will let us say take one year then another year it will go and developing it for Tata Indica so it is not obvious that if you have this model it will work there parameters are different how it behaves is different links are different and so on so you want to develop a quick model not one year you want to do it in you know one hour and do it from data you might say well what is there you know fitting correlations you measure input measure output why are you worried so much well the first problem is that I want a model of the car in dynamics okay while the car is moving now what is the complication what are the inputs what are the manipulate variables in the car accelerator and brake okay and let us look at only one one controlled output speed let us not worry about direction let us look at speed and you know motion in one on one line it is going to deviate okay now when a car runs on a track okay it is going to be subjected to drag because of the wind you are not major wind you cannot afford to put wind measurement in your car that is too much okay so but the winds are going to be you know they are going to be gusts they are going to be steady state condition steady air stagnant air condition then with helping you sometimes you sometimes it will be in cross direction okay when you do an experiment how the wind will behave no idea it is something which is outside your control it is a disturbance but when you collect data let us say you put your pressure on the accelerator and you record data on the onboard computer okay the speed that you get is going to be a complex function of your accelerator and wind and there is one more disturbance the track well in our conditions that is a big disturbance track can be suddenly very good then suddenly you know the pothole and so there are several problems which are I am going to call them as unknown disturbances so the data which I get is always corrupted with unknown disturbances okay whatever I do whatever experiments I do there are always some unknown disturbances okay which will influence how the system dynamics behaves and problem in developing models completely from data black box models we do not have any structure about coming from physics okay is in such a situation is this unmeasured disturbances if the input that I give to the system okay if that is the only thing which influences the system okay great you can model it very well okay there are so many other influences is difficult to model okay like you know if I teach you and then I expect should know something about dynamical systems and then for that I would expect study but then you go to hostel which is a big unmeasured disturbance for me and you know there are all kinds of attractions there and is difficult to model a system which is which has lot of unmeasured disturbances the second problem is when you are developing these models these models are approximate okay we are developing a model for a unknown dynamical system which is subjected to unmeasured disturbances okay we are going to make some assumptions you know this is like a linear perturbation model you know that really car is not a linear perturbation model you know car dynamics is very very complex linear perturbation model is an approximation for your convenience because you can do mathematics very well okay and if you want to control the speed in some small range these models will be very good okay so that is the assumption. So models are approximate okay then there are unmeasured disturbances as if that was not enough the measurements are always corrupted with error you will never get perfect measure okay you have a transmitter you know it is you convert signal from you know one to other and finally you convert into some electrical signal which is connected to the computer there are 100 different places where it can pick up some noise okay the data which you get I will show you some actual practical data temperature measurement in a beaker where the temperature of the water is perfectly constant I put thermocouple I get data which is fluctuating temperature is not fluctuating data is fluctuating because there are errors in the measurement okay so there are two problems there are two problems now we are going to develop a computer oriented model I have freedom to do experiment with the system so this is my experiment I am going to inject in excitation okay inside my computer I am going to get a sequence of numbers which is speed measurement okay this is my you know accelerator the way I have played with the accelerator and well there are always unmeasured disturbances wind is not going to be in my control okay or the track conditions are not in my control so there are unmeasured disturbances unknown sources we may not know even the source every time okay and then the measurements are corrupted with noise okay so the trouble is that if you want to get a model that relates this input with the output then whether you like it or not you have to model these disturbances it is a very strange thing you have a disturbance which is not measured which is not known to you and still model okay looks formidable or in fact impossible how can somebody model something which is not measurable okay and the source is not known how do I model that because there will be an approximation error which is cropping up because of linearization okay so that also when you are actually developing models of this form that also can be viewed as contributing to the unknown disturbance it is a kind of a disturbance which is coming from approximation errors okay so I would say there are three kinds of errors approximation errors okay measurement errors and actual physical inputs which are unknown okay so the data which you get as all the three I mean data will approximation errors approximation errors start cropping when you start modeling okay data will have only measurement errors and okay approximation error is something that crops up when you start modeling so data will have unknown disturbances okay so let us not get into what are the types let us look at a practical problem okay so that now I am going to look at a simpler system I do not want to look at the quadruple tag there are two inputs two outputs now I just want to look at a simple system two tanks one place above each other okay and there is there are two control walls control wall one and control wall two I will show you a schematic diagram of this okay this control wall one is used for manipulation it you pump in fluid in tank two it flows by gravity from tank two this tank one to tank two and then tank two to the sump here simple process you can probably go to our undergraduate lab this is undergraduate lab experiment in chemical engineering okay so what we do is this second wall we use it to introduce a disturbance if we want to okay right now I am not going to introduce any disturbance okay when I operate this system this pump here is subjected to fluctuations in the power there is enough disturbance already in the system I am not worried right now about introducing another disturbance here so I am going to look at a simplest possible case this pump this second pump is this pump is off okay this pump is off only I am pumping liquid through this control wall one okay what I am going to measure if this LT here is level transmitter I am going to measure level okay I do not have a mechanistic model for the system I am just going to develop a model by doing perturbation studies I am going to perturb the control wall position I am going to record the level okay I am going to record the level I want a model that relates the perturbations in wall two yeah not pulse I am giving sequence of pulses or sequence of steps actually they are not if you look at it they are not really pulses they are positive and negative steps now why am I doing this why positive and negative steps when I am linearizing a non-linear model okay if you want to do an experiment the behavior on the positive step and the behavior on the negative step is going to be different if the behavior on the negative step and positive step is going to be different okay then I need an average behavior on both the sides okay my operating point is 12 milliamps of series control wall takes between 4 to 20 milliamps as the input 12 milliamps are fixed 50% opening 12 milliamps is 50% opening okay I am introducing a fluctuation okay which goes between 10 milliamps to 14 milliamps okay about 2 out of 16 how many percent 1 by 8 15% plus or minus 15% okay I am introducing a fluctuation now what is happening because of that the level which was initially steady the level that was initially steady okay it was steady at this particular 5.6 milliamps is some level corresponding to some level inside that okay it started fluctuating what is this fluctuation the other fluctuations recorded okay this is the experiment I was allowed to do now using this input and output data single input single output let us understand the simplest thing okay we will move to the complex things later single input single output system I want to use this data and come up with a model okay if I change my operating condition I well your question is important it is not that I do not want to ignore your question but the way I introduce positive and negative perturbations here or fluctuations you know I have chosen the frequency of fluctuations very carefully it is chosen in such a way that the plant is excited in the range in which it has a dominant frequency okay or close to the corner frequency okay I do not want to excited in very high frequency range where the system is never going to operate or very very low frequency which is of importance but which will get covered if I take a band okay so how do you choose frequency of this excitation is a is an important issue and but we will postpone it is I will briefly touch up on it at some point later but how do you do this is you know you need to go through some yeah average value of not 0 will be close to 12 yeah so if I do perturbation variable what I have done here is next I have this is my absolute data absolute values okay I am subtracting the steady state here I am subtracting this steady state here and then I get perturbation data the perturbation the input if you take a mean of the input it might be close to 0 no it did not be close to 0 yeah but if you keep doing this then you will get a behavior which is fluctuating around some mean original mean value provided it will go to a new point provided the system is unstable or marginally stable okay it will not go to a new point if the system is stable okay this level tank is a stable system okay if you increase the level inside the tank by gravity the flow out increases you know so the level starts so it is a it is a self-governing or self it is a open loop stable system any other question yeah you want to directly ask me I am right now in grade 1 you are asking me grade 10 question okay not even grade 10 actually how do I model unstable point my student is doing research on that okay so it is a so we are right now in first grade okay no this is this is not this this is a known input perturbation yeah but then we assume that their fundamental so how do I capture fundamental characteristics of the you have a very good point very intelligent question every time the disturbances will be different okay I am going to talk about it just wait okay I think my animation I forgot to put okay let us just do not look at this down part look at the first thing so what I have done now I have collected the experimental data okay I have set of inputs why and measurements and you which are known to me which I have given now you here is what is going outside my computer control computer why is the measurement that is coming to my computer okay it is a computer oriented model sequence of numbers that has been collected as measurements and piecewise constant inputs that have been sent to the system okay I want to develop a model that relates the current output okay I want to develop a model that relates current output with past y and past u why past y and why past u you have seen how dynamic systems behave okay we have seen earlier how difference equations behave in dynamical systems current level will be function of past level and one level in the past past inputs we have seen this right that is the logic I want to fit a difference equation I want to fit a difference equation here I have put it in little abstract form okay now I am going to look at this model okay I am going to call this model as output error model OE model okay why it is called OE model because okay everything that is unknown is blame to this error in the output y is the measured output okay y is the measured output okay what is x here how do you interpret x, x is the effect that is present in y which is coming from u alone inputs alone is that clear x here x here is a variable okay x is a variable for which actually quantifies effect of u alone on y okay whatever is the rest okay I am whatever is the rest I am calling it as v here okay this v here is the rest of the signal so I am saying that this the output signal consist of two sub components what is first component effect of u alone okay how is the effect of u coming through it is coming through a transfer function gq okay effect of inputs on the output is coming through a transfer function do I know this transfer function I do not know this transfer function what is the order I have to guess it is a black box model I do not know whether it is first order or second order or third order or fourth order I am going to try fitting each one of them okay and see which fits best okay so the way I am going to go about is by trial and error I have data okay I will fit a first order model or a second order model or a third order model okay and then see which one of them gives me good fit okay and then decide yeah then decide okay yeah that is a good way of saying it x is the prediction but not right now wait for it we will call it prediction little later right now x is the component which is there is a subtle difference between x and prediction okay so just wait now how do I choose how do I choose this gq I have given some three options here can you see the options right now I have see earlier my gq came from physics okay from mechanistic model some arguments now I do not know okay so it could be anything that I choose I have given three options first option is a second order transfer function the second option is third order transfer function then I have given one more option do you see that what I have done is I have done a long division I have divided the let us say take this case I have divided the numerator by the denominator and if I do that I will get a model which is you know a series in q to the power you just do a division just like you do normal division of two polynomials you can do polynomial divisions and then you will get and then you truncate the order so you can get variety of models we will look at the first one okay I will look at this model how do I fit this first model okay no we have passed that stage now just do not talk about a good physical model no no no no no a separate things do not confuse here right now I have no clue what the model should be I have no clue of the parameters I only have data okay so I am just looking at fitting a transfer function into this data okay so all that situation scenario is not well it is probably there in your research problem but not okay now let us let me make an argument that you know there are two tanks so the model should look like second order okay so I am assuming that the model between x and u is second order I am neglecting wall dynamics I am neglecting sensor dynamics so I am saying that two dominant capacitances one is tank one other is tank two so my model should be like second order okay a second order model is actually a second order difference equation see here well there is one more thing which I just want to add here for this particular system okay we know that there is a time delay of one sample okay so the model that I proposed here is actually second order model with one more time delay here you see this time delay here okay so if I convert this second order model into a difference equation I get this linear difference equation everyone with me on this linear difference equation this is my model which is proposed model okay this is a proposed model not state yeah yes no there is always one unit time delay in any discrete time system there is additional time delay which will give you two units of time okay any discrete time system real discrete time systems what you do now we will have influence after one sample okay most of the most of the okay yeah not assume I have found in this particular system experimentally I have found that there is one time delay this is actually physical set up no this is our usual set up so I have found that there is a unit time delay okay so that is why I am adding it if I had found experimentally that two time delay equal to 10 seconds right now sampling time I think is 5 seconds if I have time delay equal to you know 10 seconds I have taken d to the power – 2 okay so time delay equal to 1 is an experiment to find it I have independently found that there is a unit time delay in addition to the time delay which is because of discretization discretization see you look at a discretization xk plus 1 is function of uk so there is always a unit time delay okay discretization process itself introduces a unit delay in addition to that there is one more delay here which is okay now I want to estimate model parameters what are the model parameters a1 a2 b1 b2 right these are the four parameters I need to estimate the trouble is I do not know x I only know why y has x is here inside y but I do not know what is the distribution between x and v I have no clue okay this cannot be measured the contribution to y which is coming from you alone cannot be measured there is no way of measuring a separate in the level you cannot have two level transmitters one which gives you only effect of you that is not possible okay so the fundamental problem vk is the unknown disturbance of course unknown disturbance can never be measured okay unmeasured disturbance can never be measured so now you have to do some kind of optimization and come up with okay now if I am given a guess okay if I am given a guess let us okay so what I am given I have this model let us say you give me a guess you give me a guess for a1 a2 b1 b2 okay I have no idea what is x1 x2 okay like we can make a simplifying assumption x1 x2 is 0 because you are starting from a steady state your data in which you started from a steady state so the input was 0 effect of input on y was 0 at time 0 you can make that simplifying assumption okay but right now I am saying that you give me a guess for two initial points x1 x2 okay if you give me guess for initial point x1 x2 a1 a2 b1 b2 I can predict okay I can predict x3 this is prediction okay prediction is different from true x prediction of x is not equal to the true x okay so this is my prediction is everyone with me on this I know inputs I know entire input sequence u is known to me okay now you have given me a1 a2 b1 b2 and x1 x2 given this information I can use the different situation in time go progressively predicting okay so if I predict x3 using x2 x3 I can predict x4 right is this clear I can predict x4 because I know u2 I know u1 okay parameter guess is given to me okay I can just go on okay from if you give me this six things four parameters and two initial states guesses for two initial states I can just go on solving the different situation I mean how will you do it in a program put a for loop okay and you go marching in time just going marching in time you go from x2 to x3 x3 to x4 x4 to x5 you just go marching in time okay it is very simple in general I can go up to time n okay okay so this is where I begin well then I move on to x4 which is function of u2 and u1 and xat3 which was so xat3 was computed here that is used here okay to move on you know xat3 xat4 were computed here they are used here okay and u3 u2 are known to you okay so you just go on doing predictions these are predictions for the given guess these may not be equal to the truth they will be equal to the truth only when you have correct values of a1 a2 b1 b2 well in a real system what is correct is difficult to answer so if I have all these predictions I can also predict v right I can predict v if I have predictions of xcap 2 xcap 3 xcap 4 xcap 5 I can predict v cap I am not calling it v I am calling it v cap because it is a prediction it is an estimate it is not the truth okay that is why I am calling it v cap okay now I am going to estimate these parameters through non-linear optimization problem optimization is great thing what Gauss did is invent this wonderful technique and you know all of us are in business so you have to solve the problem through optimization what I have to do is minimize some kind of an objective function what I am going to do is least square estimation okay I want this vk vk is what is vk vk is difference between y major and x what is x effect of input u alone I want to have difference between y major and x okay as small as possible how do I say this okay I say this by putting an objective function some of the square of vk should be as small as possible well why some of the square why not absolute value you can choose absolute value if you choose square problem is simple to solve relatively okay we work with two norm because you know there are many many properties of two norm which you can exploit and come up with analytical expressions for you know understanding the behavior of optimization problem and so on so two norm is very very convenient mathematically so this is an optimization problem in which so what is optimized we are going to do every time guess a1 a2 b1 b2 x1 x2 okay and compute the objective function if it is you know you have given some tolerance if it is greater than the tolerance it will you know take a new guess by gradient search or whatever method conjugate gradient or you know Newton's method and then it will find a new guess it will stop only when you get some of the square of error minimized in some sense okay so what I get after that is an estimate you can possibly you can choose if you don't want to guess every time x1 x2 you are saying that you are starting from initial steady state initial states are zero that reduces the problem to only four guesses a1 a2 b1 b2 not an easy thing how to guess a1 a2 b1 b2 for a discrete time system if I do this using matlab system identification toolbox I am going to demonstrate this toolbox at some point then this is the model that I get okay I get optimum values these are estimates of a1 a2 b1 b2 for the two tank system which I showed you how good is my model okay look here plus plus plus plus are model predictions blue line is the correct actually data which is I have collected from the system okay I also plotted optimal estimate of vk which I got after I fitted the model okay you can see that there is significant difference so might say well is this significant it's almost explaining everything well I am also worried about you know net picking and modeling even this significant or insignificant difference okay my next task is to going to be how do I model this funny signal can I develop a model this is coming from unknown sources now it has three kinds of errors measurement error in the transmitter it has unknown disturbances third approximation errors all three of them are present in this signal okay but you can see the model is good enough right I can use this model for control I do not know if I just have to design a controller this model is a very good model it predicts almost everything that is there in the data there is some minor residual left okay we will of course worry about modeling that residual but this is a good model v of k is difference between measurement and the effect of u on the level v is everything measurement noise plus disturbance plus approximation error everything combined together is v you want to have that part as small as possible because you are saying that most of it is coming through you yeah so it's a model so don't confuse a model with a reality this is a model this is a model is this the correct model we will question that is output error model is it a correct model I will question that the next thing I am going to do is to question is output error model a good model or can I improve upon it I am going to do that okay