## Error using daeic12. This DAE appears to be of index greater than 1.

I’m trying to simulate the response of a power system to a three-phase fault at one of the power lines. The system in question can be described by a set of differential-algebraic equations (44 differential and 34 algebraic equations). The response consists of three intervals:

normal operation (before the fault),

faulted operation (during the three-phase fault at one of the power lines),

post-fault operation (after the disconnection of the faulted power line).

The fault and line disconnection are simulated by modifying the bus-admittance matrix which is used in evaluating the system algebraic equations. The differential equations remain unchanged during all of the three intervals.

The script for solving the DAEs over the three intervals is as follows:

%% Initialization

% Prepare the environment

clear variables

close all

clc

% Load the test system

load(‘Two-area system.mat’,’system’) ;

% Perform the power flow to initialize the system and extract the initial

% conditions for state and algebraic variables

system = system.setInitialConditions() ;

z = [system.x0

system.y0] ;

u = system.u0 ;

% Determine the number of state and algebraic variables

numberOfStateVars = length(system.x0) ;

numberOfAlgVars = length(system.y0);

numberOfStateAndAlgVars = numberOfStateVars + numberOfAlgVars ;

% Creating a mass matrix which weights the derivatives of the state and

% algebraic variables

M = eye(numberOfStateAndAlgVars) ;

M(numberOfStateVars+1:end,numberOfStateVars+1:end) = 0 ;

% Define the options for ODE solver

options = odeset(‘Mass’,M,’RelTol’,1e-6,’AbsTol’,1e-8) ;

%% Disturbance and interval definition

% Add the disturbances to the system

threePhaseFault = Fault(1,1.1,"3-phase fault",3) ;

lineOutage = Outage(1.1,inf,"Branch outage",5) ;

system = system.addDisturbance(threePhaseFault) ;

system = system.addDisturbance(lineOutage) ;

% Total simulation time

tFinal = 10 ;

% Start by adding the initial time

timePoints = [0

[system.disturbances.tStart]’

[system.disturbances.tEnd]’

tFinal] ;

% Remove duplicates and sort the time points

timePoints = unique(timePoints) ;

timePoints(isinf(timePoints)) = [] ;

%% Main loop

% Loop through each interval and solve the DAEs

tOutput = [] ;

zOutput = [] ;

for i = 1 : length(timePoints) – 1

% Define the current time span

tSpan = [timePoints(i) timePoints(i+1)-1e-6] ;

% Call the ODE solver

[tSol,zSol] = ode15s(@(t,z)system.evaluateDAEs(t,z,u),tSpan,z,options) ;

% Append the current solution

tOutput = [tOutput

tSol] ;

zOutput = [zOutput

zSol] ;

% Extract the values of state and algebraic variables at the end of the

% current interval

x = zOutput(end,1:numberOfStateVars) ;

y = zOutput(end,numberOfStateVars+1:end) ;

% While the state variables can’t change immediately, the algebraic

% variables can. Determine the initial values for the algebraic

% variables after the fault is applied. The initial values of the state

% variables for the next interval remain unchanged.

y = fsolve(@(y) system.evaluateAlgEqns(x,y,u,timePoints(i+1)),y) ;

% Create a new initial vector

z = [x y]’ ;

end

The code properly solves the DAEs during the normal operation. The initial conditions for the faulted interval are also properly determined (the algebraic variable corresponding to the voltage of the faulted bus is 0, which is expected). However, when the integration for the faulted interval starts, I receive an error:

Error using daeic12

This DAE appears to be of index greater than 1.

Error in ode15s (line 298)

[y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(ode,odeArgs,t,ICtype,Mt,y,yp0,f0,…)

Can someone provide any insight in how to debug this issue?I’m trying to simulate the response of a power system to a three-phase fault at one of the power lines. The system in question can be described by a set of differential-algebraic equations (44 differential and 34 algebraic equations). The response consists of three intervals:

normal operation (before the fault),

faulted operation (during the three-phase fault at one of the power lines),

post-fault operation (after the disconnection of the faulted power line).

The fault and line disconnection are simulated by modifying the bus-admittance matrix which is used in evaluating the system algebraic equations. The differential equations remain unchanged during all of the three intervals.

The script for solving the DAEs over the three intervals is as follows:

%% Initialization

% Prepare the environment

clear variables

close all

clc

% Load the test system

load(‘Two-area system.mat’,’system’) ;

% Perform the power flow to initialize the system and extract the initial

% conditions for state and algebraic variables

system = system.setInitialConditions() ;

z = [system.x0

system.y0] ;

u = system.u0 ;

% Determine the number of state and algebraic variables

numberOfStateVars = length(system.x0) ;

numberOfAlgVars = length(system.y0);

numberOfStateAndAlgVars = numberOfStateVars + numberOfAlgVars ;

% Creating a mass matrix which weights the derivatives of the state and

% algebraic variables

M = eye(numberOfStateAndAlgVars) ;

M(numberOfStateVars+1:end,numberOfStateVars+1:end) = 0 ;

% Define the options for ODE solver

options = odeset(‘Mass’,M,’RelTol’,1e-6,’AbsTol’,1e-8) ;

%% Disturbance and interval definition

% Add the disturbances to the system

threePhaseFault = Fault(1,1.1,"3-phase fault",3) ;

lineOutage = Outage(1.1,inf,"Branch outage",5) ;

system = system.addDisturbance(threePhaseFault) ;

system = system.addDisturbance(lineOutage) ;

% Total simulation time

tFinal = 10 ;

% Start by adding the initial time

timePoints = [0

[system.disturbances.tStart]’

[system.disturbances.tEnd]’

tFinal] ;

% Remove duplicates and sort the time points

timePoints = unique(timePoints) ;

timePoints(isinf(timePoints)) = [] ;

%% Main loop

% Loop through each interval and solve the DAEs

tOutput = [] ;

zOutput = [] ;

for i = 1 : length(timePoints) – 1

% Define the current time span

tSpan = [timePoints(i) timePoints(i+1)-1e-6] ;

% Call the ODE solver

[tSol,zSol] = ode15s(@(t,z)system.evaluateDAEs(t,z,u),tSpan,z,options) ;

% Append the current solution

tOutput = [tOutput

tSol] ;

zOutput = [zOutput

zSol] ;

% Extract the values of state and algebraic variables at the end of the

% current interval

x = zOutput(end,1:numberOfStateVars) ;

y = zOutput(end,numberOfStateVars+1:end) ;

% While the state variables can’t change immediately, the algebraic

% variables can. Determine the initial values for the algebraic

% variables after the fault is applied. The initial values of the state

% variables for the next interval remain unchanged.

y = fsolve(@(y) system.evaluateAlgEqns(x,y,u,timePoints(i+1)),y) ;

% Create a new initial vector

z = [x y]’ ;

end

The code properly solves the DAEs during the normal operation. The initial conditions for the faulted interval are also properly determined (the algebraic variable corresponding to the voltage of the faulted bus is 0, which is expected). However, when the integration for the faulted interval starts, I receive an error:

Error using daeic12

This DAE appears to be of index greater than 1.

Error in ode15s (line 298)

[y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(ode,odeArgs,t,ICtype,Mt,y,yp0,f0,…)

Can someone provide any insight in how to debug this issue? I’m trying to simulate the response of a power system to a three-phase fault at one of the power lines. The system in question can be described by a set of differential-algebraic equations (44 differential and 34 algebraic equations). The response consists of three intervals:

normal operation (before the fault),

faulted operation (during the three-phase fault at one of the power lines),

post-fault operation (after the disconnection of the faulted power line).

The fault and line disconnection are simulated by modifying the bus-admittance matrix which is used in evaluating the system algebraic equations. The differential equations remain unchanged during all of the three intervals.

The script for solving the DAEs over the three intervals is as follows:

%% Initialization

% Prepare the environment

clear variables

close all

clc

% Load the test system

load(‘Two-area system.mat’,’system’) ;

% Perform the power flow to initialize the system and extract the initial

% conditions for state and algebraic variables

system = system.setInitialConditions() ;

z = [system.x0

system.y0] ;

u = system.u0 ;

% Determine the number of state and algebraic variables

numberOfStateVars = length(system.x0) ;

numberOfAlgVars = length(system.y0);

numberOfStateAndAlgVars = numberOfStateVars + numberOfAlgVars ;

% Creating a mass matrix which weights the derivatives of the state and

% algebraic variables

M = eye(numberOfStateAndAlgVars) ;

M(numberOfStateVars+1:end,numberOfStateVars+1:end) = 0 ;

% Define the options for ODE solver

options = odeset(‘Mass’,M,’RelTol’,1e-6,’AbsTol’,1e-8) ;

%% Disturbance and interval definition

% Add the disturbances to the system

threePhaseFault = Fault(1,1.1,"3-phase fault",3) ;

lineOutage = Outage(1.1,inf,"Branch outage",5) ;

system = system.addDisturbance(threePhaseFault) ;

system = system.addDisturbance(lineOutage) ;

% Total simulation time

tFinal = 10 ;

% Start by adding the initial time

timePoints = [0

[system.disturbances.tStart]’

[system.disturbances.tEnd]’

tFinal] ;

% Remove duplicates and sort the time points

timePoints = unique(timePoints) ;

timePoints(isinf(timePoints)) = [] ;

%% Main loop

% Loop through each interval and solve the DAEs

tOutput = [] ;

zOutput = [] ;

for i = 1 : length(timePoints) – 1

% Define the current time span

tSpan = [timePoints(i) timePoints(i+1)-1e-6] ;

% Call the ODE solver

[tSol,zSol] = ode15s(@(t,z)system.evaluateDAEs(t,z,u),tSpan,z,options) ;

% Append the current solution

tOutput = [tOutput

tSol] ;

zOutput = [zOutput

zSol] ;

% Extract the values of state and algebraic variables at the end of the

% current interval

x = zOutput(end,1:numberOfStateVars) ;

y = zOutput(end,numberOfStateVars+1:end) ;

% While the state variables can’t change immediately, the algebraic

% variables can. Determine the initial values for the algebraic

% variables after the fault is applied. The initial values of the state

% variables for the next interval remain unchanged.

y = fsolve(@(y) system.evaluateAlgEqns(x,y,u,timePoints(i+1)),y) ;

% Create a new initial vector

z = [x y]’ ;

end

The code properly solves the DAEs during the normal operation. The initial conditions for the faulted interval are also properly determined (the algebraic variable corresponding to the voltage of the faulted bus is 0, which is expected). However, when the integration for the faulted interval starts, I receive an error:

Error using daeic12

This DAE appears to be of index greater than 1.

Error in ode15s (line 298)

[y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(ode,odeArgs,t,ICtype,Mt,y,yp0,f0,…)

Can someone provide any insight in how to debug this issue? differential equations, ode15s, ode, dae MATLAB Answers — New Questions