Skip to content

Commit

Permalink
set commandLienOptions in ModelicaSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 committed Feb 12, 2020
1 parent 1064941 commit 453699e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/OMJulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,20 @@ end

"""
Main function Which constructs the datas and parameters needed for simulation
linearization of a model, The function accepts four aguments. The fourth argument
is library is optional, An example usage is given below
ModelicaSystem(obj,"BouncingBall.mo","BouncingBall",["Modelica", "SystemDynamics"])
linearization of a model, The function accepts five aguments. The fourth argument
is library is optional and fifth argument setCommandLineOptions which is a keyword argument is also optional, An example usage is given below
ModelicaSystem(obj,"BouncingBall.mo","BouncingBall",["Modelica", "SystemDynamics"],commandLineOptions="-d=newInst")
"""
function ModelicaSystem(omc,filename, modelname, library=nothing)
function ModelicaSystem(omc,filename, modelname, library=nothing; commandLineOptions=nothing)
## check for commandLineOptions
if(commandLineOptions!=nothing)
exp=join(["setCommandLineOptions(","","\"",commandLineOptions,"\"" ,")"])
cmdexp = sendExpression(omc,exp)
if(!cmdexp)
return sendExpression(omc,"getErrorString()")
end
end

omc.filepath=filename
omc.modelname=modelname
filepath=replace(abspath(filename),r"[/\\]+" => "/")
Expand Down Expand Up @@ -547,7 +556,7 @@ function simulate(omc; resultfile=nothing, simflags=nothing)
r=join(["-r=",resultfile])
omc.resultfile=replace(joinpath(omc.tempdir,resultfile),r"[/\\]+" => "/")
end

if(simflags == nothing)
simflags=""
end
Expand Down

0 comments on commit 453699e

Please sign in to comment.