Skip to content

Commit 5526c33

Browse files
committed
added generation of script file for linux to run cpp simulation with simulation parameter
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18578 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent fd01c6f commit 5526c33

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ case SIMCODE(__) then
4343
end simulationHeaderFile;
4444

4545

46+
47+
48+
4649
template simulationMainRunScrip(SimCode simCode)
4750
"Generates code for header file for simulation target."
4851
::=
@@ -61,9 +64,18 @@ match platform
6164
case "linux64"
6265
case "linux32" then
6366
match simCode
64-
case SIMCODE(modelInfo=MODELINFO(__),makefileParams=MAKEFILE_PARAMS(__)) then
67+
case SIMCODE(modelInfo=MODELINFO(__),makefileParams=MAKEFILE_PARAMS(__),simulationSettingsOpt = SOME(settings as SIMULATION_SETTINGS(__))) then
68+
let start = settings.startTime
69+
let end = settings.stopTime
70+
let stepsize = settings.stepSize
71+
let intervals = settings.numberOfIntervals
72+
let tol = settings.tolerance
73+
let solver = settings.method
74+
let moLib = makefileParams.compileDir
75+
let home = makefileParams.omhome
6576
<<
66-
77+
> #!/bin/sh
78+
> exec OMCpp<%fileNamePrefix%> -s <%start%> -e <%end%> -f <%stepsize%> -v <%intervals%> -y <%tol%> -i <%solver%> -r <%simulationLibDir(simulationCodeTarget(),simCode)%> -m <%moLib%> -R <%simulationResults(getRunningTestsuite(),simCode)%> $*
6779
>>
6880
end match
6981
case "win32"
@@ -303,35 +315,7 @@ end simulationMainDLLib2;
303315

304316

305317

306-
template simulationRunScript(SimCode simCode)
307-
::=
308-
match simCode
309-
case SIMCODE(makefileParams=MAKEFILE_PARAMS(__)) then
310-
<<
311-
<%simulationRunScript2(makefileParams.platform,simCode)%>
312-
>>
313-
end simulationRunScript;
314318

315-
template simulationRunScript2(String platform,SimCode simCode)
316-
"Generates the contents of the makefile for the simulation case."
317-
::=
318-
match platform
319-
case "win32" then
320-
match simCode
321-
case SIMCODE(makefileParams=MAKEFILE_PARAMS(__)) then
322-
<<
323-
"Test1"
324-
>>
325-
end match
326-
case "linux" then
327-
match simCode
328-
case SIMCODE(makefileParams=MAKEFILE_PARAMS(__)) then
329-
<<
330-
"Test2"
331-
>>
332-
end match
333-
end match
334-
end simulationRunScript2;
335319

336320

337321

0 commit comments

Comments
 (0)