Use the following parameters:
ThisObject: Instance of segment to add to the conductor route
Parameters: the standard context and message attribute will be displayed in a warning if the validation fails.
- ListOfConductors (input): List of all conductors routed through the segment
- Severity messages:
- Severity= 0 the treatment is to be continued (no message)
- Severity= 1 the treatment is to be continued and only a warning raised)
- Severity= 2 the treatment is supposed to be undone (i.e. the route will be lost, even if the conductors are already routed)
Note that this notion is not mandatory and it is used by the electrical command.
Validation: The output boolean variable to know if the validation succeeded or failed. If the output from is false, the conductors will not be routed.
Note:
While creating input parameter (ListOfConductors), the result of the BR EWRRouting_ValidateWireRoute will be taken into account.
Here is an example of Business Rule syntax:
/* CATRule signature (do not edit) : (ThisObject :
#In Segment, Parameters : #In RuleContext, Validation :
#Out Boolean) : #Void */
Let ListConductors(LIST)
Let Conductor (Wire)
Let sMessage (STRING)
Let iSeverity (INTEGER)
Let index (INTEGER)
Let nbConductors (INTEGER)
Let ConductorDia (LENGTH)
Let TotalDia (LENGTH)
Let SegDia (LENGTH)
Let ratio (REAL)
Let SegName(String)
/* Initialize the parameters, by default success */
set Validation = true
set sMessage = ""
set iSeverity = 0
set index = 1
set SegDia = ThisObject.Elec_Diameter
SegName = ThisObject.Name
set ListConductors = Parameters.GetAttributeObject("ListOfLinkedWires")
if(NULL <> ListConductors)
{
nbConductors = ListConductors.Size()
/* Initialize the output parameters as success, based on
computation result these parameters will be reset*/
Validation = true
iSeverity = 0
sMessage = "All the wires could be accomodated in this segments"
if(SegName == "A")
{
if(2 < nbConductors)
{
Validation = false
iSeverity = 2
sMessage = "Error : Segment " + SegName + " is fatally
overloaded"
}
else if(1 < nbConductors)
{
Validation = true
iSeverity = 1
sMessage = "Warning : Segment " + SegName + " is
overloaded"
}
}
}
else /* No conductor is to be routed from this segment, so return
true */
{
Validation = true
iSeverity = 0
sMessage = "None of the conductors are to be routed from this
segment"
}
Parameters.Message = sMessage
Parameters.Severity = iSeverity