Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ThummeTo committed Aug 30, 2024
1 parent 3d55081 commit a4ac1d9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ If you want to migrate your project from [*FMI.jl*](https://github.com/ThummeTo/

- [x] [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl) and [*FMIImport.jl*](https://github.com/ThummeTo/FMIImport.jl) were divided into [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl), [*FMIImport.jl*](https://github.com/ThummeTo/FMIImport.jl) and [*FMIBase.jl*](https://github.com/ThummeTo/FMIBase.jl). [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl) now holds the pure standard definition (C-types and -functions), while [*FMIBase.jl*](https://github.com/ThummeTo/FMIBase.jl) holds everything that is needed on top of that in [*FMIImport.jl*](https://github.com/ThummeTo/FMIImport.jl) as well as in [*FMIExport.jl*](https://github.com/ThummeTo/FMIExport.jl).

- [ ] Updated all library examples.

- [ ] Updated all library tests for a better code coverage.

- [ ] We tried to document every function, if you find undocumented user-level functions, please open an issue or PR.
Expand Down Expand Up @@ -76,6 +78,7 @@ unloadFMU(myFMU)
- importing the full FMI 2.0.3 and FMI 3.0.0 command set, including optional specials like `fmi2GetState`, `fmi2SetState` and `fmi2GetDirectionalDerivatives`
- parameterization, simulation & plotting of CS- and ME-FMUs
- event-handling for imported discontinuous ME-FMUs
- 64-bit and 32-bit FMUs

| | **FMI2.0.3** | | **FMI3.0** | | **SSP1.0** | |
|-----------------------------------|--------------|--------|------------|--------|------------|--------|
Expand Down
5 changes: 3 additions & 2 deletions examples/src/inputs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
" if x != nothing # this check is important, because inputs may be needed before the system state is known\n",
" x1 = x[1] \n",
" end\n",
" u[1] =sin(t) * x1\n",
" u[1] = sin(t) * x1\n",
" nothing\n",
"end \n",
"\n",
"# simulate while setting inputs\n",
Expand Down Expand Up @@ -198,7 +199,7 @@
},
"outputs": [],
"source": [
"fmiUnload(fmu)"
"unloadFMU(fmu)"
]
}
],
Expand Down
70 changes: 35 additions & 35 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using FMI.FMIImport

using DifferentialEquations: FBDF

fmuStructs = ("FMU", "FMUCOMPONENT")
fmuStructs = ("FMU", "INSTANCE")

# enable assertions for warnings/errors for all default execution configurations
for exec in FMU_EXECUTION_CONFIGURATIONS
Expand All @@ -37,7 +37,7 @@ function getFMUStruct(
kwargs...,
)

# choose FMU or FMUComponent
# choose FMU or FMUInstance
if endswith(modelname, ".fmu")
fmu = loadFMU(modelname; kwargs...)
else
Expand All @@ -47,7 +47,7 @@ function getFMUStruct(
if fmustruct == "FMU"
return fmu, fmu

elseif fmustruct == "FMUCOMPONENT"
elseif fmustruct == "INSTANCE"
inst, _ = FMI.prepareSolveFMU(fmu, nothing, mode; loggingOn = true)
@test !isnothing(inst)
return inst, fmu
Expand All @@ -57,52 +57,52 @@ function getFMUStruct(
end
end

toolversions = [("Dymola", "2023x")] # ("SimulationX", "4.5.2")

@testset "FMI.jl" begin
if Sys.iswindows() || Sys.islinux()
@info "Automated testing is supported on Windows/Linux."

ENV["EXPORTINGTOOL"] = "Dymola"
ENV["EXPORTINGVERSION"] = "2023x"
for (tool, version) in toolversions

for fmiversion in (2.0, 3.0)
ENV["FMIVERSION"] = fmiversion
ENV["EXPORTINGTOOL"] = tool
ENV["EXPORTINGVERSION"] = version

@testset "Testing FMI $(ENV["FMIVERSION"]) FMUs exported from $(ENV["EXPORTINGTOOL"]) $(ENV["EXPORTINGVERSION"])" begin
for fmiversion in (2.0, 3.0)
ENV["FMIVERSION"] = fmiversion

for fmustruct in fmuStructs
ENV["FMUSTRUCT"] = fmustruct
@testset "Testing FMI $(ENV["FMIVERSION"]) FMUs exported from $(ENV["EXPORTINGTOOL"]) $(ENV["EXPORTINGVERSION"])" begin

@testset "Functions for $(ENV["FMUSTRUCT"])" begin
for fmustruct in fmuStructs
ENV["FMUSTRUCT"] = fmustruct

@info "CS Simulation (sim_CS.jl)"
@testset "CS Simulation" begin
include("sim_CS.jl")
end
@testset "Functions for $(ENV["FMUSTRUCT"])" begin

@info "ME Simulation (sim_ME.jl)"
@testset "ME Simulation" begin
include("sim_ME.jl")
end
@info "CS Simulation (sim_CS.jl)"
@testset "CS Simulation" begin
include("sim_CS.jl")
end

@info "SE Simulation (sim_SE.jl)"
@testset "SE Simulation" begin
include("sim_SE.jl")
end
@info "ME Simulation (sim_ME.jl)"
@testset "ME Simulation" begin
include("sim_ME.jl")
end

@info "SE Simulation (sim_SE.jl)"
if fmiversion == 3.0
@testset "SE Simulation" begin
include("sim_SE.jl")
end
else
@info "Skipping SE tests for FMI $(fmiversion), because this is not supported by the corresponding FMI version."
end

@info "Simulation FMU without states (sim_zero_state.jl)"
@testset "Simulation FMU without states" begin
include("sim_zero_state.jl")
@info "Simulation FMU without states (sim_zero_state.jl)"
@testset "Simulation FMU without states" begin
include("sim_zero_state.jl")
end
end
end

# if VERSION >= v"1.9.0"
# @info "Performance (performance.jl)"
# @testset "Performance" begin
# include("FMI2/performance.jl")
# end
# else
@info "Julia Version $(VERSION), skipping performance tests ..."
#end
end
end
end
Expand Down

0 comments on commit a4ac1d9

Please sign in to comment.