Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FMI test case for enumerations including omc and OMSimulator (#6772)
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 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
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,47 @@ | ||
// keywords: fmu export import | ||
// status: correct | ||
// teardown_command: rm -rf Enumeration.lua Enumeration.fmu Enumeration.log Enumeration_systemCall.log temp-Enumeration/ | ||
|
||
loadString(" | ||
model Enumeration | ||
type E = enumeration(one, two, three); | ||
input E u(start=E.one); | ||
output E y = u; | ||
end Enumeration; | ||
"); getErrorString(); | ||
|
||
buildModelFMU(Enumeration, version="2.0", fmuType="me", platforms={"static"}); getErrorString(); | ||
|
||
writeFile("Enumeration.lua", " | ||
oms_setCommandLineOption(\"--suppressPath=true\") | ||
oms_setTempDirectory(\"./temp-Enumeration/\") | ||
|
||
oms_newModel(\"test\") | ||
oms_addSystem(\"test.root\", oms_system_sc) | ||
oms_addSubModel(\"test.root.A\", \"Enumeration.fmu\") | ||
oms_addSubModel(\"test.root.B\", \"Enumeration.fmu\") | ||
oms_addConnection(\"test.root.A.y\", \"test.root.B.u\") | ||
oms_setResultFile(\"test\", \"\") | ||
|
||
oms_instantiate(\"test\") | ||
oms_initialize(\"test\") | ||
oms_simulate(\"test\") | ||
oms_terminate(\"test\") | ||
oms_delete(\"test\") | ||
"); getErrorString(); | ||
|
||
system(getInstallationDirectoryPath() + "/bin/OMSimulator Enumeration.lua", "Enumeration_systemCall.log"); | ||
readFile("Enumeration_systemCall.log"); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// "Enumeration.fmu" | ||
// "" | ||
// true | ||
// "" | ||
// 0 | ||
// "info: model doesn't contain any continuous state | ||
// info: No result file will be created | ||
// " | ||
// endResult |
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,57 @@ | ||
// keywords: fmu export import | ||
// status: correct | ||
// teardown_command: rm -rf Enumeration2.lua Enum1.fmu Int1.fmu Enum1.log Int1.log Enumeration2_systemCall.log temp-Enumeration2/ | ||
|
||
loadString(" | ||
model Enum1 | ||
type E = enumeration(one, two, three); | ||
input E u; | ||
end Enum1; | ||
"); getErrorString(); | ||
|
||
loadString(" | ||
model Int1 | ||
output Integer y = 2; | ||
end Int1; | ||
"); getErrorString(); | ||
|
||
buildModelFMU(Enum1, version="2.0", fmuType="me", platforms={"static"}); getErrorString(); | ||
buildModelFMU(Int1, version="2.0", fmuType="me", platforms={"static"}); getErrorString(); | ||
|
||
writeFile("Enumeration2.lua", " | ||
oms_setCommandLineOption(\"--suppressPath=true\") | ||
oms_setTempDirectory(\"./temp-Enumeration2/\") | ||
|
||
oms_newModel(\"test\") | ||
oms_addSystem(\"test.root\", oms_system_sc) | ||
oms_addSubModel(\"test.root.A\", \"Int1.fmu\") | ||
oms_addSubModel(\"test.root.B\", \"Enum1.fmu\") | ||
oms_addConnection(\"test.root.A.y\", \"test.root.B.u\") | ||
oms_setResultFile(\"test\", \"\") | ||
|
||
oms_instantiate(\"test\") | ||
oms_initialize(\"test\") | ||
oms_simulate(\"test\") | ||
oms_terminate(\"test\") | ||
oms_delete(\"test\") | ||
"); getErrorString(); | ||
|
||
system(getInstallationDirectoryPath() + "/bin/OMSimulator Enumeration2.lua", "Enumeration2_systemCall.log"); | ||
readFile("Enumeration2_systemCall.log"); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// "Enum1.fmu" | ||
// "" | ||
// "Int1.fmu" | ||
// "" | ||
// true | ||
// "" | ||
// 0 | ||
// "info: model doesn't contain any continuous state | ||
// info: No result file will be created | ||
// " | ||
// endResult |