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.

CPumps.i90 13 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # 1 "/home/admin/SimulationCore2/CSharp/BasicInputs/RigSpecifications/CPumps.f90"
  2. module CPumps
  3. use SimulationVariables
  4. use json_module
  5. implicit none
  6. public
  7. contains
  8. ! subroutine PumpsToJson(parent)
  9. ! type(json_value),pointer :: parent
  10. ! type(json_core) :: json
  11. ! type(json_value),pointer :: p
  12. ! ! 1. create new node
  13. ! call json%create_object(p,'Pumps')
  14. ! ! 2. add member of data type to new node
  15. ! ! call StringConfigurationToJson(p)
  16. ! ! call FormationToJson(p)
  17. ! call json%add(p,"MudPump1LinerDiameter",data%Configuration%Pumps%MudPump1LinerDiameter)
  18. ! call json%add(p,"MudPump1Stroke",data%Configuration%Pumps%MudPump1Stroke)
  19. ! call json%add(p,"MudPump1MechanicalEfficiency",data%Configuration%Pumps%MudPump1MechanicalEfficiency)
  20. ! call json%add(p,"MudPump1VolumetricEfficiency",data%Configuration%Pumps%MudPump1VolumetricEfficiency)
  21. ! call json%add(p,"MudPump1Output",data%Configuration%Pumps%MudPump1Output)
  22. ! call json%add(p,"MudPump1OutputBblStroke",data%Configuration%Pumps%MudPump1OutputBblStroke)
  23. ! call json%add(p,"MudPump1Maximum",data%Configuration%Pumps%MudPump1Maximum)
  24. ! call json%add(p,"MudPump1ReliefValvePressure",data%Configuration%Pumps%MudPump1ReliefValvePressure)
  25. ! call json%add(p,"MudPump2LinerDiameter",data%Configuration%Pumps%MudPump2LinerDiameter)
  26. ! call json%add(p,"MudPump2Stroke",data%Configuration%Pumps%MudPump2Stroke)
  27. ! call json%add(p,"MudPump2MechanicalEfficiency",data%Configuration%Pumps%MudPump2MechanicalEfficiency)
  28. ! ! call json%add(p,"MudPump2VolumetricEfficiency",data%Configuration%Pumps%MudPump2VolumetricEfficiency)
  29. ! call json%add(p,"MudPump2Output",data%Configuration%Pumps%MudPump2Output)
  30. ! call json%add(p,"MudPump2OutputBblStroke",data%Configuration%Pumps%MudPump2OutputBblStroke)
  31. ! call json%add(p,"MudPump2Maximum",data%Configuration%Pumps%MudPump2Maximum)
  32. ! call json%add(p,"MudPump2ReliefValvePressure",data%Configuration%Pumps%MudPump2ReliefValvePressure)
  33. ! call json%add(p,"CementPumpLinerDiameter",data%Configuration%Pumps%CementPumpLinerDiameter)
  34. ! call json%add(p,"CementPumpStroke",data%Configuration%Pumps%CementPumpStroke)
  35. ! call json%add(p,"CementPumpMechanicalEfficiency",data%Configuration%Pumps%CementPumpMechanicalEfficiency)
  36. ! ! call json%add(p,"CementPumpVolumetricEfficiency",data%Configuration%Pumps%CementPumpVolumetricEfficiency)
  37. ! call json%add(p,"CementPumpOutput",data%Configuration%Pumps%CementPumpOutput)
  38. ! call json%add(p,"CementPumpOutputBblStroke",data%Configuration%Pumps%CementPumpOutputBblStroke)
  39. ! call json%add(p,"CementPumpMaximum",data%Configuration%Pumps%CementPumpMaximum)
  40. ! call json%add(p,"CementPumpReliefValvePressure ",data%Configuration%Pumps%CementPumpReliefValvePressure )
  41. ! call json%add(p,"MudPump1ReliefValveIsSet",data%Configuration%Pumps%MudPump1ReliefValveIsSet)
  42. ! call json%add(p,"MudPump2ReliefValveIsSet",data%Configuration%Pumps%MudPump2ReliefValveIsSet)
  43. ! call json%add(p,"CementPumpReliefValveIsSet",data%Configuration%Pumps%CementPumpReliefValveIsSet)
  44. ! ! call json%add(p,"ManualPumpPower",data%Configuration%Pumps%ManualPumpPower)
  45. ! ! call json%add(p,"Valve1",data%Configuration%Pumps%Valve1)
  46. ! ! call json%add(p,"Valve2",data%Configuration%Pumps%Valve2)
  47. ! ! call json%add(p,"Valve3",data%Configuration%Pumps%Valve3)
  48. ! ! call json%add(p,"Valve4",data%Configuration%Pumps%Valve4)
  49. ! ! call json%add(p,"Valve5",data%Configuration%Pumps%Valve5)
  50. ! ! 3. add new node to parent
  51. ! call json%add(parent,p)
  52. ! end subroutine
  53. subroutine PumpsFromJson(parent)
  54. use json_module,IK =>json_ik
  55. type(json_value),pointer :: parent
  56. type(json_core) :: json
  57. type(json_value),pointer :: p,pitems,pitem,pval,pbit
  58. call json%get(parent,'Pumps',p)
  59. call json%get(p,"MudPump1LinerDiameter",pitem)
  60. call json%get(pitem,data%Configuration%Pumps%MudPump1LinerDiameter)
  61. call json%get(p,"MudPump1Stroke",pitem)
  62. call json%get(pitem,data%Configuration%Pumps%MudPump1Stroke)
  63. call json%get(p,"MudPump1MechanicalEfficiency",pitem)
  64. call json%get(pitem,data%Configuration%Pumps%MudPump1MechanicalEfficiency)
  65. ! call json%get(p,"MudPump1VolumetricEfficiency",pitem)
  66. ! call json%get(pitem,data%Configuration%Pumps%MudPump1VolumetricEfficiency)
  67. call json%get(p,"MudPump1Output",pitem)
  68. call json%get(pitem,data%Configuration%Pumps%MudPump1Output)
  69. call json%get(p,"MudPump1OutputBblStroke",pitem)
  70. call json%get(pitem,data%Configuration%Pumps%MudPump1OutputBblStroke)
  71. call json%get(p,"MudPump1Maximum",pitem)
  72. call json%get(pitem,data%Configuration%Pumps%MudPump1Maximum)
  73. call json%get(p,"MudPump1ReliefValvePressure",pitem)
  74. call json%get(pitem,data%Configuration%Pumps%MudPump1ReliefValvePressure)
  75. call json%get(p,"MudPump2LinerDiameter",pitem)
  76. call json%get(pitem,data%Configuration%Pumps%MudPump2LinerDiameter)
  77. call json%get(p,"MudPump2Stroke",pitem)
  78. call json%get(pitem,data%Configuration%Pumps%MudPump2Stroke)
  79. call json%get(p,"MudPump2MechanicalEfficiency",pitem)
  80. call json%get(pitem,data%Configuration%Pumps%MudPump2MechanicalEfficiency)
  81. ! call json%get(p,"MudPump2VolumetricEfficiency",pitem)
  82. ! call json%get(pitem,data%Configuration%Pumps%MudPump2VolumetricEfficiency)
  83. call json%get(p,"MudPump2Output",pitem)
  84. call json%get(pitem,data%Configuration%Pumps%MudPump2Output)
  85. call json%get(p,"MudPump2OutputBblStroke",pitem)
  86. call json%get(pitem,data%Configuration%Pumps%MudPump2OutputBblStroke)
  87. call json%get(p,"MudPump2Maximum",pitem)
  88. call json%get(pitem,data%Configuration%Pumps%MudPump2Maximum)
  89. call json%get(p,"MudPump2ReliefValvePressure",pitem)
  90. call json%get(pitem,data%Configuration%Pumps%MudPump2ReliefValvePressure)
  91. call json%get(p,"CementPumpLinerDiameter",pitem)
  92. call json%get(pitem,data%Configuration%Pumps%CementPumpLinerDiameter)
  93. call json%get(p,"CementPumpStroke",pitem)
  94. call json%get(pitem,data%Configuration%Pumps%CementPumpStroke)
  95. call json%get(p,"CementPumpMechanicalEfficiency",pitem)
  96. call json%get(pitem,data%Configuration%Pumps%CementPumpMechanicalEfficiency)
  97. ! call json%get(p,"CementPumpVolumetricEfficiency",pitem)
  98. ! call json%get(pitem,data%Configuration%Pumps%CementPumpVolumetricEfficiency)
  99. call json%get(p,"CementPumpOutput",pitem)
  100. call json%get(pitem,data%Configuration%Pumps%CementPumpOutput)
  101. call json%get(p,"CementPumpOutputBblStroke",pitem)
  102. call json%get(pitem,data%Configuration%Pumps%CementPumpOutputBblStroke)
  103. call json%get(p,"CementPumpMaximum",pitem)
  104. call json%get(pitem,data%Configuration%Pumps%CementPumpMaximum)
  105. call json%get(p,"CementPumpReliefValvePressure",pitem)
  106. call json%get(pitem,data%Configuration%Pumps%CementPumpReliefValvePressure)
  107. call json%get(p,"MudPump1ReliefValveIsSet",pitem)
  108. call json%get(pitem,data%Configuration%Pumps%MudPump1ReliefValveIsSet)
  109. call json%get(p,"MudPump2ReliefValveIsSet",pitem)
  110. call json%get(pitem,data%Configuration%Pumps%MudPump2ReliefValveIsSet)
  111. call json%get(p,"CementPumpReliefValveIsSet",pitem)
  112. call json%get(pitem,data%Configuration%Pumps%CementPumpReliefValveIsSet)
  113. call json%get(p,"ManualPumpPower",pitem)
  114. ! call json%get(pitem,data%Configuration%Pumps%ManualPumpPower)
  115. ! call json%get(p,"Valve1",pitem)
  116. ! call json%get(pitem,data%Configuration%Pumps%Valve1)
  117. ! call json%get(p,"Valve2",pitem)
  118. ! call json%get(pitem,data%Configuration%Pumps%Valve2)
  119. ! call json%get(p,"Valve3",pitem)
  120. ! call json%get(pitem,data%Configuration%Pumps%Valve3)
  121. ! call json%get(p,"Valve4",pitem)
  122. ! call json%get(pitem,data%Configuration%Pumps%Valve4)
  123. ! call json%get(p,"Valve5",pitem)
  124. ! call json%get(pitem,data%Configuration%Pumps%Valve5)
  125. end subroutine
  126. subroutine OpenPump1()
  127. use CManifolds
  128. implicit none
  129. call ChangeValve(16, .true.)
  130. end subroutine
  131. subroutine ClosePump1()
  132. use CManifolds
  133. implicit none
  134. call ChangeValve(16, .false.)
  135. end subroutine
  136. subroutine OpenPump2()
  137. use CManifolds
  138. implicit none
  139. call ChangeValve(17, .true.)
  140. end subroutine
  141. subroutine ClosePump2()
  142. use CManifolds
  143. implicit none
  144. call ChangeValve(17, .false.)
  145. end subroutine
  146. subroutine OpenCementPump()
  147. use CManifolds
  148. implicit none
  149. call ChangeValve(18, .true.)
  150. end subroutine
  151. subroutine CloseCementPump()
  152. use CManifolds
  153. implicit none
  154. call ChangeValve(18, .false.)
  155. end subroutine
  156. ! subroutine SetMudPump1LinerDiameterN(a)
  157. ! implicit none
  158. ! real(8) :: a
  159. ! if(associated(MudPump1LinerDiameterPtr)) call MudPump1LinerDiameterPtr(a)
  160. ! end subroutine
  161. ! subroutine SetMudPump2LinerDiameterN(a)
  162. ! implicit none
  163. ! real(8) :: a
  164. ! if(associated(MudPump2LinerDiameterPtr)) call MudPump2LinerDiameterPtr(a)
  165. ! end subroutine
  166. ! subroutine SetMudPump3LinerDiameterN(a)
  167. ! implicit none
  168. ! real(8) :: a
  169. ! if(associated(MudPump3LinerDiameterPtr)) call MudPump3LinerDiameterPtr(a)
  170. ! end subroutine
  171. ! subroutine SetMudPump1OutputBblStrokeN(a)
  172. ! implicit none
  173. ! real(8) :: a
  174. ! if(associated(MudPump1OutputBblStrokePtr)) call MudPump1OutputBblStrokePtr(a)
  175. ! end subroutine
  176. ! subroutine SetMudPump2OutputBblStrokeN(a)
  177. ! implicit none
  178. ! real(8) :: a
  179. ! if(associated(MudPump2OutputBblStrokePtr)) call MudPump2OutputBblStrokePtr(a)
  180. ! end subroutine
  181. ! subroutine SetMudPump3OutputBblStrokeN(a)
  182. ! implicit none
  183. ! real(8) :: a
  184. ! if(associated(MudPump3OutputBblStrokePtr)) call MudPump3OutputBblStrokePtr(a)
  185. ! end subroutine
  186. ! subroutine CalcMudPump1LinerDiameter()
  187. ! use, intrinsic :: IEEE_ARITHMETIC
  188. ! implicit none
  189. ! real(8) :: a
  190. ! a = (MathPI / 4.d0) * data%Configuration%Pumps%MudPump1Stroke * 3.0d0 * data%Configuration%Pumps%MudPump1VolumetricEfficiency / 9702.03d0
  191. ! a = dsqrt(data%Configuration%Pumps%MudPump1OutputBblStroke / a)
  192. ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  193. ! data%Configuration%Pumps%MudPump1LinerDiameter = 0.0
  194. ! else
  195. ! data%Configuration%Pumps%MudPump1LinerDiameter = a
  196. ! endif
  197. ! call SetMudPump1LinerDiameterN(data%Configuration%Pumps%MudPump1LinerDiameter)
  198. ! end subroutine
  199. ! subroutine CalcMudPump2LinerDiameter()
  200. ! use, intrinsic :: IEEE_ARITHMETIC
  201. ! implicit none
  202. ! real(8) :: a
  203. ! a = (MathPI / 4.d0) * data%Configuration%Pumps%MudPump2Stroke * 3.0d0 * data%Configuration%Pumps%MudPump2VolumetricEfficiency / 9702.03d0
  204. ! a = dsqrt(data%Configuration%Pumps%MudPump2OutputBblStroke / a)
  205. ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  206. ! data%Configuration%Pumps%MudPump2LinerDiameter = 0.0
  207. ! else
  208. ! data%Configuration%Pumps%MudPump2LinerDiameter = a
  209. ! endif
  210. ! call SetMudPump2LinerDiameterN(data%Configuration%Pumps%MudPump2LinerDiameter)
  211. ! end subroutine
  212. ! subroutine CalcMudPump3LinerDiameter()
  213. ! use, intrinsic :: IEEE_ARITHMETIC
  214. ! implicit none
  215. ! real(8) :: a
  216. ! a = (MathPI / 4.d0) * data%Configuration%Pumps%CementPumpStroke * 3.0d0 * data%Configuration%Pumps%CementPumpVolumetricEfficiency / 9702.03d0
  217. ! a = dsqrt(data%Configuration%Pumps%CementPumpOutputBblStroke / a)
  218. ! if (.not.IEEE_IS_FINITE(a) .or. IEEE_IS_NAN(a)) then
  219. ! data%Configuration%Pumps%CementPumpLinerDiameter = 0.0
  220. ! else
  221. ! data%Configuration%Pumps%CementPumpLinerDiameter = a
  222. ! endif
  223. ! call SetMudPump3LinerDiameterN(data%Configuration%Pumps%CementPumpLinerDiameter)
  224. ! end subroutine
  225. ! subroutine CalcPump1OutputBblStroke()
  226. ! implicit none
  227. ! data%Configuration%Pumps%MudPump1OutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%MudPump1LinerDiameter**2) * data%Configuration%Pumps%MudPump1Stroke * 3.0d0 * data%Configuration%Pumps%MudPump1VolumetricEfficiency / 9702.03d0
  228. ! call SetMudPump1OutputBblStrokeN(data%Configuration%Pumps%MudPump1OutputBblStroke)
  229. ! end subroutine
  230. ! subroutine CalcPump2OutputBblStroke()
  231. ! implicit none
  232. ! data%Configuration%Pumps%MudPump2OutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%MudPump2LinerDiameter**2) * data%Configuration%Pumps%MudPump2Stroke * 3.0d0 * data%Configuration%Pumps%MudPump2VolumetricEfficiency / 9702.03d0
  233. ! call SetMudPump2OutputBblStrokeN(data%Configuration%Pumps%MudPump2OutputBblStroke)
  234. ! end subroutine
  235. ! subroutine CalcPump3OutputBblStroke()
  236. ! implicit none
  237. ! data%Configuration%Pumps%CementPumpOutputBblStroke = (MathPI / 4.d0) * (data%Configuration%Pumps%CementPumpLinerDiameter**2) * data%Configuration%Pumps%CementPumpStroke * 3.0d0 * data%Configuration%Pumps%CementPumpVolumetricEfficiency / 9702.03d0
  238. ! call SetMudPump3OutputBblStrokeN(data%Configuration%Pumps%CementPumpOutputBblStroke)
  239. ! end subroutine
  240. end module CPumps