Simulation¶
For testing and validation purposes, PMP provides the concept of simulated controllers. By using processing blocks, the motion platform also enables the simulation of plants. This allows for software verification without the need for physical controllers or plants.
Controller¶
Simulated controllers simulate the behavior of a physical controller. A simulated controller is created from an XML controller description.
After creation, interfacing with a simulated controller is identical to interfacing with a physical controller. Equivalent to physical controllers, simulated controllers keep running when the user’s system instance is destroyed. To destroy a simulated controller explicitly, use the destroy or dispose functionality.
Note
Simulated sub-controllers are automatically destroyed when their parent controller is destroyed.
To create a simulated controller the user must provide settings to configure the simulated controller as well as settings to configure the simulator framework as described in the following sections.
Multiple versions (Windows OS only)¶
PMP supports installing multiple versions of the motion platform when using the Windows OS. The location of each installation is stored in the Windows registry based on its release version. When creating a simulated top-controller, the version of the client library is communicated to the simulator service. The simulator service uses this version to determine the location of the corresponding installation from the Windows registry.
See also
- Create a simulator
A guide to create a simulated system via PMP API.
- Create a simulator
A guide to create a simulated system via PMP tooling.
- System description
System description XML.
- Controller description
Controller description XML.
Top-controller bus creation¶
On hardware top-controllers, it is possible for some buses to be physically absent from a controller. In this case, it is possible to mark a bus as optional in the top-controller model. If an optional bus is not physically present on the controller during startup, that bus will not be created.
On the simulator, which buses are created depends on the method by which the top-controller is created.
Using the CreateController methods on ISystem, all buses contained in the top-controller model are created.
As part of the CreateControllers methods on ISystem. In this case the bus creation depends on which Bus elements are present in the system description. If a bus is not marked as optional in the top-controller model, it will always be created. If a bus is marked as optional in the top-controller model, that bus will be created if the system description contains a bus element with the same name.
Sub-controller bus assignment¶
Similarly to hardware sub-controllers simulated sub-controllers are connected to a specific bus. Depending on how the sub-controller is created the sub-controller is either connected to a user-specified bus or to a bus determined by the top-controller.
There are 3 methods to create a simulated sub-controller:
Using the
CreateController
methods onIBus
, theIBus
instance specifies the bus the sub-controller is connected to.Using the CreateController methods on IController the controller will determine which bus to connect the created sub-controller to according to the strategy described in Bus selection strategy.
Note
These methods are only provided for backward compatibility and are not recommended for new designs.
As part of the CreateControllers method on ISystem. In this case the bus selection depends on where the Controller node is placed in the system description. If a sub-controller is nested under a Bus node, the sub-controller is connected to the specified bus. If a sub-controller is nested under a Controller node, the controller selects the bus using the strategy described in Bus selection strategy.
Note
Nesting a sub-controller directly under a Controller node is only provided for backward compatibility and not recommended for new designs.
Bus selection strategy¶
When the user does not specify a bus for a created sub-controller, the controller determines the bus to connect the sub-controller to as follows:
First all single sub-controller buses (i.e. buses that only support a single sub-controller) are considered, ordered by their default name. As soon as an empty single sub-controller bus is encountered that bus is selected to create the sub-controller on.
Once all single sub-controller buses have a connected sub-controller, multi sub-controller buses (i.e. buses that support multiple sub-controllers) are used, ordered by their default name, until their maximum capacity is reached.