Skip to content

Commit

Permalink
Merge branch 'master' into final-propagation-c
Browse files Browse the repository at this point in the history
  • Loading branch information
AHaumer authored Jan 15, 2025
2 parents 6444f0a + 2a55021 commit 846d12b
Show file tree
Hide file tree
Showing 68 changed files with 1,457 additions and 636 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.cmake text
*.csv text
*.h text
*.htm* text
Expand Down Expand Up @@ -46,3 +47,5 @@ Modelica/Resources/Images/Magnetic/FluxTubes/Shapes/HollowCylinder.vsdx export-i
Modelica/Resources/Images/Magnetic/FluxTubes/Shapes/Toroid.vsdx export-ignore
Modelica/Resources/Reference export-ignore
ModelicaTest/Resources/Reference export-ignore

*.mo linguist-language=Modelica
124 changes: 118 additions & 6 deletions .github/workflows/checkCI.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
name: CI

on: [pull_request]
on:
push:
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
external_c_checks:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Build libraries
- name: Configure
run: |
rm -rf Modelica/Resources/Library/*
mkdir -p Modelica/Resources/Library/$LIBDIR
pushd Modelica/Resources/BuildProjects/autotools
git clean -fdx .
./autogen.sh
./configure --libdir="$PWD/../../Library/$LIBDIR" --enable-static --disable-shared --enable-static-zlib --disable-hdf5 CPPFLAGS="-I${GITHUB_WORKSPACE}/.CI/Test"
popd
env:
LIBDIR: linux64
- name: Build
run: |
pushd Modelica/Resources/BuildProjects/autotools
make --output-sync
sudo make install
popd
Expand All @@ -30,11 +44,105 @@ jobs:
env:
LIBDIR: linux64
CC: gcc

external_c_checks_cmake:
name: external_c_checks_cmake_${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
toolchain:
- linux-gcc
- macos-clang
- windows-msvc
- windows-mingw
configuration:
- Debug
include:
- toolchain: linux-gcc
os: ubuntu-latest
compiler: gcc
- toolchain: macos-clang
os: macos-latest
compiler: clang
- toolchain: windows-msvc
os: windows-latest
compiler: msvc
- toolchain: windows-mingw
os: windows-latest
compiler: mingw
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Configure
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DMODELICA_DEBUG_TIME_EVENTS=ON
elif [ "${{ matrix.compiler }}" == "mingw" ]; then
cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -G "MinGW Makefiles"
else
cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_C_FLAGS="-std=c89 -Wall -Wextra"
fi
env:
SRCDIR: ${{ github.workspace }}/Modelica/Resources
TESTDIR: ${{ github.workspace }}/.CI/Test
- name: Build with ${{ matrix.compiler }}
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake --build build --config ${{ matrix.configuration }}
else
cmake --build build -- -j8
fi
- name: Run tests
run: ctest --no-tests=error --test-dir build --build-config ${{ matrix.configuration }} --verbose

external_c_checks_cmake_cygwin:
name: external_c_checks_cmake_windows-cygwin
runs-on: windows-latest
timeout-minutes: 5
steps:
- name: Set git to use LF
run: git config --global core.autocrlf input
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup cygwin
uses: cygwin/cygwin-install-action@master
with:
packages: >-
cmake
gcc-core
make
ninja
- name: Configure
run: |
export PATH=/usr/bin:$PATH
cmake -S "$(cygpath ${SRCDIR})" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$(cygpath ${TESTDIR})" -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=Debug -G Ninja
shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}'
env:
CYGWIN_NOWINPATH: 1
SRCDIR: ${{ github.workspace }}/Modelica/Resources
TESTDIR: ${{ github.workspace }}/.CI/Test
- name: Build with gcc
run: |
export PATH=/usr/bin:$PATH
cmake --build build -- -j8
shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}'
- name: Run tests
run: |
export PATH=/usr/bin:$PATH
ctest --no-tests=error --test-dir build --build-config Debug --verbose
shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}'

html_documentation_checks:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup python environment
Expand Down Expand Up @@ -64,11 +172,13 @@ jobs:
echo "::add-matcher::./.github/checkTags.json"
python ./.CI/check_html.py checkTags ./
echo "::remove-matcher owner=checkTags::"
syntax_checks:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Get moparser
Expand All @@ -82,11 +192,13 @@ jobs:
echo "::add-matcher::./.github/moparser.json"
ModelicaSyntaxChecker/Linux64/moparser -v 3.6 -r Complex.mo Modelica ModelicaReference ModelicaServices ModelicaTest ModelicaTestConversion4.mo ModelicaTestOverdetermined.mo ObsoleteModelica4.mo
echo "::remove-matcher owner=moparser::"
deprecation_checks:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup python environment
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/checkCron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
codespell -L delt ./Modelica/Media/Air/ReferenceAir.mo
codespell -L scrit,delt ./Modelica/Media/R134a.mo
codespell -L dout,scrit,delt ./Modelica/Media/Water/IF97_Utilities.mo
codespell -L rin ./Modelica/Electrical/Analog/Ideal/AD_Converter.mo
codespell -L rin ./Modelica/Electrical/Analog/Examples/AD_DA_conversion.mo
codespell -L archiv ./Modelica/Electrical/Polyphase/UsersGuide/References.mo
codespell -L additionals,vie ./Modelica/Electrical/Spice3.mo
codespell -L vai ./Modelica/Electrical/Machines/BasicMachines/Components/PartialAirGapDC.mo
Expand All @@ -75,7 +77,7 @@ jobs:
codespell -L technik ./Modelica/Magnetic/FundamentalWave/UsersGuide/References.mo
codespell -L supportt ./ModelicaTest/Rotational.mo
codespell -L lamda,inport ./ModelicaTestConversion4.mo
codespell --skip ./ObsoleteModelica4.mo,./Modelica/package.mo,./Modelica/UsersGuide/Contact.mo,./Modelica/UsersGuide/ReleaseNotes.mo,./Modelica/Clocked/RealSignals/Periodic/StateSpace.mo,./Modelica/Constants.mo,./Modelica/Blocks/Continuous.mo,./Modelica/StateGraph.mo,./Modelica/Electrical/Digital.mo,./Modelica/Electrical/Polyphase/Examples/PolyphaseRectifier.mo,./Modelica/Electrical/Polyphase/Examples/Utilities/PolyphaseRectifierData.mo,./Modelica/Fluid/package.mo,./Modelica/Fluid/Dissipation.mo,./Modelica/Fluid/Vessels.mo,./Modelica/Fluid/Examples/AST_BatchPlant.mo,./Modelica/Resources,./Modelica/Media/IdealGases/package.mo,./Modelica/Media/IdealGases/Common/SingleGasesData.mo,./Modelica/Media/IdealGases/Common/Functions.mo,./Modelica/Media/IdealGases/Common/package.mo,./Modelica/Media/Air/ReferenceAir.mo,./Modelica/Media/R134a.mo,./Modelica/Media/Water/IF97_Utilities.mo,./Modelica/Electrical/Polyphase/UsersGuide/References.mo,./Modelica/Electrical/Spice3.mo,./Modelica/Electrical/Machines/BasicMachines/Components/PartialAirGapDC.mo,./Modelica/Electrical/Machines/Examples/ControlledDCDrives,./Modelica/Electrical/Analog/UsersGuide/References.mo,./Modelica/Math/package.mo,./Modelica/Mechanics/Rotational,./Modelica/Mechanics/Translational,./Modelica/Mechanics/MultiBody,./Modelica/Magnetic/FluxTubes/UsersGuide/Contact.mo,./Modelica/Magnetic/FluxTubes/Material/SoftMagnetic/NickelIron,./Modelica/Magnetic/FundamentalWave/UsersGuide/References.mo,./ModelicaTest/Rotational.mo,./ModelicaTestConversion4.mo,./.CI,./.github,./.git,*.png -L nin,inport,te,sinc,vie,commutating
codespell --skip ./ObsoleteModelica4.mo,./Modelica/package.mo,./Modelica/UsersGuide/Contact.mo,./Modelica/UsersGuide/ReleaseNotes.mo,./Modelica/Clocked/RealSignals/Periodic/StateSpace.mo,./Modelica/Constants.mo,./Modelica/Blocks/Continuous.mo,./Modelica/StateGraph.mo,./Modelica/Electrical/Digital.mo,./Modelica/Electrical/Polyphase/Examples/PolyphaseRectifier.mo,./Modelica/Electrical/Polyphase/Examples/Utilities/PolyphaseRectifierData.mo,./Modelica/Fluid/package.mo,./Modelica/Fluid/Dissipation.mo,./Modelica/Fluid/Vessels.mo,./Modelica/Fluid/Examples/AST_BatchPlant.mo,./Modelica/Resources,./Modelica/Media/IdealGases/package.mo,./Modelica/Media/IdealGases/Common/SingleGasesData.mo,./Modelica/Media/IdealGases/Common/Functions.mo,./Modelica/Media/IdealGases/Common/package.mo,./Modelica/Media/Air/ReferenceAir.mo,./Modelica/Media/R134a.mo,./Modelica/Media/Water/IF97_Utilities.mo,./Modelica/Electrical/Analog/Ideal/AD_Converter.mo,./Modelica/Electrical/Analog/Examples/AD_DA_conversion.mo,./Modelica/Electrical/Polyphase/UsersGuide/References.mo,./Modelica/Electrical/Spice3.mo,./Modelica/Electrical/Machines/BasicMachines/Components/PartialAirGapDC.mo,./Modelica/Electrical/Machines/Examples/ControlledDCDrives,./Modelica/Electrical/Analog/UsersGuide/References.mo,./Modelica/Math/package.mo,./Modelica/Mechanics/Rotational,./Modelica/Mechanics/Translational,./Modelica/Mechanics/MultiBody,./Modelica/Magnetic/FluxTubes/UsersGuide/Contact.mo,./Modelica/Magnetic/FluxTubes/Material/SoftMagnetic/NickelIron,./Modelica/Magnetic/FundamentalWave/UsersGuide/References.mo,./ModelicaTest/Rotational.mo,./ModelicaTestConversion4.mo,./.CI,./.github,./.git,*.png -L nin,inport,te,sinc,vie,commutating
clean_workflow_runs:
timeout-minutes: 5
if: github.repository_owner == 'modelica'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generateReleaseNotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
DOCRAPTOR_API_KEY: ${{ secrets.DOCRAPTOR_API_KEY }}
DOCRAPTOR_TEST: ${{ github.event.inputs.watermark }}
run: python ./Modelica/Resources/Documentation/Generate-ReleaseNotes.py ${{ github.event.inputs.milestone }} ${{ github.event.inputs.version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ResolvedGitHubIssues-Version-${{ github.event.inputs.version }}
path: ./Modelica/Resources/Documentation/Version-${{ github.event.inputs.version }}/
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Leo Zambito <[email protected]>
Luigi Vanfretti <[email protected]>
Malte Lenz <[email protected]>
Manikantan Thiyagarajan <[email protected]>
Manikantan Thiyagarajan <[email protected]> <[email protected]>
Marco Kessler <[email protected]>
Marcus Baur <baur_ma@7ce873d0-865f-4ce7-a662-4bb36ea78beb>
Martin Otter <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Modelica/ComplexBlocks/ComplexMath/ComplexToPolar.mo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ block ComplexToPolar "Converts complex to polar representation"
parameter Boolean useConjugateInput=false
"If true, input is processed conjugate complex";
equation
len = (u.re^2 + u.im^2)^0.5;
len = sqrt(u.re^2 + u.im^2);
phi = (if useConjugateInput then Modelica.Math.atan2(-u.im, u.re) else
Modelica.Math.atan2(u.im, u.re));

Expand Down
2 changes: 1 addition & 1 deletion Modelica/ComplexMath.mo
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ end Vectors;
input Complex c "Complex number";
output Real result "= abs(c)";
algorithm
result := (c.re^2 + c.im^2)^0.5; //changed from sqrt
result := .sqrt(c.re^2 + c.im^2); // Real, not complex sqrt
annotation(Inline=true, Documentation(info="<html>
<p>This function returns the Real absolute of the Complex input, i.e., its length.</p>
</html>"));
Expand Down
16 changes: 8 additions & 8 deletions Modelica/Electrical/Analog/Examples/Lines/CompareLineTrunks.mo
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ model CompareLineTrunks "Compares oLine and tLine splitting lines into trunks"
extent={{-10,-10},{10,10}},
rotation=-90)));
initial equation
oLine1.C.v=zeros(segsPerTrunk);
oLine1.L.i=zeros(segsPerTrunk + 1);
oLine2.C.v=zeros(segsPerTrunk);
oLine2.L.i=zeros(segsPerTrunk + 1);
oLine3.C.v=zeros(segsPerTrunk);
oLine3.L.i=zeros(segsPerTrunk + 1);
oLine4.C.v=zeros(segsPerTrunk);
oLine4.L.i=zeros(segsPerTrunk + 1);
oLine1.v=zeros(segsPerTrunk);
oLine1.i=zeros(segsPerTrunk + 1);
oLine2.v=zeros(segsPerTrunk);
oLine2.i=zeros(segsPerTrunk + 1);
oLine3.v=zeros(segsPerTrunk);
oLine3.i=zeros(segsPerTrunk + 1);
oLine4.v=zeros(segsPerTrunk);
oLine4.i=zeros(segsPerTrunk + 1);
equation
connect(srcLump.v, ramp.y)
annotation (Line(points={{-52,30},{-60,30},{-60,0},{-67,0}},
Expand Down
12 changes: 6 additions & 6 deletions Modelica/Electrical/Analog/Examples/Lines/SmoothStep.mo
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ model SmoothStep "Compares oLine and tLine behaviour"
Modelica.Electrical.Analog.Basic.Ground groundT
annotation (Placement(transformation(extent={{-10,-70},{10,-50}})));
initial equation
oLine1.C.v=zeros(N1);
oLine1.L.i=zeros(N1 + 1);
oLine5.C.v=zeros(N5);
oLine5.L.i=zeros(N5 + 1);
oLine50.C.v=zeros(N50);
oLine50.L.i=zeros(N50 + 1);
oLine1.v=zeros(N1);
oLine1.i=zeros(N1 + 1);
oLine5.v=zeros(N5);
oLine5.i=zeros(N5 + 1);
oLine50.v=zeros(N50);
oLine50.i=zeros(N50 + 1);
equation
connect(groundS.p, sourceV.n) annotation (Line(
points={{-50,-50},{-50,-40}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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="<html>
Expand Down
24 changes: 12 additions & 12 deletions Modelica/Electrical/Analog/Ideal/IdealIntermediateSwitch.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions Modelica/Electrical/Analog/Ideal/IdealTwoWaySwitch.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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="<html>
Expand Down
4 changes: 2 additions & 2 deletions Modelica/Electrical/Analog/Interfaces/IdealSemiconductor.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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="<html>
Expand Down
4 changes: 2 additions & 2 deletions Modelica/Electrical/Analog/Interfaces/IdealSwitch.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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="<html>
Expand Down
Loading

0 comments on commit 846d12b

Please sign in to comment.