Simulation Core
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

179 satır
6.3 KiB

  1. module TopDriveMain
  2. use CLog4
  3. implicit none
  4. public
  5. contains
  6. subroutine TopDrive_Setup()
  7. use CSimulationVariables
  8. implicit none
  9. call OnSimulationStop%Add(TopDrive_Stop)
  10. call OnTopDriveStart%Add(TopDrive_Start)
  11. call OnTopDriveStep%Add(TopDrive_Step)
  12. call OnTopDriveMain%Add(TopDriveMainBody)
  13. end subroutine
  14. subroutine TopDrive_Stop
  15. implicit none
  16. call Log_4('TopDrive_Stop')
  17. end subroutine TopDrive_Stop
  18. subroutine TopDrive_Start
  19. implicit none
  20. call Log_4('TopDrive_Start')
  21. end subroutine TopDrive_Start
  22. subroutine TopDrive_Step
  23. implicit none
  24. call Log_4('TopDrive_Step')
  25. end subroutine TopDrive_Step
  26. subroutine TopDriveMainBody
  27. !use CDataDisplayConsoleVariables
  28. !use CDrillingConsoleVariables
  29. use CSimulationVariables
  30. use TopDrive_VARIABLES
  31. use CDrillWatchVariables
  32. use CWarningsVariables
  33. use CSounds
  34. use CTopDrivePanelVariables
  35. implicit none
  36. integer,dimension(8) :: TDS_START_TIME, TDS_END_TIME
  37. INTEGER :: TDS_SolDuration
  38. call Log_4('TopDriveMainBody')
  39. Call TopDrive_StartUp
  40. loopTopDrivestart : do
  41. call sleepqq(10)
  42. !if ( (TopDriveTdsPowerState==-1) .and. (RpmKnob==0.) ) then !FWD
  43. if ( (TopDriveTdsPowerState==-1) ) then !FWD
  44. TDS%SoundBlower = .true.
  45. !Call SetSoundBlowerRT(TDS%SoundBlower)
  46. TopDriveTdsPowerLed = 1
  47. loopTopDriveswitchFWD: do
  48. CALL DATE_AND_TIME(values=TDS_START_TIME)
  49. !IF ( RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ????
  50. TDS%N_new = (RpmKnob/250.d0)*965.d0 ! 0<RpmKnob<250 , 0<TDS%N_ref(truction motor)<965
  51. !print*, 'TDSN=', RpmKnob , TDS%N_new
  52. !===> Top Drive Malfunction ----> Drive Motor Failure
  53. call TopDrive_Malfunction_MotorFailure
  54. if (((TDS%N_new-TDS%N_old)/TDS%time_step)>193.) then
  55. TDS%N_ref = (193.*TDS%time_step)+TDS%N_old
  56. else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>193.) then
  57. TDS%N_ref = (-193.*TDS%time_step)+TDS%N_old
  58. else
  59. TDS%N_ref = TDS%N_new
  60. end if
  61. CALL TopDrive_INPUTS
  62. CALL TopDrive_Solver
  63. TDS%N_old = TDS%N_ref
  64. if ( (TopDriveTdsPowerState/=-1) .or. (IsStopped == .true.) ) then
  65. TDS%SoundBlower = .false.
  66. !Call SetSoundBlowerRT(TDS%SoundBlower)
  67. TopDriveTdsPowerLed = 0
  68. Call TopDrive_OffMode
  69. exit loopTopDriveswitchFWD
  70. end if
  71. CALL DATE_AND_TIME(values=TDS_END_TIME)
  72. TDS_SolDuration = 100-(TDS_END_TIME(5)*3600000+TDS_END_TIME(6)*60000+TDS_END_TIME(7)*1000+TDS_END_TIME(8)-TDS_START_TIME(5)*3600000-TDS_START_TIME(6)*60000-TDS_START_TIME(7)*1000-TDS_START_TIME(8))
  73. !print*, 'TDStime=', TDS_SolDuration
  74. if(TDS_SolDuration > 0.0) then
  75. CALL sleepqq(TDS_SolDuration)
  76. end if
  77. end do loopTopDriveswitchFWD
  78. !else if ( (TopDriveTdsPowerState==1) .and. (RpmKnob==0.) ) then !REV
  79. else if ( (TopDriveTdsPowerState==1) ) then !REV
  80. TDS%SoundBlower = .true.
  81. !Call SetSoundBlowerRT(TDS%SoundBlower)
  82. TopDriveTdsPowerLed = 1
  83. loopTopDriveswitchREV: do
  84. CALL DATE_AND_TIME(values=TDS_START_TIME)
  85. TDS%N_new = (RpmKnob/250.d0)*965.d0
  86. !===> Top Drive Malfunction ----> Drive Motor Failure
  87. call TopDrive_Malfunction_MotorFailure
  88. if (((TDS%N_new-TDS%N_old)/TDS%time_step)>193.) then
  89. TDS%N_ref = (193.*TDS%time_step)+TDS%N_old
  90. else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>193.) then
  91. TDS%N_ref = (-193.*TDS%time_step)+TDS%N_old
  92. else
  93. TDS%N_ref = TDS%N_new
  94. end if
  95. CALL TopDrive_INPUTS
  96. CALL TopDrive_Solver
  97. TDS%N_old = TDS%N_ref
  98. if ( (TopDriveTdsPowerState/=1) .or. (IsStopped == .true.) ) then
  99. TDS%SoundBlower = .false.
  100. !Call SetSoundBlowerRT(TDS%SoundBlower)
  101. TopDriveTdsPowerLed = 0
  102. Call TopDrive_OffMode
  103. exit loopTopDriveswitchREV
  104. end if
  105. CALL DATE_AND_TIME(values=TDS_END_TIME)
  106. TDS_SolDuration = 100-(TDS_END_TIME(5)*3600000+TDS_END_TIME(6)*60000+TDS_END_TIME(7)*1000+TDS_END_TIME(8)-TDS_START_TIME(5)*3600000-TDS_START_TIME(6)*60000-TDS_START_TIME(7)*1000-TDS_START_TIME(8))
  107. !print*, 'TDStime=', TDS_SolDuration
  108. if(TDS_SolDuration > 0.0) then
  109. CALL sleepqq(TDS_SolDuration)
  110. end if
  111. end do loopTopDriveswitchREV
  112. else
  113. if( TopDriveTdsPowerState /= 0 ) then
  114. TDS%SoundBlower = .true.
  115. !Call SetSoundBlowerRT(TDS%SoundBlower)
  116. TopDriveTdsPowerLed = 1
  117. else
  118. TDS%SoundBlower = .false.
  119. !Call SetSoundBlowerRT(TDS%SoundBlower)
  120. TopDriveTdsPowerLed = 0
  121. end if
  122. Call TopDrive_OffMode
  123. !exit loopTopDriveswitchFWD
  124. end if
  125. if (IsStopped == .true.) then
  126. exit loopTopDrivestart
  127. end if
  128. end do loopTopDrivestart
  129. end subroutine TopDriveMainBody
  130. end module TopDriveMain