Skip to content

Command line Arguments

Fred Rothganger edited this page Dec 6, 2023 · 10 revisions

The app normally starts up a graphical user interface (GUI) that supports editing and running models. In some circumstances, you may want to use the app as a command-line utility without starting up the GUI. Once the utility work is completed, the app exits. If you specify more than one utility function, only one of them will be executed. The utility functions are indicated in bold below. Other options modify the app behavior when running either the GUI or a utility function.

  • -csv -- For single simulation, converts output into standard comma-sparated-value (CSV) format. For study, outputs list of completed jobs in CSV format.
  • -export -- Writes a specified model to disk. You can also specify format and destination file.
  • -format={name} -- Specifies the file format for export. If this argument is not given but the file is specified, then the format is derived from the file suffix. If neither are given, the app will default to its own internal format. In the case of import, this parameter can override content and suffix based format detection. (Use with caution.)
  • -file={path} -- Specifies the file for import or export. Must be specified for import. For export, if this argument is not given, the destination is the current working directory with a name built from the model name and the format's usual file suffix.
  • -import -- Reads in the specified file and adds it to the primary repository. The format is determined automatically from the file contents, possibly using file suffix as a clue.
  • -install -- Unpacks the C and Python backend code into ~n2a/backend. This includes utility classes that you can use in other software projects, particularly for accessing model and output files.
  • -model={name} -- Specifies the model to run, study, import or export. In the case of import, if not specified, then the model name is derived from the file name.
  • -param={path} -- Read a file of command-line arguments. Each argument is on a separate line. The contents of the file is not subject to shell parsing, so it allows more freedom to use certain characters.
  • -plugin={name} -- Specifies a plugin class for explicit loading. Use a separate -plugin argument for each class. Note that any jar files in ~n2a/plugins will be loaded automatically using Java SPI, so they do not need to be listed.
  • -pluginDir={path} -- Adds a directory to the plugin search path. Use a separate -pluginDir argument for each directory.
  • -run -- Runs a simulation in headless mode. The given model must exist in the current repository structure. Treats the current working directory as the job directory.
  • -study -- Runs multiple simulations as part of a systematic study as specified by $meta.study tags contained in the model.
  • {keypath}={value} -- Any command-line argument that does not start with a dash is treated as a model override. This is used in conjunction with -run. The keypath is a dot-seperated list of names that specify the exact model element. The element gets set to value. This can be used to change an equation or some parameter. It can also be used to set the host or backend on which the model runs:
    • $meta.backend=c
    • $meta.host=remote-system
Clone this wiki locally