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)));