Line 45: | Line 45: | ||
---- | ---- | ||
'''STEP 3''' | '''STEP 3''' | ||
+ | |||
+ | Download [http://www.ccy.zcu.cz/files/MS2_2015/Matlab/odefunBall.m odefunBall.m], the residual function defining the DAE system for a pendulum. Use this as a template to construct a function for the network load. | ||
+ | |||
+ | The first line of you function should be: | ||
+ | |||
+ | r = dLoad(t,x,d,z,p) | ||
+ | |||
+ | where | ||
+ | % t = time | ||
+ | % x: the continuous state vector; x = [xd Pd Qd V3R V3I]; | ||
+ | %z: discrete state vector; z = []; | ||
+ | %p: parameter vector; p = [Tp Ps Pt]; where Tp = 5; Ps = 3; Pt = .4; | ||
---- | ---- | ||
'''STEP 4''' | '''STEP 4''' | ||
+ | |||
+ | Compute the time response of the load using the ode15i solver. The command is as follows: | ||
+ | |||
+ | |||
+ | sol = ode15i(@(t,x,d)odefunBall(t,x,d,z,p),[0 5],x0,d0); where x0 and d0 are computed using the function decic. |
Revision as of 12:18, 12 November 2015
The purpose of this exercise is to
- Construct a network residual model in MATLAB
- Solve network algebraic equations using MATLAB function fsolve
- Construct an DAE model of a network load in MATLAB
- Compute the time response using the implicit solver ode15i
STEP 1
Download loadFlowOne.m, the residual function constructed in lecture and extend it to the full network. The first line of your function should be: [r,J] = dNetwork(x,s,z,p)
The inputs are defined as follows: %x: network voltages; x = [V2R V2I V3R V3I]; %s: network injections; s = [-4 3]; %z: dynamic parameters; z = [1 1]; %p: static parameters; p = [X1 X2 Vm Vp nsT Qm Qp nsC];
The static parameters have the following values: X1 = 0.03; X2 = .05; Vm = .98; Vp = 1.02; Qm = -.25; Qp = .25; nsT = 0.025; nsC = .2;
The outputs are defined as follows: %r: residual; %J: Jacobian of the residual; J = dr/dx
STEP 2
Compute the voltages V2 and V3 using the following command: Vn = fsolve(@(x)dNetwork(x,s,z,p),[V2R0 V2I0 V3R0 V3I0],optimoptions('fsolve','Jacobian','on','tolx',1e-12,'tolfun',1e-6,'display','off'));
Use the flat start for the initial voltage values, i.e., V2R0 = 1; V3R0 = 1; V2I0 = 0; V3I0 = 0;
The result should be: Vn = [0.9846 0.0300 0.9651 -0.1229];
STEP 3
Download odefunBall.m, the residual function defining the DAE system for a pendulum. Use this as a template to construct a function for the network load.
The first line of you function should be:
r = dLoad(t,x,d,z,p)
where % t = time % x: the continuous state vector; x = [xd Pd Qd V3R V3I]; %z: discrete state vector; z = []; %p: parameter vector; p = [Tp Ps Pt]; where Tp = 5; Ps = 3; Pt = .4;
STEP 4
Compute the time response of the load using the ode15i solver. The command is as follows:
sol = ode15i(@(t,x,d)odefunBall(t,x,d,z,p),[0 5],x0,d0); where x0 and d0 are computed using the function decic.