Skip to content

Commit

Permalink
Add simflags (#107)
Browse files Browse the repository at this point in the history
* Fixing profiling doc strings
* Adding simFlags to profiling
  • Loading branch information
AnHeuermann authored Feb 15, 2024
1 parent f991818 commit 2293bd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/profiling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

"""
simulateWithProfiling(modelName, pathToMo; [pathToOmc], workingDir=pwd(), outputFormat="mat", clean=false])
simulateWithProfiling(modelName, moFiles; options)
Simulate Modelica model with profiling enabled using given omc.
Expand Down Expand Up @@ -80,7 +80,7 @@ function simulateWithProfiling(modelName::String,

@debug "simulate"
outputFormat = options.outputFormat === Nothing ? "csv" : options.outputFormat
msg = OMJulia.sendExpression(omc, "simulate($(modelName), outputFormat=\"$(outputFormat)\", simflags=\"-lv=LOG_STATS -clock=RT -cpu -w\")")
msg = OMJulia.sendExpression(omc, "simulate($(modelName), outputFormat=\"$(outputFormat)\", simflags=\"-lv=LOG_STATS -clock=RT -cpu -w $(options.simFlags)\")")
write(logFile, msg["messages"]*"\n")
msg = OMJulia.sendExpression(omc, "getErrorString()")
write(logFile, msg*"\n")
Expand Down Expand Up @@ -132,7 +132,7 @@ end


"""
findSlowEquations(profJsonFile, infoJsonFile; threshold)
findSlowEquations(profJsonFile, infoJsonFile; threshold = 0.03, ignoreInit = true)
Read JSON profiling file and find slowest non-linear loop equatiosn that need more then `threshold` of total simulation time.
Expand Down Expand Up @@ -383,7 +383,7 @@ end


"""
minMaxValuesReSim(vars, modelName, moFiles; pathToOmc="" workingDir=pwd())
minMaxValuesReSim(vars, modelName, moFiles; options)
(Re-)simulate Modelica model and find miminum and maximum value each variable has during simulation.
Expand Down
5 changes: 4 additions & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ struct OMOptions
clean::Bool
"Additional comannd line options for `setCommandLineOptions`."
commandLineOptions::String
"Additional simulation flags."
simFlags::String

"""
OMOptions(;pathToOmc = "", workingDir = pwd(), outputFormat = "csv", clean = false, commandLineOptions = "", disableCSE = true)
Expand All @@ -146,6 +148,7 @@ struct OMOptions
outputFormat::Union{String,Nothing} = "csv",
clean::Bool = false,
commandLineOptions::String = "",
simFlags::String = "",
disableCSE = true)

# Try to find omc executable
Expand All @@ -161,7 +164,7 @@ struct OMOptions
commandLineOptions *= " --preOptModules-=wrapFunctionCalls --postOptModules-=wrapFunctionCalls"
end

new(pathToOmc, workingDir, outputFormat, clean, commandLineOptions)
new(pathToOmc, workingDir, outputFormat, clean, commandLineOptions, simFlags)
end
end

Expand Down

0 comments on commit 2293bd5

Please sign in to comment.