module UnitySignalVariables use CVoidEventHandlerCollection use CIntegerEventHandlerCollection type:: UnitySignalsType integer :: MudBucket = 0 type(VoidEventHandlerCollection) :: OnMudBucketChange integer :: Elevator = 0 type(VoidEventHandlerCollection) :: OnElevatorChange integer :: FillupHead = 0 type(VoidEventHandlerCollection) :: OnFillupHeadChange integer :: Ibop = 0 type(VoidEventHandlerCollection) :: OnIbopChange integer :: Kelly = 0 type(VoidEventHandlerCollection) :: OnKellyChange integer :: MouseHole = 0 type(VoidEventHandlerCollection) :: OnMouseHoleChange integer :: OperationCondition = 0 type(VoidEventHandlerCollection) :: OnOperationConditionChange type(IntegerEventHandlerCollection) :: OnOperationConditionChangeInt integer :: SafetyValve = 0 type(VoidEventHandlerCollection) :: OnSafetyValveChange integer :: operation = 0 integer :: Slips = 0 integer :: Slips_S = 0 type(VoidEventHandlerCollection) :: OnSlipsChange integer :: Swing = 0 integer :: Swing_S = 0 type(VoidEventHandlerCollection) :: OnSwingChange integer :: TdsBackupClamp = 0 type(VoidEventHandlerCollection) :: OnTdsBackupClampChange integer :: TdsSpine = 0 type(VoidEventHandlerCollection) :: OnTdsSpineChange integer :: TdsSwing = 0 type(VoidEventHandlerCollection) :: OnTdsSwingChange integer :: TdsTong = 0 type(VoidEventHandlerCollection) :: OnTdsTongChange integer :: Tong = 0 integer :: Tong_S = 0 type(VoidEventHandlerCollection) :: OnTongChange end type UnitySignalsType type(UnitySignalsType):: unitySignals enum, bind(c) enumerator TONG_NEUTRAL enumerator TONG_BREAKOUT_BEGIN enumerator TONG_BREAKOUT_END enumerator TONG_MAKEUP_BEGIN enumerator TONG_MAKEUP_END enumerator TDS_SWING_NEUTRAL enumerator TDS_SWING_OFF_BEGIN enumerator TDS_SWING_OFF_END enumerator TDS_SWING_DRILL_BEGIN enumerator TDS_SWING_DRILL_END enumerator TDS_SWING_TILT_BEGIN enumerator TDS_SWING_TILT_END enumerator TDS_SPINE_NEUTRAL enumerator TDS_SPINE_CONNECT_BEGIN enumerator TDS_SPINE_CONNECT_END enumerator TDS_SPINE_DISCONNECT_BEGIN enumerator TDS_SPINE_DISCONNECT_END enumerator BACKUP_CLAMP_OFF_END enumerator BACKUP_CLAMP_OFF_BEGIN enumerator BACKUP_CLAMP_FW_BEGIN enumerator BACKUP_CLAMP_FW_END enumerator SWING_NEUTRAL enumerator SWING_MOUSE_HOLE_BEGIN enumerator SWING_MOUSE_HOLE_END enumerator SWING_RAT_HOLE_BEGIN enumerator SWING_RAT_HOLE_END enumerator SWING_WELL_BEGIN enumerator SWING_WELL_END end enum enum, bind(c) enumerator TDS_TONG_BREAKOUT_END enumerator TDS_TONG_BREAKOUT_BEGIN enumerator TDS_TONG_MAKEUP_BEGIN enumerator TDS_TONG_MAKEUP_END enumerator SAFETY_VALVE_NEUTRAL enumerator SAFETY_VALVE_REMOVE enumerator SAFETY_VALVE_INSTALL end enum enum, bind(c) enumerator OPERATION_DRILL enumerator OPERATION_TRIP end enum enum, bind(c) enumerator SLIPS_NEUTRAL enumerator SLIPS_SET_BEGIN enumerator SLIPS_SET_END enumerator SLIPS_UNSET_BEGIN enumerator SLIPS_UNSET_END enumerator MOUSE_HOLE_NEUTRAL enumerator MOUSE_HOLE_FILL enumerator MOUSE_HOLE_EMPTY enumerator KELLY_NEUTRAL enumerator KELLY_INSTALL enumerator KELLY_REMOVE !enumerator FILLUP_HEAD_NEUTRAL enumerator FILLUP_HEAD_REMOVE enumerator FILLUP_HEAD_INSTALL enumerator ELEVATOR_NEUTRAL enumerator ELEVATOR_LATCH_STRING_BEGIN enumerator ELEVATOR_LATCH_STRING_END enumerator ELEVATOR_UNLATCH_STRING_BEGIN enumerator ELEVATOR_UNLATCH_STRING_END enumerator ELEVATOR_LATCH_STAND_BEGIN enumerator ELEVATOR_LATCH_STAND_END enumerator ELEVATOR_UNLATCH_STAND_BEGIN enumerator ELEVATOR_UNLATCH_STAND_END enumerator ELEVATOR_LATCH_SINGLE_BEGIN enumerator ELEVATOR_LATCH_SINGLE_END enumerator ELEVATOR_UNLATCH_SINGLE_BEGIN enumerator ELEVATOR_UNLATCH_SINGLE_END !enumerator MUD_BUCKET_NEUTRAL enumerator MUD_BUCKET_REMOVE enumerator MUD_BUCKET_INSTALL !enumerator IBOP_NEUTRAL enumerator IBOP_REMOVE enumerator IBOP_INSTALL end enum contains subroutine Set_Ibop_Install() implicit none call Set_Ibop(IBOP_INSTALL) end subroutine subroutine Set_Ibop_Remove() implicit none call Set_Ibop(IBOP_REMOVE) end subroutine subroutine Set_Tong(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Tong == v) return #endif UnitySignals%Tong = v #ifdef deb print*, 'Tong=', UnitySignals%Tong #endif call UnitySignals%OnTongChange%RunAll() end subroutine integer function Get_Tong() implicit none Get_Tong = UnitySignals%Tong end function subroutine Set_TdsTong(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%TdsTong == v) return #endif UnitySignals%TdsTong = v #ifdef deb print*, 'TdsTong=', UnitySignals%TdsTong #endif call UnitySignals%OnTdsTongChange%RunAll() end subroutine integer function Get_TdsTong() implicit none Get_TdsTong = UnitySignals%TdsTong end function subroutine Set_TdsSwing(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%TdsSwing == v) return #endif UnitySignals%TdsSwing = v #ifdef deb print*, 'TdsSwing=', UnitySignals%TdsSwing #endif call UnitySignals%OnTdsSwingChange%RunAll() end subroutine integer function Get_TdsSwing() implicit none Get_TdsSwing = UnitySignals%TdsSwing end function subroutine Set_TdsSpine(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%TdsSpine == v) return #endif UnitySignals%TdsSpine = v #ifdef deb print*, 'TdsSpine=', UnitySignals%TdsSpine #endif call UnitySignals%OnTdsSpineChange%RunAll() end subroutine integer function Get_TdsSpine() implicit none Get_TdsSpine = UnitySignals%TdsSpine end function subroutine Set_TdsBackupClamp(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%TdsBackupClamp == v) return #endif UnitySignals%TdsBackupClamp = v #ifdef deb print*, 'TdsBackupClamp=', UnitySignals%TdsBackupClamp #endif call UnitySignals%OnTdsBackupClampChange%RunAll() end subroutine integer function Get_TdsBackupClamp() implicit none Get_TdsBackupClamp = UnitySignals%TdsBackupClamp end function subroutine Set_Swing(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Swing == v) return #endif UnitySignals%Swing = v #ifdef deb print*, 'Swing=', UnitySignals%Swing #endif call UnitySignals%OnSwingChange%RunAll() end subroutine integer function Get_Swing() implicit none Get_Swing = UnitySignals%Swing end function subroutine Set_Slips(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Slips == v) return #endif UnitySignals%Slips = v #ifdef deb print*, 'Slips=', UnitySignals%Slips #endif call UnitySignals%OnSlipsChange%RunAll() end subroutine integer function Get_Slips() implicit none Get_Slips = UnitySignals%Slips end function subroutine Set_Operation(i) implicit none integer, intent (in) :: i UnitySignals%operation = i end subroutine subroutine Set_SafetyValve(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%SafetyValve == v) return #endif UnitySignals%SafetyValve = v #ifdef deb if(UnitySignals%SafetyValve == SAFETY_VALVE_NEUTRAL) then print*, 'SafetyValve=SAFETY_VALVE_NEUTRAL' else if (UnitySignals%SafetyValve == SAFETY_VALVE_INSTALL) then print*, 'SafetyValve=SAFETY_VALVE_INSTALL' else if (UnitySignals%SafetyValve == SAFETY_VALVE_INSTALL) then print*, 'SafetyValve=SAFETY_VALVE_REMOVE' endif #endif call UnitySignals%OnSafetyValveChange%RunAll() end subroutine integer function Get_SafetyValve() implicit none Get_SafetyValve = UnitySignals%SafetyValve end function subroutine Set_SafetyValve_Install() implicit none call Set_SafetyValve(SAFETY_VALVE_INSTALL) end subroutine subroutine Set_SafetyValve_Remove() implicit none call Set_SafetyValve(SAFETY_VALVE_REMOVE) end subroutine subroutine Set_OperationCondition(v) ! use CKellyEnumVariables implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%OperationCondition == v) return #endif UnitySignals%OperationCondition = v #ifdef deb print*, 'OperationCondition=', UnitySignals%OperationCondition #endif call UnitySignals%OnOperationConditionChange%RunAll() call UnitySignals%OnOperationConditionChangeInt%RunAll(UnitySignals%OperationCondition) end subroutine integer function Get_OperationCondition() implicit none Get_OperationCondition = UnitySignals%OperationCondition end function subroutine Set_MouseHole(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%MouseHole == v) return #endif !call sleep(2) UnitySignals%MouseHole = v #ifdef deb print*, 'MouseHole=', UnitySignals%MouseHole #endif call UnitySignals%OnMouseHoleChange%RunAll() end subroutine integer function Get_MouseHole() implicit none Get_MouseHole = UnitySignals%MouseHole end function subroutine Set_Kelly(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Kelly == v) return #endif UnitySignals%Kelly = v #ifdef deb print*, 'Kelly=', UnitySignals%Kelly #endif call UnitySignals%OnKellyChange%RunAll() end subroutine integer function Get_Kelly() implicit none Get_Kelly = UnitySignals%Kelly end function subroutine Set_Ibop(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Ibop == v) return #endif UnitySignals%Ibop = v #ifdef deb print*, 'Ibop=', UnitySignals%Ibop #endif call UnitySignals%OnIbopChange%RunAll() end subroutine integer function Get_Ibop() implicit none Get_Ibop = UnitySignals%Ibop end function subroutine Set_FillupHead(v) use CManifolds, only: ToggleFillupHead implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%FillupHead == v) return #endif UnitySignals%FillupHead = v if (UnitySignals%FillupHead == FILLUP_HEAD_INSTALL) then call ToggleFillupHead(.true.) else if (UnitySignals%FillupHead == FILLUP_HEAD_REMOVE) then call ToggleFillupHead(.false.) endif #ifdef deb print*, 'FillupHead=', UnitySignals%FillupHead #endif call UnitySignals%OnFillupHeadChange%RunAll() end subroutine integer function Get_FillupHead() implicit none Get_FillupHead = UnitySignals%FillupHead end function subroutine Set_Elevator(v) implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%Elevator == v) return #endif UnitySignals%Elevator = v #ifdef deb print*, 'Elevator=', UnitySignals%Elevator #endif call UnitySignals%OnElevatorChange%RunAll() end subroutine integer function Get_Elevator() implicit none Get_Elevator = UnitySignals%Elevator end function subroutine Set_MudBucket(v) use CManifolds, only: ToggleMudBox implicit none integer , intent(in) :: v #ifdef ExcludeExtraChanges if(UnitySignals%MudBucket == v) return #endif UnitySignals%MudBucket = v if (UnitySignals%MudBucket == MUD_BUCKET_INSTALL) then call ToggleMudBox(.true.) else if (UnitySignals%MudBucket == MUD_BUCKET_REMOVE) then call ToggleMudBox(.false.) endif #ifdef deb print*, 'MudBucket=', UnitySignals%MudBucket #endif call UnitySignals%OnMudBucketChange%RunAll() end subroutine integer function Get_MudBucket() implicit none Get_MudBucket = UnitySignals%MudBucket end function end module UnitySignalVariables