Skip to content

Commit f5b8f16

Browse files
authored
well dtct sim failure -> exit 1
1 parent f0d8f27 commit f5b8f16

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

src/main/scripts/Modelica.bat

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,24 @@ loadModel(Modelica);
99
loadFile("%1%");
1010
simulate(%model%, stopTime=1,tolerance=0.001,outputFormat="csv");
1111
) > %1%.mos
12-
omc %1%.mos
12+
start /b omc %1%.mos > %1%.moo
1313
) else (
14-
omc %1%
14+
start /b omc %1% > %1%.moo
1515
)
1616

17+
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq omc.exe"') do set PID_OMC=%%b
18+
echo %PID_OMC% > PID
19+
20+
:loop
21+
tasklist | find " %PID_OMC% " >nul
22+
if not errorlevel 1 (
23+
timeout /t 1 >nul
24+
goto :loop
25+
)
26+
27+
del /f PID
28+
29+
findstr "Failed" *.moo
30+
if errorlevel 1 (
31+
exit 1
32+
)

src/main/scripts/Modelica.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@ loadModel(Modelica);
77
loadFile("$1");
88
simulate($model, stopTime=1,tolerance=0.001,outputFormat="csv");
99
EOM
10-
omc $1.mos
10+
omc $1.mos > $1.moo 2>&1 &
1111
else
12-
omc $1
12+
omc $1 > $1.moo 2>&1 &
1313
fi
1414

15+
PID_OMC=$!
16+
echo $PID_OMC >> PID #this will allow Funz to kill process if needed
1517

18+
wait $PID_OMC
19+
20+
rm -f PID
21+
22+
ERROR=`cat *.moo | grep "Failed"`
23+
if [ ! "$ERROR" == "" ]; then
24+
echo $ERROR >&2
25+
exit 1
26+
fi

0 commit comments

Comments
 (0)