Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CSwingLedNotification.f90 4.7 KiB

1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. module CSwingLedNotification
  2. use OperationScenariosModule
  3. use UnityModule
  4. implicit none
  5. contains
  6. subroutine Evaluate_SwingLed()
  7. implicit none
  8. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  9. #ifdef OST
  10. print*, 'Evaluate_SwingLed=TopDrive'
  11. #endif
  12. endif
  13. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  14. #ifdef OST
  15. print*, 'Evaluate_SwingLed=Kelly'
  16. #endif
  17. !OPERATION-CODE=22
  18. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  19. Get_HookHeight() >= (data%State%OperationScenario%HL + Get_NearFloorConnection()) .and. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%LG) .and.&
  20. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  21. Get_JointConnectionPossible() == .false. .and.&
  22. (Get_Swing() /= SWING_WELL_BEGIN .and.&
  23. Get_Swing() /= SWING_MOUSE_HOLE_BEGIN .and.&
  24. Get_Swing() /= SWING_RAT_HOLE_BEGIN) .and.&
  25. Get_Slips() == SLIPS_SET_END) then
  26. call Set_SwingLed(.true.)
  27. return
  28. end if
  29. !OPERATION-CODE=23
  30. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  31. Get_HookHeight() >= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%PL) .and. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%LG + data%State%OperationScenario%PL) .and.&
  32. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  33. Get_JointConnectionPossible() == .false. .and.&
  34. (Get_Swing() /= SWING_WELL_BEGIN .and.&
  35. Get_Swing() /= SWING_MOUSE_HOLE_BEGIN .and.&
  36. Get_Swing() /= SWING_RAT_HOLE_BEGIN) .and.&
  37. Get_Slips() == SLIPS_SET_END) then
  38. call Set_SwingLed(.true.)
  39. return
  40. end if
  41. !OPERATION-CODE=24
  42. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  43. Get_HookHeight() >= (data%State%OperationScenario%HKL + Get_NearFloorConnection()) .and. Get_HookHeight() <= (data%State%OperationScenario%HKL + Get_NearFloorConnection() + data%State%OperationScenario%LG) .and.&
  44. Get_JointConnectionPossible() == .false. .and.&
  45. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  46. (Get_Swing() /= SWING_WELL_BEGIN .and.&
  47. Get_Swing() /= SWING_MOUSE_HOLE_BEGIN .and.&
  48. Get_Swing() /= SWING_RAT_HOLE_BEGIN) .and.&
  49. Get_Slips() == SLIPS_SET_END) then
  50. call Set_SwingLed(.true.)
  51. return
  52. end if
  53. !OPERATION-CODE=25
  54. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  55. Get_HookHeight() >= (data%State%OperationScenario%HKL + Get_NearFloorConnection() + data%State%OperationScenario%PL) .and. Get_HookHeight() <= (data%State%OperationScenario%HKL + Get_NearFloorConnection() + data%State%OperationScenario%LG + data%State%OperationScenario%PL) .and.&
  56. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  57. Get_JointConnectionPossible() == .false. .and.&
  58. (Get_Swing() /= SWING_WELL_BEGIN .and.&
  59. Get_Swing() /= SWING_MOUSE_HOLE_BEGIN .and.&
  60. Get_Swing() /= SWING_RAT_HOLE_BEGIN) .and.&
  61. Get_Slips() == SLIPS_SET_END) then
  62. call Set_SwingLed(.true.)
  63. return
  64. end if
  65. call Set_SwingLed(.false.)
  66. endif
  67. end subroutine
  68. ! subroutine Subscribe_SwingLed()
  69. ! implicit none
  70. ! call OnOperationConditionChange%Add(Evaluate_SwingLed)
  71. ! call OnHookHeightChange%Add(Evaluate_SwingLed)
  72. ! call OnElevatorConnectionChange%Add(Evaluate_SwingLed)
  73. ! call OnKellyConnectionChange%Add(Evaluate_SwingLed)
  74. ! call OnSwingChange%Add(Evaluate_SwingLed)
  75. ! call OnSlipsChange%Add(Evaluate_SwingLed)
  76. ! call OnFillMouseHoleLedChange%Add(Evaluate_SwingLed)
  77. ! end subroutine
  78. end module CSwingLedNotification