IF NOTxInitTHEN
productionUnitMode(sName := gc_sPRODUCTION, dwSupportedStates :=PACK_ML.State.All, dwAllowsLeavingFromStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, dwAllowsEnteringIntoStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, eInitialState := PACK_ML.State.Idle, xActive := TRUE);
semiAutoUnitMode(sName := gc_sSEMIAUTO, dwSupportedStates := PACK_ML.State.All - PACK_ML.State.Holding - PACK_ML.State.Held - PACK_ML.State.UnHolding - PACK_ML.State.Suspending - PACK_ML.State.Suspended - PACK_ML.State.UnSuspending, dwAllowsLeavingFromStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, dwAllowsEnteringIntoStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, eInitialState := PACK_ML.State.Idle, xActive := FALSE);
maintenanceUnitMode(sName := gc_sSETUP, dwSupportedStates := PACK_ML.State.All - PACK_ML.State.Completing - PACK_ML.State.Complete - PACK_ML.State.UnSuspending - PACK_ML.State.Suspended - PACK_ML.State.Suspending, dwAllowsLeavingFromStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, dwAllowsEnteringIntoStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle OR PACK_ML.State.Held, eInitialState := PACK_ML.State.Idle, xActive := FALSE);
// Register the unit modes unitModeManager.Register(productionUnitMode); unitModeManager.Register(semiAutoUnitMode); unitModeManager.Register(maintenanceUnitMode);
xInit := TRUE;
END_IF
currentUnitMode := unitModeManager.ActiveUnitMode;
// buttons IFin_StackStartButton AND NOT lastStackStartButtonTHEN m_StackStartButton := TRUE; ELSE m_StackStartButton := FALSE; END_IF
// STATE MACHINE CASEcurrentUnitMode.CurrentStateOF PACK_ML.State.Idle: IFm_StackStartButtonTHEN currentUnitMode.Enter(PACK_ML.Starting); END_IF PACK_ML.State.Starting : IF pickAndPlaceUnit.starting() = tFINISHEDTHEN currentUnitMode.ActingStateCompleted(); END_IF PACK_ML.State.Execute : m_StackStartButton := FALSE; IFpickAndPlaceUnit.execute() = tERRORTHEN currentUnitMode.Enter(PACK_ML.Holding); ELSIFm_CounterForErrorPusher = 5 AND m_Conveyor1WPAtRamp1 THEN currentUnitMode.Enter(PACK_ML.Completing); END_IF PACK_ML.State.Holding : IFpickAndPlaceUnit.holding() = tFINISHEDTHEN currentUnitMode.ActingStateCompleted(); END_IF PACK_ML.State.Held : IFm_StackStartButtonTHEN currentUnitMode.Enter(PACK_ML.UnHolding); END_IF PACK_ML.State.UnHolding : IFpickAndPlaceUnit.unholding() = tFINISHEDTHEN currentUnitMode.ActingStateCompleted(); END_IF PACK_ML.State.Completing : m_StackStartButton := FALSE; test_OMACState := 'Completing'; IF pickAndPlaceUnit.completing() = tFINISHEDTHEN currentUnitMode.ActingStateCompleted(); END_IF PACK_ML.State.Complete : test_OMACState := 'Complete'; IF pickAndPlaceUnit.complete() = tFINISHED AND m_StackStartButtonTHEN currentUnitMode.Enter(PACK_ML.Execute); END_IF END_CASE
// last buttons lastStackStartButton := in_StackStartButton; |