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.

CUnlatchLedNotification.f90 8.8 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. module CUnlatchLedNotification
  2. use COperationScenariosVariables
  3. use CLog4
  4. implicit none
  5. contains
  6. subroutine Evaluate_UnlatchLed()
  7. use CCommon
  8. implicit none
  9. if (DriveType == TopDrive_DriveType) then
  10. #ifdef OST
  11. print*, 'Evaluate_UnlatchLed=TopDrive'
  12. #endif
  13. !TOPDRIVE-CODE=47
  14. if (Get_HookHeight() <= (TL() + NFC() - ECG) .and.&
  15. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  16. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  17. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  18. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  19. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  20. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  21. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  22. Get_ElevatorPickup() == .false. .and.&
  23. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) .and.&
  24. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  25. Get_Slips() == SLIPS_SET_END) then
  26. call Set_UnlatchLed(.true.)
  27. return
  28. end if
  29. !TOPDRIVE-CODE=48
  30. if ((Get_HookHeight() >= (TL() + SL - ECG + NFC()) .and. Get_HookHeight() <= (TL() + SL - ECG + NFC() + TG)) .and.&
  31. GetStandRack() > 80 .and.&
  32. Get_JointConnectionPossible() == .false. .and.&
  33. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  34. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  35. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  36. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  37. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  38. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  39. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND .and.&
  40. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  41. Get_Slips() == SLIPS_SET_END) then
  42. call Set_UnlatchLed(.true.)
  43. return
  44. end if
  45. !TOPDRIVE-CODE=49
  46. if ((Get_HookHeight() >= TL() .and. Get_HookHeight() <= (TL() + NFC() + SG)) .and.&
  47. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  48. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  49. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  50. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  51. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  52. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  53. (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.&
  54. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  55. Get_FillMouseHoleLed() == .false.) then
  56. call Set_UnlatchLed(.true.)
  57. return
  58. end if
  59. endif
  60. if (DriveType == Kelly_DriveType) then
  61. #ifdef OST
  62. print*, 'Evaluate_UnlatchLed=Kelly'
  63. #endif
  64. !OPERATION-CODE=40
  65. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  66. Get_HookHeight() <= (HL + Get_NearFloorConnection() - ECG) .and.&
  67. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  68. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  69. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  70. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  71. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  72. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  73. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  74. !Get_Elevator() == ELEVATOR_LATCH_STRING_END .and.&
  75. (Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  76. !(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  77. !Get_LatchLed() == .false.
  78. Get_Swing() == SWING_WELL_END .and.&
  79. Get_Slips() == SLIPS_SET_END ) then
  80. call Set_UnlatchLed(.true.)
  81. !call Set_LatchLed(.false.)
  82. return
  83. end if
  84. !OPERATION-CODE=41
  85. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  86. Get_HookHeight() >= (HL + SL - ECG + Get_NearFloorConnection()) .and. Get_HookHeight() <= (HL + SL - ECG + Get_NearFloorConnection() + LG) .and.&
  87. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL + RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG) .and.&
  88. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  89. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  90. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  91. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  92. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  93. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  94. Get_StandRack() < 80 .and.&
  95. Get_JointConnectionPossible() == .false. .and.&
  96. !Get_Elevator() == ELEVATOR_UNLATCH_STAND_END .and.&
  97. !Get_LatchLed() == .false.
  98. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  99. Get_Swing() == SWING_WELL_END .and.&
  100. Get_Slips() == SLIPS_SET_END) then
  101. call Set_UnlatchLed(.true.)
  102. !call Set_LatchLed(.false.)
  103. return
  104. end if
  105. !OPERATION-CODE=42
  106. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  107. Get_HookHeight() >= HL .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SG) .and.&
  108. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  109. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  110. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  111. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  112. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  113. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  114. !Get_Elevator() == ELEVATOR_UNLATCH_SINGLE_END .and.&
  115. Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  116. !Get_LatchLed() == .false. .and.&
  117. Get_FillMouseHoleLed() == .false.) then
  118. call Set_UnlatchLed(.true.)
  119. !call Set_LatchLed(.false.)
  120. return
  121. end if
  122. !call Log_4('OPERATION-CODE=43-OPERATION_DRILL=', Get_OperationCondition() == OPERATION_DRILL)
  123. !call Log_4('OPERATION-CODE=43-Get_HookHeight=', Get_HookHeight() >= 27.41)
  124. !call Log_4('OPERATION-CODE=43-Get_Swing()=', Get_Swing() == SWING_RAT_HOLE_END)
  125. !call Log_4('OPERATION-CODE=43-Get_LatchLed()=', Get_LatchLed() == .false.)
  126. !OPERATION-CODE=43
  127. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  128. Get_HookHeight() >= 27.41 .and.&
  129. !Get_LatchLed() == .false.
  130. Get_Swing() == SWING_RAT_HOLE_END) then
  131. !call Log_4('OPERATION-CODE=43-call Set_UnlatchLed(.true.)')
  132. call Set_UnlatchLed(.true.)
  133. !call Set_LatchLed(.false.)
  134. return
  135. end if
  136. call Set_UnlatchLed(.false.)
  137. endif
  138. end subroutine
  139. subroutine Subscribe_UnlatchLed()
  140. implicit none
  141. call OnOperationConditionChange%Add(Evaluate_UnlatchLed)
  142. call OnHookHeightChange%Add(Evaluate_UnlatchLed)
  143. call OnStandRackChanged%Add(Evaluate_UnlatchLed)
  144. call OnElevatorConnectionChange%Add(Evaluate_UnlatchLed)
  145. call OnSwingChange%Add(Evaluate_UnlatchLed)
  146. call OnSlipsChange%Add(Evaluate_UnlatchLed)
  147. call OnLatchLedChange%Add(Evaluate_UnlatchLed)
  148. call OnFillMouseHoleLedChange%Add(Evaluate_UnlatchLed)
  149. end subroutine
  150. end module CUnlatchLedNotification