Simulation Core
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

204 rader
7.7 KiB

  1. module RotaryTableMain
  2. implicit none
  3. public
  4. contains
  5. ! subroutine RotaryTable_Setup()
  6. ! use CSimulationVariables
  7. ! implicit none
  8. ! call OnSimulationInitialization%Add(RotaryTable_Init)
  9. ! call OnSimulationStop%Add(RotaryTable_Init)
  10. ! call OnRotaryTableStep%Add(RotaryTable_Step)
  11. ! call OnRotaryTableOutput%Add(RotaryTable_Output)
  12. ! call OnRotaryTableMain%Add(RotaryTableMainBody)
  13. ! end subroutine
  14. subroutine RotaryTable_Init
  15. implicit none
  16. end subroutine RotaryTable_Init
  17. subroutine RotaryTable_Step
  18. implicit none
  19. end subroutine RotaryTable_Step
  20. subroutine RotaryTable_Output
  21. implicit none
  22. end subroutine RotaryTable_Output
  23. subroutine RotaryTableMainBody
  24. use CDataDisplayConsoleVariables
  25. use CDrillingConsoleVariables
  26. use CSimulationVariables
  27. use RTable_VARIABLES
  28. use CDrillWatchVariables
  29. use CWarningsVariables
  30. use CSounds
  31. implicit none
  32. integer,dimension(8) :: RT_START_TIME, RT_END_TIME
  33. INTEGER :: RT_SolDuration
  34. Call RTable_StartUp
  35. loopRtablestart : do
  36. call sleepqq(10)
  37. if (IsPortable) then
  38. RTable%AssignmentSwitch = 1
  39. else
  40. RTable%AssignmentSwitch = AssignmentSwitch
  41. end if
  42. if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTSwitch == -1) ) then
  43. RTable%SoundBlower = .true.
  44. Call SetSoundBlowerRT(RTable%SoundBlower)
  45. RTBLWR = 1
  46. loopRtableswitch: do
  47. CALL DATE_AND_TIME(values=RT_START_TIME)
  48. IF ( RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ??????
  49. RTable%N_new = RTThrottle
  50. !===> Rotary Table Malfunction ----> Drive Motor Failure
  51. call RTMalfunction_MotorFailure
  52. if (((RTable%N_new-RTable%N_old)/RTable%time_step)>193.) then
  53. RTable%N_ref = (193.*RTable%time_step)+RTable%N_old
  54. else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>193.) then
  55. RTable%N_ref = (-193.*RTable%time_step)+RTable%N_old
  56. else
  57. RTable%N_ref = RTable%N_new
  58. end if
  59. CALL RTable_INPUTS
  60. CALL RTable_Solver
  61. RT_RPMUnityOutput = RotaryRPMGauge
  62. RTable%N_old = RTable%N_ref
  63. Else IF ( RTTransmissionLever==0) THEN !be in brake mode ??????
  64. Call RTable_OffMode
  65. RT_RPMUnityOutput = RotaryRPMGauge
  66. End IF
  67. RT_OldTransMode = RTTransmissionLever
  68. CALL DATE_AND_TIME(values=RT_END_TIME)
  69. RT_SolDuration = 100-(RT_END_TIME(5)*3600000+RT_END_TIME(6)*60000+RT_END_TIME(7)*1000+RT_END_TIME(8)-RT_START_TIME(5)*3600000-RT_START_TIME(6)*60000-RT_START_TIME(7)*1000-RT_START_TIME(8))
  70. !print*, 'RTtime=', RT_SolDuration
  71. if(RT_SolDuration > 0.0) then
  72. CALL sleepqq(RT_SolDuration)
  73. end if
  74. if (IsPortable) then
  75. RTable%AssignmentSwitch = 1
  76. else
  77. RTable%AssignmentSwitch = AssignmentSwitch
  78. end if
  79. if ((any(RTable%AssignmentSwitch==(/6,7,12/))) .or. (RTSwitch/=-1) .or. (IsStopped == .true.)) then
  80. RTable%SoundBlower = .false.
  81. Call SetSoundBlowerRT(RTable%SoundBlower)
  82. RTBLWR = 0
  83. Call RTable_OffMode
  84. RT_RPMUnityOutput = RotaryRPMGauge
  85. exit loopRtableswitch
  86. end if
  87. end do loopRtableswitch
  88. else if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTSwitch == 1) .and. (RTThrottle==0.) ) then
  89. RTable%SoundBlower = .true.
  90. Call SetSoundBlowerRT(RTable%SoundBlower)
  91. RTBLWR = 1
  92. loopRtableswitchREV: do
  93. CALL DATE_AND_TIME(values=RT_START_TIME)
  94. IF ( RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ??????
  95. RTable%N_new = RTThrottle
  96. !===> Rotary Table Malfunction ----> Drive Motor Failure
  97. call RTMalfunction_MotorFailure
  98. if (((RTable%N_new-RTable%N_old)/RTable%time_step)>193.) then
  99. RTable%N_ref = (193.*RTable%time_step)+RTable%N_old
  100. else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>193.) then
  101. RTable%N_ref = (-193.*RTable%time_step)+RTable%N_old
  102. else
  103. RTable%N_ref = RTable%N_new
  104. end if
  105. CALL RTable_INPUTS
  106. CALL RTable_Solver
  107. RT_RPMUnityOutput = -RotaryRPMGauge
  108. RTable%N_old = RTable%N_ref
  109. Else IF ( RTTransmissionLever==0) THEN !be in brake mode ??????
  110. Call RTable_OffMode
  111. RT_RPMUnityOutput = -RotaryRPMGauge
  112. End IF
  113. RT_OldTransMode = RTTransmissionLever
  114. CALL DATE_AND_TIME(values=RT_END_TIME)
  115. RT_SolDuration = 100-(RT_END_TIME(5)*3600000+RT_END_TIME(6)*60000+RT_END_TIME(7)*1000+RT_END_TIME(8)-RT_START_TIME(5)*3600000-RT_START_TIME(6)*60000-RT_START_TIME(7)*1000-RT_START_TIME(8))
  116. !print*, 'RTtime=', RT_SolDuration
  117. if(RT_SolDuration > 0.0) then
  118. CALL sleepqq(RT_SolDuration)
  119. end if
  120. if (IsPortable) then
  121. RTable%AssignmentSwitch = 1
  122. else
  123. RTable%AssignmentSwitch = AssignmentSwitch
  124. end if
  125. if ((any(RTable%AssignmentSwitch==(/6,7,12/))) .or. (RTSwitch/=1) .or. (IsStopped == .true.)) then
  126. RTable%SoundBlower = .false.
  127. Call SetSoundBlowerRT(RTable%SoundBlower)
  128. RTBLWR = 0
  129. Call RTable_OffMode
  130. RT_RPMUnityOutput = -RotaryRPMGauge
  131. exit loopRtableswitchREV
  132. end if
  133. end do loopRtableswitchREV
  134. else
  135. if (IsPortable) then
  136. RTable%AssignmentSwitch = 1
  137. else
  138. RTable%AssignmentSwitch = AssignmentSwitch
  139. end if
  140. if((any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTSwitch /= 0)) then
  141. RTable%SoundBlower = .true.
  142. Call SetSoundBlowerRT(RTable%SoundBlower)
  143. RTBLWR = 1
  144. else
  145. RTable%SoundBlower = .false.
  146. Call SetSoundBlowerRT(RTable%SoundBlower)
  147. RTBLWR = 0
  148. end if
  149. Call RTable_OffMode
  150. RT_RPMUnityOutput = RotaryRPMGauge
  151. !exit loopRtableswitch
  152. RT_OldTransMode = RTTransmissionLever
  153. end if
  154. if (IsStopped == .true.) then
  155. exit loopRtablestart
  156. end if
  157. end do loopRtablestart
  158. end subroutine RotaryTableMainBody
  159. end module RotaryTableMain