Problem statement

State model

We will use the State package, which must already be installed.

<<StateMint`
?stateEquations

inVars={
Qs[t],
Ps1[t],
Ps2[t]
};
primaryVars={
PC1[t],
PC2[t],
QL1[t],
ΩJ[t],
iL2[t],
vC3[t],
PR1[t],
PR2[t],
P1[t],
T2[t],
TB[t],
T3[t],
v4[t],
vR3[t],
iR4[t]
};
elementalEqs={
PC1'[t] == 1/C1 * QC1[t],
PC2'[t] == 1/C2 * QC2[t],
QL1'[t] == 1/L1 * PL1[t],
ΩJ'[t] == 1/J * TJ[t],
iL2'[t] == 1/L2 * vL2[t],
vC3'[t] == 1/C3 * iC3[t],
PR1[t] == QR1[t] * R1,
PR2[t] == QR2[t] * R2,
T2[t] == -α*Q1[t],
Ω2[t] == 1/α * P1[t],
ΩB[t] == 1/B * TB[t],
i4[t] == -1/km * T3[t],
v4[t] == km * Ω3[t],
vR3[t] == iR3[t] * R3,
iR4[t] == 1/R4 * vR4[t]
};
constraintEqs = {(* continuity and compatibility *)
QC1[t] == Qs[t] - QL1[t],
QC2[t] == QL1[t],
PL1[t] == -PR1[t] + PC1[t] - PC2[t] - PR2[t] + Ps2[t] - P1[t] + Ps1[t],
TJ[t] == -T2[t] - TB[t] - T3[t],
vL2[t] == -vR3[t] + v4[t] - vC3[t],
iC3[t] == iL2[t] - iR4[t],
QR1[t] == QL1[t],
QR2[t] == QL1[t],
Q1[t] == QL1[t],
Ω2[t] == ΩJ[t],
ΩB[t] == ΩJ[t],
Ω3[t] == ΩJ[t],
i4[t] == -iL2[t],
iR3[t] == iL2[t],
vR4[t] == vC3[t]
};

ass={C1,C2,C3,L1,L2,R1,R2,R3,R4,B,km,α}//Thread[#>0]&; (* assumptions *)

Find state equation.

stateSolution=stateEquations[inVars,primaryVars,elementalEqs,constraintEqs]//Flatten;
stateVars = "state variables"/.stateSolution;
stateEqList = "RHS"/.stateSolution;
"state equations"/.stateSolution//TableForm

Linearize the state equation about an operating point.

?linearizeState

(* symbolic operating point for state variables (can be numeric) *)
x0= ConstantArray[0,Dimensions[stateVars]] ;
(* symbolic operating point for input variables (can be numeric) *)
u0= ConstantArray[0,Dimensions[inVars]] ;
abe=linearizeState[inVars,stateVars,stateEqList,u0,x0];
{a,b,e} = abe;
a//MatrixForm//Print["A = ",#]&
b//MatrixForm//Print["B = ",#]&