using "types";
# index-1 formulation
FlowSheet index_prob
PARAMETERS
e as negative;
VARIABLES
y1 as Real;
y2 as Real;
x as Real;
EQUATIONS
diff(y1)*'s' = y2;
diff(y2)*'s' = x;
y1 - e*x = sin(time*'rad/s');
SET
e = -0.1; # system is unstable if e > 0, and index-3 if e = 0
INITIAL
# y1 = 1; # initial condition that tends to be inconsistent when e goes to zero
y1 = 0;
y2 = 1;
OPTIONS
DAESolver (File = "dasslc");
TimeStep = 0.1;
TimeEnd = 10;
TimeUnit = 's';
end
# index-3 formulation
FlowSheet index_prob2
VARIABLES
y1 as Real;
y2 as Real;
x as Real;
EQUATIONS
diff(y1)*'s' = y2;
diff(y2)*'s' = x;
y1 = sin(time*'rad/s');
OPTIONS
DAESolver (File = "dasslc");
TimeStep = 0.1;
TimeEnd = 10;
TimeUnit = 's';
end