Simulation Center—Deploying Simulations
Simulations can be exported from Simulation Center and then be deployed to run standalone on any computer without any dependency on System Modeler being installed on the target computer. The only restriction is that the export has to be done from the same operating system and architecture as the target computer. This can be used for to run batch jobs on a computer cluster or to deploy real-time simulations that connect to another system using, for example, ModelPlug, OPCUA or OPCClassic.
To export the simulation executable and the corresponding settings file from the active experiment, choose File ▶ Export ▶ Simulation executable and select the desired output directory. At least two files will be created in that directory: ExperimentName.exe, which is the simulation executable, and ExperimentName.sim, which is the settings file. If the model uses any external C code that is linked dynamically, those shared libraries will also be copied to the destination folder. To deploy the simulation to another computer, all those files need to be transferred to the target computer.
The simulation executable takes four switches:
- -server IP-address:PORT to specify IP address and port to use when starting the simulation in interactive mode
The settings file contains all parameter values and initial values for the model. It can be used to parameterize the simulation, e.g. to run parameter sweeps. For more information on the file format of the .sim file, see Simulation Settings Files.
The simulation result is stored in the file specified with -r using the format described in Simulation Result Files. If no result file is specified with -r, the result is not stored to file; this is, for example, useful for interactive simulations.
To start the simulation in batch mode, specify the simulation settings file to use with the -f switch and the result file with the -r switch. The following will run MyExperiment.exe using the parameters and start values specified in MyExperiment.sim and saving the simulation result in ResultFile.mat.
To start the simulation in interactive mode, specify the simulation settings file to use with the -f switch and the IP address and port that the simulation should listen on with the -server switch. The argument to the -server specifies the IP-address and PORT using the format IP-address:PORT. When the simulation is run in interactive mode, it will start in a paused state, and a client needs to connect to it to start the simulation. For information on how to interact with the simulation, see the Simulation API documentation.
Note that it is also possible to save the simulation result to file using the -r switch as in batch mode. However, since interactive simulations are in general unbounded in time, that is not advisable.
The following will run MyExperiment.exe using the MyExperiment.sim settings file and listening to IP address 127.0.0.1 and port 7000.