SumoCore command documentation

Command path <folder>
Description Sets the current working directory.
Arguments
folderThe current working directory will be changed to this folder
Examples
path c:/;
Response 530007 Path set to: "\1".


Command reset
Description Resets all variables to the factory default. Any parameters, dynamic inputs, state variable values are lost.
Response 530011 Reset


Command set <variable> <value>
Description Sets a variable to the given value. Changing a dimension variable will automatically resize all arrays connected to it. If this happens during a simulation, the simulation stops.
Arguments
variableFull name of the variable. Only variables with the role of SystemParameter, Parameter, Dimension or Constant can be set.
valueThe type of the value must match the type of the variable.
Examples
set Sumo__Plant__Unit__param__Scalar 1;
set Sumo__Plant__Unit__param__Array 1 2 3;
set Sumo__Plant__Unit__param__Array(0) 1;
Response 530021 Set: \1 to \2


Command mode <mode>
Description Sets the simulation mode. Algebraic mode is for very simple calculations in a special Algebraic block. Dynamic mode does dynamic simulation. Steady mode calculates steady-state.
Arguments
modealgebraic, dynamic or steady
Examples
mode dynamic;
Response 530053 Mode: \1.


Command save <filename>
Description Saves every variable in an xml format, that you can load back with the load command.
Arguments
filenamethe name (or full path) of the file you want to create
Examples
save systemstate.xml;
save "c:/Users/UserName with Spaces/systemstate.xml";
Response 530045 Current systemstate saved to "\1".


Command load <filename> [-partial 1]
Description Load every variable from an xml format. Must be used on a systemstate file created with save command from the same model.
Arguments
filenamethe name (or full path) of the file you want to open
-partial 1optional. If the models doesn't match, loads back any variable that does match. Everything else is ignored.
Examples
load systemstate.xml;
load "c:/Users/UserName with Spaces/systemstate.xml" -partial 1;
Response 530041 Systemstate loaded from "\1".


Command savestates <filename>
Description Saves every state variable in an xml format, that you can load back with the loadstates command.
Arguments
filenamethe name (or full path) of the file you want to create
Examples
savestates state.ss;
savestates "c:/Users/UserName with Spaces/state.ss";
Response 530045 Current systemstate saved to "\1".


Command loadstates <filename> [-partial 1] [-if-better-by <value>] [-maptoic]
Description Load every state variable from an xml format. Must be used on a systemstate file created with savestates command from the same model.
Arguments
filenamethe name (or full path) of the file you want to open
-partial 1optional. If the models doesn't match, loads back any variable that does match. Everything else is ignored.
-if-better-by <value>optional. If present, the core will not load back the state, if Sumo__MaxAbsDer is larger than the current divided by the given value
-maptoicoptional. If the command is successful, follow it up with a maptoic command
Examples
loadstates state.ss;
loadstates "c:/Users/UserName with Spaces/systemstate.xml" -partial 1 -if-better-by 10 -maptoic;
Response 530041 Systemstate loaded from "\1".


Command loadtsv <filename> [-cycletime <value>] [-interpolation <value>]
Description Loads a dynamic input table from a tsv file. The file should contain the full name of the target variables, the numbers should be in in-code units and the first column should be Sumo__Time in days. If you modify the file, you need to call unloadtsv on it and then use loadtsv again to refresh the values in the Core.
Arguments
filenamethe name (or full path) of the file you want to open
-cycletime <value>optional. If set, the dynamic input will restart every <value> msecs. Any value in the dynamic input beyond this time will be ignored with a warning.
-interpolation <value>optional. Can be none or linear. If this flag is not set, the default interpolation is none.
Examples
loadtsv input.tsv;
input.tsv
Sumo__TimeSumo__Plant__Influent__param__Q
024000
112000
224000
Response 530029 TSV file "\1" loaded with \2 interpolation.
530030 TSV file "\1" loaded.
530042 TSV file "\1" loaded with \2 cyclestart and \3 cycletime.
530043 TSV file "\1" loaded with \2 interpolation, \3 cyclestart and \4 cycletime.


Command unloadtsv <filename>
Description Unloads the target dynamic input file that was previously loaded.
Arguments
filenamethe name (or full path) of the file that is to be unloaded. It should be the exact same argument that was given to the loadtsv command, even if the file is not there anymore.
Examples
unloadtsv input.tsv;
Response 530050 TSV file "\1" unloaded.


Command writetsv <filename> [<variableslist_filename>]
Description Creates a tsv file containing simulation data from every datacomm. A writetsv command is needed without any arguments to release the files that were written.
Arguments
filenamethe name (or full path) of the file that is to be written.
variableslist_filenameoptional. The name (or full path) of the file that contain the list of variables (one variable per line). If omitted, all variables are saved to the file.
Examples
writetsv output.tsv;
Response 530037 TSV writer: "\1" all variables.
530038 TSV writer: "\1" variables from file "\2".
530047 TSV writer: writing disabled.


Command maptoic
Description Maps state variables to initial condition.
Response 530019 Mapping to initial conditions.


Command execute <filename>
Description Executes the target sumocore script. The file should contain sumocore commands delimited by semicolon (';').
Arguments
filenamethe name (or full path) of the file you want to execute.
Examples
execute myscript.scs;
Response 530036 Script file \1 loaded.


Command start
Description Starts the simulation in the mode previously selected by the mode command
Response 530002 Simulation started.


Command pause
Description Pauses the simulation.
Response 530003 Simulation paused.


Command continue
Description Resumes the simulation.
Response 530008 Simulation continues...


Command stop
Description Stops the simulation.
Response 530004 Simulation ended.