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.1 KiB

  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/CUnlatchLedNotification.f90"
  2. module CUnlatchLedNotification
  3. use OperationScenariosModule
  4. use UnityModule
  5. use CLog4
  6. implicit none
  7. contains
  8. subroutine Evaluate_UnlatchLed()
  9. use CCommon
  10. implicit none
  11. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  12. # 16
  13. !TOPDRIVE-CODE=47
  14. if (Get_HookHeight() <= (TL() + NFC() - data%State%OperationScenario%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() + 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.&
  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() + data%State%OperationScenario%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 (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  61. # 99
  62. !OPERATION-CODE=40
  63. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  64. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() - data%State%OperationScenario%ECG) .and.&
  65. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  66. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  67. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  68. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  69. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  70. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  71. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  72. !Get_Elevator() == ELEVATOR_LATCH_STRING_END .and.&
  73. (Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  74. !(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  75. !Get_LatchLed() == .false.
  76. Get_Swing() == SWING_WELL_END .and.&
  77. Get_Slips() == SLIPS_SET_END ) then
  78. call Set_UnlatchLed(.true.)
  79. !call Set_LatchLed(.false.)
  80. return
  81. end if
  82. !OPERATION-CODE=41
  83. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  84. 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.&
  85. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL + RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG) .and.&
  86. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  87. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  88. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  89. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  90. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  91. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  92. Get_StandRack() < 80 .and.&
  93. Get_JointConnectionPossible() == .false. .and.&
  94. !Get_Elevator() == ELEVATOR_UNLATCH_STAND_END .and.&
  95. !Get_LatchLed() == .false.
  96. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  97. Get_Swing() == SWING_WELL_END .and.&
  98. Get_Slips() == SLIPS_SET_END) then
  99. call Set_UnlatchLed(.true.)
  100. !call Set_LatchLed(.false.)
  101. return
  102. end if
  103. !OPERATION-CODE=42
  104. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  105. Get_HookHeight() >= data%State%OperationScenario%HL .and. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%SG) .and.&
  106. (Get_Elevator() /= ELEVATOR_LATCH_STRING_BEGIN .and.&
  107. Get_Elevator() /= ELEVATOR_UNLATCH_STRING_BEGIN .and.&
  108. Get_Elevator() /= ELEVATOR_LATCH_STAND_BEGIN .and.&
  109. Get_Elevator() /= ELEVATOR_UNLATCH_STAND_BEGIN .and.&
  110. Get_Elevator() /= ELEVATOR_LATCH_SINGLE_BEGIN .and.&
  111. Get_Elevator() /= ELEVATOR_UNLATCH_SINGLE_BEGIN) .and.&
  112. !Get_Elevator() == ELEVATOR_UNLATCH_SINGLE_END .and.&
  113. Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  114. !Get_LatchLed() == .false. .and.&
  115. Get_FillMouseHoleLed() == .false.) then
  116. call Set_UnlatchLed(.true.)
  117. !call Set_LatchLed(.false.)
  118. return
  119. end if
  120. !call Log_4('OPERATION-CODE=43-OPERATION_DRILL=', Get_OperationCondition() == OPERATION_DRILL)
  121. !call Log_4('OPERATION-CODE=43-Get_HookHeight=', Get_HookHeight() >= 27.41)
  122. !call Log_4('OPERATION-CODE=43-Get_Swing()=', Get_Swing() == SWING_RAT_HOLE_END)
  123. !call Log_4('OPERATION-CODE=43-Get_LatchLed()=', Get_LatchLed() == .false.)
  124. !OPERATION-CODE=43
  125. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  126. Get_HookHeight() >= 27.41 .and.&
  127. !Get_LatchLed() == .false.
  128. Get_Swing() == SWING_RAT_HOLE_END) then
  129. !call Log_4('OPERATION-CODE=43-call Set_UnlatchLed(.true.)')
  130. call Set_UnlatchLed(.true.)
  131. !call Set_LatchLed(.false.)
  132. return
  133. end if
  134. call Set_UnlatchLed(.false.)
  135. endif
  136. end subroutine
  137. ! subroutine Subscribe_UnlatchLed()
  138. ! implicit none
  139. ! !**call data%State%unitySignals%OnOperationConditionChange%Add(Evaluate_UnlatchLed)
  140. ! ! call softwareInputs%OnHookHeightChange%Add(Evaluate_UnlatchLed)
  141. ! ! call softwareInputs%OnStandRackChanged%Add(Evaluate_UnlatchLed)
  142. ! call data%State%OperationScenario%OnElevatorConnectionChange%Add(Evaluate_UnlatchLed)
  143. ! !**call data%State%unitySignals%OnSwingChange%Add(Evaluate_UnlatchLed)
  144. ! !**call data%State%unitySignals%OnSlipsChange%Add(Evaluate_UnlatchLed)
  145. ! !**call data%State%notifications%OnLatchLedChange%Add(Evaluate_UnlatchLed)
  146. ! !**call data%State%notifications%OnFillMouseHoleLedChange%Add(Evaluate_UnlatchLed)
  147. ! end subroutine
  148. end module CUnlatchLedNotification