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.

CTopDrivePanel.f90 9.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. module CTopDrivePanel
  2. use CTopDrivePanelVariables
  3. use ConfigurationVariables
  4. use CLog3
  5. implicit none
  6. public
  7. contains
  8. ! Input routines
  9. subroutine SetTopDriveTdsPowerState(v)
  10. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTdsPowerState
  11. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTdsPowerState' :: SetTopDriveTdsPowerState
  12. implicit none
  13. integer, intent(in) :: v
  14. data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState = v
  15. #ifdef deb
  16. call Log_3( 'TopDriveTdsPowerState=', data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState)
  17. #endif
  18. end subroutine
  19. subroutine SetTopDriveTorqueWrench(v)
  20. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueWrench
  21. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueWrench' :: SetTopDriveTorqueWrench
  22. implicit none
  23. logical, intent(in) :: v
  24. data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench = v
  25. #ifdef deb
  26. call Log_3( 'TopDriveTorqueWrench=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench)
  27. #endif
  28. end subroutine
  29. subroutine SetTopDriveDrillTorqueState(v)
  30. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveDrillTorqueState
  31. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveDrillTorqueState' :: SetTopDriveDrillTorqueState
  32. implicit none
  33. integer, intent(in) :: v
  34. data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState = v
  35. #ifdef deb
  36. call Log_3( 'TopDriveDrillTorqueState=', data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState)
  37. #endif
  38. end subroutine
  39. subroutine SetTopDriveLinkTiltState(v)
  40. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveLinkTiltState
  41. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveLinkTiltState' :: SetTopDriveLinkTiltState
  42. implicit none
  43. integer, intent(in) :: v
  44. data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState = v
  45. #ifdef deb
  46. call Log_3( 'TopDriveLinkTiltState=', data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState)
  47. #endif
  48. end subroutine
  49. subroutine SetTopDriveIbop(v)
  50. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveIbop
  51. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveIbop' :: SetTopDriveIbop
  52. implicit none
  53. logical, intent(in) :: v
  54. data%EquipmentControl%TopDrivePanel%TopDriveIbop = v
  55. #ifdef deb
  56. call Log_3( 'TopDriveIbop=', data%EquipmentControl%TopDrivePanel%TopDriveIbop)
  57. #endif
  58. end subroutine
  59. subroutine SetTopDriveTorqueLimitKnob(v)
  60. !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueLimitKnob
  61. !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueLimitKnob' :: SetTopDriveTorqueLimitKnob
  62. ! use CSimulationVariables, only: IsPortable
  63. use CDrillingConsoleVariables
  64. use ConfigurationVariables
  65. use ConfigurationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob
  66. use CWarnings, only: Activate_TopdriveRotaryTableConfilict
  67. use CScaleRange
  68. implicit none
  69. real, intent(in) :: v
  70. if (IsPortable) then
  71. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict()
  72. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then
  73. data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = 0
  74. data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v
  75. #ifdef deb
  76. call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob )
  77. call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob )
  78. #endif
  79. endif
  80. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then
  81. data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = 0
  82. data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = real(ScaleRange(v, 0.0, 10.0, 0.0, 6000.0), 8)
  83. #ifdef deb
  84. call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob )
  85. call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob )
  86. #endif
  87. endif
  88. else
  89. data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v
  90. #ifdef deb
  91. call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob)
  92. #endif
  93. endif
  94. end subroutine
  95. subroutine SetRpmKnob(v)
  96. !DEC$ ATTRIBUTES DLLEXPORT :: SetRpmKnob
  97. !DEC$ ATTRIBUTES ALIAS: 'SetRpmKnob' :: SetRpmKnob
  98. ! use CSimulationVariables, only: IsPortable
  99. use CDrillingConsoleVariables
  100. use ConfigurationVariables
  101. use ConfigurationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTThrottle
  102. use CWarnings, only: Activate_TopdriveRotaryTableConfilict
  103. use CScaleRange
  104. implicit none
  105. real, intent(in) :: v
  106. if (IsPortable) then
  107. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict()
  108. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then
  109. data%EquipmentControl%DrillingConsole%RTThrottle = 0
  110. data%EquipmentControl%TopDrivePanel%RpmKnob = v
  111. #ifdef deb
  112. call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle )
  113. call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob )
  114. #endif
  115. endif
  116. if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then
  117. data%EquipmentControl%TopDrivePanel%RpmKnob = 0
  118. data%EquipmentControl%DrillingConsole%RTThrottle = real(ScaleRange(v, 0.0, 965.0, 0.0, 250.0), 8)
  119. #ifdef deb
  120. call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob )
  121. call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle )
  122. #endif
  123. endif
  124. else
  125. data%EquipmentControl%TopDrivePanel%RpmKnob = v
  126. endif
  127. if (IsPortable) then
  128. !
  129. else
  130. data%EquipmentControl%TopDrivePanel%RpmKnob = v
  131. #ifdef deb
  132. call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob )
  133. #endif
  134. endif
  135. end subroutine
  136. ! Output routines
  137. integer function GetTopDriveOperationFaultLed()
  138. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveOperationFaultLed
  139. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveOperationFaultLed' :: GetTopDriveOperationFaultLed
  140. implicit none
  141. GetTopDriveOperationFaultLed = data%EquipmentControl%TopDrivePanel%TopDriveOperationFaultLed
  142. !GetTopDriveOperationFaultLed = 1
  143. end function
  144. integer function GetTopDriveTdsPowerLed()
  145. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTdsPowerLed
  146. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTdsPowerLed' :: GetTopDriveTdsPowerLed
  147. implicit none
  148. GetTopDriveTdsPowerLed = data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed
  149. !GetTopDriveTdsPowerLed = 1
  150. end function
  151. integer function GetTopDriveTorqueWrenchLed()
  152. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueWrenchLed
  153. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueWrenchLed' :: GetTopDriveTorqueWrenchLed
  154. implicit none
  155. GetTopDriveTorqueWrenchLed = data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrenchLed
  156. !GetTopDriveTorqueWrenchLed = 1
  157. end function
  158. integer function GetTopDriveLinkTiltLed()
  159. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveLinkTiltLed
  160. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveLinkTiltLed' :: GetTopDriveLinkTiltLed
  161. implicit none
  162. GetTopDriveLinkTiltLed = data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltLed
  163. !GetTopDriveLinkTiltLed = 1
  164. end function
  165. integer function GetTopDriveIbopLed()
  166. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveIbopLed
  167. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveIbopLed' :: GetTopDriveIbopLed
  168. implicit none
  169. GetTopDriveIbopLed = data%EquipmentControl%TopDrivePanel%TopDriveIbopLed
  170. !GetTopDriveIbopLed = 1
  171. end function
  172. real function GetTopDriveTorqueGauge()
  173. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueGauge
  174. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueGauge' :: GetTopDriveTorqueGauge
  175. implicit none
  176. GetTopDriveTorqueGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueGauge
  177. !GetTopDriveTorqueGauge = 340
  178. end function
  179. real function GetTopDriveTorqueLimitGauge()
  180. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueLimitGauge
  181. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueLimitGauge' :: GetTopDriveTorqueLimitGauge
  182. implicit none
  183. GetTopDriveTorqueLimitGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitGauge
  184. !GetTopDriveTorqueLimitGauge = 442
  185. end function
  186. real function GetTopDriveRpmGauge()
  187. !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveRpmGauge
  188. !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveRpmGauge' :: GetTopDriveRpmGauge
  189. implicit none
  190. GetTopDriveRpmGauge = data%EquipmentControl%TopDrivePanel%TopDriveRpmGauge
  191. !GetTopDriveRpmGauge = 67
  192. end function
  193. end module CTopDrivePanel