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.
 
 
 
 
 
 

212 lines
7.1 KiB

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