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.
 
 
 
 
 
 

217 lines
9.8 KiB

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