lecture, we will simulate the generator with an AVR. In the last class, we had of course discussed various transfer functions which could be used with an AVR. We now integrate the system. In fact, this is our kind of first experience of trying to simulate a control system, the power apparatus and the external power system. So, that is what we will do today. Recall that in the previous class, you can look at this paper. We had discussed the model of a simple static excitation system. We have chosen a static excitation system because it is the model of the excitation power apparatus is very simple. The only complexity so to speak is the limits of the static exciter which are dependent on the terminal voltage. Recall that if we normalize the field voltage and the control voltage to their corresponding values, when we get 1 per unit at the terminal of an open circuited generator running at rated speed, then the gain of this converter can be is effectively 1 because everything is normalized. The control signal also is normalized and the output also is normalized. If we have v ref minus v, the summing junction, v ref and v are expressed in per unit, then a typical or rather a transfer function which we can use, the simplest one one can say is a proportional type static excitation system. T a is very small. The gain k a when we use the normalized control output and also the per unit values of voltage here. In that case, k is typically around 200, 300 or you know that it is in that range. So, coming back to what we will be doing this lecture is to actually mathematically write down these equations. I will just show you a simple simulation and we shall also try to study the behavior of a synchronous machine connected to a infinite bias or a voltage source through a reactance and with the a we are regulating the terminal voltage of the generator. So far, we have been considering constant field voltage or the field voltage you can say manually increased in steps, but now we will have an automatic continuously acting feedback control system. So, today's lecture will be focused on the simulation of a generator connected to a infinite voltage source with the a we are in action. So, this is of course, the starting point of our discussion yesterday. The only thing we will be simulating today at least in the beginning would be the regulator function. We will not of course, be talking about the limiter and protective circuits or the power system stabilizer although I hope to give you a motivation for its use today itself why we need a stabilizer. As I mentioned sometime back, we will be using a simple model of an excitation system that is a static exciter and a generator which is connected to a power system and of course, as I mentioned couple of lectures back we will be simply trying to regulate the voltage that is the terminal voltage is measured and compared with the reference. We will not be putting any compensation for the load on the generator. So, we will not be having in the summing block any component corresponding to the current output of the generator. So, simply we will be having V ref minus V at the summing junction of the AVR. So, this is our static excitation system and as I mentioned sometime back. So, this is the model we will be using for the system. Now, when we want to simulate synchronous generator connected to an infinite bus, we will again have to use the equations which are given here. The fluxes of course, are something we have defined earlier. These are the fluxes of the synchronous machine. I D and I Q are the currents going out of the machine. V D and V Q are of course, the voltages at the terminal of the machine and E F D is the per unit value of the field voltage as defined earlier. Now, remember that currents and fluxes are related by an algebraic relationship as given here and A 1 is of this form. Remember you can notice the omega dependence of A 1. That is an important thing you should remember and A 2 of course, which relates the derivative of the flux to the current is given by this. B 1 and B 2 are given by these matrices and A 3 which relates the current to the fluxes is a matrix. It is a 2 into 6 matrix. Now of course, we are not considering zero sequence. The implicit thing in all our discussion so far have been that we are having a balanced system. So, we do not actually have to model the zero sequence. The thing is that the zero sequence variables do not appear in the D Q variable equations. So, there is a complete decoupling that coupling will occur in case if the synchronous machine is connected to an unbalanced network. But otherwise these equations are completely decoupled and the zero sequence equations can be separated out. Zero sequence equations have no source of excitation in case you have got a balanced system. So, you can practically say that all the zero sequence variables are zero and they are not coupled with the D Q variables. So, that is the reason why we are not considering zero sequence variables, but in case you do study unbalanced systems you should remember to take into account the zero sequence equations. Now, coming to the system we are going to study. Now, in the last simulation which I had shown you, I had got a synchronous machine which is synchronized directly to a voltage source and that was the kind of simplest system I could have shown you the synchronization. In order to show AVR action of course, it does not make sense to connect synchronize a generator to a voltage source because if you have connected a generator to a voltage source which is a stiff or constant voltage source, there is no question of voltage regulation because the voltage is maintained by the voltage source itself. So, voltage regulation makes no sense in case you have got a generator directly connected to a voltage source in this fashion. Of course, this is a symbolic representation of the generator. The generator itself is not a voltage source it is represented by the equation which I have already shown you. Now, the aim of the AVR is trying to maintain the voltage of this constant. So, constant is near constant. In fact, if you are using a proportional gain it is near constant not perfectly constant. Now, as I said this does not make any sense if you have got a perfect voltage source here to which this generator is connected. What makes sense of course, to you know show the action of a AVR is to connect it to a infinite bus or a large grid. It is connected to a large grid it is also called an infinite bus or a constant voltage source whose magnitude, frequency, phase angle all are all remain constant. What we are going to do is connected via a what would you connected via a transmission line or a transformer a transformer and a transmission line. So, this is a transmission line. Now, we have not gone into the modeling of a transmission line. So, we will not really delve deeply into this modeling of the transmission line itself, but you will know that well kind of a simple model of a generator connected via a transmission line and a transformer a very simple model could be a lumped reactor. This is the simplest model let us you know which one can have you know in a in a laboratory you could actually make the setup you could actually connected via a reactor, but right now we will assume that you have got a three phase inductance L which connects the generator to the perfect voltage source that is the infinite bus. Now, the generator now can you know maintain the terminal voltage try to maintain the terminal voltage because it tends to vary. How does it vary the how does the terminal voltage vary for example, if the power output of this generator changes in that case the current through this will change and you will find that the voltage here changes. Now, the only way you can maintain this voltage here at a near constant value is to have a close loop feedback system which changes E f d the field voltage. Now, in of course, in steady state the steady state representation of a non salient pole generator is simply like this please refer to a fairly early analysis of a steady state steady state analysis of a synchronous generator which was done roughly six or seven lectures back quite time quite at some time back. So, a steady state representation of a non salient pole synchronous generator is this. So, this is a steady state not of course, please do not use this under transient conditions under transient conditions you will actually have to use the differential equation model of the synchronous machine. So, do not use this for a transient representation of a machine, but we can see that if you have got a system like this infinite bus at least in steady state it is easy to see that if I change E f d I will be able to control or change the voltage here. So, this is the basic principle of course, of the AVR itself that you change E f d now coming to the model of this transmission line. Now, this is a simple you know a reactor whose inductance is L then the equations are given as shown in this slide that is L d I a by d t is equal to V a minus E a E a is of course, E a and V a are in fact, the phase two neutral voltages of the balanced infinite the generator as well as the infinite bus. So, remember that E a E b E c actually represent the phase two new neutral voltages of the infinite bus and the synchronous generator. For simplicity we will of course, assume that your infinite bus is simply E a is nothing, but so for simplicity we will assume E a the phase two neutral voltage of the infinite bus is nothing, but root 2 by 3 V line to line RMS the line to line RMS of rather I should call it E that would be notationally more easy to remember this is E sin omega 0 t. So, we will assume that you are seeing the infinite bus is of course, this is 120 degrees this plus 120 degrees now. So, omega naught is the constant frequency of the infinite bus. So, this is what E a means now if you look at what will happen in case you try to transform this into d q 0 variables. Now, transforming the d q 0 variable is quite simple in this case you know the d q transformation we have talked about the d q transformation or the Parkes transformation. So, if you use the Parkes transformation it transform I a I b I c into I d I q and I 0 and by doing that the equations are quite straightforward, but remember that you get these speed terms you know or rather I should say omega dependence omega remember is d theta by d t where theta is the position instantaneous position of the rotor of the machine. So, if you do the d q analysis of this system you can express this equation in this fashion it is also in per unit. So, what you see as x here is omega b l by z base. So, the best thing would be of course, you use a common base which is the base of the synchronous machine itself. So, the impedance base of the synchronous machine is used we have defined the basis sometime ago in our course. Now, one small an interesting point which we have here is the current through the this reactor which is interconnecting the synchronous machine to the infinite bus is the same as the current through the synchronous machine. So, actually if you look at the synchronous machine this is your synchronous machine this is not this is only a symbolic representation this is not a electrical circuit remember a synchronous generator cannot be represented simply as a voltage source this is your reactor and this is here. So, your current output of the machine i d i q is the same as the current through this i d and i q i 0 also is there which the neglect of which the neglect of which I have already explained sometime back. Of course, if you have got some load here for example, if you have got a resistive load here or any kind of load here this will not be true. So, if I have got something here then i d and i q are not the same for the generator and the inductor. Now, one of the interesting points which you have here is this is an interesting theoretically also is and also as practical consequences when you are trying to program the simulation of this system is that since i d and i q are effectively determined are a function of the fluxes the algebraically related to the fluxes we have seen that, but you also see that i d and i q are also determined by this differential equation. So, obviously there is a kind of a interesting situation here you have got two sets of one algebraic equation one differential equation which are with both are trying to define the current. So, this is a actually you have to be consistent you cannot have this differential equation for example, telling you that the current is something else and algebraic equation is telling you something else. Remember the algebraic equation relate the current to the fluxes which are again independently determined by differential equations. So, this so the issue here is that in some sense we have got these two differential equations here they are quite redundant in the sense that i d i q is already determined by that by an algebraic relationship with the fluxes. So, you really do not need to define two you know this extra set of differential equations and if we do use these differential equations as well we have to be really care to be consistent in the sense you cannot give i d and i q here for example, the initial conditions for this differential equation which are inconsistent with what you would obtain when you get the currents algebraically related to the fluxes. So, all the initial conditions would need to be absolutely consistent. Now, a situation like this could arise this is of course, like diversion from a main theme of power system dynamics, but it would be nice to just chew on this suppose I have got two capacitors which are in parallel. So, you can have this is suppose the current here is i. So, you have got d v by c c 1 c 2 is equal to i 1 i 2.  So, we will have c 1 d 1 v 2 by d 1 by d t is equal to i 1 and c 2 d v 2 by d t is equal to i 2 and i 1 plus i 2 is equal to i and v 1 should be equal to v 2. So, actually this in some sense you can say that you know by choosing v 1 equal to v 2 why do we require a differential equation again why do we need another law to define v 2. So, this in some sense v 2 is again a redundant state in such a situation.  So, you only need to determine the current through this whatever voltage you have here will be the same as the voltage here. You can have another situation when an inductor is connected to another inductor. So, there to you know the question is how many states are there you know you can if you write two differential equations this could be even you could take even a one inductance split it into two and get into this problem. So, this is something which this is a similar situation which you encounter here of course, this problem is solved in case you have got something connected in shunt which is not an inductor for example, a resistor or a capacitor you connected then these two states become distinct you can have two differential two sets of differential equations which really for these inductors which define give you separate and important information. So, this is one interesting point which you know you should chew upon if you look at something about the infinite bus itself we are kind of progressing to finally, getting our equations we have not actually solved this earlier problem of redundant states I have just told you that there these states are in actually redundant because I d and I q are obtained by algebraic relationships with the states. So, how do you use this information usefully. So, that is something which you need to chew upon the infinite bus itself remember its frequencies omega naught and the phase angle since e a e b and e c are defined to be these. Now, if the rotor angle position theta that is the position of the rotor theta is defined like this if omega naught is the frequency of the infinite bus rotor position is omega naught t plus delta which also means which also means that if you have got a say a two pole machine we will just talk about two pole machine here the a phase winding the axis of the a phase winding and the axis of the rotor winding the field winding that is is delta whenever there is a negative to positive zero crossing. So, if I at every negative to positive zero crossing of this sine wave if I take a snapshot of a synchronous machine of the synchronous machine I will see that the rotor is at an angle delta. So, that is what delta means now if that is the case e d will be e sin minus e sin delta this something we have defined before this is just obtained by applying the d q transformation to e a e b and e c and d delta by d t from by differentiating theta d theta by d t is nothing but the speed of the machine the instantaneous speed of the machine which which is nothing but omega naught plus d delta by d t and that is how I get d delta by d t is equal to omega minus omega naught. Let us assume that e is equal to 1 and the frequency of the infinite bus is equal to the base frequency. So, this is a simplify our math our analysis. So, what we have now is the synchronous machine and plus the equations of the external network. Now, what remains to be done of course, is the exciter equations themselves the excitation system essentially takes a feedback of the voltage the terminal voltage v d and v q and the set point is what is given by us and this is how your system looks like. Now, one of the things is that for the excitation system we really require to know the magnitude of the voltage and that is something we will spend little bit of time on now. What is the terminal voltage magnitude in fact, I have been using this somewhat nebulous kind of concept of a voltage magnitude this this is the voltage magnitude of the terminal you know. What is v? v is the magnitude of the voltage at the terminal of a synchronous machine, but you will immediately recognize is the fact that voltage magnitude in transient what do we mean you know if you have got a pure sinusoid then getting the magnitude is very simple you know you can for example, take the peak value and you can you know kind of from the peak value you can find out the line to line RMS value of the voltage. So, we got balance three phase sinusoid you can get the peak value of any phase and then get the line to line RMS magnitude. Now, magnitude of course, is in some sense a coefficient of the sinusoidal term when we write down the time relationship. So, when I say magnitude I usually mean something like this if I want the magnitude of a sinusoid I mean that I usually mean that the coefficient here is the magnitude, but this assumes that you got a sinusoid. Now, if I give you a waveform which is like this and I tell you well find out the magnitude of the sinusoid here in this case that is a bit of a bit of a question mark because this is no longer a sinusoid. So, what do I represent this as and how do I get the magnitude as a coefficient of a sine function you know when this is a transient kind of behavior where you cannot represent it as a pure sinusoid. So, this is an interesting point in practice whenever I am getting the magnitude of V what could I do one of the things I could do is you take the three phase voltages V a V b V c. So, for example, you have got V a is the voltage across the winding of a synchronous machine I could connect them in star and I could take the phase to neutral voltage is the voltage across the winding give it here sense it. So, I will get three well in steady state I will get three sinusoids, but otherwise of course, I will get simply the instantaneous values V a n V b n and V c n. Now, one of the ways you could you know define magnitude of a voltage is to take the Fourier component of V a V a n V b a n and V c n. For example, of course, your data is just coming in you know it is not a fixed signal, but you know your kind of continuously getting if this is a digital signal system for example, you will be continuously getting samples of V a n V b a n and V c n. So, how do you actually take out the magnitude or you can say Fourier coefficient of this fundamental Fourier coefficient of this well. So, I could define V a bar as something like this T minus T to T. So, this is one way of defining it. So, you try to get the magnitude of V a in this fashion you know as you get the instantaneous values you evaluate this integral using some kind of function you know you will have to actually implement this using for example, digitally you can implement a numerical integrator using the discrete samples of V a n. So, this is what you could do and get you know the kind of a Fourier coefficient of course, during transients you know you will get something which seems reasonable to assume what you will get is the Fourier what you call the magnitude of V a. So, this is one way of doing it in fact, you will have to get a sin component as well as a cosine component and then you know whatever you get you know let us call this the sin component and this is the cosine component this is of course, a real number and then you can use this root of V a s square plus V a c square to get what we can call or define the magnitude. So, if you you should remember that when it comes to transients you have to kind of you know define what is voltage magnitude there is no you know there is no definition by definition you cannot have a magnitude of rather naturally or inherently there is no meaning to having a magnitude of a non sinusoidal wave. So, another easy way of doing things is you take this V a, V b and V c and you compute root of V a square plus V b square plus V c square. Now, this also I can you know call as the magnitude of the voltage remember that if V a, V b and V c are balance sinusoids I leave it to you to prove that V will be a constant and equal to the line to line RMS magnitude. So, if V a and V b and V c and we take evaluate this you know instant by instant. So, this is an instantaneous value if V a, V b, V c are pure sinusoids balance sinusoids balance set of sinusoids you can show that V is a constant and equal to the line to line RMS voltage under these circumstances. So, what one extension I can do is that even during transients even during transients treat this V as if it is a voltage magnitude. So, this is one way of doing things and this is a simple way of doing things. So, you can either use this kind of method of finding the Fourier components even during transients by using this kind of numerical integration or you can take the instantaneous values of V a and V b and V c and square them and square and add them up get this value of V and treat it as if it is the voltage magnitude even during non sinusoidal and transient conditions. Of course, V is not a constant in case the system is not balanced or during transient conditions, but eventually we settles down to a constant value if the transient dies down and we reach a balanced sinusoidal steady state. So, this is one important point. So, if V is equal to root of V a square plus V b square plus V c square you can show that this is equal to. So, you can actually actually it is plus V 0 square, but we are of course, assuming we are using a absolutely balanced system. So, V naught is 0. So, V can be defined as root of V d square plus V q square. In fact, what it means really is that we can use our equations in the d q form and model the summing junction of an A V R the inputs of the summing junction of the A V R by simple d q variables themselves. Now, can you prove this I leave it to you to prove one of the things I can just hint to you is V is equal to V a V b V c into V a V b and V c and of course, the square root of it. So, raise to half and remember that V a V b V c into this can be treated as identity into V a V b V c. This identity matrix can be written as C p transpose into C P the box transformation and that is how you will get this particular relationship you can just work it out. There are some other interesting points in this stage which I must tell you is that what is real power real power in terms of you know at a bus you know injected at a bus what is the real power in terms of the d q variables. Now, instantaneous power is defined as in three phase balance setup is this instantaneous power. Now, you can show that this is nothing, but if you use the transformation which you have used sometime back that is the box transformation with the appropriate values of k d and k q this is in fact equal to this. Remember of course, that in sinusoidal steady state this product is a constant balance sinusoidal steady state this product is a constant. Reactive power what is the definition of instantaneous reactive power well now we have to be a bit careful reactive power probably makes no sense at least I cannot make much sense out of reactive power defined on an instantaneous basis. But if you for example, you can show that q q t this the reactive power instantly can be defined. So, it can be defined as and a balance situations of course, you will you can show that this in fact boils down to a normal definition of reactive power. So, this is something please think over if you have got a three phase sinusoidal circuit with a you know you can just take a simple star connected circuit and prove these things that at least in sinusoidal steady state this is true. This matches with sinusoidal balance steady state this particular expression matches with our classical expression of q, but q instantaneous reactive power can be defined in such a fashion. Remember that it does not really make sense to define means reactive power is a kind of a steady state concept it is a sinusoidal steady state concept. So, again it is a bit you know you should remember that whenever you say instantaneous reactive power is this this is only a mathematical artifice and it is not really have does not have any physical meaning, but in steady state of course, this boils down to what is our classical definition of reactive power which indeed has physical make some physical sense. So, please this is something you should just think over it is an interesting problem in itself. Now, if I am measuring v as root of v d square plus v q square I am getting instantaneous values of magnitude or this is the definition of the instantaneous value of magnitude which is consistent with what we get in steady state. So, this will be equal to the line to line RMS voltage magnitude in steady state. So, this is a nice definition of course, if you are under unbalanced conditions it is not difficult to show that v d square plus v q square square root of that is not a constant. So, whenever we are making for example, we could have v ref and we could be calculating the magnitude say by taking v a, v b, v c from v a, v b, v c we may be getting square root of v d square plus v q square as the magnitude normally we will not use this without any kind of filtering we will normally pass it through some low pass filter. So, this is something which you should remember, but this low pass filter would be basically designed only to reject high frequency transients not the slow transients high frequency noise or unbalance which will cause v d square plus v q square to keep varying will be removed by this low pass filter. So, this is how a summing junction would look like. Now, another interesting point is that if I do not use this d q definition of voltage magnitude, but instead use the square root of v a square plus v a c square this is for the a phase square root of as the magnitude and this is how I define and compute this from the instantaneous values. In that case remember that since we are doing an integration here the moving kind of integration from t minus t. So, it is over a window of t then in this case there is a kind of inherent you know filtering effect which is there because of this integration. So, just think over it it is an interesting problem of computing instantaneous magnitudes and so on. So, in this particular course we shall assume that this is when I say magnitude it is this root of v d square plus v q square the square root of it. So, that is what is what we have. So, if I want to write down the model of a AVR and exciter this is what we need to do. So, if we take a simple static exciter model which is suitable for slow transients slow transients I mean typically associated with electromechanical phenomena like swings or you know low frequency transients of around 1 between 1 or 2 hertz which involve oscillations of 1 or 2 hertz. That is what I will define as a slow transient in that case this is a simple model that is the AVR is k 1 plus s t a then you have got this limit and you have got E f t. So, the differential equations which you get are let us call this state associated with this transfer function is x c. We have already seen in the previous class that 1 upon 1 plus s t a can be written down in terms of state equations. So, in such a case what we have effectively is d x c by d t is equal to minus 1 upon t a into x c plus k a into the input which is nothing but the error v ref minus v and as I have defined sometime back the voltage magnitude is root of v d square plus v q c the terminal voltage of the generator. Now, x c itself is not E f d well not always x c is equal to E f d only if the value of x c lies in the limits. For example, we could have plus as I mentioned in the previous class we could have plus 7.0 v and minus 7.0 v this is essentially modeling the limits of the converter in the sense that it is the output of the converter will be limited by the a c input to it. So, x c will be equal to E f d only if x c is between minus 7 times minus 7 times minus v and plus 7 times v this is not volts this is the voltage magnitude of the terminal voltage. So, this is what we get if we had used a brushless excitation system remember that we would get much more complicated equations for the excitation system. So, if I used a brushless exciter in fact the output would depend there would be dynamical equations associated with the excitation power apparatus as well. So, as I mentioned in the previous class you need to look at the IEEE standard or several books which really describe a brushless excitation system modeling in detail, but if you are talking about static excitation system it is practically only the limit which has to be modeled. The AVR of course is a simple transfer function it is a simply a proportional controller in practice you may have something more complicated you may have lead lag blocks also in series with it, but we will not really go into modeling that much in detail we will just do a simple simulation to show you the effect of the static excitation system. If studying slow electromechanical transients while operating near the nominal speed we can as an approximation set d psi d by d t is equal to 0 and d psi q by d t equal to 0 and omega approximately equals omega base. So, this is of course if you are operating near the normal speed and we are interested in the slow transients as we have just discussed in our previous treatment of this system. Now, one more so we have now two algebraic equations here instead of differential equations on the other hand our model of the interconnection I have mentioned some this sometime back in the context of the presence of redundant states the model of the interconnection is given by this differential equation. Now, as a logical extension to the approximation which you have just made that is d psi d by d t is equal to 0 and d psi q by d t is equal to 0 omega approximately equal to omega b it makes sense to set d i d by d t is equal to 0 and d i q by d t is equal to 0 as well in these equations. So, if you do that of course the differential equations get converted to algebraic equations the differential equation which I just showed in the previous slide gets converted to the algebraic equation which is shown here. So, of course what is the logic for doing this remember that in case we are neglecting fast transients by setting d psi d by d t is equal to 0 and d psi q by d t is equal to 0. There is really no point in retaining rather describing i d and i q by a differential equation because if I do retain this differential equation then we are not really getting rid of a fast transient you can show this is something which I am not proving here, but you can show that if I retain this differential equation while setting d psi d by d t equal to 0 and d psi q by d t equal to 0 I am not really getting rid of the fast transients because of this differential equation you will still have fast transients and the system will be still stiff. So, in case you are studying slow electromechanical you know phenomena it makes sense not only to set d psi d by d t equal to 0 and d psi q by d t equal to 0, but also d i d by d t equal to 0 and d i q by d t equal to 0 as a result you get these algebraic equations. So, now we have in fact if you have noticed got rid of four differential equations and have algebraic equations in their place now let us look at the other differential equations of the system. Incidentally before we go ahead remember that the redundancy of states which I was just discussing sometime back in this lecture that problem in some sense gets also solved because once you set d i d by d t equal to 0 and d i q by d t equal to 0 d psi d by d t and d psi q by d t equal to 0 they are no longer states and then we do not have to give initial conditions to them and if we do not give initial conditions to them we do not have to worry about giving consistent initial conditions to these variables. Now in fact to some extent you will notice that rather I should say that since you have got i d i q psi d psi q as algebraic variables which are really dependent on other variables of the system we do not have to bother about the redundancy in the states problem anymore. Looking at the differential equations let us just scan through all the equations again this is a torque equation in per unit these are the rotor flux equations remember that psi d psi q no longer being states we do not have to write the differential equation for psi d and psi q.  So, let us just so we have got one differential equation of the rotor speed four differential equations corresponding to the rotor flux equations later on we shall also see that there is one differential equation corresponding to the rotor angle delta a 1 dash 8 1 double dash and b 2 dash are given by these equations there is also an algebraic relationship which relates i d and i q to psi d psi q psi f psi g and psi k. So, there are two algebraic equations that two algebraic equations which really relate i d and i q to the rotor and stator fluxes. So, these are algebraic equations not differential equations. So, overall incidentally a 3 is given by this. So, in this equation a 3 is given by this we also see that e d and e q which appear in these equations. In fact, e d and e q appears in the algebraic relationship of i d and i q which we discussed sometime ago. So, e d is nothing but e sin delta minus e sin delta and e q is equal to e cos delta this is by applying path transformation to e a n e b n and e c n which are the phase 2 neutral voltages of the infinite bus. This is one differential equation here remember that in this system we assume this data is equal to 1 and the frequency of the omega of the infinite bus is equal to the nominal frequency or the base frequency. This is of course data which is given to us or rather I am giving it to you this could be this is this for example, e could be 1.1 also or the frequency of the infinite bus could be slightly higher or lower than the nominal speed. But let us first simplicity let us assume e is equal to 1 and omega naught is equal to omega b. So, we are assuming that the infinite bus frequency is the nominal bus frequency nominal frequency for the synchronous machine. The static exciter is modeled by a first order differential equation. Now, x e is not the same as e f d. In fact, x e is the same as e f d only if x e is within the limits of the excitation system. Of course, if it exceeds the limits then x e is clipped to the maximum or the minimum value of e f d as defined by the exciter model. So, actually this is a simple static exciter plus voltage regulator model. So, in fact, I should write here static exciter plus automatic voltage regulator. So, it is just if defined by one differential equation v is equal to square root of v d square plus v q square as discussed sometime previously in this lecture. So, the number of states are the 6 in fact, there are 6 differential equations corresponding to these 6 states. The other variables i d psi q i d and i q v d and v q are really not states. We have set d psi d by d t and d psi q by d t d i d by d t and d i q by d t equal to 0 because of which we have got got rid of differential equations and redundancy of states. There are 6 algebraic equations of course, and the inputs to the system are t m and e f d. e is of course, the infinite bus voltage which also has to be given to you and the speed of the infinite or the frequency of the infinite bus also has to be given to you. Remember that the 6 others other variables psi d psi q i d i q v d v q which are no longer states can be obtained in terms of the states. The states are delta omega psi f psi g psi h and psi k by using these 6 linear algebraic equations. Linear simplifies our job because the solution can be got in one shot without any numerical iterative procedure. So, you can directly write psi q and psi d i d and i q and v d and v q in terms of delta omega. Omega in fact, does not appear here because we have taken omega approximately equal to omega b, but delta appears in this e d and e q term and of course, psi f psi h psi g and psi k appear here. So, this is how we obtain all the equations or mixture of 6 differential equations and 6 algebraic equation. The algebraic equations allow us to get rid or rather a better word would be to get to write v d v q i d i q in terms of the states.  These are in fact, in terms of the states itself themselves psi f psi h psi g psi k delta and omega. So, it is a fairly trivial matter to write psi d psi q i d i q v d v q in terms of the states and in some sense, you know eliminate them from the differential equations. So, before we close today, let me just give you a flavor of a simulation. We will not be able to explain all the aspects of the simulation today. What I will do is I will synchronize the generator right at time t is equal to 0. It will be a bumpless synchronization. Thereafter, I will increase the torque of the synchronous machine. I will load the synchronous machine and I will show you that the terminal voltage remains more or less constant in case you have got an A V R. And after 15 seconds, of course, the step in real power will be given at 5 seconds. After 15 seconds, we will give a step change in the reference value of the A V R. So, that is what we will simulate and close this lecture thereafter. So, if I simulate this, I am simulating for 25 seconds with Euler method with a time step of 5 milliseconds.  Remember, one more problem which is encountered with Euler method is that one problem which is encountered with Euler method is not a very numerically stable way of simulation. I have just used it for simplicity of simulation. So, it is often said that Euler method is only taught. It is never used really in practice. So, anyway by making the time step very small and removing the stiffness or nonetheless I am able to use Euler method in this particular situation. I encourage you to try to use some other method. Now, let us plot how E F D looks. Now, remember at 5 seconds, I have increased the torque and at 15 seconds, I have increased the reference value of the A V R, V ref. In both situations, you will notice that whenever there is a change in the loading of the machine at 5 seconds, E F D changes from 1 which is the value under no load conditions. It changes automatically to around 1.5 and if I change the V ref, that is the reference voltage of the synchronous machine, again E F D changes. Now, E F D is able to take on values as high as 7 because the limits are very high. Excitation system of this kind is high ceilings. So, we are able to force the field to a very high value. That is of course, as I mentioned sometime back because the field winding is a very slow acting system and you really need to push it a lot in order to make it work faster. So, this is the way how field voltage changes. Remember field voltage is no longer constant because it is being changed by the automatic voltage regulator and if you look at V itself, it is V gen, I have changed the reference value initially was 1 per unit, near about 1 per unit. As I loaded the machine, the reference value went down slightly, rather the terminal voltage magnitude went down slightly. Initially, it was 1 per unit. If I load the machine, it goes down. Now, the question is why does the voltage magnitude of the synchronous machine go down if it is regulated? Here, remember at 5 seconds, I have applied a load. Now, while if I applied a load, why should the terminal voltage magnitude change if it is being regulated by the AVR? That is one question which we need to ask ourselves. We will try to answer that question the next time. Of course, if I give a step change in the automatic voltage regulator at 10 seconds, of course, it was 10, not 15 seconds. At 10 seconds, the terminal voltage of the machine goes up. So, it regulates it. It changes the value according to the set point. So, it has gone to around 1.045, roughly. So, this is how the AVR behaves. There are many, many interesting points which I need to discuss with you. There is no time for that in this lecture. So, we will revisit this point in the next class. So, redo the simulation and try to bring out some of the nice interesting points which come out of the simulation. So, for that, we will meet again in the next class.


Hi, I'm Zor. Welcome to Unizor education. Let's continue talking about a particular statistical problem. The problem was actually explained in the previous lecture, and this lecture is about the solution to this problem. All right, so the task at hand is we are dealing with certain Bernoulli random variable which is equal to 1 with the probability p and 0 with probability 1 minus p. And we don't know the probability, we would like to evaluate it somehow. Well, it can be something like, for instance, what's the probability of picking a spade, for instance, from a full deck of 52 cards? I mean, we know that there are basically four different suits, and the probability should be one quarter, right? But if somebody doesn't know this, and he decides to basically make an experiment to empirically evaluate this probability. If somebody makes an experiment, let's say, 100 times, and 22 times out of 100, he picked a spade. So his reasonable assumption is that since probability is a limit of the frequency of occurrence of the event. Now, the frequency of occurrence is 22 out of 100, so approximately the probability is 0.22. Well, it's not wrong, absolutely not. It's kind of a right approach. But I would say it's incomplete, naive in certain way, and definitely needs some mathematical foundation, and that's exactly what this lecture is about. So the solution is known. You just make experiments, average the results, and basically do away with this. The question is what exactly this means, and how to quantitatively evaluate the quality of our evaluation. All right, so how can we do it? Well, first of all, let's make a theory out of these practical experiments. Now, what does it mean that we conduct experiments with our random variable? Well, and we get n results, obviously. But think about this way. If you have a different set of n experiments, you will have different results. I mean, 1s and 0s will be in different places. What does it mean? Well, it means that the average, which you have calculated based on these n results, is actually a random variable. And the result of each individual experiment is also a random variable, exactly distributed like our original random variable Xe. And all these experiments, I presume, are independent of each other and identically distributed. So I will use the letters C1, C2, etc. as results of n experiments. And this is my average. Now, again, I'm using notation that resembles the random variables rather than constants. Yes, I understand that in one series of n experiments we get concrete values, kind of constants. But somebody else would do exactly the same and he will have different numbers. And what we would like to do, we would like to put some kind of a mathematical foundation to a statement that, regardless of the result, averaging would be close to p. That's why I have to consider what are different values of these averages. So that's why I approach this as a random variable which has certain distribution, obviously. So this is a random variable which we are dealing with and we would like it to use as approximation of the probability p. Now, obviously, since C1, C2, etc. are equal to either 1 or 0, sum is the number of times it's equal to 1. So that's the number of times this event occurred and that's why this ratio is exactly the frequency. And that's why I assume that this is an approximation. Now, the definition of probability is that as I increase the number n, this is supposed to be closer and closer to the probability. But the word closer is not so far. It's not really well-defined. I really have to define it mathematically. Because, let me just state it upfront, what are possible values for this sum? Well, obviously, as I indicated in the previous lecture, this sum can have various, basically, the sum in the numerator from 0 to n, right? 0 and all of them are 0 and n and all of them are 1. So if I will divide it by n, I will have different numbers from 0 to 1, right? So I will have 1 n, so I have 2 n, etc. So all the different possibilities from 0 to 1 with the step of 1 n are possible. So what does it mean that this value is close to some constant? I know without actually even thinking that p is from 0 to 1 because it's a probability. So how can I say that a random variable which can take any one of these values from 0 to 1 actually is an approximation of p if I know basically nothing about p except that it's from 0 to 1. Well, this is something which I would like to address more mathematically. What does this closeness actually mean, all right? Now, before doing that, let's just think about what exactly this particular random variable is. Well, it's called actually, it's distribution, it's called binomial distribution. Now, I have explained actually all the details about binomial distribution in the lecture in the theory of probability part of this course. So if you forgot about what this is, I do suggest you to just stop right now and go to the chapter of this course in the binomial distribution. Now, binomial distribution, although it does have in this particular case this variable, it does have all these different values, it takes them with different probabilities and that's extremely important. Here is what I meant. Now, how many different ways this particular sum can be equal to 0? Well, obviously if all of them are equal to 0, now what's the probability of this? Well, that's probability of this being equal to 0 times this being equal to 0, etc., so it's basically 1 minus p to nth degree. Now, if p is not 0 and not 1, somewhere in between, like one quarter for instance, this will be less than 1 and raised in the power of n, it will be smaller and smaller and smaller depending on how, as n increasing, this particular value goes smaller and smaller. Now, exactly the same is this. The probability of this sum to be equal to 1 is the probability of each component equal to 1, which is p to the nth degree. And again, if p is between 0 and 1, this is decreasing with n going to infinity. So, and it's smaller and smaller. So what I mean is the following. If I will put the distribution of probabilities graph here. So this is 1 and this is 0 and this is 1.5, this is 1.25, this is 3.25, etc., so these are with a step of 1ns. Now, the graph, which basically represents the probability for my variable, to take any particular variable, will be very small here and very small here as n really large because it will be like this. And then it will be greater because there are how many, for instance, cases when it's equal to, when the numerator equals to 1. Well, it means this can be 1 and these are 0, which is p times 1 minus p to the power of n minus 1, right? 1 is 1 and the rest is 0. But I can have this one as 1 and the rest of 0, or this one as 1 and these are 0. So I have n different variations and if I divide it by n, it would be, I don't have to divide it by n. It's n different variations. It means it's n different cases when my sum is equal to 1 in the numerator. And this is definitely greater than this. So I will have more here, more here, etc. So I will have graph approximately looking like this. So the middle values, like somewhere around around 1 half, will have the greater probability because there are more combinations of 1's and 0's which deliver this particular number. So, as I was saying, yes, the range of values of this thing of 8 that is from 0 to 1, but different values it takes with different probability. Now, let's examine two main characteristics of this variable eta. The characteristics are mathematical expectation and variance. Now, mathematical expectation is, now this is the sum, mathematical expectation of sum is the sum of mathematical expectations. The factor can be taken out of this, so it would be 1n times sum of these and each of them, mathematical expectation is mathematical expectation of c which is p, right? Now, obviously, mathematical expectation of c is equal to what? It takes value of 1 with probability p plus value of 0 with probability 1 minus p, right? Which is p. Now, the variance of c is equal to, now, variance is expectation of value minus its expectation square, right? So, now, we know what expectation is. That's p. So, c can take value of 1 in which case it's 1 minus p square with probability p or it can have a value of 0 which is minus p square, which is p square with probability 1 minus p equals, okay, 1 minus p out, then I will have 1 minus p times p plus p square which will be 1 times p which is p minus p square plus p square. So, it's 1 minus p times p. Okay, so, variance is equal p times 1 minus p. Now, when I'm talking about variance of the eta, variance of the sum of independent variables, random variables is equal to sum of their variances. But the factor goes out in a square. Well, because the variance is expectation of something square, right? So, it would be 1 over n square times sum of these which is n and p and 1 minus p which is equal to p 1 minus p divided by n. Now, there are two very encouraging factors right now we have established. Now, this is encouraging factor number 1. What does it mean? Average of the random variable is exactly what we want to evaluate. So, whenever we are using the value of this as an estimate of this, we know that on average it will be concentrated exactly where we need. Now, the variance describes how much it deviates on average from the from the center, from the mean, right? And as you see, we have n in the denominator which means as n increasing the variance of this thing decreasing. So, it will be tighter and tighter around its mathematical expectation. So, that's very important. So, for n equal to let's say 2 I will have 1 half and 1 half, right? For n is equal to 3 it will be something like this. For n equal to 4 it will be something like this. So, this is a graph of frequencies. And more and more experiments I conduct the more the shape of this would resemble something like a bell curve. Just keep it in mind. But anyway, these are two encouraging factors. Although I do not know p I can definitely say that my mathematical expectation of a random variable variation of p is equal to p which is a very good sign. And the variance of this is decreasing as n is increasing. That's also very important. Now, the problem is if to evaluate the quality of this evaluation I'm using my variance and I'm saying when the variance is small then the values are concentrated around p more and that's a better variation if the variance is greater than my deviation from the mathematical expectation would be greater and the variation would have a lesser quality. Great, but I don't know the p. So, how can I say whether it's big or small or whatever if I don't know anything about it? Well, in this case what can help is analysis of this formula. Now, look at this p times 1 minus p. What is this? Well, let's consider a graph of function x times 1 minus x where x is from 0 to 1. Now, this is a parabola because it's a polynomial of the second degree. Now, the coefficient at x square is minus 1. So, parabola has horns directed downwards, right? So, it's this type parabola. Now, where are the roots? Where are the values of x which bring y to 0? Well, obviously it's 0 and 1, right? These two solutions of this equation x times 1 minus x is equal to 0. So, it's 0 0 and 1 that would be my graph, right? In this segment it's 0 at 0 and 0 at 1, right? At 0 and at 1, 0 and it reaches maximum in the middle, 1 half, right? So, what is this maximum of this parabola? Well, 1 half times 1 minus 1 half is 1 quarter. So, I can definitely say that this is less than 1 over 4n. Okay, so I don't know exactly the value of the p but I have estimated from the top from above. Now, why is this helpful? Well, I still have n in the denominator which is very good and now I can say that, okay, my variance I don't know it, but it's definitely not greater than this guy. And that's sufficient to understand how tightly my distribution of eta is around its mathematical expectation. And here is how it can be approached. So, let's just wipe it out and I can say that the mathematical expectation of eta is p and variance no, not c, eta is not greater than 1 over 4n. Okay, so I know these two things. Now, is it sufficient to say to anybody? Okay, my evaluation is my evaluation of probability p is calculated using this formula where c1, etc., cn is the result of your experiments. You have conducted an experiment, these are results. You do the averaging and I'm saying, okay, this is the variation and the variation is not biased because the mathematical expectation is exactly p which is good and I also can say that the variance of this is not greater than this number. Well, this second statement is not really very informative for a normal person and here is what would be more informative and that's how the whole statistics actually is doing, is making these type of statements. I understand that my standard deviation is less than one quarter, one over 4n. However, I don't want to know my variance. I know a different thing. I would like to know that my value of p is within certain limits of delta from empirically obtained value of the random variable delta. So if I know that this is true then this delta which is the measure of error, it's a margin of error actually gives me from and to boundaries for its value. These are two equivalents, right? Because both mean that absolute value of the difference is not greater than delta. So I would like to know this delta. So getting an empirical result, let's say 0.22 if I can say that my real probability is within let's say two tenths from 0.22 no, not two hundredths let's say from 0.22 then it means it's from 0.20 to 0.24. That gives me the range. Range is much more informative than variance. But how can I get the range? Is there any delta which gives me such an inequality in absolute terms? Well, no. Because again since eta can be anything from 0 to 1 with different probabilities it means that basically the difference between p and eta can be up to 1 actually, which means it's absolutely of no value to me. However knowing that different values eta can take with different probabilities and those values which are closer to p are greater probabilities taken. I can say that this particular inequality is not observed in absolute terms, but it's observed in probabilistic terms. The probability of this event if I can say that probability is greater than some level of certainty which I consider to be acceptable for me, for instance I can say that, okay, with probability or with certainty level of 95%, 0.95 this is true with delta equals 0.02, for instance. This is much more informative than this. Now, so my purpose in my statistical analysis and basically that's the purpose in the entire statistics is to come up with inequalities like this. So I'm evaluating value based on my empirical factors with this precision with this level of certainty and how can I do it in this particular case? Well, in theory with computers or anything like this it is possible because eta has a binomial distribution we know it's a function of n of number of experiments and obviously formulas are rather complex but probably can be handled by the computer. Well, people don't do this and they're using something which is which I was actually addressing again in the course of theory of probabilities it's called central limit theorem. Now, central limit theorem states that the sum of random variables under relatively liberal conditions but in this case for instance they're all independent and identically distributed that's definitely a good condition. So the sum of these behaves like a normal distribution as the number increases. Now how close this distribution to a normal distribution depending on the number and I'm not addressing this issue right now. I'm just blindly using this theorem considering that n is sufficiently large so the approximation of the distribution of this binomial distribution with the normal distribution is correct. It's a different story when exactly it's correct. I'm just assuming that n is sufficiently large for our purposes. In which case I can replace binomial distribution of eta with normal distribution which has exactly the same expectation which is p and exactly the same standard deviation which is sigma where sigma square is equal to var of eta in which case sigma is not greater than 1 over 2 square root of n, right? So standard deviation square which is variation is not greater than 1 over 4n so sigma itself is this one and now what I'm doing next is using the apparatus which has been already researched for for normal distributions to obtain something like this and here's how for any normal distributions and again I address this issue in my theory of probabilities lectures we know that the random variable, well in this case eta is probability of eta to be within infinity of its standard of its mathematical expectation it's closer than sigma than this probability is 0.6 825 so look at the bell curve now this is my mathematical expectation now and sigma is 1sigma is from here to here so the area of this is equal to 0.6825 so the probability of our random variable to be very very close to my mathematical expectation is this now if I will have 2sigma so within this more greater interval well obviously the probability is greater probability of my random variable to come within this distance from its expectation is greater which is 0.95 45 and finally if I am taking a very broad margin of error which is 3sigma probability is almost 1 actually so these tails are very very improbable so to speak so now everything depends on how big my delta is supposed to be how certain I would like to be within this distance of delta from my mathematical expectation which is this case the same as my probability of c equal to 1 the very beginning which I wanted to evaluate so now I basically can solve all the problems if my delta is given and n is given and from n I can write sigma which means sigma is given so knowing n means knowing sigma so if my delta is given which is a sigma and my level of certainty is given so let's say I would like delta to be equal to 2sigma for instance which means and I would like certain level to be equal to 0.95 0.9545 then I know that this actually does happen right and knowing exactly this value my precision which I would like to evaluate I can calculate my sigma and from sigma I calculate n so basically from delta and p I can calculate n now if I would like greater precision I mean I would like to have equal to sigma for instance so it's closer to my then I have to be satisfied with either I have to be satisfied with lesser probability or I have to basically increase the number of increase the number of n to get to a smaller degree here so in any case my point is that knowing delta and knowing p you can come up with n knowing p and n you can come up with delta using this type of evaluation and knowing what n and delta for instance so you have already the number of experiments you already done it so you can change it and you would like certain precision then you have to be satisfied with whatever certain two level it gives you so anyway having these three main parameters of our statistical analysis number of observation operation precision which is basically deviation from the median and level of certainty p these are all connected and knowing two of them I can find out the third one based on this so let just as an example for instance you have attempted to do something 100 times say you are picking your space from the deck of cards right so if you have arranged n is equal to 100 so that means your standard deviation would be less than 120 right now if you have 0.22 frequency empirical frequency of number of space what you can say that with the probability 0.68 25 you can say that your p minus 0.22 probability of this to be less than or equal to let's say 2 sigma which is 110 now that's 1 sigma so we don't need this so it's 95 something 45 so you would like to achieve this probability this certainty of your answer, your evaluation then you can say your unknown probability of space from the empirical number the probability of this to be less than one tenth is equal to 0.9545 actually a little bit better because if you remember this is not really a real variation variance this is an estimate from above the real variance is like p times 1 minus p which is unknown so at least this level of certainty you will probably even better which means that your probability of getting space is with this certainty from 0.21 to 0.23 or again and precision you can find for instance this so any kind of combinations are possible in this particular case well that was a solution to this statistical problem which I have introduced in the last lecture I would like you to read again the notes for this particular lecture they are on Unisor.com maybe something is explained a little differently and in this case it's a very useful exercise of your statistical analysis well that's it for today thank you very much and good luck