diff --git a/Project.toml b/Project.toml index 3e58327..72b02fb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FMIExport" uuid = "31b88311-cab6-44ed-ba9c-fe5a9abbd67a" authors = ["TT ", "LM "] -version = "0.2.1" +version = "0.3.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" @@ -10,6 +10,7 @@ FMICore = "8af89139-c281-408e-bce2-3005eb87462f" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] +Dates = "1" EzXML = "1.1.0" -FMICore = "0.17.1" +FMICore = "0.18.0 - 0.19.0" julia = "1.6" diff --git a/README.md b/README.md index 05ca998..34f0446 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ To keep dependencies nice and clean, the original package [*FMI.jl*](https://git - [*FMIImport.jl*](https://github.com/ThummeTo/FMIImport.jl): Importing FMUs into Julia - [*FMIExport.jl*](https://github.com/ThummeTo/FMIExport.jl): Exporting stand-alone FMUs from Julia Code - [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl): C-code wrapper for the FMI-standard +- [*FMISensitivity.jl*](https://github.com/ThummeTo/FMISensitivity.jl): Static and dynamic sensitivities over FMUs - [*FMIBuild.jl*](https://github.com/ThummeTo/FMIBuild.jl): Compiler/Compilation dependencies for FMIExport.jl - [*FMIFlux.jl*](https://github.com/ThummeTo/FMIFlux.jl): Machine Learning with FMUs (differentiation over FMUs) - [*FMIZoo.jl*](https://github.com/ThummeTo/FMIZoo.jl): A collection of testing and example FMUs diff --git a/examples/FMI2/BouncingBall/Project.toml b/examples/FMI2/BouncingBall/Project.toml index a4ec89c..fb7408c 100644 --- a/examples/FMI2/BouncingBall/Project.toml +++ b/examples/FMI2/BouncingBall/Project.toml @@ -8,6 +8,5 @@ FMIBuild = "226f0e26-6dd6-4589-ada7-1d32f6e1d800" FMIExport = "31b88311-cab6-44ed-ba9c-fe5a9abbd67a" [compat] -FMIBuild = "0.1.15" -FMIExport = "0.2.0" +FMIBuild = "0.2.0" julia = "1.6" diff --git a/examples/FMI2/BouncingBall/src/BouncingBall.jl b/examples/FMI2/BouncingBall/src/BouncingBall.jl index 7992dcf..25610b3 100644 --- a/examples/FMI2/BouncingBall/src/BouncingBall.jl +++ b/examples/FMI2/BouncingBall/src/BouncingBall.jl @@ -134,8 +134,8 @@ tmpDir = mktempdir(; prefix="fmibuildjl_test_", cleanup=false) fmu_save_path = joinpath(tmpDir, "BouncingBall.fmu") fmu = FMIBUILD_CONSTRUCTOR() -using FMIBuild: fmi2Save # <= this must be excluded during export, because FMIBuild cannot execute itself (but it is able to build) -fmi2Save(fmu, fmu_save_path) # <= this must be excluded during export, because fmi2Save would start an infinte build loop with itself +using FMIBuild: fmi2Save # <= this must be excluded during export, because FMIBuild cannot execute itself (but it is able to build) +fmi2Save(fmu, fmu_save_path; debug=true) # <= this must be excluded during export, because fmi2Save would start an infinte build loop with itself (debug=true allows debug messages, but is slow during execution!) ### some tests ### # using FMI diff --git a/examples/FMI2/Manipulation/Project.toml b/examples/FMI2/Manipulation/Project.toml index 8b2cd89..0aa09b0 100644 --- a/examples/FMI2/Manipulation/Project.toml +++ b/examples/FMI2/Manipulation/Project.toml @@ -10,6 +10,5 @@ FMIImport = "9fcbc62e-52a0-44e9-a616-1359a0008194" FMIZoo = "724179cf-c260-40a9-bd27-cccc6fe2f195" [compat] -FMIBuild = "0.1.15" -FMIExport = "0.2.0" +FMIBuild = "0.2.0" julia = "1.6" diff --git a/examples/FMI2/NeuralFMU/Project.toml b/examples/FMI2/NeuralFMU/Project.toml index b676635..66a8fc6 100644 --- a/examples/FMI2/NeuralFMU/Project.toml +++ b/examples/FMI2/NeuralFMU/Project.toml @@ -10,6 +10,5 @@ FMIImport = "9fcbc62e-52a0-44e9-a616-1359a0008194" FMIZoo = "724179cf-c260-40a9-bd27-cccc6fe2f195" [compat] -FMIBuild = "0.1.15" -FMIExport = "0.2.0" +FMIBuild = "0.2.0" julia = "1.6" diff --git a/examples/FMI2/NeuralFMU/src/NeuralFMU.jl b/examples/FMI2/NeuralFMU/src/NeuralFMU.jl index 21f0a28..1a07fbe 100644 --- a/examples/FMI2/NeuralFMU/src/NeuralFMU.jl +++ b/examples/FMI2/NeuralFMU/src/NeuralFMU.jl @@ -367,7 +367,7 @@ fmu_save_path = joinpath(tmpDir, "NeuralFMU.fmu") sourceFMU = FMIZoo.get_model_filename("SpringDamperPendulum1D", "Dymola", "2022x") fmu = FMIBUILD_CONSTRUCTOR(dirname(sourceFMU)) import FMIBuild:fmi2Save # <= this must be excluded during export, because FMIBuild cannot execute itself (but it is able to build) -fmi2Save(fmu, fmu_save_path; compress=true, resources=Dict(sourceFMU=>"SpringDamperPendulum1D.fmu")) # <= this must be excluded during export, because fmi2Save would start an infinte build loop with itself +fmi2Save(fmu, fmu_save_path; compress=false, debug=true, resources=Dict(sourceFMU=>"SpringDamperPendulum1D.fmu")) # <= this must be excluded during export, because fmi2Save would start an infinte build loop with itself ### some tests ### # using FMI diff --git a/src/FMI2_simple.jl b/src/FMI2_simple.jl index 0673d38..9c24859 100644 --- a/src/FMI2_simple.jl +++ b/src/FMI2_simple.jl @@ -33,21 +33,6 @@ function dereferenceInstance(address::fmi2Component) return nothing end -function logInfo(_component::fmi2Component, message, status::fmi2Status=fmi2StatusOK) - component = dereferenceInstance(_component) - logInfo(component, message, status) -end - -function logWarning(_component::fmi2Component, message, status::fmi2Status=fmi2StatusWarning) - component = dereferenceInstance(_component) - logWarning(component, message, status) -end - -function logError(_component::fmi2Component, message, status::fmi2Status=fmi2StatusError) - component = dereferenceInstance(_component) - logError(component, message, status) -end - ############## function reset(_component::fmi2Component) @@ -77,10 +62,10 @@ function evaluate(_component::fmi2Component, eventMode=false) xd = tmp_xd else if xc != tmp_xc - logError(_component, "FMU_FCT_EVALUATE changes the systems continuous state while not being in event-mode, this is not allowed!") + logError(component, "FMU_FCT_EVALUATE changes the systems continuous state while not being in event-mode, this is not allowed!") end if xd != tmp_xd - logError(_component, "FMU_FCT_EVALUATE changes the systems discrete state while not being in event-mode, this is not allowed!") + logError(component, "FMU_FCT_EVALUATE changes the systems discrete state while not being in event-mode, this is not allowed!") end end @@ -309,7 +294,7 @@ function simple_fmi2GetReal(_component::fmi2Component, _vr::Ptr{fmi2ValueReferen try value[i] = component.values[valueRef] catch e - logError(component.compAddr, "fmi2SetReal: Unknown value reference $(valueRef).") + logError(component, "fmi2SetReal: Unknown value reference $(valueRef).") return fmi2StatusError end end @@ -353,7 +338,7 @@ function simple_fmi2SetReal(_component::fmi2Component, _vr::Ptr{fmi2ValueReferen try component.values[valueRef] = value[i] catch e - logError(component.compAddr, "fmi2SetReal: Unknown value reference $(valueRef).") + logError(component, "fmi2SetReal: Unknown value reference $(valueRef).") return fmi2StatusError end end @@ -401,7 +386,7 @@ function simple_fmi2SetContinuousStates(_component::fmi2Component, _x::Ptr{fmi2R component = dereferenceInstance(_component) if nx != length(component.fmu.modelDescription.stateValueReferences) - logWarning(component.compAddr, "fmi2SetContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") + logWarning(component, "fmi2SetContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") end x = unsafe_wrap(Array{fmi2Real}, _x, nx) @@ -462,7 +447,7 @@ function simple_fmi2GetDerivatives(_component::fmi2Component, _derivatives::Ptr{ component = dereferenceInstance(_component) if nx != length(component.fmu.modelDescription.derivativeValueReferences) - logWarning(component.compAddr, "fmi2GetDerivatives: Model has $(length(component.fmu.modelDescription.derivativeValueReferences)) states, but `nx`=$(nx).") + logWarning(component, "fmi2GetDerivatives: Model has $(length(component.fmu.modelDescription.derivativeValueReferences)) states, but `nx`=$(nx).") end derivatives = unsafe_wrap(Array{fmi2Real}, _derivatives, nx) @@ -479,7 +464,7 @@ function simple_fmi2GetEventIndicators(_component::fmi2Component, _eventIndicato component = dereferenceInstance(_component) if ni != length(component.fmu.modelDescription.numberOfEventIndicators) - logWarning(component.compAddr, "fmi2GetEventIndicators: Model has $(length(component.eventIndicators)) states, but `ni`=$(ni).") + logWarning(component, "fmi2GetEventIndicators: Model has $(length(component.eventIndicators)) states, but `ni`=$(ni).") end eventIndicators = unsafe_wrap(Array{fmi2Real}, _eventIndicators, ni) @@ -497,7 +482,7 @@ function simple_fmi2GetContinuousStates(_component::fmi2Component, _x::Ptr{fmi2R component = dereferenceInstance(_component) if nx != length(component.fmu.modelDescription.stateValueReferences) - logWarning(component.compAddr, "fmi2GetContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") + logWarning(component, "fmi2GetContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") end x = unsafe_wrap(Array{fmi2Real}, _x, nx) @@ -514,7 +499,7 @@ function simple_fmi2GetNominalsOfContinuousStates(_component::fmi2Component, _x_ component = dereferenceInstance(_component) if nx != length(component.fmu.modelDescription.stateValueReferences) - logWarning(component.compAddr, "fmi2GetNominalsOfContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") + logWarning(component, "fmi2GetNominalsOfContinuousStates: Model has $(length(component.fmu.modelDescription.stateValueReferences)) states, but `nx`=$(nx).") end x_nominal = unsafe_wrap(Array{fmi2Real}, _x_nominal, nx) diff --git a/src/FMIExport.jl b/src/FMIExport.jl index f1f5920..fb3a68a 100644 --- a/src/FMIExport.jl +++ b/src/FMIExport.jl @@ -13,7 +13,7 @@ using FMICore: fmi2RealAttributesExt, fmi2IntegerAttributesExt, fmi2BooleanAttri using FMICore: fmi2VariableDependency, fmi2Unknown, fmi2DependencyKind using FMICore: fmi2VariableNamingConventionStructured using FMICore: fmi2CausalityToString, fmi2VariabilityToString, fmi2InitialToString -using FMICore: fmi2String, fmi2Boolean, fmi2Integer, fmi2Real, fmi2Enum +using FMICore: fmi2String, fmi2Boolean, fmi2Integer, fmi2Real using FMICore: fmi2Type, fmi2TypeModelExchange, fmi2TypeCoSimulation using FMICore: fmi2CallbackFunctions using FMICore: fmi2StatusOK, fmi2StatusWarning, fmi2StatusError diff --git a/test/runtests.jl b/test/runtests.jl index 5736ef9..1b52929 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,13 +16,13 @@ function runtests() end @testset "FMU Manipulation" begin - @warn "This test is currently excluded because of insufficient ressources in GitHub-Actions." - #include("manipulation.jl") + #@warn "The test `FMU Manipulation` is currently excluded because of insufficient ressources in GitHub-Actions." + include("manipulation.jl") end @testset "NeuralFMU" begin - @warn "This test is currently excluded because of insufficient ressources in GitHub-Actions." - #include("neuralFMU.jl") + #@warn "The test `NeuralFMU` is currently excluded because of insufficient ressources in GitHub-Actions." + include("neuralFMU.jl") end end