Simulation Core
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

248 linhas
7.8 KiB

  1. module PumpsMain
  2. use CPumpsVariables
  3. use CDrillingConsoleVariables
  4. use CDataDisplayConsoleVariables
  5. use CSimulationVariables
  6. use Pump_VARIABLES
  7. use CSounds
  8. implicit none
  9. public
  10. contains
  11. ! ****************************************
  12. ! ***** subroutine Pump1MainBody *****
  13. ! ****************************
  14. subroutine Pump1_Setup()
  15. use CSimulationVariables
  16. implicit none
  17. call OnSimulationInitialization%Add(Pump1_Init)
  18. call OnSimulationStop%Add(Pump1_Init)
  19. call OnPump1Step%Add(Pump1_Step)
  20. call OnPump1Output%Add(Pump1_Output)
  21. call OnPump1Main%Add(Pump1MainBody)
  22. end subroutine
  23. subroutine Pump1_Init
  24. Call Pump_StartUp
  25. end subroutine Pump1_Init
  26. subroutine Pump1_Step
  27. Call Pump1_MainSolver
  28. end subroutine Pump1_Step
  29. subroutine Pump1_Output
  30. implicit none
  31. end subroutine Pump1_Output
  32. subroutine Pump1MainBody
  33. use ifport
  34. use ifmt
  35. !use Pump1_MainSolver
  36. use CWarningsVariables
  37. !use equipments_PowerLimit
  38. implicit none
  39. integer,dimension(8) :: MP_START_TIME, MP_END_TIME
  40. INTEGER :: MP_SolDuration
  41. loop1 : do
  42. Call DATE_AND_TIME(values=MP_START_TIME)
  43. Call Pump1_MainSolver
  44. Call DATE_AND_TIME(values=MP_END_TIME)
  45. MP_SolDuration = 100-(MP_END_TIME(5)*3600000+MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(5)*3600000-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8))
  46. if(MP_SolDuration > 0.0) then
  47. Call sleepqq(MP_SolDuration)
  48. end if
  49. if (IsStopped == .true.) then
  50. exit loop1
  51. end if
  52. end do loop1
  53. end subroutine Pump1MainBody
  54. ! ****************************************
  55. ! ***** subroutine Pump2MainBody *****
  56. ! ****************************
  57. subroutine Pump2_Setup()
  58. use CSimulationVariables
  59. implicit none
  60. call OnSimulationInitialization%Add(Pump2_Init)
  61. call OnSimulationStop%Add(Pump2_Init)
  62. call OnPump2Step%Add(Pump2_Step)
  63. call OnPump2Output%Add(Pump2_Output)
  64. call OnPump2Main%Add(Pump2MainBody)
  65. end subroutine
  66. subroutine Pump2_Init
  67. implicit none
  68. end subroutine Pump2_Init
  69. subroutine Pump2_Step
  70. call Pump2_MainSolver
  71. end subroutine Pump2_Step
  72. subroutine Pump2_Output
  73. implicit none
  74. end subroutine Pump2_Output
  75. subroutine Pump2MainBody
  76. use ifport
  77. use ifmt
  78. use CWarningsVariables
  79. implicit none
  80. integer,dimension(8) :: MP_START_TIME, MP_END_TIME
  81. INTEGER :: MP_SolDuration
  82. Call Pump_StartUp
  83. loop1 : do
  84. Call DATE_AND_TIME(values=MP_START_TIME)
  85. Call Pump2_MainSolver
  86. Call DATE_AND_TIME(values=MP_END_TIME)
  87. MP_SolDuration = 100-(MP_END_TIME(5)*3600000+MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(5)*3600000-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8))
  88. if(MP_SolDuration > 0.0) then
  89. Call sleepqq(MP_SolDuration)
  90. end if
  91. if (IsStopped == .true.) then
  92. exit loop1
  93. end if
  94. end do loop1
  95. end subroutine Pump2MainBody
  96. ! ****************************************
  97. ! ***** subroutine Pump3MainBody *****
  98. ! ****************************
  99. subroutine Pump3_Setup()
  100. use CSimulationVariables
  101. implicit none
  102. call OnSimulationInitialization%Add(Pump3_Init)
  103. call OnSimulationStop%Add(Pump3_Init)
  104. call OnPump3Step%Add(Pump3_Step)
  105. call OnPump3Output%Add(Pump3_Output)
  106. call OnPump3Main%Add(Pump3MainBody)
  107. end subroutine
  108. subroutine Pump3_Init
  109. implicit none
  110. end subroutine Pump3_Init
  111. subroutine Pump3_Step
  112. implicit none
  113. end subroutine Pump3_Step
  114. subroutine Pump3_Output
  115. implicit none
  116. end subroutine Pump3_Output
  117. subroutine Pump3MainBody
  118. use ifport
  119. use ifmt
  120. implicit none
  121. integer,dimension(8) :: MP_START_TIME, MP_END_TIME
  122. INTEGER :: MP_SolDuration
  123. !Call Pump_StartUp
  124. !loop1 : do
  125. !
  126. ! Call sleepqq(10)
  127. !
  128. ! !!! Pump3 Malfunction ----> Power Failure
  129. ! !!if (PUMP(1)%PowerFailMalf==1) then
  130. ! !! !MP1BLWR=0
  131. ! !! Call Pump3_OffMode_Solver
  132. ! !! Call ClosePump1()
  133. ! !!end if
  134. !
  135. ! !if( (MP1CPSwitch==1) .and. (MP1Throttle==0.) .and. (PUMP(3)%PowerFailMalf==0) ) then
  136. !!
  137. !! loop2: do
  138. !!
  139. !! Call DATE_AND_TIME(values=MP_START_TIME)
  140. !!
  141. !!!! ! Pump3 Malfunction ----> Power Failure
  142. !!!! if (PUMP(1)%PowerFailMalf==1) then
  143. !!!! !MP1BLWR=0
  144. !!!! Pump3_OffMode_Solver
  145. !!!! Call ClosePump1()
  146. !!!! exit loop2
  147. !!!! end if
  148. !!
  149. !! PUMP(3)%N_new = MP1Throttle
  150. !! if (((PUMP(3)%N_new-PUMP(3)%N_old)/PUMP(3)%time_step)>193.) then
  151. !! PUMP(3)%N_ref =(193.*PUMP(3)%time_step)+PUMP(3)%N_old
  152. !! else if (((PUMP(3)%N_old-PUMP(3)%N_new)/PUMP(3)%time_step)>193.) then
  153. !! PUMP(3)%N_ref = (-193.*PUMP(3)%time_step)+PUMP(3)%N_old
  154. !! else
  155. !! PUMP(3)%N_ref = PUMP(3)%N_new
  156. !! end if
  157. !!
  158. !! Call Pump3_OnMode_Solver
  159. !!
  160. !! IF (PUMP(3)%Flow_Rate>0.) Then
  161. !! Call OpenCementPump()
  162. !! Else
  163. !! Call CloseCementPump()
  164. !! End if
  165. !!
  166. !! PUMP(3)%N_old = PUMP(3)%N_ref
  167. !!
  168. !! Call DATE_AND_TIME(values=MP_END_TIME)
  169. !! MP_SolDuration = 100-(MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8))
  170. !! !print*, 'MPtime=', MP_SolDuration
  171. !! if(MP_SolDuration > 0.0) then
  172. !! Call sleepqq(MP_SolDuration)
  173. !! end if
  174. !!
  175. !! if ((MP1CPSwitch==0) .or. (IsStopped == .true.)) then
  176. !! Call Pump3_OffMode_Solver
  177. !! Call CloseCementPump()
  178. !! exit loop2
  179. !! end if
  180. !! end do loop2
  181. !
  182. ! else
  183. !
  184. ! !Call Pump3_OffMode_Solver
  185. ! !Call CloseCementPump()
  186. !
  187. ! end if
  188. !
  189. ! if (IsStopped == .true.) then
  190. ! exit loop1
  191. ! end if
  192. !
  193. !end do loop1
  194. end subroutine Pump3MainBody
  195. end module PumpsMain