Functional and Logical Ports Mapping During a Replace (FL_Replace_PortsMapping)

An opening ID is an entry point used to customize business logic. The FL_Replace_PortsMapping business logic allows to define equivalence rules that are taken into account every time that a replace action is performed on a functional or logical reference with ports. It allows to overload or to help the default ports mapping that is used to reroute connections.

Important: This business logic computes equivalences for the ports mapping only. It does not compute equivalence for interfaces mapping.
Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This opening ID is called every time that a replace action is performed on a functional or logical reference with ports.

Default behavior: During a replace action, the current ports mapping computes equivalences between ports. A mapping between two ports is made only if a port on the replaced reference has a unique equivalent port on the replacing reference. This mapping is used to reconnect the functional or logical connections that are impacted by the replace action.

Example:

If we replace "Reference 2" by "Reference 3", the current ports mapping would find these equivalences:

Ports on "Reference 2" Equivalent port(s) found on "Reference 3" Consequence
Consumption - Flow A Consumption - Flow A

Mapping done because unique equivalence found.

Connection 1 is rerouted.

Consumption - Flow B Consumption - Flow B (1) Consumption - Flow B (2)

No mapping because more than one equivalence are found.

Connection 2 is broken.

Emission - Flow C -

No mapping because no equivalence is found.

Connection 3 is broken.

And the result is:

This opening ID enables you to define your own ports mapping rules. It can be used to overload the default rules, or to complete the current ports mapping:

  • Overload the current ports mapping

    In this case, the opening ID is called before the current ports mapping. It allows you to overload the default equivalence rules and define your own equivalence rules. In the previous example, you could define rules that lead to these equivalences:

    Ports on "Reference 2" Equivalent port(s) found on "Reference 3" Consequence
    Consumption - Flow A -

    No mapping because no equivalence is found.

    Connection 1 is broken.

    Consumption - Flow B Consumption - Flow A

    Mapping done because unique equivalence found.

    Connection 2 is rerouted.

    Emission - Flow C Emission - Flow D

    Mapping done because unique equivalence found.

    Connection 3 is rerouted.



  • Help the current ports mapping on remaining unmapped ports

    In that case, the Opening ID is called after the current ports mapping, and only on unmapped ports. In the example above, only ports “Consumption – Flow B” and “Emission – Flow C” would be given to the Opening ID. The port “Consumption – Flow A” is not given because unique equivalence has been found by the current ports mapping. In the Opening ID, you can define rules that lead to these equivalences:

    Ports on "Reference 2" Equivalent port(s) found on "Reference 3" Consequence
    Consumption - Flow B Consumption - Flow B (1)

    Mapping done because unique equivalence found.

    Connection 2 is rerouted.

    Emission - Flow C Emission - Flow D

    Mapping done because unique equivalence found.

    Connection 3 is rerouted.



Here is a state diagram of the Opening ID:

The table below provides you with information related to the definition of the Opening ID.

PLM Opening ID: FL_Replace_PortsMapping
Customization intent: Computation
Execution context:Client

Input Objects

Input objects must be of the following types:

  • ThisObject is the replaced functional or logical reference.
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter NameTypeRead/WriteComments
OperationId String Read The operation identifier defines when the equivalences are computed:
  • Case (1): before the default ports mapping, to overload it (OperationId = "OverloadPortsMapping")
  • Case (2): after the default ports mapping, and only for unmapped ports (OperationId = "PortMappingOnPortsWithoutEquivalence")
ReplacingReference Feature Read The replacing functional/logical reference
ListOfPortsReplaced List (Feature) Read This parameter contains the list of functional/logical ports on the replaced reference. All ports in case (1), only ports without unique equivalence in case (2).
ListOfPortsReplacing List (Feature) Read This parameter contains the list of all the functional/logical ports on the replacing Reference.
ListOfPortsEquivalence List of List (Feature) Write This parameter is used to return the list of equivalences. It must contain a list of couples [Replaced Port, Port Equivalent]. If no equivalence found, an empty list is returned.
IsPortsMappingOverloaded Boolean Write Default value: True. This parameter is useful only in case (1), it allows you to indicate if the business logic overloads the ports mapping or not. If false, the list of equivalences must be empty and current ports mapping is called. If true, current ports mapping is not be called and only retrieved equivalences are used.

Sample

Case 1: Overload ports mapping

Let's implement the following rule (on the functional domain):

  • If V_Name attribute of the replaced reference equals MyName, overload the ports mapping. Replaced Port equivalent to the last Replacing Port with same direction.
  • Else, ports mapping not overloaded.

To achieve this particular business logic implementation, a .CATRuleExit file, known as family, declares the script to run every time a replace is performed on a functional reference:

<Scripts>
    <Script 	OpeningID="FL_Replace_PortsMapping"
			Type="RFLPLMFunctionalReferenceSubType" 
			ScriptName="MyOverloadingPortsMappingComputationRule" >

		<Condition 	Attribute="OperationId" 
				Value=" OverloadPortsMapping" />
    </Script>
</Scripts>

This family tells to run the script MyOverloadingPortsMappingComputationRule whenever a replace operation is launched on a functional reference (that have at least one port) of PLM type RFLPLMFunctionalReferenceSubType. This script is a .CATRule file that contains the following business logic implementation:

let ReferenceReplacing(PLMEntity)
let lPortsReplaced(list)
let lPortsReplacing(list)
let lPortsEquivalence(list)
let portReplaced(RFLPLMFunctionalConnector)
let portReplacing(RFLPLMFunctionalConnector)
let portEquivalent(RFLPLMFunctionalConnector)

set ReferenceReplacing = Parameters->GetAttributeObject("ReplacingReference")
set lPortsReplaced = Parameters->GetAttributeObject("ListOfPortsReplaced")
set lPortsReplacing = Parameters->GetAttributeObject("ListOfPortsReplacing")

if (ThisObject.V_Name == "MyName") {
	//Overload ports mapping
	For portReplaced inside lPortsReplaced
	{
		set portEquivalent=NULL
		For portReplacing inside lPortsReplacing
		{
			// If same V_Direction, set equivalent Port. Only last one kept.
			if( portReplaced.V_Direction == portReplacing.V_Direction ) {
				set portEquivalent=portReplacing
			}
		}
		//If port equivalent found, add it to the equivalences list.
		if( NULL <> portEquivalent) {
			lPortsEquivalence.Append(List(portReplaced, portEquivalent))
		}
	}
	Parameters->SetAttributeObject("ListOfPortsEquivalence",lPortsEquivalence)
}
else {
	// Ports Mapping not overloaded
	Parameters->SetAttributeBoolean("IsPortsMappingOverloaded",false)
}

When ports mapping is NOT overloaded, only IsPortsMappingOverloaded is returned to false. Otherwise, the list of found equivalences is returned (can be null if no equivalences found).

Case 2: Help the current ports mapping on unmapped ports
Let's implement the following rule (on the functional domain): Replaced port equivalent to the last replacing port with same direction.

Here is the corresponding .CATRuleExit file:

<Scripts>
    <Script 	OpeningID="FL_Replace_PortsMapping"
			Type="RFLPLMFunctionalReferenceSubType" 
			ScriptName="MyHelpingPortsMappingComputationRule" >

		<Condition 	Attribute="OperationId" 
				Value="PortMappingOnPortsWithoutEquivalence" />
    </Script>
</Scripts>
This family tells to run the script MyHelpingPortsMappingComputationRule whenever a replace operation is launched with a functional reference (that remains with Port(s) without unique equivalence) of PLM type RFLPLMFunctionalReferenceSubType. This script is a .CATRule file that contains the following business logic implementation:
let ReferenceReplacing(PLMEntity)
let lPortsReplaced(list)
let lPortsReplacing(list)
let lPortsEquivalence(list)
let portReplaced(RFLPLMFunctionalConnector)
let portReplacing(RFLPLMFunctionalConnector)
let portEquivalent(RFLPLMFunctionalConnector)

set ReferenceReplacing = Parameters->GetAttributeObject("ReplacingReference")
set lPortsReplaced = Parameters->GetAttributeObject("ListOfPortsReplaced")
set lPortsReplacing = Parameters->GetAttributeObject("ListOfPortsReplacing")

For portReplaced inside lPortsReplaced
{
	set portEquivalent=NULL
	For portReplacing inside lPortsReplacing
	{
		// If same V_Direction, set equivalent Port. Only last one kept.
		if( portReplaced.V_Direction == portReplacing.V_Direction ) {
			set portEquivalent=portReplacing
		}
	}
	//If port equivalent found, add it to the equivalences list.
	if( NULL <> portEquivalent) {
		lPortsEquivalence.Append(List(portReplaced, portEquivalent))
	}
}
Parameters->SetAttributeObject("ListOfPortsEquivalence",lPortsEquivalence)

As a result, the list of found equivalences is returned (can be null of no equivalences found).