FB50 MAIN P03 Main control program

[hit  <- on your browser to return]

 

 

 

Netzwerk 1: P03 Initialisation

 

IF "M03 Init" OR NOT "M00 OB1 FirstCycle" THEN

    "M03 MW58" := #STEP_BITS := 0;

    IF "M03 Init" THEN

        "M03 MD50" :=

        "M03 MD54" := 0;

        "M03 RunHomPos" := TRUE;

        "DatOfMod".P03.CrntModule := 101;

    END_IF;

END_IF;

 

 

 

Netzwerk 2: P03 SET execute home position

 

IF "M03 RunHomPos" AND #SET.SET.S.step0 THEN

    #SET.SET.S.steps := TRUE;

END_IF;

 

IF NOT "M03 RunHomPos" OR "HMI KEY".SYS.GLB.F8_Stop OR "HMI KEY".P03.GLB.F8_Stop THEN

    #SET.SET.S.steps := "M03 RunHomPos" := FALSE;

END_IF;

 

#SET.SET.S.steph := "M03 FLT ModuStp";

 

#SET(ACT_STEP => #SET.STEP_NO);

 

 

 

Netzwerk 3: P03 SEQ1 start, stop, hold

 

#SEQ1.SSM1.S.steph := "M03 SEQ1 Start" AND NOT "M00 AutoCmpltMa run";

#SEQ1.SSM1.S.steps := NOT "M03 RunHomPos" AND "M03 SEQ1 Start";

 

#SEQ1(ACT_STEP => #SEQ1.STEP_NO);

 

 

 

Netzwerk 4: P03 FLT faults monitoring

 

#FLT(FLT_MODULE := "M03 FLT ModuStp");

 

 

 

Netzwerk 5: P03 STEP.SEQ1_Start

 

IF "M00 TrnsSysRun Imp" AND "M00 AutoCmpltMa run" THEN

    #STEP.SEQ1_Start := TRUE;

    RETURN;

ELSIF #STEP.SEQ1_Start THEN

    IF NOT "M03 RunHomPos" AND NOT "M03 SEQ1 Active" THEN

        "M03 SEQ1 Start" := TRUE;

    ELSIF "M03 SEQ1 Active" THEN

        #STEP_BITS := 0;

        #STEP.SEQ1_Running := TRUE;

        "M03 SEQ1 WP1 DnOK" := "M03 SEQ1 DoWP1" := FALSE;

    END_IF;

END_IF;

 

 

 

Netzwerk 6: P03 STEP.SEQ1_Running

 

IF #STEP.SEQ1_Running THEN

    IF "M03 SEQ1 Done" THEN

        "M03 SEQ1 Active" := "M03 SEQ1 Start" := FALSE;

        #STEP_BITS := 0;

        #STEP.SEQ1_Done := TRUE;

        RETURN;

    END_IF;

END_IF;

 

 

 

Netzwerk 7: P03 STEP.Done

 

IF #STEP.SEQ1_Done THEN

    "M03 SEQ1 Done" := FALSE;

    #STEP_BITS := 0;

    #STEP.SEQ1_Write := TRUE;

    // Save actual data   

    "DatOfMod".P03.STS.RunTimeCntr_seq1 := #MaDa.RunTimeCntr_seq1;

    "DatOfMod".P03.STS.WPC_ok := "M03 SEQ1 DoWP1" AND "M03 SEQ1 WP1 DnOK";

    "DatOfMod".P03.STS.CrntWP_ok := "M03 SEQ1 WP1 DnOK" AND NOT "M03 SEQ1 WP1 DnNOK";

   

    "DatOfMod".P03.TrgtModule := 102;

    // If necessary, changing drive direction to module 103   

    IF NOT "DatOfMod".P03.STS.CrntWP_ok THEN

        "DatOfMod".P03.TrgtModule := 103;

    END_IF;

    IF "DI OUT P03".HBS_1.RdyToTakOver_FrmNC THEN

        "DatOfMod".BoxData := #SEQ1.Box_Data_HBS1;

    ELSIF "DI OUT P03".HBS_2.RdyToTakOver_FrmNC THEN

        "DatOfMod".BoxData := #SEQ1.Box_Data_HBS2;

    END_IF;

END_IF;

 

After each box transfer whether it is to HBS1 or to HBS2, the PLC sends a message in reply to the MFC that transfer is done.

 

Netzwerk 8: P03 STEP.Write

 

IF #STEP.SEQ1_Write THEN

    "M03 TCP/IP Wrt start" := TRUE;

   

    IF "M03 TCP/IP Wrt done" OR #SEQ1.DlyOnCommissionDone.Q THEN

        "M03 TCP/IP Wrt start" := "M03 TCP/IP Wrt done" := FALSE;

       

        IF NOT "M03 RdyToStart" THEN

            "M00 AutoCmpltMa run" := FALSE;

        END_IF;

        #STEP_BITS := 0;

        #SEQ1.Box_Data_HBS1.BoxCode :=

        #SEQ1.Box_Data_HBS2.BoxCode := '----';

        #SEQ1.Box_Data_HBS1.Commission :=

        #SEQ1.Box_Data_HBS1.Trgt_Storage.Place :=

        #SEQ1.Box_Data_HBS1.Trgt_Storage.Depth :=

        #SEQ1.Box_Data_HBS1.Trgt_Storage.HBS := 0;

        #SEQ1.Box_Data_HBS2.Commission :=

        #SEQ1.Box_Data_HBS2.Trgt_Storage.Place :=

        #SEQ1.Box_Data_HBS2.Trgt_Storage.Depth :=

        #SEQ1.Box_Data_HBS2.Trgt_Storage.HBS := 0;

    END_IF;

END_IF;

 

 

 

Netzwerk 9: P03 Run-Time

 

IF #STEP.SEQ1_Running THEN

    IF "M00 Imp 10Hz" AND "M03 Enabled" THEN

        #MaDa.RunTimeCntr_seq1 := #MaDa.RunTimeCntr_seq1 + 1;

    END_IF;

ELSE

    // #MaDa.RunTimeCntr_seq1 := 0;

    IF NOT "M03 Active" AND ("M00 ManuCmpltMa run" AND "HMI KEY".P03.GLB.F19_GoToStep OR "M00 AutoCmpltMa run") THEN

        #STEP.SEQ1_Start := TRUE;

    END_IF;

END_IF;

 

 

 

Netzwerk 10: P03 SEQ1 active

 

"M03 Active" :=

#STEP.SEQ1_Start AND "M03 SEQ1 Active"

OR #STEP.SEQ1_Running

OR #STEP.SEQ1_Done

OR #STEP.SEQ1_Write;

 

 

 

Netzwerk 11: P03 Assign signal

 

IF "M03 FLT ModuStp" THEN

    "M03 FLT ModuStp SR" := true;

END_IF;

 

IF "M03 FLT ModuStp SR" AND NOT "M03 FLT ModuStp ACK" THEN

    IF "M03 FLT ModuStp SR" AND "M00 ACK Imp" THEN

        "M03 FLT ModuStp ACK" := true;

    END_IF;

ELSIF NOT "M03 FLT ModuStp" AND "M03 FLT ModuStp ACK" THEN

    "M03 FLT ModuStp SR" := "M03 FLT ModuStp ACK" := FALSE;

END_IF;

 

"A03 H68.0 Rd" := "M00 FltCmpltMaSR" AND NOT "M00 FLT GLB ACK" AND "M00 Clock_1Hz" OR "M00 FltCmpltMaSR" AND "M00 FLT GLB ACK";

"A03 H68.2 Gn" := NOT "M00 FltCmpltMaSR" AND ("M00 AutoCmpltMa run" AND "M03 SEQ1 Active" OR "M00 Clock_1Hz" AND NOT "M00 AutoCmpltMa run" AND "M03 SEQ1 Active");

"A03 H68.1 Ye" := "M00 ManuCmpltMa run" AND "M00 Clock_1Hz";

 

 

 

Netzwerk 12: P03 delete BoxData if necessary

 

#ResetCntr_SE(IN := "HMI KEY".P03.GLB.F23_Execute,PT := t#2s);

IF #ResetCntr_SE.Q THEN

    "DatOfMod".BoxData_30M2 := "DatOfMod".BoxData_30M3 := "DatOfMod".BoxData_30M4 := "DatOfMod".BoxData_30M5 := #tmp_Del_Box_Data;

END_IF;