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.
 
 
 
 
 
 

251 lines
10 KiB

  1. module CLatchLedNotification
  2. use OperationScenariosModule
  3. use CLog4
  4. implicit none
  5. contains
  6. subroutine Evaluate_LatchLed()
  7. use CCommon
  8. implicit none
  9. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  10. #ifdef OST
  11. print*, 'Evaluate_LatchLed=TopDrive'
  12. #endif
  13. !TOPDRIVE-CODE=44
  14. if (Get_HookHeight() <= (TL() + NFC() - data%State%OperationScenario%ECG) .and.&
  15. Get_ElevatorConnectionPossible() .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_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  23. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  24. Get_Slips() == SLIPS_SET_END) then
  25. call Set_LatchLed(.true.)
  26. return
  27. end if
  28. !TOPDRIVE-CODE=45
  29. 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.&
  30. GetStandRack() > 0 .and.&
  31. Get_JointConnectionPossible() == .false. .and.&
  32. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  33. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  34. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  35. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  36. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  37. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  38. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  39. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  40. Get_Slips() == SLIPS_SET_END) then
  41. call Set_LatchLed(.true.)
  42. return
  43. end if
  44. !TOPDRIVE-CODE=46
  45. 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.&
  46. Get_ElevatorConnectionPossible() .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_NOTHING .and.&
  54. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  55. Get_FillMouseHoleLed()) then
  56. call Set_LatchLed(.true.)
  57. return
  58. end if
  59. endif
  60. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  61. #ifdef OST
  62. print*, 'Evaluate_LatchLed=Kelly'
  63. #endif
  64. !OPERATION-CODE=36
  65. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  66. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() - data%State%OperationScenario%ECG) .and.&
  67. Get_ElevatorConnectionPossible() .and.&
  68. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .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_UNLATCH_STRING_END .and.&
  76. !Get_UnlatchLed() .and.&
  77. Get_Swing() == SWING_WELL_END .and.&
  78. Get_Slips() == SLIPS_SET_END) then
  79. !call Log_4("OPERATION-CODE=36")
  80. call Set_LatchLed(.true.)
  81. !call Set_UnlatchLed(.false.)
  82. return
  83. end if
  84. !OPERATION-CODE=37
  85. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  86. Get_StandRack() > 0 .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_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .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_Elevator() == ELEVATOR_UNLATCH_STAND_END .and.&
  96. Get_ElevatorConnectionPossible() == .false. .and.&
  97. !Get_UnlatchLed() .and.&
  98. Get_Swing() == SWING_WELL_END .and.&
  99. Get_Slips() == SLIPS_SET_END) then
  100. !call Log_4("OPERATION-CODE=37")
  101. call Set_LatchLed(.true.)
  102. !call Set_UnlatchLed(.false.)
  103. return
  104. end if
  105. !OPERATION-CODE=38
  106. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  107. Get_ElevatorConnectionPossible() .and.&
  108. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .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_UnlatchLed() .and.&
  117. Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  118. Get_FillMouseHoleLed()) then
  119. !call Log_4("OPERATION-CODE=38")
  120. call Set_LatchLed(.true.)
  121. !call Set_UnlatchLed(.false.)
  122. return
  123. end if
  124. !OPERATION-CODE=39
  125. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  126. Get_HookHeight() >= 27.41 .and.&
  127. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  128. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  129. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  130. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  131. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  132. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  133. !Get_UnlatchLed() .and.&
  134. Get_Swing() == SWING_RAT_HOLE_END) then
  135. !call Log_4("OPERATION-CODE=39")
  136. call Set_LatchLed(.true.)
  137. !call Set_UnlatchLed(.false.)
  138. return
  139. end if
  140. call Set_LatchLed(.false.)
  141. endif
  142. end subroutine
  143. ! subroutine Subscribe_LatchLed()
  144. ! use UnitySignalsModuleVariables
  145. ! use CStandRack
  146. ! use CUnityInputs, OnElevatorConnectionChangePosibility => OnElevatorConnectionPossibleChange
  147. ! use CSwingEnumVariables
  148. ! use CSlipsEnumVariables
  149. ! use CFillMouseHoleLedNotificationVariables
  150. ! implicit none
  151. ! call OnOperationConditionChange%Add(Evaluate_LatchLed)
  152. ! call OnStandRackChanged%Add(Evaluate_LatchLed)
  153. ! call OnElevatorConnectionChangePosibility%Add(Evaluate_LatchLed)
  154. ! call OnElevatorPickupChange%Add(Evaluate_LatchLed)
  155. ! call OnNearFloorPositionChange%Add(Evaluate_LatchLed)
  156. ! call OnSwingChange%Add(Evaluate_LatchLed)
  157. ! call OnSlipsChange%Add(Evaluate_LatchLed)
  158. ! call OnFillMouseHoleLedChange%Add(Evaluate_LatchLed)
  159. ! end subroutine
  160. end module CLatchLedNotification