module CTongNotification use COperationScenariosVariables implicit none contains subroutine Evaluate_TongNotification() implicit none if (DriveType == TopDrive_DriveType) then #ifdef OST print*, 'Evaluate_TongNotification=TopDrive' #endif !TOPDRIVE-CODE=50 if (((Get_HookHeight() >= (TL() + PL - ECG + NFC() - RE) .and. Get_HookHeight() <= (TL() + NFC() + PL - ECG + TG)) .or.& (Get_HookHeight() >= (TL() + SL - ECG + NFC() - RE) .and. Get_HookHeight() <= (TL() + NFC() + SL - ECG + TG))).and.& GetRotaryRpm() == 0.0d0 .and.& Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.& ((Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .or.& Get_Tong() == TONG_NEUTRAL ) .and.& (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) .and.& Get_TdsSwing() == TDS_SWING_OFF_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !TOPDRIVE-CODE=51 if (GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.& Get_TdsSwing() == TDS_SWING_OFF_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !TOPDRIVE-CODE=52 if (GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) .and.& Get_TdsSwing() == TDS_SWING_OFF_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if endif if (DriveType == Kelly_DriveType) then #ifdef OST print*, 'Evaluate_TongNotification=Kelly' #endif !OPERATION-CODE=44 if (Get_OperationCondition() == OPERATION_DRILL .and.& !((Get_HookHeight() >= 65.0 .and. Get_HookHeight() <= 70.0) .or.& ! (Get_HookHeight() >= 96.0 .and. Get_HookHeight() <= 101.0)).and.& ((Get_HookHeight() >= (HKL + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HKL + Get_NearFloorConnection() + TG)) .or.& (Get_HookHeight() >= (HKL + Get_NearFloorConnection() + PL -RE) .and. Get_HookHeight() <= (HKL + Get_NearFloorConnection() + TG + PL))).and.& GetRotaryRpm() == 0.0d0 .and.& Get_KellyConnection() == KELLY_CONNECTION_STRING .and.& Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.& Get_Swing() == SWING_WELL_END .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=45 if (Get_OperationCondition() == OPERATION_DRILL .and.& Get_HookHeight() >= 66 .and. Get_HookHeight() <= 69 .and.& Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_MOUSE_HOLE_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=46 if (Get_OperationCondition() == OPERATION_DRILL .and.& Get_JointConnectionPossible() .and.& Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_MOUSE_HOLE_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=47 if (Get_OperationCondition() == OPERATION_DRILL .and.& GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_WELL_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=48 if (Get_OperationCondition() == OPERATION_DRILL .and.& GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_WELL_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=50 if (Get_OperationCondition() == OPERATION_TRIP .and.& ((Get_HookHeight() >= (HL + PL - ECG + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + PL - ECG + TG)) .or.& (Get_HookHeight() >= (HL + SL - ECG + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + TG - ECG + SL))).and.& Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.& GetRotaryRpm() == 0.0d0 .and.& Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_WELL_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=51 if (Get_OperationCondition() == OPERATION_TRIP .and.& GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_WELL_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !OPERATION-CODE=52 if (Get_OperationCondition() == OPERATION_TRIP .and.& GetRotaryRpm() == 0.0d0 .and.& Get_JointConnectionPossible() .and.& Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.& (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& Get_Swing() == SWING_WELL_END .and.& Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if !if (Get_OperationCondition() == OPERATION_DRILL .and.& ! Get_KellyConnection() == KELLY_CONNECTION_STRING .and.& ! Get_Swing() == SWING_WELL_END .and.& ! Get_Slips() == SLIPS_SET_END) then ! ! call Set_TongNotification(.true.) ! return !end if ! call Set_TongNotification(.false.) endif end subroutine subroutine Subscribe_TongNotification() implicit none call OnOperationConditionChange%Add(Evaluate_TongNotification) call OnHookHeightChange%Add(Evaluate_TongNotification) call OnJointConnectionPossibleChange%Add(Evaluate_TongNotification) call OnSingleSetInMouseHoleChange%Add(Evaluate_TongNotification) call OnElevatorConnectionChange%Add(Evaluate_TongNotification) call OnKellyConnectionChange%Add(Evaluate_TongNotification) call OnSwingChange%Add(Evaluate_TongNotification) call OnSlipsChange%Add(Evaluate_TongNotification) end subroutine end module CTongNotification