Filter Piping Specification from LineID attributes

Introduction

we don't pretend that the bellow scenarii are real industrial cases. The objectiveis more to illustrate the possible cappability of the Application

 

Scenario 1 : Choose specification filter object by "type" attribute from LineID attributes

Need

In some cases, piping spools are required to be galvanized (zinc coated) instead painting to prevent corrosion inside the piping. In this case, specific type of parts (like flange joint, CG Coupling,...) is usually selected because welding at zinc coated piping may cause corrosion. 

The need is to be able to select resulting parts of filter based on type on the same specification based on criteria coming from line ID .

For example, defining a different type for 

  • Non-galvanized
  • galvanized

 

Proposal

The proposal is to use different filters in the specification as follow with description of galvanization done on 

V_SpecDescription attribute

The Galvanization will be defined on the filter custom attribute :

Then the business rule "Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)" is used to choose the right filter result.

If there is no criteria corresponding to galvanization by filter on one type, the results of all filters will be used.

 

Demonstration

To sum up the logic of the BR :

  • Check if the part placed is in a predefined list (List done to improve performance)
  • Check if the specification is part of a predefined list
  • If yes
    • Check if there is a least one filter for the input type with attribute : "Galvanized" or "NON-Galvanized"
      • If yes
        • Take only the result of the filter corresponding to the DSKGalvanized attribute from line ID
      • If no
        • results from filter without filter criteria 

Video :

How to setup ?

The business rule "Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)" in Piping Specification Resource

 

has to be defined with this code :

 

/* ------------------------------------------
Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)

ThisObject : #In KweTrigger_BL_AddedSpecsAndResourceFilteringParams
Parameters : #In RuleContext

------------------------------------------ */

/* Inputs */ 

let FeatureCurrentApplicativeInformation (Feature)

/* Declarations for current applicative entities */
let ListCurrentApplicativeEntitiesKeys (List)
let sCurrentApplicativeEntityKey (String)
let ListCurrentApplicativeEntities (List)
let NbCurrentApplicativeEntities (Integer)
let pCurrentApplicativeEntity (PLMEntity)
let sCurrentApplicativeEntityName (String)
let pip_line_inst(Piping_Line_Inst)
let pipingLine(Piping_Line)

/* Declarations for current ens specifications & content */
let ListCurrentEnsSpecifications (List)
let NbCurrentEnsSpecifications (Integer)

/* Declarations for additional customer ens specifications */
let ListAuthorizedAdditionalEnsSpecifications (List)
let NbAuthorizedAdditionalEnsSpecifications (Integer)
let pAuthorizedAdditionalEnsSpecification (PLMEntity)
let sAuthorizedAdditionalEnsSpecificationName1 (String)
let sAuthorizedAdditionalEnsSpecificationName2 (String)
let SearchedType(String)
let galvanizedtype(String)

/* Declarations for BL Outputs : additional PLM attributes to filter searched resource 
AND/OR indexes of customer additional ens specifications to filter searched resource */ 
let FeatureAddedPLMAttributesFilteringSearchedResource (Feature)
let FeatureAddedPLMAttributesFilteringSearchedPLMParts (Feature)
let ListIndexesOfAddedEnsSpecifications (List)
let ListOfAdditionalPLMAttributeFilteringSearchedPLMParts(List)                 

let i (Integer)
let j (Integer)
let posX(Real)
let posY(Real)
let posZ(Real)
let pos(Real)
let lineFluid(String)
let index(Integer)
let logValveOcc (PipLogicalValveOcc)
let typesList(List)
lineFluid=""

let debug(Boolean)
debug=False

/************ ADD TYPES to THE LIST *****************/
typesList = List("Gasket Ring Type","Welding Sleeve","CG Coupling")

/************ Get input parameters : ListCurrentEnsSpecifications ****************/
ListCurrentEnsSpecifications = Parameters->GetAttributeObject("ListCurrentEnsSpecifications")
NbCurrentEnsSpecifications = ListCurrentEnsSpecifications.Size()
SearchedType = Parameters->GetAttributeString("SearchedType")
let pipingSpec (PipSpecification)
pipingSpec = ListCurrentEnsSpecifications[1]

index = typesList.IndexOf(SearchedType, 1)

if(debug AND Parameters->GetAttributeString("ApplicativeOperationName")=="PartPlace" AND index > 0)
{
	Notify("**** BR CATPiping_OP_AddedSpecsAndResourceFilteringParams Called ****")
	Notify("NbCurrentApplicativeEntities Size #",NbCurrentApplicativeEntities)
	Notify("SearchedType : ", Parameters->GetAttributeString("SearchedType"))
	Notify("ApplicativeOperationName : ", Parameters->GetAttributeString("ApplicativeOperationName"))
	Notify("NbCurrentEnsSpecifications Size() : #",NbCurrentEnsSpecifications)
	Notify("PipSpecification : #",pipingSpec.Name)
	Notify("index typesList : #",index)
}


// Check galvanized rule if spec is Steel / Steel Heavy / Steel Extra Heavy
if((pipingSpec.Name == "St" OR pipingSpec.Name == "St-H" OR pipingSpec.Name == "St-EH") AND index > 0)
{
	galvanizedtype = typesList[index]
	
	/************ Get input parameters : ListCurrentApplicativeEntities ****************/
	ListCurrentApplicativeEntitiesKeys = Parameters->GetAttributeObject("ListCurrentApplicativeEntitiesKeys")
	ListCurrentApplicativeEntities = Parameters->GetAttributeObject("ListCurrentApplicativeEntities")
	NbCurrentApplicativeEntities = ListCurrentApplicativeEntities.Size()

	i = 1
	if (0 < NbCurrentApplicativeEntities)
	{

		for i while i <= NbCurrentApplicativeEntities
		{
			set sCurrentApplicativeEntityKey = ListCurrentApplicativeEntitiesKeys.GetItem(i)
			set pCurrentApplicativeEntity = ListCurrentApplicativeEntities.GetItem(i)
			
			if(debug)
				Notify("sCurrentApplicativeEntityKey : #", sCurrentApplicativeEntityKey)
			
			if (NULL <> pCurrentApplicativeEntity)
			{
				sCurrentApplicativeEntityName = pCurrentApplicativeEntity.V_Name  /* Title */
				if(debug)
					Notify("sCurrentApplicativeEntityName : #", pCurrentApplicativeEntity.V_Name)
			}
			if (sCurrentApplicativeEntityKey == "Logical_Line")
			{
				set pip_line_inst = ListCurrentApplicativeEntities.GetItem(i)
				if(debug)
					Notify("pip_line_inst : #", pip_line_inst.Name)
			}
			else if(sCurrentApplicativeEntityKey == "Object_Occurrence")
			{
				let iOcc (ProductOccurrence)
				set iOcc = ListCurrentApplicativeEntities.GetItem(i)
				if(debug)
					Notify("iOcc : #", iOcc.Name)
			}
		}

		/************ Check Line Id Parameters ****************/
		if(pip_line_inst <> NULL)
		{
			set pipingLine = pip_line_inst.Reference
			
			if(debug)
				Notify("LineId : # (#)",pipingLine.Name)
				
			let linewithAttribute (DSKLogicalPipeLineAttributes)
			set linewithAttribute = pipingLine

			if(linewithAttribute <> NULL)
			{
				let DSKGalvanized(String)
				DSKGalvanized = linewithAttribute.DSKGalvanized
				
				if(debug)
					Notify("DSKGalvanized : #",DSKGalvanized)

				// Eng spec specification->GetSpecificationContent (SearchedType: String, ListOfContent: out List): Boolean
				
				let filters(List)
				let ContentObject(PLMEntity)
				let res  (Boolean)
				let iPartFilter (PipPartFilter)
				res=false
				
				res = pipingSpec-> GetSpecificationContent("PipPartFilter", filters)
				if(debug)
					Notify("filters : #",filters.Size())
				
				let galv, nongalv, correspondingFilterfound,oppositeFilterfound(Boolean)
				galv=False
				nongalv=False
				correspondingFilterfound=False
				oppositeFilterfound=False
				
				//Check if it exist a filter with the corresponding V_SpecDescription
				
				i = 1
				for i while i <= filters.Size()
				{
					set ContentObject = filters.GetItem(i)
					if (NULL <> ContentObject)
					{
						set iPartFilter = ContentObject
						if(debug)
						{
							Notify("iPartFilter : # (#)", iPartFilter.Name, iPartFilter.V_SpecDescription)
						}
						
						let declaredProvidedPartTypes(List)
						let type(String)
						declaredProvidedPartTypes = iPartFilter.V_DeclaredProvidedPartTypes
						for type inside declaredProvidedPartTypes
						{
							if(type == galvanizedtype)
							{
								if(DSKGalvanized == "G")
								{
									if(iPartFilter.V_SpecDescription == "Galvanized")
									{
										correspondingFilterfound=True
									}
									else if(iPartFilter.V_SpecDescription == "NON-Galvanized")
									{
										oppositeFilterfound=True
									}
								}
								if(DSKGalvanized == "")
								{
									if(iPartFilter.V_SpecDescription == "NON-Galvanized")
									{
										correspondingFilterfound=True
									}
									else if(iPartFilter.V_SpecDescription == "Galvanized")
									{
										oppositeFilterfound=True
									}
								}
							}
						}
					}
				}
				
				// if a filters with corresponding galvanized attribute has been found
				if(correspondingFilterfound OR oppositeFilterfound)
				{
					/* **************************** Add Attributes for filtering Resources ********************* */
					let galvanizedvalue(String)
					set FeatureAddedPLMAttributesFilteringSearchedResource = Parameters->GetAttributeObject("FeatureAddedPLMAttributesFilteringSearchedResource")
					
					//chhose filter from line id attribute
					if(DSKGalvanized == "G")
					{
						galvanizedvalue = "Galvanized"
					}
					else if(DSKGalvanized == "")
					{
						galvanizedvalue = "NON-Galvanized"
					}
					
					FeatureAddedPLMAttributesFilteringSearchedResource->SetAttributeString("V_SpecDescription",galvanizedvalue)
					Notify("Added attribute to filter result : V_SpecDescription = #",galvanizedvalue)
					
				}		
			}
		}
	}
}

 

Scenario 2 : Choose specification filter object by LineID Fluid Criteria

Need

The need is to be able to define different resulting list of valves on the same specification based on fluid criteria coming from line ID .

For example, defining a different list of valves for 

  • Potable Water
  • Bilge water

 

Proposal

The proposal is to use 2 different filters in the 1 specification as follow

with the corresponding results based on Fluid.

The fluid will be defined on the filter attribute :

Then the business rule "Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)" is used to choose the right filter result.

If there is no filter corresponding to the fluid defined in the line ID, the results of all filters will be used.

 

Demonstration

in the demonstration, 2 filters are defined as follow :

Video :

How to setup ?

 

The business rule "Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)" in Piping Specification Resource

has to be defined with this code :

 

/* ------------------------------------------
Compute the List of Additional Specification to be used depending of the context (CATPiping_OP_AddedSpecsAndResourceFilteringParams)
ThisObject : #In KweTrigger_BL_AddedSpecsAndResourceFilteringParams
Parameters : #In RuleContext
------------------------------------------ */
/* Inputs */
let FeatureCurrentApplicativeInformation (Feature)
/* Declarations for current applicative entities */
let ListCurrentApplicativeEntitiesKeys (List)
let sCurrentApplicativeEntityKey (String)
let ListCurrentApplicativeEntities (List)
let NbCurrentApplicativeEntities (Integer)
let pCurrentApplicativeEntity (PLMEntity)
let sCurrentApplicativeEntityName (String)
let pip_line_inst(Piping_Line_Inst)
let pipingLine(Piping_Line)
/* Declarations for current ens specifications & content */
let ListCurrentEnsSpecifications (List)
let NbCurrentEnsSpecifications (Integer)
/* Declarations for additional customer ens specifications */
let ListAuthorizedAdditionalEnsSpecifications (List)
let NbAuthorizedAdditionalEnsSpecifications (Integer)
let pAuthorizedAdditionalEnsSpecification (PLMEntity)
let sAuthorizedAdditionalEnsSpecificationName1 (String)
let sAuthorizedAdditionalEnsSpecificationName2 (String)

/* Declarations for BL Outputs : additional PLM attributes to filter searched resource 
AND/OR indexes of customer additional ens specifications to filter searched resource */ 
let FeatureAddedPLMAttributesFilteringSearchedResource (Feature)
let FeatureAddedPLMAttributesFilteringSearchedPLMParts (Feature)
let ListIndexesOfAddedEnsSpecifications (List)
let ListOfAdditionalPLMAttributeFilteringSearchedPLMParts(List)                
let i (Integer)
let j (Integer)
let posX(Real)
let posY(Real)
let posZ(Real)
let pos(Real)
let lineFluid(String)
let logValveOcc (PipLogicalValveOcc)
lineFluid=""
let debug(Boolean)
debug=False
/************ Get input parameters : ListCurrentApplicativeEntities ****************/
ListCurrentApplicativeEntitiesKeys = Parameters->GetAttributeObject("ListCurrentApplicativeEntitiesKeys")
ListCurrentApplicativeEntities = Parameters->GetAttributeObject("ListCurrentApplicativeEntities")
NbCurrentApplicativeEntities = ListCurrentApplicativeEntities.Size()
i = 1
if (0 < NbCurrentApplicativeEntities)
{
    if(debug)
    {
        Notify("BR CATPiping_OP_AddedSpecsAndResourceFilteringParams Called")
        Notify("NbCurrentApplicativeEntities Size #",NbCurrentApplicativeEntities)
    }
    for i while i <= NbCurrentApplicativeEntities
    {
        set sCurrentApplicativeEntityKey = ListCurrentApplicativeEntitiesKeys.GetItem(i)
        set pCurrentApplicativeEntity = ListCurrentApplicativeEntities.GetItem(i)
        
        if(debug)
            Notify("sCurrentApplicativeEntityKey : #", sCurrentApplicativeEntityKey)
        
        if (NULL <> pCurrentApplicativeEntity)
        {
            sCurrentApplicativeEntityName = pCurrentApplicativeEntity.V_Name  /* Title */
            if(debug)
                Notify("sCurrentApplicativeEntityName : #", pCurrentApplicativeEntity.V_Name)
        }
        if (sCurrentApplicativeEntityKey == "Logical_Line")
        {
            set pip_line_inst = ListCurrentApplicativeEntities.GetItem(i)
            if(debug)
                Notify("pip_line_inst : #", pip_line_inst.Name)
        }
        else if(sCurrentApplicativeEntityKey == "Object_Occurrence")
        {
            let iOcc (ProductOccurrence)
            set iOcc = ListCurrentApplicativeEntities.GetItem(i)
            if(debug)
                Notify("iOcc : #", iOcc.Name)
        }
        else if(sCurrentApplicativeEntityKey == "Logical_Object")
        {
            let iLog (LogicalOccurrence)
            set iLog = ListCurrentApplicativeEntities.GetItem(i)
            if(debug)
                Notify("iLog : #", iLog.Name)
            
            set logValveOcc = iLog
        }
        
    }            

    /************ Check Line Id Parameters ****************/
    if(pip_line_inst <> NULL AND logValveOcc <> NULL)
    {
        set pipingLine = pip_line_inst.Reference
        
        lineFluid = pipingLine.V_Fluid
        if(debug)
            Notify("LineId : # (#)",pipingLine.Name, lineFluid)
        
        if(lineFluid <>"")
        {
            /************ Get input parameters : ListCurrentEnsSpecifications ****************/
            ListCurrentEnsSpecifications = Parameters->GetAttributeObject("ListCurrentEnsSpecifications")
            NbCurrentEnsSpecifications = ListCurrentEnsSpecifications.Size()
            
            if(debug)
                Notify("NbCurrentEnsSpecifications Size() : #",NbCurrentEnsSpecifications)
            
            let pipingSpec (PipSpecification)
            pipingSpec = ListCurrentEnsSpecifications[1]
            
            if(debug)
                Notify("PipSpecification : #",pipingSpec.Name)
            
            // Eng spec specification->GetSpecificationContent (SearchedType: String, ListOfContent: out List): Boolean
            
            let filters(List)
            let ContentObject(PLMEntity)
            let res  (Boolean)
            let iPartFilter (PipPartFilter)
            res=false
            
            res = pipingSpec-> GetSpecificationContent("PipPartFilter", filters)
            if(debug)
                Notify("filters : #",filters.Size())
            
            let fluidfound(Boolean)
            fluidfound=False
            
            i = 1
            for i while i <= filters.Size()
            {
                set ContentObject = filters.GetItem(i)
                if (NULL <> ContentObject)
                {
                    set iPartFilter = ContentObject
                    if(debug)
                        Notify("iPartFilter : # (#, #)", iPartFilter.Name, iPartFilter.V_Fluid, iPartFilter.V_ProvidedPartTypes)
                    
                    if(iPartFilter.V_Fluid == lineFluid)
                    {
                        fluidfound=True
                        Notify("fluidfound : #", fluidfound)
                    }
                }
            }
            
            // if a filter with the corresponding fluid is found
            if(fluidfound)
            {
                /* **************************** Add Attributes for filtering Resources ********************* */
                set FeatureAddedPLMAttributesFilteringSearchedResource = Parameters->GetAttributeObject("FeatureAddedPLMAttributesFilteringSearchedResource")
                
                FeatureAddedPLMAttributesFilteringSearchedResource->SetAttributeString("V_Fluid",lineFluid)
                Notify("Added attribute to Valva filter result : V_Fluid = #",lineFluid)
            }        
        }
    }
}
 


 Cross reference links