forked from lbl-srg/BuildingsPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix timeout at low level and start process as daemon The daemon flag is an extra safety: in case the main process exists for whatever reason, the daemonic subprocess will also be terminated. * Fix timeout in base class * Run autopep8 * Fix issues with error logging * Dummy commit (empty line) to trigger CI * Set daemon with a flag for compatibility with Python 2 * Added error message if log file is not found * Refactored process termination * Refactor timeout mechanism * Run autopep8 * Restore error log * Add test for timeout with Dymola * pep8 * Added function that sleeps * Add tests and release notes * Fix Python version requirement Co-authored-by: Michael Wetter <[email protected]>
- Loading branch information
1 parent
797f8cd
commit 7f35d83
Showing
13 changed files
with
148 additions
and
47 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
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
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,16 @@ | ||
within MyModelicaLibrary; | ||
model MyModelTimeOut | ||
parameter Integer sec = 5 "Time for sleep in seconds"; | ||
Real r "Return value of mySleep"; | ||
|
||
function mySleep | ||
input Integer sec "Sleep time in seconds"; | ||
output Integer r "Return value"; | ||
external "C" r = MySleep(sec) | ||
annotation ( | ||
Include="#include <MySleep.c>", | ||
IncludeDirectory="modelica://MyModelicaLibrary/Resources/C-Sources"); | ||
end mySleep; | ||
equation | ||
r = mySleep(sec=sec); | ||
end MyModelTimeOut; |
15 changes: 15 additions & 0 deletions
15
buildingspy/tests/MyModelicaLibrary/Resources/C-Sources/MySleep.c
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,15 @@ | ||
#ifdef _WIN32 | ||
#include <Windows.h> | ||
#else | ||
#include <unistd.h> | ||
#endif | ||
|
||
int MySleep(int sec) | ||
{ | ||
#ifdef _WIN32 | ||
Sleep(sec); | ||
return 0; | ||
#else | ||
return sleep(sec); | ||
#endif | ||
} |
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,4 +1,5 @@ | ||
MyModel | ||
MyModelTimeOut | ||
MyStep | ||
Reset | ||
one | ||
|
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