Fault Logic
Establishing Fault Logic
After determining a location, you must use VBScript to identify the faults for each location. Click the drop-down list of locations (for each location that has faults) and fill in the script. End each script with Fault = <Fault Name>, or Fault = <Fault Value>. If you provide a fault that does not match one already defined in the fault list, the model still logs downtime; however, the fault is ignored.
To search for available faults and automatically fill in either the value or the name, click Insert Fault.... Only those faults already identified for the selected location are displayed.
You can also click Check Syntax to check that the script follows proper VBScript syntax.
A fault script can be defined for each location. However, only the fault script for the location determined by location logic will run.
Fault Logic Example #1
In this example, if alias A = 1 then the fault "Conveyor Fault" is returned; if A = 2 then the fault "Lubrication" is returned.
if A = 1 Then Fault = "Conveyor Fault"
if A = 2 Then Fault = "Lubrication"
Fault Logic Example #2
This example checks to see if the bits are set in a given alias and return the fault accordingly.
if A And &H1 Then Fault = 0
if A And &H2 Then Fault = 1
You can also use the following:
if A And &H1 Then Fault = "Conveyor Fault"
if A And &H2 Then Fault = "Lubrication"
Fault Logic Example #3
This example rounds the value in alias A and then uses a case statement to return Fault codes.
Select Case Round(A)
Case 0 Fault = "R1 Jam"
Case 1 Fault = "R1 Jam"
Case 2 Fault = "R1 Starve"
Case 4 Fault = "R1 Block"
End Select
You can also use the following:
Select Case Round(A)
Case 0 Fault = 1
Case 1 Fault = 2
Case 2 Fault = 3
Case 4 Fault = 4
End Select