Table of Contents

Using Parameters in Components

Software components are intended for composition “as-is” without the intention to modify them in source-code. The SmartMDSD Toolchain foresees “component parameters” to configure foreseen variation points.

Parameters are defined in Tier 2 as re-usable domain models or within a software component. Their values can be customized durin system composition.

This page will describe the steps to setup a component with parameters. We will configure the component parameters in a component project and will customize it during system composition.

Note that there are two types of component parameters:

This HowTo will describe the use of component internal parameters. If you want to model parameters at Tier 2, model them in a domain project (model file .parameters)

Modeling the Component Parameters in a Component Project

Step 1: Create a Component Project

Step 2: Model the Component with Component Parameters

Step 3: Assign the initial values to Component Parameters

Step 4 : Using Component Parameters in Code

Accessing parameter in Task (ConfigTask)

Code to access the parameter in the Task :

int ConfigTask::on_execute()
{
	double maxVel = COMP->getGlobalState().getRobot().getMaxVel();
			//OR
	double maxvel2 = COMP->getParameters().getRobot().getMaxVel();
	return 0;
}

Customizing the Component Parameters in the System

Step 1: Create a System Project

Step 2: Import and Model Component

Model your system as usual:

Step 3:Using Parameters in Components

Step 4: Customize the Component Parameters

You can use the parameter in the system either from the parameter model (file suffix .componentParameters) or via the component parameter editor view. See the below animation for a usage demonstration how to define the parameter values:

The below screenshot shows another example using the component parameter editor view. Select the

DokuWiki Appliance - Powered by TurnKey Linux