Omc Run Options

From OpenM++
Jump to: navigation, search

There are a number of options which control model compilation and publishing. The most frequently used are:

  • model name
  • input directory containing model .ompp or .mpp source files
  • input directory with model parameters (a.k.a. "scenario" .dat files)
  • use directory containing openM++ standard .ompp files included by "use" statement

OpenM++ compiler (omc) gets run options in following order:

  • as command line arguments
  • from options ini-file
  • use default values

Following options supported by omc command line:

  • -Omc.ModelName name/of/model/executable, e.g. RiskPaths
  • -Omc.ScenarioName name/of/base/scenario, e.g. Base
  • -Omc.InputDir input/dir/to/find/source/files
  • -Omc.OutputDir output/dir/to/place/compiled/cpp_and_h_and_sql/files
  • -Omc.UseDir use/dir/with/ompp/files
  • -Omc.ParamDir input/dir/to/find/parameter/files/for/scenario
  • -Omc.FixedDir input/dir/to/find/fixed/parameter/files/
  • -Omc.CodePage code page for converting source files, e.g. windows-1252
  • -Omc.SqlDir sql/script/dir to create SQLite database
  • -Omc.SqlPublishTo create sql scripts to publish in SQLite,MySQL,PostgreSQL,MSSQL,Oracle,DB2, default: SQLite
  • -OpenM.OptionsFile some/optional/omc.ini
  • -Omc.TraceScanning detailed tracing from scanner
  • -Omc.TraceParsing detailed tracing from parser
  • -Omc.MessageLanguage language to display output messages, default: user environment settings
  • -Omc.MessageFnc localized message functions, default: LT,logMsg,logFormatted,WriteLogEntry,WarningMsg,ModelExit
  • -Omc.SqlDir sql/script/dir to create SQLite database
  • -Omc.SqlPublishTo create sql scripts to publish in SQLite,MySQL,PostgreSQL,MSSQL,Oracle,DB2, default: SQLite

Or you can use short form of command line arguments:

  • -m short form of -Omc.ModelName
  • -s short form of -Omc.ScenarioName
  • -i short form of -Omc.InputDir
  • -o short form of -Omc.OutputDir
  • -u short form of -Omc.UseDir
  • -p short form of -Omc.ParamDir
  • -f short form of -Omc.FixedDir
  • -ini short form of -OpenM.OptionsFile

Each option has unique key string associated with it, i.e.: "Omc.InputDir". You can use this key to specify command line argument or as ini-file Section.Key entry. For example:

omc.exe -m Alpha1 -Omc.InputDir ../../alpha -ini omc2.ini

would compile model Alpha1 source files: ../../alpha/*.ompp and ../../alpha/*.mpp with some other options specified through omc2.ini file.

Also omc compiler supports common openM++ log options described below.

Omc ini-file options

To specify name of ini-file you can use -ini or -OpenM.OptionsFile key. Please see OpenM++ ini-file format to find out more.

Example of omc ini-file:

;
; Omc-specific options
;
[Omc]

;
; model name, it must be specified either on command line or here
; no default value
;
; ModelName = NewCaseBased

;
; input directory to get source .ompp or .mpp files to compile
; default = current directory
;
; InputDir = ./code

;
; output directory to place generated .cpp and .h files for the model
; default = current directory
;
; OutputDir = ../build/NewCaseBased

;
; use directory to resolve 'use' statements
; default = directory/of/omc.exe/../use/
;
; UseDir = ../../use

;
; name of default set of input parameters (a.k.a. base scenario data)
; default = Default
;
; ScenarioName = Default

;
; parameter directory to get source .dat files to publish a scenario
; default = Default
;
; ParamDir = parameters/Default

;
; fixed directory to get source .dat files with fixed parameter values
; default = Fixed
;
; FixedDir = parameters/Fixed

;
; directory where common sql scripts located (used to create SQLite database)
; default = directory/of/omc.exe/../sql/
;
; SqlDir = ../../sql         sql/script/dir to create SQLite database

;
; database providers comma-separated list
; supported providers: SQLite,MySQL,PostgreSQL,MSSQL,Oracle,DB2
; default: SQLite
;
; SqlPublishTo = SQLite

;
; code page for converting source files into utf-8
; default on Linux: utf-8 (no conversion)
; default on Windows: current user code page, e.g.: windows-1252
;
; CodePage = windows-1252

; language to display output messages
; default: Windows Control Panel or Linux LANG 
;
; messageLang = en-CA

;
; localized message functions
; first argument of the Function("const char * message",...) translated into other language
; by lookup in omc.message.ini where "message" = "translated message"
; default: LT,logMsg,logFormatted,WriteLogEntry,WarningMsg,ModelExit
;
; MessageFnc = LT,logMsg,logFormatted,WriteLogEntry,WarningMsg,ModelExit

;
; Common openM++ run options supported by omc
;
[OpenM]

;
; log settings:
; log can be enabled/disabled for 3 independent streams:
;   console         - cout stream
;   "last run" file - log file with specified name, truncated on every compiler run
;   "stamped" file  - log file with unique name, created for every compiler run
;
; "stamped" name produced from "last run" name by adding time-stamp and pid-stamp, i.e.:
;   omc.log => omc_20120817_160459_0148.1234.log
;

LogToConsole     = true       ; log to console
LogNoMsgTime     = true       ; if true then do not prefix log messages with date-time
; LogToFile        = true     ; log to file
; LogToStampedFile = true     ; log to "stamped" file
; LogUseTimeStamp  = true     ; use time-stamp in log "stamped" file name
; LogUsePidStamp   = true     ; use pid-stamp in log "stamped" file name
; LogFilePath      = omc.log  ; log file path, default = current/dir/omc.log 
; LogSql           = true       ; debug only: log sql statements (reserved, but not used by omc)

<metadesc>OpenM++: open source microsimulation platform</metadesc>