Skip to content

Commit 8c1b37a

Browse files
committed
add tests for #3934
1 parent ea660a6 commit 8c1b37a

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

test/fmi/fmi.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ end
274274
sol.t; idxs = [sys.adder1.c, sys.adder2.c]).u rtol=1e-3
275275
end
276276

277+
@testset "multiDimArray Support" begin
278+
path_to_FMU = joinpath(FMU_DIR, "SimpleArrayModel.fmu")
279+
fmu = loadFMU(path_to_FMU)
280+
@named model = MTK.FMIComponent(Val(2); fmu, type = :ME)
281+
@test model !== nothing
282+
end
277283
function build_looped_sspace(sspace1, sspace2)
278284
@variables x(t) = 1
279285
@mtkcompile sys = System([D(x) ~ x, sspace1.u ~ sspace2.x, sspace2.u ~ sspace1.y],

test/fmi/fmus/SimpleArrayModel.fmu

2.74 MB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SimpleArrayModel.fmu is a v2 ME FMU that contains multidimensional array variables with derivatives. It is included to test SciML issue number 3934. It is generated from the Modelica model in test_mtk_2darray_bug.mo using Dymola 2022x. The translation command is
2+
3+
```julia
4+
translateModelFMU("SimpleArrayModel", false, "", "2", "me", true, 0, fill("",0));
5+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
model SimpleArrayModel
2+
"Simple model with a 2D array variable and its derivative"
3+
4+
parameter Integer n = 3 "First dimension size";
5+
parameter Integer m = 2 "Second dimension size";
6+
7+
Real x[n,m] "Two-dimensional array variable";
8+
Real dx[n,m] "Derivative of the array variable";
9+
10+
equation
11+
// Define the derivative relationship
12+
der(x) = dx;
13+
14+
// Simple example dynamics for the derivative
15+
for i in 1:n loop
16+
for j in 1:m loop
17+
dx[i,j] = -x[i,j] + sin(time);
18+
end for;
19+
end for;
20+
21+
initial equation
22+
// Initial conditions
23+
x = zeros(n,m);
24+
25+
end SimpleArrayModel;

0 commit comments

Comments
 (0)