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.
 
 
 
 
 
 

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