Skip to content

Commit 1ce0fe0

Browse files
authored
Update script to work with ModelingToolkit 10 (#250)
* Update script to work with ModelingToolkit 10 * Use BaseModelica.create_odeproblem
1 parent 0e9a9de commit 1ce0fe0

28 files changed

+1317
-568
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.mo linguist-language=Modelica
2+
*.bmo linguist-language=Modelica
23
*.html.tpl linguist-language=HTML

.github/workflows/test_julia.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest]
16-
julia-version: [1.11]
16+
julia-version: [1.12]
1717
fail-fast: false
1818
runs-on: ${{ matrix.os }}
1919
timeout-minutes: 60
@@ -45,7 +45,7 @@ jobs:
4545
strategy:
4646
matrix:
4747
os: [ubuntu-latest]
48-
julia-version: [1.11]
48+
julia-version: [1.12]
4949
omc-version: [stable]
5050
python-version: ['3.10']
5151
fail-fast: false

TestBaseModelica/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.CondaPkg/
2+
test/test_out/

TestBaseModelica/Manifest.toml

Lines changed: 384 additions & 387 deletions
Large diffs are not rendered by default.

TestBaseModelica/Project.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
name = "TestBaseModelica"
22
uuid = "bba3f925-4bbc-4b14-b723-9b95a7c9c63c"
3-
authors = ["AnHeuermann <38031952+AnHeuermann@users.noreply.github.com>"]
43
version = "0.1.0"
4+
authors = ["AnHeuermann <38031952+AnHeuermann@users.noreply.github.com>"]
55

66
[deps]
77
BaseModelica = "a17d5099-185d-4ff5-b5d3-51aa4569e56d"
88
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
99
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
10-
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
1110
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
11+
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
12+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
13+
14+
[sources]
15+
BaseModelica = {rev = "main", url = "https://github.com/SciML/BaseModelica.jl.git"}
16+
17+
[compat]
18+
ModelingToolkit = "10"
19+
OrdinaryDiffEq = "6"
20+
SciMLBase = "2"
1221

1322
[extras]
1423
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"

TestBaseModelica/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ Test coupling of Base Modelica export off OpenModelica and
55

66
For a Base Modelica file exported by OpenModelica parsing with
77
[BaseModelica.jl](https://github.com/SciML/BaseModelica.jl) and simulating with
8-
[DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl) is
8+
[OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) is
99
tested.
1010

1111
## Dependencies
1212

13-
- Julia
14-
- Julia packages
13+
- Julia
14+
- Julia packages
1515

1616
## Precompilation
1717

1818
To speed up the execution of the test and reduce the TTFP-overhad of Julia there are two options:
1919

2020
1. Precompile this package with
21-
[PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl) and
22-
start a new Julia session for each test.
21+
[PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl) and
22+
start a new Julia session for each test.
2323

24-
```julia
25-
julia> using PackageCompiler
26-
(@v1.11) pkg> activate .
27-
julia> create_sysimage(["TestBaseModelica"]; sysimage_path="TestBaseModelica.so", precompile_execution_file="precompile_skript.jl" )
28-
```
24+
```julia
25+
julia> using PackageCompiler
26+
(@v1.11) pkg> activate .
27+
julia> create_sysimage(["TestBaseModelica"]; sysimage_path="TestBaseModelica.so", precompile_execution_file="precompile_skript.jl" )
28+
```
2929

30-
```bash
31-
time julia --project=$(pwd) -e 'using TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="ExampleFirstOrder", output_directory="ExampleFirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "ExampleFirstOrder.mo"); settings=test_settings)'
30+
```bash
31+
time julia --project=$(pwd) -e 'using TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="FirstOrder", output_directory="FirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "FirstOrder.bmo"); settings=test_settings)'
3232
33-
time julia --sysimage=TestBaseModelica.so -e 'using .TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="ExampleFirstOrder", output_directory="ExampleFirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "ExampleFirstOrder.mo"); settings=test_settings)'
34-
```
33+
time julia --sysimage=TestBaseModelica.so -e 'using .TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="FirstOrder", output_directory="FirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "FirstOrder.bmo"); settings=test_settings)'
34+
```
3535

3636
2. Keep a Julia daemon running in the background for all tests by using
37-
[DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl)
37+
[DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl)
3838

3939
## How to use
4040

@@ -49,9 +49,9 @@ solver_settings = SolverSettings(
4949
)
5050
5151
test_settings = TestSettings(
52-
modelname = "ExampleFirstOrder",
53-
output_directory = "ExampleFirstOrder",
52+
modelname = "FirstOrder",
53+
output_directory = "FirstOrder",
5454
solver_settings = solver_settings)
5555
56-
run_test(joinpath("examples", "ExampleFirstOrder.mo"); settings = test_settings)
56+
run_test(joinpath("examples", "FirstOrder.bmo"); settings = test_settings)
5757
```
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
//! base 0.1.0
2+
package 'CauerLowPassAnalog'
3+
model 'CauerLowPassAnalog' "Cauer low pass filter with analog components"
4+
parameter Real 'l1'(unit = "H", quantity = "Inductance") = 1.304 "Filter coefficient I1";
5+
parameter Real 'l2'(unit = "H", quantity = "Inductance") = 0.8586 "Filter coefficient I2";
6+
parameter Real 'c1'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.072 "Filter coefficient c1";
7+
parameter Real 'c2'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.0 / (2.906997720064 * 'l1') "Filter coefficient c2";
8+
parameter Real 'c3'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.682 "Filter coefficient c3";
9+
parameter Real 'c4'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.0 / (1.392270203025 * 'l2') "Filter coefficient c4";
10+
parameter Real 'c5'(min = 0.0, unit = "F", quantity = "Capacitance") = 0.7262 "Filter coefficient c5";
11+
Real 'G.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
12+
Real 'G.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
13+
Real 'C1.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
14+
Real 'C1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
15+
Real 'C1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
16+
Real 'C1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
17+
Real 'C1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
18+
Real 'C1.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
19+
parameter Real 'C1.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c1' "Capacitance";
20+
Real 'C2.v'(start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
21+
Real 'C2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
22+
Real 'C2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
23+
Real 'C2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
24+
Real 'C2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
25+
Real 'C2.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
26+
parameter Real 'C2.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c2' "Capacitance";
27+
Real 'C3.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
28+
Real 'C3.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
29+
Real 'C3.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
30+
Real 'C3.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
31+
Real 'C3.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
32+
Real 'C3.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
33+
parameter Real 'C3.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c3' "Capacitance";
34+
Real 'C4.v'(start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
35+
Real 'C4.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
36+
Real 'C4.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
37+
Real 'C4.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
38+
Real 'C4.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
39+
Real 'C4.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
40+
parameter Real 'C4.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c4' "Capacitance";
41+
Real 'C5.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
42+
Real 'C5.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
43+
Real 'C5.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
44+
Real 'C5.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
45+
Real 'C5.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
46+
Real 'C5.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
47+
parameter Real 'C5.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c5' "Capacitance";
48+
Real 'L1.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
49+
Real 'L1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
50+
Real 'L1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
51+
Real 'L1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
52+
Real 'L1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
53+
Real 'L1.i'(fixed = true, start = 0.0, unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
54+
parameter Real 'L1.L'(start = 1.0, unit = "H", quantity = "Inductance") = 'l1' "Inductance";
55+
Real 'L2.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
56+
Real 'L2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
57+
Real 'L2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
58+
Real 'L2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
59+
Real 'L2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
60+
Real 'L2.i'(fixed = true, start = 0.0, unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
61+
parameter Real 'L2.L'(start = 1.0, unit = "H", quantity = "Inductance") = 'l2' "Inductance";
62+
parameter Real 'R1.R'(start = 1.0, unit = "Ohm", quantity = "Resistance") = 1.0 "Resistance at temperature T_ref";
63+
parameter Real 'R1.T_ref'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 300.15 "Reference temperature";
64+
parameter Real 'R1.alpha'(unit = "1/K", quantity = "LinearTemperatureCoefficient") = 0.0 "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))";
65+
Real 'R1.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
66+
Real 'R1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
67+
Real 'R1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
68+
Real 'R1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
69+
Real 'R1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
70+
Real 'R1.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
71+
parameter Boolean 'R1.useHeatPort' = false "= true, if heatPort is enabled" annotation(Evaluate = true);
72+
parameter Real 'R1.T'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 'R1.T_ref' "Fixed device temperature if useHeatPort = false";
73+
Real 'R1.LossPower'(unit = "W", quantity = "Power") "Loss power leaving component via heatPort";
74+
Real 'R1.T_heatPort'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") "Temperature of heatPort";
75+
Real 'R1.R_actual'(unit = "Ohm", quantity = "Resistance") "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))";
76+
parameter Real 'R2.R'(start = 1.0, unit = "Ohm", quantity = "Resistance") = 1.0 "Resistance at temperature T_ref";
77+
parameter Real 'R2.T_ref'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 300.15 "Reference temperature";
78+
parameter Real 'R2.alpha'(unit = "1/K", quantity = "LinearTemperatureCoefficient") = 0.0 "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))";
79+
Real 'R2.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
80+
Real 'R2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
81+
Real 'R2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
82+
Real 'R2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
83+
Real 'R2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
84+
Real 'R2.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
85+
parameter Boolean 'R2.useHeatPort' = false "= true, if heatPort is enabled" annotation(Evaluate = true);
86+
parameter Real 'R2.T'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 'R2.T_ref' "Fixed device temperature if useHeatPort = false";
87+
Real 'R2.LossPower'(unit = "W", quantity = "Power") "Loss power leaving component via heatPort";
88+
Real 'R2.T_heatPort'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") "Temperature of heatPort";
89+
Real 'R2.R_actual'(unit = "Ohm", quantity = "Resistance") "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))";
90+
parameter Real 'V.V'(start = 1.0, unit = "V", quantity = "ElectricPotential") = 1.0 "Height of step";
91+
Real 'V.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)";
92+
Real 'V.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
93+
Real 'V.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
94+
Real 'V.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin";
95+
Real 'V.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin";
96+
Real 'V.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n";
97+
parameter Real 'V.signalSource.height' = 'V.V' "Height of step";
98+
Real 'V.signalSource.y' "Connector of Real output signal";
99+
parameter Real 'V.signalSource.offset' = 'V.offset' "Offset of output signal y";
100+
parameter Real 'V.signalSource.startTime'(unit = "s", quantity = "Time") = 'V.startTime' "Output y = offset for time < startTime";
101+
parameter Real 'V.offset'(unit = "V", quantity = "ElectricPotential") = 0.0 "Voltage offset";
102+
parameter Real 'V.startTime'(unit = "s", quantity = "Time") = 1.0 "Time offset";
103+
equation
104+
'L1.p.v' = 'C1.p.v';
105+
'L1.p.v' = 'C2.p.v';
106+
'L1.p.v' = 'R1.n.v';
107+
'C2.n.v' = 'L2.p.v';
108+
'C2.n.v' = 'C4.p.v';
109+
'C2.n.v' = 'C3.p.v';
110+
'C2.n.v' = 'L1.n.v';
111+
'C4.n.v' = 'R2.p.v';
112+
'C4.n.v' = 'C5.p.v';
113+
'C4.n.v' = 'L2.n.v';
114+
'V.n.v' = 'G.p.v';
115+
'V.n.v' = 'R2.n.v';
116+
'V.n.v' = 'C1.n.v';
117+
'V.n.v' = 'C5.n.v';
118+
'V.n.v' = 'C3.n.v';
119+
'R1.p.v' = 'V.p.v';
120+
'V.n.i' + 'R2.n.i' + 'C5.n.i' + 'C3.n.i' + 'C1.n.i' + 'G.p.i' = 0.0;
121+
'L2.p.i' + 'L1.n.i' + 'C4.p.i' + 'C3.p.i' + 'C2.n.i' = 0.0;
122+
'R2.p.i' + 'L2.n.i' + 'C5.p.i' + 'C4.n.i' = 0.0;
123+
'V.p.i' + 'R1.p.i' = 0.0;
124+
'R1.n.i' + 'L1.p.i' + 'C2.p.i' + 'C1.p.i' = 0.0;
125+
'G.p.v' = 0.0;
126+
'C1.i' = 'C1.C' * der('C1.v');
127+
0.0 = 'C1.p.i' + 'C1.n.i';
128+
'C1.i' = 'C1.p.i';
129+
'C1.v' = 'C1.p.v' - 'C1.n.v';
130+
'C2.i' = 'C2.C' * der('C2.v');
131+
0.0 = 'C2.p.i' + 'C2.n.i';
132+
'C2.i' = 'C2.p.i';
133+
'C2.v' = 'C2.p.v' - 'C2.n.v';
134+
'C3.i' = 'C3.C' * der('C3.v');
135+
0.0 = 'C3.p.i' + 'C3.n.i';
136+
'C3.i' = 'C3.p.i';
137+
'C3.v' = 'C3.p.v' - 'C3.n.v';
138+
'C4.i' = 'C4.C' * der('C4.v');
139+
0.0 = 'C4.p.i' + 'C4.n.i';
140+
'C4.i' = 'C4.p.i';
141+
'C4.v' = 'C4.p.v' - 'C4.n.v';
142+
'C5.i' = 'C5.C' * der('C5.v');
143+
0.0 = 'C5.p.i' + 'C5.n.i';
144+
'C5.i' = 'C5.p.i';
145+
'C5.v' = 'C5.p.v' - 'C5.n.v';
146+
'L1.L' * der('L1.i') = 'L1.v';
147+
0.0 = 'L1.p.i' + 'L1.n.i';
148+
'L1.i' = 'L1.p.i';
149+
'L1.v' = 'L1.p.v' - 'L1.n.v';
150+
'L2.L' * der('L2.i') = 'L2.v';
151+
0.0 = 'L2.p.i' + 'L2.n.i';
152+
'L2.i' = 'L2.p.i';
153+
'L2.v' = 'L2.p.v' - 'L2.n.v';
154+
assert(1.0 + 'R1.alpha' * ('R1.T_heatPort' - 'R1.T_ref') >= 2.220446049250313e-16, "Temperature outside scope of model!", AssertionLevel.error);
155+
'R1.R_actual' = 'R1.R' * (1.0 + 'R1.alpha' * ('R1.T_heatPort' - 'R1.T_ref'));
156+
'R1.v' = 'R1.R_actual' * 'R1.i';
157+
'R1.LossPower' = 'R1.v' * 'R1.i';
158+
'R1.T_heatPort' = 'R1.T';
159+
0.0 = 'R1.p.i' + 'R1.n.i';
160+
'R1.i' = 'R1.p.i';
161+
'R1.v' = 'R1.p.v' - 'R1.n.v';
162+
assert(1.0 + 'R2.alpha' * ('R2.T_heatPort' - 'R2.T_ref') >= 2.220446049250313e-16, "Temperature outside scope of model!", AssertionLevel.error);
163+
'R2.R_actual' = 'R2.R' * (1.0 + 'R2.alpha' * ('R2.T_heatPort' - 'R2.T_ref'));
164+
'R2.v' = 'R2.R_actual' * 'R2.i';
165+
'R2.LossPower' = 'R2.v' * 'R2.i';
166+
'R2.T_heatPort' = 'R2.T';
167+
0.0 = 'R2.p.i' + 'R2.n.i';
168+
'R2.i' = 'R2.p.i';
169+
'R2.v' = 'R2.p.v' - 'R2.n.v';
170+
'V.signalSource.y' = 'V.signalSource.offset' + (if time < 'V.signalSource.startTime' then 0.0 else 'V.signalSource.height');
171+
'V.v' = 'V.signalSource.y';
172+
0.0 = 'V.p.i' + 'V.n.i';
173+
'V.i' = 'V.p.i';
174+
'V.v' = 'V.p.v' - 'V.n.v';
175+
annotation(experiment(StopTime = 60));
176+
end 'CauerLowPassAnalog';
177+
end 'CauerLowPassAnalog';

0 commit comments

Comments
 (0)