FMI.jl
FMI.jl copied to clipboard
DimensionMismatch for OpenModelica `Modelica.Blocks.Examples.RealNetwork1` 2.0.4 FMU
Issue
I'm in the process of adding regression tests for OpenModelica via OMJulia.jl using FMI.jl as FMU importing tool, see https://github.com/OpenModelica/OMJulia.jl/pull/111. But FMI.jl is failing to import some of the FMUs.
The FMU is simulating with FMPy and OMSimulator.
How to reproduce
Export FMU with OpenModelica for Modelica model Modelica.Blocks.Examples.RealNetwork1 from the Modelica standard library.
Export FMU:
using OMJulia
omc = OMJulia.OMCSession()
OMJulia.API.loadModel(omc, "Modelica"; priorityVersion = ["4.0.0"], requireExactVersion = true)
fmuPath = OMJulia.API.buildModelFMU(omc, "Modelica.Blocks.Examples.RealNetwork1")
OMJulia.quit(omc)
or download pre-build FMUs (remove .zip from the filename):
Linux Modelica.Blocks.Examples.RealNetwork1.fmu
Windows Modelica.Blocks.Examples.RealNetwork1.fmu
Simulate with FMI.jl:
import FMI
recordValues = ["add.u[1]", "linearDependency1.y", "minMax.u[1]", "minMax.u[2]", "minMax.yMax", "minMax.yMin", "multiSwitch.expr[1]", "multiSwitch.expr[2]", "product.u[1]", "showValue3.number", "multiSwitch.u[1]", "multiSwitch.u[2]", "add.u[2]", "add.y", "integerStep.y", "linearDependency1.u1", "linearDependency1.u2", "multiSwitch.y", "product.y", "showValue.showNumber", "showValue1.showNumber", "showValue3.showNumber", "sine.y", "booleanPulse1.y", "booleanPulse2.y"]
fmu = FMI.fmiLoad(fmuPath)
FMI.fmiSimulate(fmu; recordValues = recordValues, showProgress=false)
Error message
I'm getting different error messages on different platforms, here is the Windows error message:
ERROR: DimensionMismatch: all inputs to eachindex must have the same indices, got Base.OneTo(1), Base.OneTo(1), Base.OneTo(1) and Base.OneTo(0)
Stacktrace: error.log
Versions 'n stuff
- OS: Windows 11
- Julia v1.9.3
- FMI.jl v0.13.0
- OMJulia.jl v0.3.0
- OpenModelica v1.23.0-dev-149-g0b8ad21918-cmake