-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed testa * added test for execution config, fixed bug with freeInstance * compatibility to new FMI3 topology
- Loading branch information
Showing
7 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "FMI" | ||
uuid = "14a09403-18e3-468f-ad8a-74f8dda2d9ac" | ||
authors = ["TT <[email protected]>", "LM <[email protected]>", "JK <[email protected]>"] | ||
version = "0.11.1" | ||
version = "0.11.2" | ||
|
||
[deps] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
|
@@ -20,7 +20,7 @@ ChainRulesCore = "1.15.0" | |
DiffEqCallbacks = "2.24.0" | ||
DifferentialEquations = "7.5.0" | ||
FMIExport = "0.1.0" | ||
FMIImport = "0.13.0" | ||
FMIImport = "0.14.0" | ||
ForwardDiff = "0.10.0" | ||
ProgressMeter = "1.7.0" | ||
Requires = "1.3.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# | ||
# Copyright (c) 2021 Tobias Thummerer, Lars Mikelsons, Josef Kircher | ||
# Licensed under the MIT license. See LICENSE file in the project root for details. | ||
# | ||
|
||
using FMI.FMIImport | ||
|
||
t_start = 0.0 | ||
t_stop = 1.0 | ||
|
||
myFMU = fmiLoad("SpringPendulum1D", ENV["EXPORTINGTOOL"], ENV["EXPORTINGVERSION"]) | ||
|
||
comp = fmiInstantiate!(myFMU; loggingOn=false, type=fmi2TypeCoSimulation) | ||
@test comp != 0 | ||
# choose FMU or FMUComponent | ||
fmuStruct = nothing | ||
envFMUSTRUCT = ENV["FMUSTRUCT"] | ||
if envFMUSTRUCT == "FMU" | ||
fmuStruct = myFMU | ||
elseif envFMUSTRUCT == "FMUCOMPONENT" | ||
fmuStruct = comp | ||
end | ||
@assert fmuStruct !== nothing "Unknown fmuStruct, environment variable `FMUSTRUCT` = `$envFMUSTRUCT`" | ||
|
||
for execConf in (FMU2_EXECUTION_CONFIGURATION_NO_FREEING, FMU2_EXECUTION_CONFIGURATION_RESET, FMU2_EXECUTION_CONFIGURATION_NO_RESET) # ToDo: Add `FMU2_EXECUTION_CONFIGURATION_NOTHING` | ||
for mode in (:CS, :ME) | ||
global fmuStruct | ||
@info "\t$(mode) | $(execConf)" | ||
|
||
myFMU.executionConfig = execConf | ||
|
||
# sim test | ||
numInst = length(myFMU.components) | ||
|
||
if mode == :CS | ||
fmiSimulateCS(fmuStruct, (t_start, t_stop)) | ||
elseif mode == :ME | ||
fmiSimulateME(fmuStruct, (t_start, t_stop)) | ||
else | ||
@assert false "Unknown mode `$(mode)`." | ||
end | ||
|
||
if execConf.instantiate | ||
numInst += 1 | ||
end | ||
if execConf.freeInstance | ||
numInst -= 1 | ||
end | ||
|
||
@test length(myFMU.components) == numInst | ||
|
||
# prepare next run start | ||
if envFMUSTRUCT == "FMU" | ||
if !execConf.freeInstance | ||
fmi2FreeInstance!(myFMU) | ||
end | ||
fmi2Instantiate!(myFMU; type=(mode==:CS ? fmi2TypeModelExchange : fmi2TypeCoSimulation)) | ||
|
||
elseif envFMUSTRUCT == "FMUCOMPONENT" | ||
if !execConf.freeInstance | ||
fmi2FreeInstance!(fmuStruct) | ||
end | ||
fmuStruct = fmi2Instantiate!(myFMU; type=(mode==:CS ? fmi2TypeModelExchange : fmi2TypeCoSimulation)) | ||
|
||
end | ||
|
||
# prepare next run end | ||
|
||
end | ||
end | ||
|
||
fmiUnload(myFMU) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9055475
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
9055475
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/74452
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: