reduceDAEIndex
Convert system of first-order differential algebraic equations to equivalent system of differential index 1
Syntax
Description
[
converts a high-index system of first-order differential algebraic equationsnewEqs
,newVars
] = reduceDAEIndex(eqs
,vars
)eqs
to an equivalent systemnewEqs
of differential index 1.
reduceDAEIndex
keeps the original equations and variables and introduces new variables and equations. After conversion,reduceDAEIndex
checks the differential index of the new system by callingisLowIndexDAE
. If the index ofnewEqs
is 2 or higher, thenreduceDAEIndex
issues a warning.
Examples
Reduce Differential Index of DAE System
Check if the following DAE system has a low (0
or1
) or high (>1
) differential index. If the index is higher than1
, then usereduceDAEIndex
减少它。
Create the following system of two differential algebraic equations. Here, the symbolic functionsx(t)
,y(t)
, andz(t)
represent the state variables of the system. Specify the equations and variables as two symbolic vectors: equations as a vector of symbolic equations, and variables as a vector of symbolic function calls.
syms x(t) y(t) z(t) f(t) eqs = [diff(x) == x + z, diff(y) == f(t), x == y]; vars = [x(t), y(t), z(t)];
UseisLowIndexDAE
to check the differential index of the system. For this system,isLowIndexDAE
returns0
(false
). This means that the differential index of the system is2
或更高版本。
isLowIndexDAE(eqs, vars)
ans = logical 0
UsereduceDAEIndex
to rewrite the system so that the differential index is1
. The new system has one additional state variable,Dyt(t)
.
[newEqs, newVars] = reduceDAEIndex(eqs, vars)
newEqs = diff (x (t), t) - z (t) x (t) Dyt (t) - f (t)x(t) - y(t) diff(x(t), t) - Dyt(t) newVars = x(t) y(t) z(t) Dyt(t)
Check if the differential order of the new system is lower than2
.
isLowIndexDAE(newEqs, newVars)
ans = logical 1
Reduce the Index and Return More Details
Reduce the differential index of a system that contains two second-order differential algebraic equation. Because the equations are second-order equations, first usereduceDifferentialOrder
to rewrite the system to a system of first-order DAEs.
Create the following system of two second-order DAEs. Here,x(t)
,y(t)
, andF(t)
are the state variables of the system. Specify the equations and variables as two symbolic vectors: equations as a vector of symbolic equations, and variables as a vector of symbolic function calls.
syms t x(t) y(t) F(t) r g eqs = [diff(x(t), t, t) == -F(t)*x(t),... diff(y(t), t, t) == -F(t)*y(t) - g,... x(t)^2 + y(t)^2 == r^2 ]; vars = [x(t), y(t), F(t)];
Rewrite this system so that all equations become first-order differential equations. ThereduceDifferentialOrder
function replaces the second-order DAE by two first-order expressions by introducing the new variablesDxt(t)
andDyt(t)
. It also replaces the first-order equations by symbolic expressions.
[eqs, vars] = reduceDifferentialOrder(eqs, vars)
eqs = diff(Dxt(t), t) + F(t)*x(t) diff(Dyt(t), t) + g + F(t)*y(t) - r^2 + x(t)^2 + y(t)^2 Dxt(t) - diff(x(t), t) Dyt(t) - diff(y(t), t) vars = x(t) y(t) F(t) Dxt(t) Dyt(t)
UsereduceDAEIndex
to rewrite the system so that the differential index is1
.
[eqs, vars, R, originalIndex] = reduceDAEIndex(eqs, vars)
eqs = Dxtt(t) + F(t)*x(t) g + Dytt(t) + F(t)*y(t) - r^2 + x(t)^2 + y(t)^2 Dxt(t) - Dxt1(t) Dyt(t) - Dyt1(t) 2*Dxt1(t)*x(t) + 2*Dyt1(t)*y(t) 2*Dxt1t(t)*x(t) + 2*Dxt1(t)^2 + 2*Dyt1(t)^2 + 2*y(t)*diff(Dyt1(t), t) Dxtt(t) - Dxt1t(t) Dytt(t) - diff(Dyt1(t), t) Dyt1(t) - diff(y(t), t) vars = x(t) y(t) F(t) Dxt(t) Dyt(t) Dytt(t) Dxtt(t) Dxt1(t) Dyt1(t) Dxt1t(t) R = [ Dytt(t), diff(Dyt(t), t)] [ Dxtt(t), diff(Dxt(t), t)] [ Dxt1(t), diff(x(t), t)] [ Dyt1(t), diff(y(t), t)] [ Dxt1t(t), diff(x(t), t, t)] originalIndex = 3
UsereduceRedundancies
to shorten the system.
[eqs, vars] = reduceRedundancies(eqs, vars)
eqs = Dxtt(t) + F(t)*x(t) g + Dytt(t) + F(t)*y(t) - r^2 + x(t)^2 + y(t)^2 2*Dxt(t)*x(t) + 2*Dyt(t)*y(t) 2*Dxtt(t)*x(t) + 2*Dytt(t)*y(t) + 2*Dxt(t)^2 + 2*Dyt(t)^2 Dytt(t) - diff(Dyt(t), t) Dyt(t) - diff(y(t), t) vars = x(t) y(t) F(t) Dxt(t) Dyt(t) Dytt(t) Dxtt(t)
Input Arguments
Output Arguments
Algorithms
The implementation ofreduceDAEIndex
uses the Pantelides algorithm. This algorithm reduces higher-index systems to lower-index systems by selectively adding differentiated forms of the original equations. The Pantelides algorithm can underestimate the differential index of a new system, and therefore, can fail to reduce the differential index to1
. In this case,reduceDAEIndex
issues a warning and, for the syntax with four output arguments, returns the value ofoldIndex
asNaN
. ThereduceDAEToODE
function uses more reliable, but slower Gaussian elimination. Note thatreduceDAEToODE
requires the DAE system to be semilinear.