Introduction
Usage : During design, the list of allowed specification available in Data information panel can be filtered according to context like lineID attribute value
Datasetup Resource Set :
- Piping/Tubing Specification Resources
- HVAC Specification Resources
Datasetup Resource : Compute list of piping specification following the context
Rule Example 1
Description
Filter Piping specification list according LineID Operating Temperature*/
Piping spec is available If the LineID operating temperature < Max temp of the PipSpecification and Standards are same
Prereq
Define value for standard and Temperature attributes on LineID and on Specification objects
Rule
/* Sample Rule - Start*/
/*Trigger Piping spec according LineID PRessure and Temperature*/
/* Rule:- For "Out Of Spec" operation if the LineID operating temperature lies in between the Min && Max temp of the PipSpecification. Append it to the list to be sent as OUTPUT */
let EnsSpecs_Input (List)
let EnsSpecs_Output (List)
let EnsSpec_CurrentObj (EnsSpecification)
let PipSpec_CurrentObj (PipSpecification)
let NbEnsSpecs (Integer)
let LineIDOcc_Value (LogicalOccurrence)
let OperationName_Value(String)
let name(String)
let LogRef(RFLVPMLogicalReference)
let LineID_Obj(Piping_Line)
let LineID_Attr_Standard(string)
let LineID_Attr_Temp(TEMPRTRE)
let Spec_Attr_MinTemp(TEMPRTRE)
let Spec_Attr_MaxTemp(TEMPRTRE)
let LineID_Attr_Pressure(PRESSURE)
let Spec_Attr_MinPressure(PRESSURE)
let Spec_Attr_MaxPressure(PRESSURE)
let Spec_Attr_Standard(String)
let j (Integer)
// Attribute names set on the Context to retrieve the value
let EnsSpecList_Input_attr = "EnsSpecList_Input" /*List of EnsSpecifications */
let EnsSpecList_Output_attr = "EnsSpecList_Output" /*List of EnsSpecifications */
let EnsSpecList_OperationName_attr = "ApplicativeOperationName"
let EnsSpecList_LineIDOcc_attr = "LineID_Occurrence"
// Get OperationName attribute Value
set OperationName_Value = Parameters.GetAttributeString(EnsSpecList_OperationName_attr)
// Get LineID Occurrence object and retrieve the required information e.g. LineID Operating
// Temperature
set LineIDOcc_Value = Parameters ->GetAttributeObject( EnsSpecList_LineIDOcc_attr )
if ( NULL <> LineIDOcc_Value )
{
Trace(1,"LineID Occurrence retrieved Successfully !!!")
set LogRef = LineIDOcc_Value.Reference
if ( NULL <> LogRef )
{
set LineID_Obj = LogRef
if ( NULL <> LineID_Obj)
{
set LineID_Attr_Standard = LineID_Obj.V_Standard
// set LineID_Attr_Temp = LineID_Obj.V_OperatingTemperature
set LineID_Attr_Pressure = LineID_Obj.V_OperatingPressure
Trace(1,"LineID Attributes read successfully !!!")
}
}
}
// Get Input Spec List to process
set EnsSpecs_Input = Parameters ->GetAttributeObject (EnsSpecList_Input_attr)
set NbEnsSpecs = EnsSpecs_Input.Size()
let EnsSpecName_Value (String)
set j = 1
for j while j <= NbEnsSpecs
{
set EnsSpec_CurrentObj = EnsSpecs_Input.GetItem(j)
if (NULL <> EnsSpec_CurrentObj)
{
set EnsSpecName_Value = EnsSpec_CurrentObj.V_Name
set PipSpec_CurrentObj = EnsSpec_CurrentObj
if ( NULL <> PipSpec_CurrentObj )
{
set Spec_Attr_MinTemp = PipSpec_CurrentObj.V_MinTemperature
set Spec_Attr_MaxTemp = PipSpec_CurrentObj.V_MaxTemperature
set Spec_Attr_MinPressure = PipSpec_CurrentObj.V_MinPressure
set Spec_Attr_MaxPressure = PipSpec_CurrentObj.V_MaxPressure
set Spec_Attr_Standard = PipSpec_CurrentObj.V_Standard
if ( OperationName_Value == "Operation_OutOfSpec" ) // For *OUT OF SPEC* operation //use the follwing logic to filter the EnsSpecifications
{
// If the LineID operating temperature less than Max temp of the PipSpecification and
// Standards are same. Append it to the list to be sent as OUTPUT
// if ( ( LineID_Attr_Temp <= Spec_Attr_MaxTemp ) and
if ( ( LineID_Attr_Pressure <= Spec_Attr_MaxPressure ) and
( Spec_Attr_Standard == LineID_Attr_Standard ))
{
EnsSpecs_Output.Append( EnsSpec_CurrentObj )
}
}
else if ( ( OperationName_Value == "Operation_SetLineID_AdditionalSpec") OR (OperationName_Value == "Operation_SetLineIDSpec"))
{
if ( OperationName_Value == "Operation_SetLineIDSpec" )
{
// if ( ( LineID_Attr_Temp >= Spec_Attr_MinTemp ) and
if ( ( LineID_Attr_Pressure >= Spec_Attr_MinPressure ) AND ( LineID_Attr_Pressure <= Spec_Attr_MaxPressure ) AND ( Spec_Attr_Standard == LineID_Attr_Standard ) )
{
EnsSpecs_Output.Append( EnsSpec_CurrentObj )
}
}
}
}
}
}
// Set the output
Parameters ->SetAttributeObject (EnsSpecList_Output_attr, EnsSpecs_Output)
if ( EnsSpecs_Output.Size() > 0 )
{
Trace(1,"Business Rule - Successful Execution !!!")
}
else
{
Trace(1,"Business Rule - No matching EnsSpecification found as per the criteria !!!")
}
/* Sample Rule - End*/
Rule Exemple2:
Description
There is a Business Rule that allows you to Compute the List of Piping Specification Following the Context (PipSpecListPipingSpecifications)
On this example, the list of specification is selected based on the system attributes :
Video
Code:
/* Compute the List of Piping Specification Following the Context (PipSpecListPipingSpecifications) */
/* Rule:- For "Out Of Spec" operation if the LineID operating temperature lies in between the Min && Max temp of the PipSpecification. Append it to the list to be sent as OUTPUT */
let EnsSpecs_Input (List)
let EnsSpecs_Output (List)
let EnsSpec_CurrentObj (EnsSpecification)
let PipSpec_CurrentObj (PipSpecification)
let NbEnsSpecs (Integer)
let LineIDOcc_Value (LogicalOccurrence)
let OperationName_Value(String)
let name(String)
let LogRef, systemRef(RFLVPMLogicalReference)
let systemOcc(LogicalOccurrence)
let LineID_Obj(Piping_Line)
let LineID_Attr_Standard(string)
let LineID_Attr_Temp(TEMPRTRE)
let Spec_Attr_Standard(String)
let j (Integer)
let debug(Boolean)
debug = false
// Attribute names set on the Context to retrieve the value
let EnsSpecList_Input_attr = "EnsSpecList_Input" /*List of EnsSpecifications */
let EnsSpecList_Output_attr = "EnsSpecList_Output" /*List of EnsSpecifications */
let EnsSpecList_OperationName_attr = "ApplicativeOperationName"
let EnsSpecList_LineIDOcc_attr = "LineID_Occurrence"
// Get OperationName attribute Value
set OperationName_Value = Parameters.GetAttributeString(EnsSpecList_OperationName_attr)
if debug
Notify("OperationName_Value : #",OperationName_Value)
// Get Input Spec List to process
set EnsSpecs_Input = Parameters ->GetAttributeObject (EnsSpecList_Input_attr)
set NbEnsSpecs = EnsSpecs_Input.Size()
if debug
Notify("EnsSpecs_Input.Size : #", NbEnsSpecs)
// Get LineID Occurrence object and retrieve the required information e.g. LineID Operating
set LineIDOcc_Value = Parameters->GetAttributeObject(EnsSpecList_LineIDOcc_attr)
if (NULL <> LineIDOcc_Value)
{
set systemOcc = LineIDOcc_Value.Owner
set systemRef = systemOcc.Reference
if debug
{
Notify("systemOcc : #", systemOcc.Name)
Notify("systemRef : #", systemRef.Name)
}
if (systemRef.HasAttribute("Asset Type"))
{
EnsSpecs_Output.Append(EnsSpecs_Input.GetItem(1))
Notify("List of specification Filtered")
}
else
{
set EnsSpecs_Output = EnsSpecs_Input
Notify("Full List of specification")
}
}
// Set the output
Parameters ->SetAttributeObject (EnsSpecList_Output_attr, EnsSpecs_Output)
