Skip to content

Commit 99c46d9

Browse files
committed
same issue with Electrical.Analog.Ideal.{IdealTwoWaySwitch, IdealIntermediateSwitch, ControlledIdealTwoWaySwitch, ControlledIdealIntermediateSwitch}
1 parent c6c5e4b commit 99c46d9

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

Modelica/Electrical/Analog/Ideal/ControlledIdealIntermediateSwitch.mo

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ protected
3030
equation
3131
control.i = 0;
3232

33-
p1.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron);
34-
p2.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then 1 else Ron);
35-
p1.v - n2.v = (s3*unitCurrent)*(if (control.v > level) then Ron else 1);
36-
p2.v - n1.v = (s4*unitCurrent)*(if (control.v > level) then Ron else 1);
33+
p1.v - n1.v = s1*(if (control.v > level) then unitVoltage else Ron*unitCurrent);
34+
p2.v - n2.v = s2*(if (control.v > level) then unitVoltage else Ron*unitCurrent);
35+
p1.v - n2.v = s3*(if (control.v > level) then Ron*unitCurrent else unitVoltage);
36+
p2.v - n1.v = s4*(if (control.v > level) then Ron*unitCurrent else unitVoltage);
3737

3838
p1.i = if control.v > level then s1*unitVoltage*Goff + s3*unitCurrent else
3939
s1*unitCurrent + s3*unitVoltage*Goff;
4040
p2.i = if control.v > level then s2*unitVoltage*Goff + s4*unitCurrent else
4141
s2*unitCurrent + s4*unitVoltage*Goff;
42-
n1.i = if control.v > level then -s1*unitVoltage*Goff - s4*unitCurrent
43-
else -s1*unitCurrent - s4*unitVoltage*Goff;
44-
n2.i = if control.v > level then -s2*unitVoltage*Goff - s3*unitCurrent
45-
else -s2*unitCurrent - s3*unitVoltage*Goff;
42+
-n1.i = if control.v > level then s1*unitVoltage*Goff + s4*unitCurrent else
43+
s1*unitCurrent + s4*unitVoltage*Goff;
44+
-n2.i = if control.v > level then s2*unitVoltage*Goff + s3*unitCurrent else
45+
s2*unitCurrent + s3*unitVoltage*Goff;
4646

4747
LossPower = p1.i*p1.v + p2.i*p2.v + n1.i*n1.v + n2.i*n2.v;
4848
annotation (defaultComponentName="switch",

Modelica/Electrical/Analog/Ideal/ControlledIdealTwoWaySwitch.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ equation
2626
control.i = 0;
2727
0 = p.i + n2.i + n1.i;
2828

29-
p.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron);
30-
n1.i = -(s1*unitVoltage)*(if (control.v > level) then Goff else 1);
31-
p.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then Ron else 1);
32-
n2.i = -(s2*unitVoltage)*(if (control.v > level) then 1 else Goff);
29+
p.v - n1.v = s1*(if (control.v > level) then unitVoltage else Ron*unitCurrent);
30+
n1.i = -s1*(if (control.v > level) then Goff*unitVoltage else unitCurrent);
31+
p.v - n2.v = s2*(if (control.v > level) then Ron*unitCurrent else unitVoltage);
32+
n2.i = -s2*(if (control.v > level) then unitCurrent else Goff*unitVoltage);
3333
LossPower = p.i*p.v + n1.i*n1.v + n2.i*n2.v;
3434
annotation (defaultComponentName="switch",
3535
Documentation(info="<html>

Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ protected
2626
constant SI.Voltage unitVoltage=1 annotation (HideResult=true);
2727
constant SI.Current unitCurrent=1 annotation (HideResult=true);
2828
equation
29-
p1.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron);
30-
p2.v - n2.v = (s2*unitCurrent)*(if (control) then 1 else Ron);
31-
p1.v - n2.v = (s3*unitCurrent)*(if (control) then Ron else 1);
32-
p2.v - n1.v = (s4*unitCurrent)*(if (control) then Ron else 1);
29+
p1.v - n1.v = s1*(if control then unitVoltage else Ron*unitCurrent);
30+
p2.v - n2.v = s2*(if control then unitVoltage else Ron*unitCurrent);
31+
p1.v - n2.v = s3*(if control then Ron*unitCurrent else unitVoltage);
32+
p2.v - n1.v = s4*(if control then Ron*unitCurrent else unitVoltage);
3333

34-
p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else s1*
35-
unitCurrent + s3*unitVoltage*Goff;
36-
p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else s2*
37-
unitCurrent + s4*unitVoltage*Goff;
38-
n1.i = if control then -s1*unitVoltage*Goff - s4*unitCurrent else -s1*
39-
unitCurrent - s4*unitVoltage*Goff;
40-
n2.i = if control then -s2*unitVoltage*Goff - s3*unitCurrent else -s2*
41-
unitCurrent - s3*unitVoltage*Goff;
34+
p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else
35+
s1*unitCurrent + s3*unitVoltage*Goff;
36+
p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else
37+
s2*unitCurrent + s4*unitVoltage*Goff;
38+
-n1.i = if control then s1*unitVoltage*Goff + s4*unitCurrent else
39+
s1*unitCurrent + s4*unitVoltage*Goff;
40+
-n2.i = if control then s2*unitVoltage*Goff + s3*unitCurrent else
41+
s2*unitCurrent + s3*unitVoltage*Goff;
4242

4343
LossPower = p1.i*p1.v + p2.i*p2.v + n1.i*n1.v + n2.i*n2.v;
4444
annotation (defaultComponentName="switch",

Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ protected
2727
equation
2828
0 = p.i + n2.i + n1.i;
2929

30-
p.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron);
31-
n1.i = -(s1*unitVoltage)*(if (control) then Goff else 1);
32-
p.v - n2.v = (s2*unitCurrent)*(if (control) then Ron else 1);
33-
n2.i = -(s2*unitVoltage)*(if (control) then 1 else Goff);
30+
p.v - n1.v = s1*(if control then unitVoltage else Ron*unitCurrent);
31+
n1.i = -s1*(if control then Goff*unitVoltage else unitCurrent);
32+
p.v - n2.v = s2*(if control then Ron*unitCurrent else unitVoltage);
33+
n2.i = -s2*(if control then unitCurrent else Goff*unitVoltage);
3434
LossPower = p.i*p.v + n1.i*n1.v + n2.i*n2.v;
3535
annotation (defaultComponentName="switch",
3636
Documentation(info="<html>

0 commit comments

Comments
 (0)