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.
 
 
 
 
 
 

314 rivejä
14 KiB

  1. subroutine TopDrive_Solver
  2. !use CDrillingConsoleVariables
  3. !use CDataDisplayConsoleVariables
  4. use CSimulationVariables
  5. use CDrillWatchVariables
  6. use TopDrive_VARIABLES
  7. use CSounds
  8. use CTopDrivePanelVariables
  9. use CTdsConnectionModesEnumVariables
  10. use equipments_PowerLimit
  11. IMPLICIT NONE
  12. REAL :: const
  13. !TDS%TracTorque = TDS%String_Torque/TDS%Conv_Ratio/TDS%Mech_Efficiency
  14. TDS_wOld = TDS%w_new/TDS%Conv_Ratio
  15. CALL TopDrive_Traction_Motor
  16. !if (TDS%N_ref<=0.) then
  17. ! Call TopDrive_OffMode
  18. !end if
  19. !******************************************************************
  20. !IF (TDS%ia_new<=1150.) THEN
  21. TDS%fii = 6.3304d-3*1150.d0
  22. !ELSE IF (TDS%ia_new>1150.) THEN
  23. ! TDS%fii = 2.8571d-7*(TDS%ia_new-1150.)+7.28
  24. !END IF
  25. TDS%Te = TDS%fii*TDS%ia_new
  26. const = TDS%J_coef+(TDS%String_JCoef/(TDS%Mech_Efficiency*TDS%Conv_Ratio))
  27. TDS%dw = (TDS%Te-TDS%TL)/(const)
  28. if ( TopDriveTdsPowerState==-1 .or. TDS_OldPowerMode==-1 ) then !FWD
  29. if ( TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE
  30. TopDriveOperationFaultLed = 0
  31. TDS%Speed = 0.d0 !Speed [RPM]
  32. TopDriveRpmGauge = 30.d0
  33. TD_RPMUnityOutput = TopDriveRpmGauge
  34. TDS%SoundRPM = 30
  35. !Call SetSound( TDS%SoundRPM )
  36. TDS%Torque = 0.d0 ![ft.lbf]
  37. TopDriveTorqueGauge = 0.d0
  38. TDS_OldPowerMode = -1
  39. else if ( TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE
  40. TopDriveOperationFaultLed = 0
  41. TDS%Speed = 0.d0 !Speed [RPM]
  42. TopDriveRpmGauge = TDS%Speed
  43. TD_RPMUnityOutput = TopDriveRpmGauge
  44. TDS%SoundRPM = 0
  45. !Call SetSound( TDS%SoundRPM )
  46. TDS%Torque = 0.d0 ![ft.lbf]
  47. TopDriveTorqueGauge = 1000.d0
  48. TDS_OldPowerMode = -1
  49. else if ( TopDriveDrillTorqueState==1 ) then ! TdsMu_Torque
  50. if ( RpmKnob>0. ) then
  51. TopDriveOperationFaultLed = 1
  52. TDS%Speed = 0.d0 !Speed [RPM]
  53. TopDriveRpmGauge = TDS%Speed
  54. TD_RPMUnityOutput = TopDriveRpmGauge
  55. TDS%SoundRPM = 0
  56. !Call SetSound( TDS%SoundRPM )
  57. TDS%Torque = 0.d0 ![ft.lbf]
  58. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  59. TDS_OldPowerMode = -1
  60. else
  61. TopDriveOperationFaultLed = 0
  62. if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
  63. TDS%Speed = 0.d0 !Speed [RPM]
  64. TopDriveRpmGauge = TDS%Speed
  65. TD_RPMUnityOutput = TopDriveRpmGauge
  66. TDS%SoundRPM = 0
  67. !Call SetSound( TDS%SoundRPM )
  68. TDS%Torque = 0.d0 ![ft.lbf]
  69. TopDriveTorqueGauge = max( 1000.d0,((TopDriveTorqueLimitKnob/10.d0)*60000.d0) ) ![ft.lbf] ????
  70. TDS_OldPowerMode = -1
  71. else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
  72. TDS%Speed = 0.d0 !Speed [RPM]
  73. TopDriveRpmGauge = TDS%Speed
  74. TD_RPMUnityOutput = TopDriveRpmGauge
  75. TDS%SoundRPM = 0
  76. !Call SetSound( TDS%SoundRPM )
  77. TDS%Torque = 0.d0 ![ft.lbf]
  78. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  79. TDS_OldPowerMode = -1
  80. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
  81. TDS%Speed = 0.d0 !Speed [RPM]
  82. TopDriveRpmGauge = TDS%Speed
  83. TD_RPMUnityOutput = TopDriveRpmGauge
  84. TDS%SoundRPM = 0
  85. !Call SetSound( TDS%SoundRPM )
  86. TDS%Torque = 0.d0 ![ft.lbf]
  87. TopDriveTorqueGauge = 1000.d0 ![ft.lbf]
  88. TDS_OldPowerMode = -1
  89. end if
  90. end if
  91. else if ( TopDriveDrillTorqueState==-1 ) then ! TdsMu_DRILL
  92. if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
  93. TopDriveOperationFaultLed = 0
  94. TDS%Speed = (30.d0*TDS%w_new/pi)/TDS%Conv_Ratio !Speed [RPM]
  95. TopDriveRpmGauge = TDS%Speed
  96. TD_RPMUnityOutput = TopDriveRpmGauge
  97. TDS%SoundRPM = INT(TDS%Speed)
  98. !Call SetSound( TDS%SoundRPM )
  99. TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((TDS%w_new/TDS%Conv_Ratio)-TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf]
  100. TopDriveTorqueGauge= TDS%Torque
  101. TDS_OldPowerMode = -1
  102. else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
  103. TopDriveOperationFaultLed = 0
  104. TDS%Speed = 0.0d0
  105. TopDriveRpmGauge = ((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) !Speed [RPM]
  106. TD_RPMUnityOutput = TopDriveRpmGauge
  107. TDS%SoundRPM = INT((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio)
  108. !Call SetSound( TDS%SoundRPM )
  109. TDS%Torque = 0.0d0
  110. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  111. TDS_OldPowerMode = -1
  112. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
  113. if ( RpmKnob>0. ) then
  114. TopDriveOperationFaultLed = 1
  115. TDS%Speed = 0.d0 !Speed [RPM]
  116. TopDriveRpmGauge = TDS%Speed
  117. TD_RPMUnityOutput = TopDriveRpmGauge
  118. TDS%SoundRPM = 0
  119. !Call SetSound( TDS%SoundRPM )
  120. TDS%Torque = 0.d0 ![ft.lbf]
  121. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  122. TDS_OldPowerMode = -1
  123. else
  124. TopDriveOperationFaultLed = 0
  125. TDS%Speed = 0.d0 !Speed [RPM]
  126. TopDriveRpmGauge = TDS%Speed
  127. TD_RPMUnityOutput = TopDriveRpmGauge
  128. TDS%SoundRPM = 0
  129. !Call SetSound( TDS%SoundRPM )
  130. TDS%Torque = 0.d0 ![ft.lbf]
  131. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  132. TDS_OldPowerMode = -1
  133. end if
  134. end if
  135. else
  136. TopDriveOperationFaultLed = 0
  137. TDS%Speed = 0.d0 !Speed [RPM]
  138. TopDriveRpmGauge = TDS%Speed
  139. TD_RPMUnityOutput = TopDriveRpmGauge
  140. TDS%SoundRPM = 0
  141. !Call SetSound( TDS%SoundRPM )
  142. TDS%Torque = 0.d0 ![ft.lbf]
  143. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  144. TDS_OldPowerMode = -1
  145. end if
  146. else if ( TopDriveTdsPowerState==1 .or. TDS_OldPowerMode==1 ) then !REV
  147. if ( TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE
  148. TopDriveOperationFaultLed = 0
  149. TDS%Speed = 0.d0 !Speed [RPM]
  150. TopDriveRpmGauge = 30.d0
  151. TD_RPMUnityOutput = -TopDriveRpmGauge
  152. TDS%SoundRPM = 30
  153. !Call SetSound( TDS%SoundRPM )
  154. TDS%Torque = 0.d0 ![ft.lbf]
  155. TopDriveTorqueGauge = 0.d0
  156. TDS_OldPowerMode = 1
  157. else if ( TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE
  158. TopDriveOperationFaultLed = 0
  159. TDS%Speed = 0.d0 !Speed [RPM]
  160. TopDriveRpmGauge = 30.d0
  161. TD_RPMUnityOutput = -TopDriveRpmGauge
  162. TDS%SoundRPM = 0
  163. !Call SetSound( TDS%SoundRPM )
  164. TDS%Torque = 0.d0 ![ft.lbf]
  165. TopDriveTorqueGauge = 1000.d0
  166. TDS_OldPowerMode = 1
  167. else if ( TopDriveDrillTorqueState==1 ) then ! TdsMu_Torque
  168. if ( RpmKnob>0. ) then
  169. TopDriveOperationFaultLed = 1
  170. TDS%Speed = 0.d0 !Speed [RPM]
  171. TopDriveRpmGauge = TDS%Speed
  172. TD_RPMUnityOutput = -TopDriveRpmGauge
  173. TDS%SoundRPM = 0
  174. !Call SetSound( TDS%SoundRPM )
  175. TDS%Torque = 0.d0 ![ft.lbf]
  176. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  177. TDS_OldPowerMode = 1
  178. else
  179. TopDriveOperationFaultLed = 0
  180. if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
  181. TDS%Speed = 0.d0 !Speed [RPM]
  182. TopDriveRpmGauge = TDS%Speed
  183. TD_RPMUnityOutput = -TopDriveRpmGauge
  184. TDS%SoundRPM = 0
  185. !Call SetSound( TDS%SoundRPM )
  186. TDS%Torque = 0.d0 ![ft.lbf]
  187. TopDriveTorqueGauge = 2000.d0
  188. TDS_OldPowerMode = 1
  189. else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
  190. TDS%Speed = 0.d0 !Speed [RPM]
  191. TopDriveRpmGauge = TDS%Speed
  192. TD_RPMUnityOutput = -TopDriveRpmGauge
  193. TDS%SoundRPM = 0
  194. !Call SetSound( TDS%SoundRPM )
  195. TDS%Torque = 0.d0 ![ft.lbf]
  196. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  197. TDS_OldPowerMode = 1
  198. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
  199. TDS%Speed = 0.d0 !Speed [RPM]
  200. TopDriveRpmGauge = TDS%Speed
  201. TD_RPMUnityOutput = TopDriveRpmGauge
  202. TDS%SoundRPM = 0
  203. !Call SetSound( TDS%SoundRPM )
  204. TDS%Torque = 0.d0 ![ft.lbf]
  205. TopDriveTorqueGauge = 1000.d0 ![ft.lbf]
  206. TDS_OldPowerMode = -1
  207. end if
  208. end if
  209. else if ( TopDriveDrillTorqueState==-1 ) then ! TdsMu_DRILL
  210. if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
  211. TopDriveOperationFaultLed = 0
  212. TDS%Speed = (30.d0*TDS%w_new/pi)/TDS%Conv_Ratio !Speed [RPM]
  213. TopDriveRpmGauge = TDS%Speed
  214. TD_RPMUnityOutput = -TopDriveRpmGauge
  215. TDS%SoundRPM = INT(TDS%Speed)
  216. !Call SetSound( TDS%SoundRPM )
  217. TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((TDS%w_new/TDS%Conv_Ratio)-TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf]
  218. TopDriveTorqueGauge= TDS%Torque
  219. TDS_OldPowerMode = 1
  220. else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then
  221. TopDriveOperationFaultLed = 0
  222. TDS%Speed = 0.0d0
  223. TopDriveRpmGauge = ((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) !Speed [RPM]
  224. TD_RPMUnityOutput = -TopDriveRpmGauge
  225. TDS%SoundRPM = INT((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio)
  226. !Call SetSound( TDS%SoundRPM )
  227. TDS%Torque = 0.0d0
  228. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  229. TDS_OldPowerMode = 1
  230. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
  231. if ( RpmKnob>0. ) then
  232. TopDriveOperationFaultLed = 1
  233. TDS%Speed = 0.d0 !Speed [RPM]
  234. TopDriveRpmGauge = TDS%Speed
  235. TD_RPMUnityOutput = -TopDriveRpmGauge
  236. TDS%SoundRPM = 0
  237. !Call SetSound( TDS%SoundRPM )
  238. TDS%Torque = 0.d0 ![ft.lbf]
  239. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  240. TDS_OldPowerMode = 1
  241. else
  242. TopDriveOperationFaultLed = 0
  243. TDS%Speed = 0.d0 !Speed [RPM]
  244. TopDriveRpmGauge = TDS%Speed
  245. TD_RPMUnityOutput = -TopDriveRpmGauge
  246. TDS%SoundRPM = 0
  247. !Call SetSound( TDS%SoundRPM )
  248. TDS%Torque = 0.d0 ![ft.lbf]
  249. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  250. TDS_OldPowerMode = 1
  251. end if
  252. end if
  253. else
  254. TopDriveOperationFaultLed = 0
  255. TDS%Speed = 0.d0 !Speed [RPM]
  256. TopDriveRpmGauge = TDS%Speed
  257. TD_RPMUnityOutput = -TopDriveRpmGauge
  258. TDS%SoundRPM = 0
  259. !Call SetSound( TDS%SoundRPM )
  260. TDS%Torque = 0.d0 ![ft.lbf]
  261. TopDriveTorqueGauge = 0.d0 ![ft.lbf]
  262. TDS_OldPowerMode = 1
  263. end if
  264. end if
  265. !******************************************************************
  266. !!!!TDS%Output_Current = (TDS%TracTorque*TDS%w_new)/TDS%Vt !????????????
  267. !print*, 'Power_sigma=', Power_sigma
  268. !print*, 'power_num_of_Jenerators=', power_num_of_Jenerators
  269. !print*, 'drilling_num_of_Jenerators=', drilling_num_of_Jenerators
  270. !!print*, 'Jenerator_power=', Jenerator_power
  271. !print*, 'max_Power_sigma=', max_Power_sigma
  272. !print*, 'TDS%Vt=', TDS%Vt
  273. !!print*, 'TDS%w=', TDS%w_new
  274. !!!print*, 'TDS%String_Torque=', TDS%String_Torque
  275. !!print*, 'TDS%Speed=', TDS%Speed
  276. !!print*, 'TDS%Speed2=', ((30.*TDS%w_new/pi)/TDS%Conv_Ratio)
  277. !!!!!print*, 'TDS%Te=', TDS%Te
  278. !!print*, 'TDS%TL=', TDS%TL
  279. !print*, 'TDS%ia=', TDS%ia_new
  280. !print*, 'TDS%ia_ref=', TDS%ia_ref
  281. !print*, 'TDS%ia_ref_limit=', TDS%ia_ref_limit
  282. END subroutine