From eddf1669f526a637b10ff5ceeead155cbd2147e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20H=C3=B6pfner?= Date: Tue, 1 Oct 2024 16:25:38 +0200 Subject: [PATCH 1/2] different handling for dependencies="" and tests --- src/FMI2/md.jl | 4 ++++ src/FMI3/md.jl | 4 ++++ test/FMI2/model_description.jl | 14 ++++++++++++++ test/FMI3/model_description.jl | 10 ++++++++++ 4 files changed, 32 insertions(+) diff --git a/src/FMI2/md.jl b/src/FMI2/md.jl index 0a4d955..4e303ce 100644 --- a/src/FMI2/md.jl +++ b/src/FMI2/md.jl @@ -407,6 +407,8 @@ function parseUnknown(md::fmi2ModelDescription, node::EzXML.Node) if length(dependenciesSplit) > 0 varDep.dependencies = collect(parse(UInt, e) for e in dependenciesSplit) end + else + varDep.dependencies = UInt[] end end @@ -419,6 +421,8 @@ function parseUnknown(md::fmi2ModelDescription, node::EzXML.Node) stringToDependencyKind(md, e) for e in dependenciesKindSplit ) end + else + varDep.dependenciesKind = fmi2DependencyKind[] end end diff --git a/src/FMI3/md.jl b/src/FMI3/md.jl index 1f931db..ddaf225 100644 --- a/src/FMI3/md.jl +++ b/src/FMI3/md.jl @@ -464,6 +464,8 @@ function parseDependencies(md::fmi3ModelDescription, node::EzXML.Node) if length(dependenciesSplit) > 0 varDep.dependencies = collect(parse(UInt, e) for e in dependenciesSplit) end + else + varDep.dependencies = UInt[] end end @@ -475,6 +477,8 @@ function parseDependencies(md::fmi3ModelDescription, node::EzXML.Node) varDep.dependenciesKind = collect(stringToDependencyKind(md, e) for e in dependenciesKindSplit) end + else + varDep.dependenciesKind = fmi3DependencyKind[] end end diff --git a/test/FMI2/model_description.jl b/test/FMI2/model_description.jl index 4a08a02..7d52c00 100644 --- a/test/FMI2/model_description.jl +++ b/test/FMI2/model_description.jl @@ -134,3 +134,17 @@ for sv in myFMU.modelDescription.modelVariables end unloadFMU(myFMU) + +myFMU = loadFMU("BouncingBall", "ModelicaReferenceFMUs", "0.0.30", "2.0") +@test isnothing(myFMU.modelDescription.modelStructure.derivatives[1].dependencies) + +info(myFMU) # check if there is an error thrown + +unloadFMU(myFMU) + +myFMU = loadFMU("Dahlquist", "ModelicaReferenceFMUs", "0.0.30", "2.0") +@test !isnothing(myFMU.modelDescription.modelStructure.outputs[1].dependencies) + +info(myFMU) # check if there is an error thrown + +unloadFMU(myFMU) diff --git a/test/FMI3/model_description.jl b/test/FMI3/model_description.jl index 23eb7cc..2544770 100644 --- a/test/FMI3/model_description.jl +++ b/test/FMI3/model_description.jl @@ -34,7 +34,17 @@ myFMU = loadFMU("BouncingBall", "ModelicaReferenceFMUs", "0.0.30", "3.0") @test myFMU.modelDescription.eventIndicatorValueReferences == [1] @test typeof(myFMU.modelDescription.modelStructure.eventIndicators[1]) == fmi3VariableDependency +@test isnothing(myFMU.modelDescription.modelStructure.continuousStateDerivatives[1].dependencies) + info(myFMU) # check if there is an error thrown unloadFMU(myFMU) + +# Sadly there are no FMI3-Reference-FMUs with dependencies="" +# myFMU = loadFMU("Dahlquist", "ModelicaReferenceFMUs", "0.0.30", "3.0") +# @test !isnothing(myFMU.modelDescription.modelStructure.outputs[1].dependencies) + +# info(myFMU) # check if there is an error thrown + +# unloadFMU(myFMU) From 5fdeefc76b7cf1529bad1baba759968f2b0d7ce7 Mon Sep 17 00:00:00 2001 From: ThummeTo <83663542+ThummeTo@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:03:49 +0200 Subject: [PATCH 2/2] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7878ed7..f0b63f5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FMIImport" uuid = "9fcbc62e-52a0-44e9-a616-1359a0008194" authors = ["TT ", "LM ", "JK "] -version = "1.0.7" +version = "1.0.8" [deps] Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"