A SimulationExecutionListener Class is a listener for Events that will be activated during execution of a model. All available Events are listed below.
public class SimulationExecutionListener { void executionStarted(SimulationExecution execution); void elementActivated(Element element, Collection<?> values); void elementDeactivated(Element element, Collection<?> values); void eventTriggered(SignalInstance signal); void operationCalled(Operation operation, ParameterValueList pvl, Object_ caller, Object_ target, boolean isSynchronous); void behaviorCalled(Behavior behavior, ParameterValueList pvl, Object_ caller, Object_ target, boolean isSynchronous); void objectCreated(Object_ sender, Object_ object); void valueChange(StructuredValue context, FeatureValue feature, Object oldValue, Object newValue); void executionTerminated(SimulationExecution execution); void configLoaded(Element config); void busyStatusChange(StructuredValue context, Object oldValue, Object newValue); } |
Once you have created the execution listener, you can register it to a list of global execution listeners.
To register a new execution listener to a global list, type the following code
SimulationManager.registerSimulationExecutionListener(listener); //listener is an instance of SimulationExecutionListener. |
All registered listeners will be cleared and removed automatically when the execution is terminated.
ExecutionAdapter and ExecutionListener are not valid in Cameo Simulation Toolkit 19.0 and in later versions. |
All open APIs below are used by the Simulation Dashboard plugin and can be added for particular purposes.
Open API | Function |
---|---|
beforeObjectDestroyed(Object_ object) | Works with an object-destroying Listener when added into SimulationExecutionListener. |
objectStateActivated(StructuredValue context, State newState) | Works with a State activation Listener when added into SimulationExecutionListener. |
SimulationExecutionListener.contextInitialized(SimulationExecution execution) | Gets an Event when objects have been initialized but not started the execution yet. |
SimulationHelper.findFeatureValue(Object_ runtimeContext, List<Property> propertyPath, Property target) : List<FeatureValue> | Gets featureValue objects that match the given nested property path. |
SimulationHelper.getAvailableSignals(StructuredValue target, ExecutionEngine engine) | Retrieves available Signals from the specified structured value. |
SimulationHelper.getConfigElement(SimulationExecution execution) | Gets a Config element. |
SimulationHelper.isFeatureValueInvalid(FeatureValue featureValue, int index) | Checks the validity of FeatureValue. |
SimulationManager.getContext(SimulationSession session) : Object_ | Gets the execution context. |
SimulationManager.registerSimulationExecutionListener(SimulationExecutionListener listener, SimulationExecution execution) | Registers SimulationExecutionListener dynamically during the execution. |
SimulationManager.unregisterSimulationExecutionListener(SimulationExecutionListener listener) SimulationManager.unregisterSimulationExecutionListener(SimulationExecutionListener listener, SimulationExecution execution) | Unregisters SimulationExecutionListener. |