Extending PCM

Aus SDQ-Wiki

This page collects some information about non-invasive PCM extensions, i.e. extending PCM around the stable PCM core.

Creating a PCM Add-On

If you just want to provide some additional enhancement to PCM that accesses PCM Core code, but does not need to change PCM Core code, consider creating a PCM Addons project. See PCM Development/Create new AddOn for details.

Palladio Model Template

Palladio provides a wizard to create new palladio projects with the opportunity to choose a model template to start with. This wizard provides an extension point to add your own template to the list of templates to choose from. How the wizard is used and how to work with this extension point is described in the article Palladio Project Wizard

Extending the PCM Analysis workflow

The PCM Analysis workflow is based on the SDQ Workflow Engine (WFE). The WFE features dynamic extensions, i.e. workflow engine jobs that are executed if the corresponding plugin is available in the eclipse runtime. By using such extension, extensions to the PCM workflow can be provided that do not need any PCM core adaptations.

More information on extendible workflows

Extending the PCM Simulation

Adding a scheduler

  • Create a new plugin.
  • In the plugin, add a dependency to
    • de.uka.ipd.sdq.simucomframework
    • de.uka.ipd.sdq.scheduler
    • de.uka.ipd.sdq.simulation.abstractsimengine
  • In the plugin, create a class that inherits from de.uka.ipd.sdq.simucomframework.resources.SimuComExtensionResource
    • This class will provide the base class for the extended scheduler
    • SimuComExtensionResource inherits from AbstractActiveResource, which is implemented by all PCM SimuCom schedulers
  • In the plugin, create a factory class that inherits from de.uka.ipd.sdq.scheduler.factory.SchedulerExtensionFactory
    • This class has to implement the method getExtensionScheduler(..) that returns an instance of the scheduler
  • In the plugin, add an extension for the extension point "de.uka.ipd.sdq.scheduler"
    • Define an id for the new scheduler
    • Create a "scheduler" child element for the extension
      • In the "class" attribute of the "scheduler" element, provide the path to the scheduler factory class.

To use the new scheduler, launch an eclipse runtime with the new scheduler plugin and all PCM plugins enabled.

  • Create a new PCM model or use an existing one.
  • Create a resourcetype model (Root element ResourceRepository)
    • In the resourcetype model, create a SchedulingPolicy element.
    • The id attribute of the SchedulingPolicy element has to be set to the id of the defined scheduler extension point
  • In the PCM resourcenenvironment model, the scheduling policy of a ProcessingResourceSpecification which has to be simulated with the new scheduler has to be set to the SchedulingPolicy element.
  • The resourcetype repository can also be placed in the plugin of the new scheduler, making it available to the runtime by using the extension point "org.eclipse.emf.ecore.uri_mapping"

Adding a scheduler with a new resource interface

  • Create a scheduler as explained in the "Adding a scheduler" section
  • In the resourcetype repository, create a new ResourceInterface
    • Add ResourceSignatures to the ResourceInterface, depending on how the interface should look like
  • In the resourcetype repository, create a ProcessingResourceType that provides the specified ResourceInterface.
  • A component using the resource has to have a ResourceRequiredRole referencing the ResourceInterface
    • In a SEFF InternalAction of the component, add a ResourceCall that refers to this ResourceRequiredRole and a signature of the resource
    • A ResourceCall is comparable to the traditional ParametricResourceDemand. It also contains a StoEx specification for the demand.
  • Your scheduler implementation will be called with the method
    protected void doProcessing(ISchedulableProcess request, int resourceServiceID, double demand)
    The resourceServiceID attribute denotes the id of the service and corresponds to the specified signature in the ResourceCall.
    The first signature has the id 0, the second has the id 1, and so on.
    The scheduler implementation can now provide scheduler logic depending on the called resource service.

Adding additional input parameters for your Scheduler

  • If your Scheduler needs more than one input parameter (Demand), follow the steps in the "Adding a scheduler with new resource interface" section
  • Then add the necessary input parameters to the ResourceSignatures in the ResourceInterface
  • You need to specify the name and the type of the parameter
  • Inside the ResourceCall you have to add one VariableUsage for each parameter
  • You add a VariableReference to this VariableUsage, referencing the name of the corresponding parameter
  • Now you can assign a value to this parameter by using a VariableCharacterisation, StoEx are possible. The Expression has to match the Type of the Parameter in the ResourceSignature
  • The last step is to override the method
protected void doProcessing(ISchedulableProcess process, int resourceServiceID,
           Map<String, Serializable> parameterMap, double demand)

from the AbstractActiveResource class in your Scheduler class. Don’t use

protected void doProcessing(ISchedulableProcess process, int resourceServiceID, double demand) 

which is already in your Scheduler.

  • The Map<String, Serializable> parameterMap contains the parameters you assigned values for in the form: parameter name -> value. You need to convert the value from type Serializable to the type the parameter actually has.

Providing a different SimuCom ResourceContainer implementation

Have a look at the RTEMS scheduler PCM Addons project available at

https://svnserver.informatik.kit.edu/i43/svn/code/Palladio/Addons/RTEMSScheduler/trunk/edu.kit.ipd.sdq.pcm.simulation.rtems