How to add to recipe in SubUnits non-inheriting from CcWsTmplV2Logic
use case for subunits
Follow the instructions below in case of subunits which do not inherit from CcWsTmplV2Logic. Otherwise go to recipes for CcWsTmplV2Logic.
Add ProcessParamsPort
-
Go to Structure Diagram of your module
-
Create a new port with following properties:
-
Name: ProcessParamsPort
-
Protocol: CpJobHandlerV2ProcessParams
-
check only protected and end port b
-
Create relevant transitions
-
Go to State Diagram of your module
-
Create internal transition "SetPointerToProcessParams" with following properties:
-
Name: SetPointerToProcessParams
-
trigger: ProcessParamsPort on signal: SetPointerToProcessParams
-
actions:
-
m_oProcessParams = *rtdata;
m_oProcessParams.Register("UpgradedTapeHandler", 1, "PP_RetrySearch", "", &m_xnRetrySearch );
-
Create internal transition "OnParameterSetSaved" with following properties:
-
Name: OnParameterSetSaved
-
trigger: ProcessParamsPort on signal: ParameterSetSaved
-
-
Create internal transition "OnParameterSetLoaded" with following properties:
-
Name: OnParameterSetLoaded
-
trigger: ProcessParamsPort on signal: ParameterSetLoaded
-
-
Create internal transition DeferSetPointerToProcessParams inside Offline state with the following properties:
-
Name : DeferSetPointerToProcessParams
-
trigger : ProcessParamsPort on signal: SetPointerToProcessParams
-
actions:
-
msg->defer();
- Add action on inside OnStartUp transition with following properties:
- actions:
ProcessParamsPort.SetPointerToProcessParams().recall(true);
Naming of Recipe variables
X Variables for modules with Cardinality
To avoid confusing parameters of different subunits, we assign to them unique identication, either by appending part of its capsule name to the parameter name or by separating them into multiple groups, each corresponding to one incarnated capsule.
Option 1: Multiple Parameters with unique indices
- Go to State Diagram of your module and add the following lines in actions tab of SetPointerToProcessParams internal transition:
CdString sCapsuleName = GetLongNameOfCapsule();
//modify the name as you wish it to appear in your recipe
CdString sParamsName = "BlindSpeed";
sParamsName = sParamsName + sCapsuleName[39];//[39] was chosen here because in our example the 39th element correspond to the incarnation index.
- then use your string in parameter registration
m_oProcessParams.Register("TapeHandler", 1, sParamsName, "", &m_xfBlindSpeed );//using sParamsName as the title of m_xfBlindSpeed parameter
Capsule Name
Use GetLongNameOfCapsule() to get the full (hierarchical) name of capsule. This function returns CdString value.
Option 2: Multiple Groups
- Go to State Diagram of your module and add the following lines in actions tab of SetPointerToProcessParams internal transition:
CdString sCapsuleName = GetLongNameOfCapsule();
//modify the name as you wish it appears in your recipe
CdString sCapsuleType = "TapeHandler";
sCapsuleName = sCapsuleType + sCapsuleName[39];//[39] was chosen here because in our example the 39th element correspond to the incarnation index.
m_oProcessParams.Register(sCapsuleName, 1, "PP_RetrySearch", "", &m_xnRetrySearch );//using sCapsuleName as the title of recipe group