# Modelling of Electric Power Grid

I'm trying to model a portion of the Electric Grid (yes, I have looked through the MATLAB forums already and came across the load flow solution), but this is more of a modelling problem for State Estimation.

I have a set of differential equations, non linear, which represent a 5 bus structure (3 generators and 2 loads). I have a state vector which stacks together all my state variables of interest.

Trying to research on the forums, what is the appropriate way to model this system? Is it simply to declare a system of equations which can then be solved by ODE45? Please see some example code at the bottom

A subquestion must also be asked. Is it possible to model a non linear system in MATLAB? Or do we have to use simulink.

Another subquestion. Am i confusing modelling the system with solving the differential equations? Is there a difference? I would really appreciate some guidance with this bit of theory.

Example Code (for just one of the 12 equations):

function [dx_dt] = statevector (t,x)

%This function contains the systems of DE describe the state vector

%State Vector x(t) = (Xg(t), Xl(t))

%x(t)=[V1(t),ω1(t),θ2(t),V2(t),ω2(t),θ3(t),V3(t),ω3(t)},θ4(t),V4(t),θ5(t),V5(t}) %x(1) = V1

%x(2) = ω1

%x(3) = θ2

%x(4) = V2

%...and so on

%Generators are busses 1 - 3, Load are busses 4 - 5

%Define Constants J = 1.26; % Inertia Constant D = 2; % Damping Coefficient Tdo = 0.25; % Time Constant Xd = 1.05; Xdp = 0.185; Pmi = 1; % Mechanical Input Power Ef = 1; % Electromagnetic Field

dx_dt = zeros(12,1); %initializing column vector which will contain eqns

%do i need to transpose dx_DT?

dx_dt(1) = 4 * Ef - 4 * x(1) + 3.46 * (2*x(4)*sin(x(3)) + 4*x(4)*cos(x(3)) + x(10)*sin(x(9)) + 4*x(10)* cos(x(4)));

• Please check out this MathJax basic tutorial for how you can format your formulas. – JYelton Aug 28 '13 at 20:56
• If you are trying to do a transient study, involving the response of the generator control systems (AVR, governor) to changing load conditions, then Simulink would be involved. What are you trying to investigate? – Li-aung Yip Sep 27 '13 at 22:59

The way to model the system and solve the system is the following:

• Create a one-line power flow diagram
• Convert everything to per-unit representation
• Enumerate all buses
• Write down a bus admittance matrix
• Now write down your state variables, each load bus has a V and δ, generator buses have only V, and reference buses don't have state variables
• To solve the system you can use many methods like Newton-Raphson or Gauss-Siedel

My best suggestion is that you try to get this book: Schaum's Outline of Electrical Power Systems. It has everything you need in an easy to understand format.

• Thanks Arthur! I believe the method you have outlined is how to do a typical power flow analysis to find out the Voltage and Phase Angles at every bus. These, done on static data, will get me the initial conditions for the differential equations of the generator and loads. From then I should be able to "model" the system in terms of a state model. Please correct me if I am wrong. Where I'm getting confused is, are modelling the system and solving the differential equations the same thing? I should add the main purpose of this exercise is to prepare a model for Dynamic State Estimation. – Shehezaada Aug 28 '13 at 23:14

Wow, 3 years later...I should have answered earlier. There a bunch of misconceptions I had when searching around for this information, I'll clear them up here in case another poor soul in search of the same answers:

1) What is an appropriate way of modeling the Electric Power Grid?

There are many appropriate ways to model any system. There are specialty drag and drop programs that can do this for us (ETAP, CYME), there are models built in Simulink and PSCAD to do this. However, I needed to model the power grid for running state estimation algorithms, and so I needed something called a state model.

The state of a system is simply that - what is it's state? In simple terms - is it stable, is it idle, has there been a fault?

The state of a system is represented by its state variables, and each state variable has its own differential equation. Differential equations describe the behaviour of a system with respect to time. Therefore, we can model the electric power grid by gathering the differential equations for all the state variable, stacking them together, and solving them. We can choose a linear/nonlinear ODE solver from MATLAB (or whatever solver the program your using has), or we can discretize the differential equations, and solve that way. Remember that the output at discrete time (k) is dependent on time index (k-1), so make sure you hold the last values of the state values in memory to be used in the subsequent iteration of your loop.

For the Electric Power Grid - if we know all the bus voltages and angles, we know have enough information to know the state of the power grid. So when you model the grid, make sure these two are in your state model.

2) Is it possible to model a non-linear model in MATLAB? Or do we need Simulink.

You can model anything you like in either of those programs. The non-linearity of the simulation depends on the mathematical equations that govern it. If you have linear equations, you have a linear system. If you have non-linear equations, and you linearize your model (small angle approximation, Taylor series expansion), you have a linear model. In my case I kept the non-linear equations as is and discretized with a fixed time step.

3) Am i confusing modelling the system with solving the differential equations? Is there a difference?

A system model is meant to give a framework that describes the behaviour of the system over time. Solving this model is the implementation to give you that behaviour. Solving the equations gives us behaviour of the model over time.