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.
 
 
 
 
 
 

231 lines
9.5 KiB

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