-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functions for getting FMU metadata (#17)
* Added functions for getting inp, out, state names * added tests for checking values * changed fmi2GetVariableUnits to default nothing * updated fmi2GetVariableDescriptions * returns dict instead of list of dict * added tests for checking units and start values Co-authored-by: sathvikbhagavan <sathvikbhagavan@@gmail.com>
- Loading branch information
1 parent
aa9af79
commit 94d8184
Showing
4 changed files
with
246 additions
and
1 deletion.
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
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,46 @@ | ||
# | ||
# Copyright (c) 2021 Tobias Thummerer, Lars Mikelsons, Josef Kircher | ||
# Licensed under the MIT license. See LICENSE file in the project root for details. | ||
# | ||
|
||
using FMIImport.FMICore: fmi2VariableNamingConventionStructured | ||
|
||
myFMU = fmi2Load("IO", ENV["EXPORTINGTOOL"], ENV["EXPORTINGVERSION"]) | ||
myFMU.executionConfig.assertOnWarning = true | ||
|
||
@test length(fmi2GetNamesToValueReference(myFMU.modelDescription)) == 11 | ||
@test length(fmi2GetNamesToValueReference(myFMU)) == 11 | ||
|
||
@test length(fmi2GetValueRefenceToName(myFMU.modelDescription)) == 11 | ||
@test length(fmi2GetValueRefenceToName(myFMU)) == 11 | ||
|
||
@test length(fmi2GetInputNames(myFMU.modelDescription)) == 3 | ||
@test length(fmi2GetInputNames(myFMU)) == 3 | ||
@test fmi2GetInputNames(myFMU.modelDescription) == ["u_real", "u_boolean", "u_integer"] | ||
@test fmi2GetInputNames(myFMU) == ["u_real", "u_boolean", "u_integer"] | ||
|
||
@test length(fmi2GetOutputNames(myFMU.modelDescription)) == 3 | ||
@test length(fmi2GetOutputNames(myFMU)) == 3 | ||
@test fmi2GetOutputNames(myFMU.modelDescription) == ["y_real", "y_boolean", "y_integer"] | ||
@test fmi2GetOutputNames(myFMU) == ["y_real", "y_boolean", "y_integer"] | ||
|
||
@test length(fmi2GetParameterNames(myFMU.modelDescription)) == 0 | ||
@test length(fmi2GetParameterNames(myFMU)) == 0 | ||
|
||
@test length(fmi2GetStateNames(myFMU.modelDescription)) == 0 | ||
@test length(fmi2GetStateNames(myFMU)) == 0 | ||
|
||
@test length(fmi2GetDerivateNames(myFMU.modelDescription)) == 0 | ||
@test length(fmi2GetDerivateNames(myFMU)) == 0 | ||
|
||
@test length(fmi2GetVariableDescriptions(myFMU.modelDescription)) == 11 | ||
@test length(fmi2GetVariableDescriptions(myFMU)) == 11 | ||
|
||
@test length(fmi2GetVariableUnits(myFMU.modelDescription)) == 11 | ||
@test length(fmi2GetVariableUnits(myFMU)) == 11 | ||
|
||
@test length(fmi2GetStartValues(myFMU.modelDescription)) == 11 | ||
@test length(fmi2GetStartValues(myFMU)) == 11 | ||
|
||
|
||
fmi2Unload(myFMU) |