Skip to content

Commit

Permalink
well dtct sim failure -> exit 1
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrichet authored Nov 25, 2022
1 parent f0d8f27 commit f5b8f16
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/main/scripts/Modelica.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ loadModel(Modelica);
loadFile("%1%");
simulate(%model%, stopTime=1,tolerance=0.001,outputFormat="csv");
) > %1%.mos
omc %1%.mos
start /b omc %1%.mos > %1%.moo
) else (
omc %1%
start /b omc %1% > %1%.moo
)

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq omc.exe"') do set PID_OMC=%%b
echo %PID_OMC% > PID

:loop
tasklist | find " %PID_OMC% " >nul
if not errorlevel 1 (
timeout /t 1 >nul
goto :loop
)

del /f PID

findstr "Failed" *.moo
if errorlevel 1 (
exit 1
)
15 changes: 13 additions & 2 deletions src/main/scripts/Modelica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ loadModel(Modelica);
loadFile("$1");
simulate($model, stopTime=1,tolerance=0.001,outputFormat="csv");
EOM
omc $1.mos
omc $1.mos > $1.moo 2>&1 &
else
omc $1
omc $1 > $1.moo 2>&1 &
fi

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

wait $PID_OMC

rm -f PID

ERROR=`cat *.moo | grep "Failed"`
if [ ! "$ERROR" == "" ]; then
echo $ERROR >&2
exit 1
fi

0 comments on commit f5b8f16

Please sign in to comment.