Skip to content

Resetting Alarms

Resetting components of the MM

If there are no Components of the Machine then we can clear the Machine Alarms and let the SUPER^.Clearing() handle the rest. But if the Machine Module has one or more components then the process of clearing the alarms must be handled in a slightly different manner. This will prevent an existing alarm condition that is still TRUE from being cleared and raised multiple times.

In the Machine.Clearing() method the following code can be used:

Note

This code is a modified version of what is used in the FB_PackML_BaseModule.Clearing()

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    IF NumberOfComponents = 0 THEN
        F_ClearAllEventsInClass(Alarms := MachineAlarms);
        SUPER^.Clearing();
    ELSE
        CASE SequenceState OF
            0:
                F_ClearAllEventsInClass(Alarms := MachineAlarms);
                SequenceState := SequenceState + 10;

            10:
                // Send the command to all EMs to change state to Clearing
                FOR i := 1 TO NumberOfSubModules DO
                    ipSubModules[i].StateCommand := ePMLCommand_Clear;
                END_FOR

                IF BaseAlarms[E_BaseAlarms.ComponentError].bRaised THEN
                    BaseAlarms[E_BaseAlarms.ComponentError].Clear(0, 0);
                END_IF;

                IF BaseAlarms[E_BaseAlarms.SubModuleError].bRaised THEN
                    BaseAlarms[E_BaseAlarms.SubModuleError].Clear(0, 0);
                END_IF;

                SequenceState := SequenceState + 10;

            20:
                // Call the Reset method of all Components of the MM
                FOR i := 1 TO NumberOfComponents DO
                    IF Parameters_PackML_Base.RESET_COMPONENTS_WITHOUT_ERROR THEN
                        ipComponents[i].Reset();
                    ELSE
                        IF ipComponents[i].Error THEN
                            ipComponents[i].Reset();
                        END_IF
                    END_IF
                END_FOR

                //Check that all components are Error free and Ready
                FOR i := 1 TO NumberOfComponents DO
                    ComponentsReady := ComponentsReady AND NOT ipComponents[i].Error;
                END_FOR

                IF ComponentsReady THEN
                    SequenceState := SequenceState + 10;
                END_IF

            30:
                //Check that all EMs have finished Clearing and reached the Stopped state
                FOR i := 1 TO NumberOfSubModules DO
                    SubModulesReady := SubModulesReady AND (ipSubModules[i].CurrentState = ePMLState_Stopped);
                END_FOR

                // Move the MM to the Stopped state
                IF SubModulesReady AND (StateTasksComplete OR NoStateTasksToComplete) THEN
                    NoStateTasksToComplete := TRUE;
                    StateTasksComplete     := FALSE;
                    StateComplete();
                END_IF
        END_CASE
    END_IF