The Class JSONObjectSimulationDataComponent is a bare bone implementation of a simulator that

  1. Uses a predefined model file from the workspace or a model file provided by the currently active editor
  2. Validates the EMF model before proceeding (optionally)
  3. Makes a model2model or model2text transformation with visual feedback (progress monitor)
  4. Reacts to input data (signals) with output data (signals)

It differs from the JSONObjectDataComponent by replacing the following methods:

Method Name

Comment

checkModelValidation

New method for using EMF validation facilities to check the model prior simulation.

doStep

Code of method step, specifying what should be done in a step. In the case of an editor it will check each step if the editor was modified.

doProvideProperties

Code of provideProperties, additionally a Model File property is inserted at the beginning of the property list (WARNING: all indices shifted by one!)

doModel2ModelTransform

New method for specifying a transformation that might take time (visual progress monitor if not running headless)

doProvideInitialVariables

Code of provideInitialVariables

There are special methods that are provided to access the model to be simulated:

Method Name

Comment

getModelFilePath

Always possible. Provides the path to the model (relative in the workspace). This also works for a headless mode if ACTIVE EDITOR is selected KIEM will provide the current model.

getModelRootElement

Only possible for EMF models. If the model is based on an active and opened edito this is directly the root element of this editor. If the editor is not the source but the EMF model file then this root element is automatically loaded (if this is possible). If this fails or the model is not an EMF model this method returns NULL.

getModelEditor

Only possible if editor is open and ACTIV EDITOR is selected. This returns the active and opened editor if the considered model file if this exists and NULL otherwise.

It is encouraged to use file utility methods provided by the KIEM Plugin utility Class KiemUtil.

Tags: