FB30 MAIN P02 : Spring elasticity reading - main module program (slave 2)

[hit  <- on your browser to return]

 

 

 

Netzwerk 1: P02 Initialisation

 

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

    "M02 MW48" := #STEP_BITS := 0;

    IF "M02 Init" THEN

        "M02 MD40" :=

        "M02 MD44" := 0;

        "M02 RunHomPos" := TRUE;

        "DatOfMod".P02.CrntModule := 102;

    END_IF;

END_IF;

 

 

 

Netzwerk 2: P02 SET execute home position

 

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

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

END_IF;

 

IF NOT "M02 RunHomPos" OR "HMI KEY".SYS.GLB.F8_Stop OR "HMI KEY".P02.GLB.F8_Stop THEN

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

END_IF;

 

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

 

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

 

 

 

Netzwerk 3: P02 SEQ1 start, stop, hold

 

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

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

 

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

 

 

 

Netzwerk 4: P02 FLT faults monitoring

 

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

 

 

 

Netzwerk 5: P02 STEP.SEQ1_Start

 

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

    #STEP.SEQ1_Start := TRUE;

    RETURN;

ELSIF #STEP.SEQ1_Start THEN

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

        "M02 SEQ1 Start" := TRUE;

    ELSIF "M02 SEQ1 Active" THEN

        #STEP_BITS := 0;

        #STEP.SEQ1_Running := TRUE;

        #MaDa.RunTimeCntrl_seq1 := 0;

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

    END_IF;

END_IF;

 

 

 

Netzwerk 6: P02 STEP.SEQ1_Running

 

IF #STEP.SEQ1_Running THEN

    IF "M02 SEQ1 Done" THEN

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

        #STEP_BITS := 0;

        #STEP.SEQ1_Done := TRUE;

        RETURN;

    END_IF;

END_IF;

 

 

 

Netzwerk 7: P02 STEP.Done

 

IF #STEP.SEQ1_Done THEN

    "M02 SEQ1 Done" := FALSE;

    #STEP_BITS := 0;

    #STEP.SEQ1_Write := TRUE;

    // Save actual data   

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

    "DatOfMod".P02.STS.WPC_ok := "M02 SEQ1 DoWP1" AND "M02 SEQ1 WP1 DnOK";

    "DatOfMod".P02.STS.CrntWP_ok := "M02 SEQ1 WP1 DnOK" AND NOT "M02 SEQ1 WP1 DnNOK";

   

    "DatOfMod".P02.TrgtModule := 102;

    // If necessary, changing drive direction to module 106   

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

        "DatOfMod".P02.TrgtModule := 106;

    END_IF;

    "DatOfPLC".P02 := "DatOfMod".P02; // Block move

END_IF;

 

 

 

Netzwerk 8: P02 STEP.Write

 

IF #STEP.SEQ1_Write THEN

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

   

    IF "M02 TCP/IP Wrt done" THEN

        #STEP.SEQ1_Write :=

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

    END_IF;

END_IF;

 

 

 

Netzwerk 9: P02 Run-Time

 

IF #STEP.SEQ1_Running THEN

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

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

    END_IF;

ELSE

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

        #STEP.SEQ1_Start := TRUE;

    END_IF;

END_IF;

 

 

 

Netzwerk 10: P02 SEQ1 active

 

"M02 Active" :=

#STEP.SEQ1_Start AND "M02 SEQ1 Active"

OR #STEP.SEQ1_Running

OR #STEP.SEQ1_Done

OR #STEP.SEQ1_Write;

 

 

 

Netzwerk 11: P02 Assign signal

 

IF "M02 FLT ModuStpIS" THEN

    "M02 FLT ModuStpSR" := true;

END_IF;

 

IF "M02 FLT ModuStpSR" AND NOT "M02 FLT ModuStp ACK" THEN

    IF "M00 ACK Imp" THEN

        "M02 FLT ModuStp ACK" := TRUE;

    END_IF;

ELSIF NOT "M02 FLT ModuStpIS" AND "M02 FLT ModuStp ACK" THEN

    "M02 FLT ModuStpSR" := "M02 FLT ModuStp ACK" := FALSE;

END_IF;

#tmp_lamp_SigRD := "M02 FLT ModuStpSR" AND NOT "M02 FLT ModuStp ACK" AND "M00 Clock_1Hz" OR "M02 FLT ModuStpSR" AND "M02 FLT ModuStp ACK";

#tmp_lamp_SigGN := NOT "M02 FLT ModuStpSR" AND ("M00 AutoCmpltMa run" AND "M02 SEQ1 Active" OR "M00 Clock_1Hz" AND NOT "M00 AutoCmpltMa run" AND "M02 SEQ1 Active");

#tmp_lamp_SigYE := "M00 ManuCmpltMa run" AND "M00 Clock_1Hz" OR NOT "M00 AutoCmpltMa run" AND NOT "M00 ManuCmpltMa run";

 

 

FB41 SET P02: Spring elasticity reading - move to home position (slave 2)

 

 

 

 

Netzwerk 1: SET query home position

"M02 HomPos" :=

"DI MAIN P02".SEQ1.Index = 0

AND "DI OUT P02".M5_Z.DRV.Support.HomDone

AND "DI OUT P02".M5_Z.DRV.Support.InPos

AND ("DI OUT P02".M5_Z.DRV.Support.ActPos = "DI OUT P02".MANUAL.M5_Z.Set_TchInPos_0 OR "DI OUT P02".M5_Z.DRV.Support.ActPos = "DI OUT P02".MANUAL.M5_Z.Set_TchInPos_1);

// Pre-Setting

"M02 MW48" := 0;

 

 

 

Netzwerk 2: SET execute home position

 

#SET(MAX_STEP := 2);

#ACT_STEP := #SET.S.stepact;

#SET.S.DlyStart.PT := t#200ms;

 

 

 

Netzwerk 3: Step jump distributor

 

CASE #SET.S.stepact OF

    0: // Waiting for enable

        #SET.S.stepd :="DI OUT P02".M5_Z.DRV.Support.HomDone AND #SET.S.steps;

       

    1: // Move M5_Z axis Elasticity servo drive HP

        IF #SET.S.stepfc THEN

            "DI OUT P02".M5_Z.DRV.MC_MoveAbsolute.Position := "DI OUT P02".MANUAL.M5_Z.Set_TchInPos_0;

            "DI OUT P02".M5_Z.DRV.Support.SetVelo := "DI OUT P02".MANUAL.M5_Z.Set_TchInVelo_0;

            RETURN;

        ELSE

            "M02 M5_Z GoToPosAbso" := NOT "DI OUT P02".M5_Z.HALT_01;

        END_IF;

        #SET.S.stepd := "DI OUT P02".M5_Z."MC MoveAbsolute".Done;

       

    2: // Query module HP

        IF "DI OUT P02".HSC_FORC_IO.UserStatusFlags.StatusDQ0 AND "M02 HomPos" THEN

            "M02 RunHomPos" := FALSE;

            "M02 Enbl toRTT" := "DI MAIN P05".SEQ1.Shift_Register.%X8;

        END_IF;

END_CASE;