Note: There is a strong relation between Simulator and Model . A Simulator will execute a Model. In PLASMA Lab, they are grouped under the same object, heriting from AbstractModel . A Model will execute itself.
But we make a distinction between the Simulator/Model and the textual content, the model.
Each Simulator inherits from the AbstractModel class which inherits from AbstractData. AbstractData describes a container for a data such as a model (but also a requirement) and provides functions such as getName, getContent and checkForErrors. As this abstract class is quite simple we won't get too much into details and will mostly focus on the AbstractModel.
checkForErrors come from the AbstractData class. A call to this function will parse the model and initialize any data structure needed before starting a simulation. If errors were found, the function returns true.
After modifying the model, a single call to checkForErrors is needed before starting a batch of simulation (several call to newPath).
The newPath method initialize a new trace and return the initial state. A version of this method can also take a seed as a parameter. The seed can then be freely use by the simulator. Depending on the semantic used in each simulator, the seed may not have the same usage from one simulator to another.
Once the trace was started with newPath, the simulate method is used to progress the simulation step by step. A call to simulate will thus execute a single simulation step. The simulate method does not return anything (see the Trace part for more details). If a deadlock is reached, a PlasmaDeadlockException is thrown.
The backtrack method cancels the last call to simulate. This method will return false if the current (latest) state is the initial state.
Depending on the simulator implementation, a succession of call to simulate and backtrack may or may not produces the same state.
The cut function take an integer stateNb as a parameter and cut the current trace at the stateNb position. Every state before this point is deleted as if the state at position stateNb was the initial state.
The clean method is called after a simulation was completed and before a new one start. It is used in case were some operations must be done in order to return to a safe state. It was added to close the CADP proxy (see CADP plugin for more details).
The AbstractModel provides several accessers to states.
A simulation trace or path is a list of states. There is no trace class to represent it. As the getTrace function has been deprecated, their will be no more constraints on how the execution trace is stored and represented.
The InterfaceState represents a mapping from InterfaceIdentifiers to values. It also provides references to a set of enabled transition and a chosen transition from which this state was reached.
For now, only double values are used.
InterfaceIdentifier is an interface used in PLASMA Lab to represents an object acting as an identifier.
Optimization variables are used to initialize a model with a range of initial state in the same experiment. PLASMA Lab use this feature with the optimization procedure.
Optimization variables can be declared in the Model or in Requirements and are retrieved using the getOptimizationVariables function.