|
| 1 | +# Interactive Simulation |
| 2 | + |
| 3 | +This example showcases a basic "Hello world" interactive simulation. |
| 4 | + |
| 5 | +The simulation relies on `SimulationWrapperInteractive.m` to manage TCP/IP communication with the MATLAB agent, allowing real-time data exchange between the simulation and the client. |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Interactive Simulation](#interactive-simulation) |
| 10 | + - [Table of Contents](#table-of-contents) |
| 11 | + - [Usage](#usage) |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +Before running the simulation, you need to configure the Matlab agent by setting the simulation folder path in the `config.yaml` file under the simulation section: |
| 16 | + |
| 17 | +```yaml |
| 18 | +simulation: |
| 19 | + path: <path_to_simulation_folder> |
| 20 | +``` |
| 21 | +
|
| 22 | +This path should point to the directory `interactive-simulation` containing the simulation files |
| 23 | + |
| 24 | +Once configured, you can initiate the simulation using the API as described below. |
| 25 | + |
| 26 | +The simulation can be initiated via the API by submitting a YAML payload, a template of which is available in the file `api/simulation.yaml` |
| 27 | + |
| 28 | +```yaml |
| 29 | +simulation: |
| 30 | + request_id: abcdef12345 # Unique identifier for this simulation request |
| 31 | + client_id: dt # Client identifier for tracking purposes |
| 32 | + simulator: matlab # Specifies MATLAB as the simulation engine |
| 33 | + type: interactive # Indicates this is an interactive simulation type |
| 34 | + file: InteractiveSimulation.m # Main MATLAB file to execute |
| 35 | + inputs: |
| 36 | + stream_source: "rabbitmq://streaming.inputs.sim123" # RabbitMQ stream for input data |
| 37 | + outputs: |
| 38 | + predicted: |
| 39 | + x_next: float # Next predicted X coordinate value |
| 40 | + y_next: float # Next predicted Y coordinate value |
| 41 | + misc: |
| 42 | + distance_from_origin: float # Calculated distance from origin point |
| 43 | + timestamp: float # Simulation timestamp in epoch seconds |
| 44 | +``` |
| 45 | + |
| 46 | +Use the client `use_matlab_agent_interactive.py` to start the client. |
0 commit comments