Configure the simulation
The simulator uses a Properties concept to be configurable.
All the data in the simulator that is meant to be changeable by the user is separated in its own class. For example the Vehicle class, which represents an instanced vehicle in the simulation, refers to a VehicleProperties class to store all the configurable entries.
The properties data is not duplicated, so in the
Vehicle example any data that is associated to the vehicle but is also configurable is located in the
VehicleProperties class and not the
Vehicle class itself.
The properties of different simulation object (and simulation modules) is structured in the same way that the instanced simulation objects are structured. This forms a tree that with at its root the SimulationConfig class.
This structure can be seen in the Structure Overview graphic. The properties classes are highlighted in orange. As can be seen they follow the same structure as the internal simulator objects.
Used to create simulations
Every element of the property tree (the
...Properties classes or
SimulationConfig) contains a function to instantiate the corresponding simulation object.
This is then called recursively on the children of every property class to create the entire simulation.
Direct mapping to JSON
The advantage of this separation is that the entire properties structure can be directly loaded from JSON using the Json system. By creating a JSON file that exactly reflects this structure, entire simulation scenarios can be specified. (As explained in Simulation Configuration and Vehicle Configuration.)