diff --git a/Modelica/Electrical/Analog/Ideal/ControlledIdealIntermediateSwitch.mo b/Modelica/Electrical/Analog/Ideal/ControlledIdealIntermediateSwitch.mo index 6bfa7ad511..0d8cf4851d 100644 --- a/Modelica/Electrical/Analog/Ideal/ControlledIdealIntermediateSwitch.mo +++ b/Modelica/Electrical/Analog/Ideal/ControlledIdealIntermediateSwitch.mo @@ -30,19 +30,19 @@ protected equation control.i = 0; - p1.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); - p2.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then 1 else Ron); - p1.v - n2.v = (s3*unitCurrent)*(if (control.v > level) then Ron else 1); - p2.v - n1.v = (s4*unitCurrent)*(if (control.v > level) then Ron else 1); + p1.v - n1.v = s1*(if (control.v > level) then unitVoltage else Ron*unitCurrent); + p2.v - n2.v = s2*(if (control.v > level) then unitVoltage else Ron*unitCurrent); + p1.v - n2.v = s3*(if (control.v > level) then Ron*unitCurrent else unitVoltage); + p2.v - n1.v = s4*(if (control.v > level) then Ron*unitCurrent else unitVoltage); p1.i = if control.v > level then s1*unitVoltage*Goff + s3*unitCurrent else s1*unitCurrent + s3*unitVoltage*Goff; p2.i = if control.v > level then s2*unitVoltage*Goff + s4*unitCurrent else s2*unitCurrent + s4*unitVoltage*Goff; - n1.i = if control.v > level then -s1*unitVoltage*Goff - s4*unitCurrent - else -s1*unitCurrent - s4*unitVoltage*Goff; - n2.i = if control.v > level then -s2*unitVoltage*Goff - s3*unitCurrent - else -s2*unitCurrent - s3*unitVoltage*Goff; + -n1.i = if control.v > level then s1*unitVoltage*Goff + s4*unitCurrent else + s1*unitCurrent + s4*unitVoltage*Goff; + -n2.i = if control.v > level then s2*unitVoltage*Goff + s3*unitCurrent else + s2*unitCurrent + s3*unitVoltage*Goff; LossPower = p1.i*p1.v + p2.i*p2.v + n1.i*n1.v + n2.i*n2.v; annotation (defaultComponentName="switch", diff --git a/Modelica/Electrical/Analog/Ideal/ControlledIdealTwoWaySwitch.mo b/Modelica/Electrical/Analog/Ideal/ControlledIdealTwoWaySwitch.mo index d12f492e9a..671bc3c339 100644 --- a/Modelica/Electrical/Analog/Ideal/ControlledIdealTwoWaySwitch.mo +++ b/Modelica/Electrical/Analog/Ideal/ControlledIdealTwoWaySwitch.mo @@ -26,10 +26,10 @@ equation control.i = 0; 0 = p.i + n2.i + n1.i; - p.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); - n1.i = -(s1*unitVoltage)*(if (control.v > level) then Goff else 1); - p.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then Ron else 1); - n2.i = -(s2*unitVoltage)*(if (control.v > level) then 1 else Goff); + p.v - n1.v = s1*(if (control.v > level) then unitVoltage else Ron*unitCurrent); + n1.i = -s1*(if (control.v > level) then Goff*unitVoltage else unitCurrent); + p.v - n2.v = s2*(if (control.v > level) then Ron*unitCurrent else unitVoltage); + n2.i = -s2*(if (control.v > level) then unitCurrent else Goff*unitVoltage); LossPower = p.i*p.v + n1.i*n1.v + n2.i*n2.v; annotation (defaultComponentName="switch", Documentation(info=" diff --git a/Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo b/Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo index 34aea2ada8..57c700f192 100644 --- a/Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo +++ b/Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo @@ -26,19 +26,19 @@ protected constant SI.Voltage unitVoltage=1 annotation (HideResult=true); constant SI.Current unitCurrent=1 annotation (HideResult=true); equation - p1.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); - p2.v - n2.v = (s2*unitCurrent)*(if (control) then 1 else Ron); - p1.v - n2.v = (s3*unitCurrent)*(if (control) then Ron else 1); - p2.v - n1.v = (s4*unitCurrent)*(if (control) then Ron else 1); + p1.v - n1.v = s1*(if control then unitVoltage else Ron*unitCurrent); + p2.v - n2.v = s2*(if control then unitVoltage else Ron*unitCurrent); + p1.v - n2.v = s3*(if control then Ron*unitCurrent else unitVoltage); + p2.v - n1.v = s4*(if control then Ron*unitCurrent else unitVoltage); - p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else s1* - unitCurrent + s3*unitVoltage*Goff; - p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else s2* - unitCurrent + s4*unitVoltage*Goff; - n1.i = if control then -s1*unitVoltage*Goff - s4*unitCurrent else -s1* - unitCurrent - s4*unitVoltage*Goff; - n2.i = if control then -s2*unitVoltage*Goff - s3*unitCurrent else -s2* - unitCurrent - s3*unitVoltage*Goff; + p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else + s1*unitCurrent + s3*unitVoltage*Goff; + p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else + s2*unitCurrent + s4*unitVoltage*Goff; + -n1.i = if control then s1*unitVoltage*Goff + s4*unitCurrent else + s1*unitCurrent + s4*unitVoltage*Goff; + -n2.i = if control then s2*unitVoltage*Goff + s3*unitCurrent else + s2*unitCurrent + s3*unitVoltage*Goff; LossPower = p1.i*p1.v + p2.i*p2.v + n1.i*n1.v + n2.i*n2.v; annotation (defaultComponentName="switch", diff --git a/Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo b/Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo index fdc41f840a..0fd62db204 100644 --- a/Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo +++ b/Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo @@ -27,10 +27,10 @@ protected equation 0 = p.i + n2.i + n1.i; - p.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); - n1.i = -(s1*unitVoltage)*(if (control) then Goff else 1); - p.v - n2.v = (s2*unitCurrent)*(if (control) then Ron else 1); - n2.i = -(s2*unitVoltage)*(if (control) then 1 else Goff); + p.v - n1.v = s1*(if control then unitVoltage else Ron*unitCurrent); + n1.i = -s1*(if control then Goff*unitVoltage else unitCurrent); + p.v - n2.v = s2*(if control then Ron*unitCurrent else unitVoltage); + n2.i = -s2*(if control then unitCurrent else Goff*unitVoltage); LossPower = p.i*p.v + n1.i*n1.v + n2.i*n2.v; annotation (defaultComponentName="switch", Documentation(info=" diff --git a/Modelica/Electrical/Analog/Interfaces/IdealSemiconductor.mo b/Modelica/Electrical/Analog/Interfaces/IdealSemiconductor.mo index 1f1c1488d1..a045ae5f74 100644 --- a/Modelica/Electrical/Analog/Interfaces/IdealSemiconductor.mo +++ b/Modelica/Electrical/Analog/Interfaces/IdealSemiconductor.mo @@ -18,8 +18,8 @@ protected constant SI.Voltage unitVoltage=1 annotation (HideResult=true); constant SI.Current unitCurrent=1 annotation (HideResult=true); equation - v = (s*unitCurrent)*(if off then 1 else Ron) + Vknee; - i = (s*unitVoltage)*(if off then Goff else 1) + Goff*Vknee; + v = s*(if off then unitVoltage else Ron*unitCurrent) + Vknee; + i = s*(if off then Goff*unitVoltage else unitCurrent) + Goff*Vknee; LossPower = v*i; annotation ( Documentation(info=" diff --git a/Modelica/Electrical/Analog/Interfaces/IdealSwitch.mo b/Modelica/Electrical/Analog/Interfaces/IdealSwitch.mo index a52c8405ec..20e3726851 100644 --- a/Modelica/Electrical/Analog/Interfaces/IdealSwitch.mo +++ b/Modelica/Electrical/Analog/Interfaces/IdealSwitch.mo @@ -12,8 +12,8 @@ protected constant SI.Voltage unitVoltage=1 annotation (HideResult=true); constant SI.Current unitCurrent=1 annotation (HideResult=true); equation - v = (s*unitCurrent)*(if off then 1 else Ron); - i = (s*unitVoltage)*(if off then Goff else 1); + v = s*(if off then unitVoltage else Ron*unitCurrent); + i = s*(if off then Goff*unitVoltage else unitCurrent); LossPower = v*i; annotation ( Documentation(info="