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)
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; }
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