Give some parameter values to the model, as in the following version of your model:
In[]:=
model=ImportString
,"MO";
And then linearize:
In[]:=
lin=SystemModelLinearize[model,Method->{"SymbolicDerivative","SymbolicParameters"->{"r","l","c","k1","k2","Ron","Goff"}}]//FullSimplify
Out[]=
​
​
Vi
capacitor1.v
-
1.
c
r
1.
c
0.
inductor1.i
-
1.
l
-
1.If[
k1
,1,
Ron
]If[
k2
,1,
Ron
]
(If[
k1
,
Goff
,1]If[
k2
,1,
Ron
]+If[
k1
,1,
Ron
]If[
k2
,
Goff
,1])
l
1.If[
k1
,
Goff
,1]If[
k2
,1,
Ron
]
(If[
k1
,
Goff
,1]If[
k2
,1,
Ron
]+If[
k1
,1,
Ron
]If[
k2
,
Goff
,1])
l
Vc
1.
0
0
Notice that this switch has a non-zero open circuit conductance and a non-zero closed circuit resistance. To model 0 conductance, it’s recommended to use the Modelica.Electrical.Analog.Ideal component instead. Similarly, use a direct connection to model a closed circuit with 0 resistance.
​
The introduction of nonlinear or more complicated components can impede the symbolic linearization, and in that case you will only be able to use a numerical method to linearize.
Let’s consider all the combinations for the boolean parameters:
In[]:=
kVals=Thread[{
k1
,
k2
}->#]&/@Tuples[{{True,False},{True,False}}]
Out[]=
{{
k1
True,
k2
True},{
k1
True,
k2
False},{
k1
False,
k2
True},{
k1
False,
k2
False}}
In[]:=
{#,lin/.#}&/@kVals//TableForm
Out[]//TableForm=
k1
True
k2
True
​
​
Vi
capacitor1.v
-
1.
c
r
1.
c
0.
inductor1.i
-
1.
l
-
0.5
Goff
l
0.5
l
Vc
1.
0
0
k1
True
k2
False
​
​
Vi
capacitor1.v
-
1.
c
r
1.
c
0.
inductor1.i
-
1.
l
-
1.
Ron
l
(1+
Goff
Ron
)
1.
Goff
Ron
l
(1+
Goff
Ron
)
Vc
1.
0
0
k1
False
k2
True
​
​
Vi
capacitor1.v
-
1.
c
r
1.
c
0.
inductor1.i
-
1.
l
-
1.
Ron
l
(1+
Goff
Ron
)
1.
l
(1+
Goff
Ron
)
Vc
1.
0
0
k1
False
k2
False
​
​
Vi
capacitor1.v
-
1.
c
r
1.
c
0.
inductor1.i
-
1.
l
-
0.5
Ron
l
0.5
l
Vc
1.
0
0