## Simulator generation

The simulator generator allows to generate a simulator for a CommaSuite model. It can be generated for a single interface and for a component. If the used interfaces contain triggers with parameters, replies and notifications with variables or any (*) value then one or more parameters file is required.

The user interface of the generated simulator makes it possible to walk through the various states of the CommaSuite model.

To enable simulator generation add the following to the `.prj` file, e.g. using content assist (ctrl + space):

    import "Camera.interface"

    Project Camera {

    	Generate Simulator {
    		// For components user "for component" instead
    	    Simulator_ICamera for interface ICamera
    	    {
                // Input parameters for the interface (only required when the interface has commands/signals with input parameters and replies/notifications with variables or any (*) expression)
    	        params: "ICamera.params"
    	    }
    	}
    }

To generate the simulator, run the `.prj` (right click on the `.prj` file → Run As → Run generators). To also execute it select Generate and execute simulator instead. Alternatively the simulator can be started by executing the generated `.bat`/`.sh` in the `src-gen/simulator` folder.

Once the simulator started you will see a window like below:

The client and server section allow to execute actions:

- The client section contains all the commands and signals

- The server section all the replies and notifications.

- Greyed out actions cannot be executed in the current state.

- To execute an action click on an enabled action. The possible transitions or clauses will then be shown in the actions section, click on one to execute it.

Notice that the executed actions are added to the log and sequence (visualisation) section. The controls section allows to i.a. log the current variable values and step back to previous states. The save button in the top left allows to save the log and sequence (plantuml text) to a file.

Limitations:

- Simulation of component models:

  - Currently, usage of variables of type id that are used to identify the communication party of a component are not supported

  - Component models with parts are not supported (compound components)

- Time and data constraints are not supported