|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- module COperationScenariosMain
- use CIActionReference
- use UnitySignalsModule
- implicit none
- public
- contains
-
- subroutine OperationScenarios_Step
- use OperationScenariosModule
- use CElevatorConnectionEnum
- use CCloseKellyCockLedNotification
- use CCloseSafetyValveLedNotification
- use CFillMouseHoleLedNotification
- use CIrIBopLedNotification
- use CIrSafetyValveLedNotification
- use CLatchLedNotification
- use COpenKellyCockLedNotification
- use COpenSafetyValveLedNotification
- use CSlipsNotification
- use CSwingLedNotification
- use CTongNotification
- use CUnlatchLedNotification
- use CInstallFillupHeadPermission
- use CInstallMudBucketPermission
- use CIrIbopPermission
- use CIrSafetyValvePermission
- use CRemoveFillupHeadPermission
- use CRemoveMudBucketPermission
- use SoftwareInputsVariables
-
- use UnityModule
- use UnitySignalsModule
- use CTongEnum
- use CFlowKellyDisconnectEnum
- use CFillupHeadPermission
- use CSwingDrillPermission
- use CSwingOffPermission
- use CSwingTiltPermission
- use CTdsElevatorModesEnum
- use CTdsSpineEnum
- use CTdsSwingEnum
- use CTdsTongEnum
- use CTdsBackupClamp
- use CTdsIbopLedNotification
- use CTdsPowerLedNotification
- use CTdsTorqueWrenchLedNotification
- use CElevatorConnectionEnum
-
- implicit none
-
- call Evaluate_KellyConnection()
- call Evaluate_ElevatorConnection()
-
- call Evaluate_CloseKellyCockLed()
- call Evaluate_CloseSafetyValveLed()
- call Evaluate_FillMouseHoleLed()
- call Evaluate_IrIBopLed()
- call Evaluate_IrSafetyValveLed()
- call Evaluate_LatchLed()
- call Evaluate_OpenKellyCockLed()
- call Evaluate_OpenSafetyValveLed()
- call Evaluate_SlipsNotification()
- call Evaluate_SwingLed()
- call Evaluate_TongNotification()
- call Evaluate_UnlatchLed()
-
- call Evaluate_InstallFillupHeadPermission()
- call Evaluate_InstallMudBucketPermission()
- call Evaluate_IrIbopPermission()
- call Evaluate_IrSafetyValvePermission()
- call Evaluate_RemoveFillupHeadPermission()
- call Evaluate_RemoveMudBucketPermission()
-
- call Evaluate_MudBucket()
- ! call Evaluate_Elevator()
- call Evaluate_FillupHead()
- ! call Evaluate_Ibop() is empty, so i commented (mahmood)
- ! call Evaluate_Kelly() is empty, so i commented (mahmood)
- ! call Evaluate_MouseHole()
- ! call Evaluate_OperationCondition()
- ! call Evaluate_SafetyValve()
- ! call Evaluate_Slips()
- ! call Evaluate_Swing()
- ! call Evaluate_Tong()
-
- ! call Evaluate_StringUpdate()
-
- ! call Evaluate_FlowKellyDisconnect() is empty, so i commented (mahmood)
- ! call Evaluate_FlowPipeDisconnect() is empty, so i commented (mahmood)
-
- !if(Get_FillMouseHoleLed()) then
- ! call Set_MouseHole(MOUSE_HOLE_FILL)
- !else
- ! if((Get_KellyConnection() == KELLY_CONNECTION_SINGLE .or.&
- ! Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) .and.&
- ! Get_HookHeight() >= 95.0 ) then
- ! call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
- ! else
- ! call Set_MouseHole(MOUSE_HOLE_EMPTY)
- ! endif
- !endif
-
-
-
-
-
-
-
-
- !topdrive
- ! call Evaluate_TdsElevatorModes()
- ! call Evaluate_TdsConnectionModes()
- ! call Evaluate_SwingTiltPermission()
- ! call Evaluate_SwingOffPermission()
- ! call Evaluate_SwingDrillPermission()
- ! call Evaluate_FillupHeadPermission()
- ! call Evaluate_TdsTong()
- ! call Evaluate_TdsBackupClamp()
- ! call Evaluate_TdsSwing()
- ! call Evaluate_TdsSpine()
-
- call Evaluate_PowerLed()
- call Evaluate_IbopLed()
-
- call Evaluate_TorqueWrenchLed()
-
- end subroutine OperationScenarios_Step
-
- ! subroutine UpdateUnity()
- ! implicit none
- ! if(associated(UpdateUnityPtr)) call UpdateUnityPtr()
- ! end subroutine
-
- subroutine Kelly_ConnectionNothing() bind (C,name="Kelly_ConnectionNothine")
- use UnitySignalVariables
- use CHook
- use SimulationVariables
- implicit none
- ! call logg(4,"Kelly_ConnectionNothing started")
- print *,"Kelly_ConnectionNothing started"
- call Set_HookHeight(75.0)
- call sleep(1)
-
- ! first wait for unity to get to starting point
- loop1: do
- if(Get_Swing() == SWING_WELL_END .and. Get_Slips() == SLIPS_SET_END) exit loop1
- call sleepqq(100)
- enddo loop1
- call sleep(1)
-
- !TODO: possibly goto a position to activate swing
-
- ! goto preferred swing position
- if(data%State%unitySignals%Swing_S == SWING_MOUSE_HOLE_END) then
- call Set_Swing(SWING_MOUSE_HOLE_BEGIN)
- !@call UpdateUnity()
- loop2: do
- if(Get_Swing() == SWING_MOUSE_HOLE_END) exit loop2
- call sleepqq(100)
- enddo loop2
- elseif (data%State%unitySignals%Swing_S == SWING_RAT_HOLE_END) then
- call Set_Swing(SWING_RAT_HOLE_BEGIN)
- !@call UpdateUnity()
- loop3: do
- if(Get_Swing() == SWING_RAT_HOLE_END) exit loop3
- call sleepqq(100)
- enddo loop3
- !elseif (Swing_S == SWING_WELL_END) then
- ! call Set_Swing(SWING_WELL_BEGIN)
- ! !@call UpdateUnity()
- ! loop4: do
- ! if(Get_Swing() == SWING_WELL_END) exit loop4
- ! call sleepqq(100)
- ! enddo loop4
- endif
- call sleep(3)
-
- ! move to final hook height
- call Update_HookHeight_From_Snapshot()
- call sleep(3)
- ! call logg(4,"Kelly_ConnectionNothing end")
- print *,"Kelly_ConnectionNothing end"
-
- end subroutine Kelly_ConnectionNothing
-
- subroutine Kelly_ConnectionString() BIND(C,name='Kelly_ConnectionString')
- use UnitySignalVariables
- use CHook
- use SimulationVariables
- implicit none
-
- call Set_HookHeight(75.0)
- call sleep(1)
-
- ! first wait for unity to get to starting point
- loop1: do
- if(Get_Swing() == SWING_WELL_END .and. Get_Slips() == SLIPS_SET_END) exit loop1
- call sleepqq(100)
- enddo loop1
- call sleep(1)
-
- ! goto connection to string position
- call Set_HookHeight_S(66.7)
- call sleep(1)
-
- ! start tong makeup
- call Set_Tong(TONG_MAKEUP_BEGIN)
- !@call UpdateUnity()
- loop2: do
- if(Get_Tong() == TONG_MAKEUP_END) exit loop2
- call sleepqq(100)
- enddo loop2
- call sleepqq(100)
-
- ! release slips
- call Set_Slips(SLIPS_UNSET_BEGIN)
- !@call UpdateUnity()
- loop3: do
- if(Get_Slips() == SLIPS_UNSET_END) exit loop3
- call sleepqq(100)
- enddo loop3
- call sleepqq(100)
-
- ! move to final hook height
- call Update_HookHeight_From_Snapshot()
- call sleep(3)
-
-
- ! put slips to saved position
- if(data%State%unitySignals%Slips_S == SLIPS_SET_END) then
-
- call Set_Slips(SLIPS_SET_BEGIN)
- !@call UpdateUnity()
- loop4: do
- if(Get_Slips() == SLIPS_SET_END) exit loop4
- call sleepqq(100)
- enddo loop4
- call sleep(1)
- endif
-
-
- end subroutine Kelly_ConnectionString
-
- subroutine Kelly_ConnectionSingle() BIND(C,name='Kelly_ConnectionSingle')
- use UnitySignalVariables
- use CHook
- use SimulationVariables
- implicit none
-
- call Set_HookHeight(75.0)
- call sleep(1)
-
- ! first wait for unity to get to starting point
- loop1: do
- if(Get_Swing() == SWING_WELL_END .and. Get_Slips() == SLIPS_SET_END) exit loop1
- call sleepqq(100)
- enddo loop1
- call sleep(1)
-
-
- ! goto swing mouse hole position
- call Set_HookHeight_S(70.0)
- call sleep(1)
-
- ! swing mouse hole
- call Set_Swing(SWING_MOUSE_HOLE_BEGIN)
- !@call UpdateUnity()
- loop2: do
- if(Get_Swing() == SWING_MOUSE_HOLE_END) exit loop2
- call sleepqq(100)
- enddo loop2
- call sleepqq(100)
-
-
- ! goto makeup pipe location
- call Set_HookHeight_S(65.0)
- call sleep(1)
-
-
- ! start tong makeup
- call Set_Tong(TONG_MAKEUP_BEGIN)
- !@call UpdateUnity()
- loop3: do
- if(Get_Tong() == TONG_MAKEUP_END) exit loop3
- call sleepqq(100)
- enddo loop3
- call sleepqq(100)
-
-
-
- if (data%State%unitySignals%Swing_S == SWING_WELL_END) then ! already in mouse hole
-
- ! goto swing location
- call Set_HookHeight_S(98.0)
- call sleep(1)
-
- ! goto preferred swing position
- call Set_Swing(SWING_WELL_BEGIN)
- !@call UpdateUnity()
- loop4: do
- if(Get_Swing() == SWING_WELL_END) exit loop4
- call sleepqq(100)
- enddo loop4
- call sleep(2)
-
- endif
-
-
- ! move to final hook height
- call Update_HookHeight_From_Snapshot()
- call sleep(3)
-
- end subroutine Kelly_ConnectionSingle
-
- subroutine Elevator_ConnectionNothing() BIND(C,name='Elevator_ConnectionNothing')
- use UnitySignalVariables
- use CHook
- use SimulationVariables
- implicit none
-
- call Set_HookHeight(75.0)
- call sleep(1)
-
- ! first wait for unity to get to starting point
- loop1: do
- if(Get_Swing() == SWING_WELL_END .and. Get_Slips() == SLIPS_SET_END) exit loop1
- call sleepqq(100)
- enddo loop1
- call sleep(1)
-
-
- call Set_Kelly(KELLY_REMOVE)
- call sleepqq(100)
-
- ! goto preferred swing position
- if(data%State%unitySignals%Swing_S == SWING_MOUSE_HOLE_END) then
- call Set_Swing(SWING_MOUSE_HOLE_BEGIN)
- !@call UpdateUnity()
- loop4: do
- if(Get_Swing() == SWING_MOUSE_HOLE_END) exit loop4
- call sleepqq(100)
- enddo loop4
- elseif (data%State%unitySignals%Swing_S == SWING_RAT_HOLE_END) then
- call Set_Swing(SWING_RAT_HOLE_BEGIN)
- !@call UpdateUnity()
- loop5: do
- if(Get_Swing() == SWING_RAT_HOLE_END) exit loop5
- call sleepqq(100)
- enddo loop5
- elseif (data%State%unitySignals%Swing_S == SWING_WELL_END) then
- call Set_Swing(SWING_WELL_BEGIN)
- !@call UpdateUnity()
- loop6: do
- if(Get_Swing() == SWING_WELL_END) exit loop6
- call sleepqq(100)
- enddo loop6
- endif
- call sleepqq(100)
-
- ! move to final hook height
- call Update_HookHeight_From_Snapshot()
- call sleep(3)
-
- end subroutine Elevator_ConnectionNothing
-
-
-
-
-
- subroutine Elevator_ConnectionString
- implicit none
- end subroutine Elevator_ConnectionString
-
-
-
-
-
-
-
- subroutine Elevator_ConnectionStand
- implicit none
- end subroutine Elevator_ConnectionStand
-
-
-
-
-
-
- subroutine Elevator_ConnectionSingle
- implicit none
- end subroutine Elevator_ConnectionSingle
-
- end module COperationScenariosMain
|