Simulation Core
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

158 строки
9.8 KiB

  1. module CPumpProblems
  2. use SimulationVariables
  3. implicit none
  4. public
  5. contains
  6. subroutine PumpProblemsFromJson(parent)
  7. type(json_value),pointer :: parent
  8. type(json_core) :: json
  9. type(json_value),pointer :: p
  10. call json%get(parent,'PumpProblems',p)
  11. call ProblemFromJson(p,"Pump1PowerFail",data%problems%PumpProblems%Pump1PowerFail)
  12. call ProblemFromJson(p,"Pump1BlowPopOffValve",data%problems%PumpProblems%Pump1BlowPopOffValve)
  13. call ProblemFromJson(p,"Pump2PowerFail",data%problems%PumpProblems%Pump2PowerFail)
  14. call ProblemFromJson(p,"Pump2BlowPopOffValve",data%problems%PumpProblems%Pump2BlowPopOffValve)
  15. call ProblemFromJson(p,"CementPumpPowerFail",data%problems%PumpProblems%CementPumpPowerFail)
  16. call ProblemFromJson(p,"CementPumpBlowPopOffValve",data%problems%PumpProblems%CementPumpBlowPopOffValve)
  17. end subroutine
  18. subroutine PumpProblemsToJson(parent)
  19. type(json_value),pointer :: parent
  20. type(json_core) :: json
  21. type(json_value),pointer :: p
  22. ! 1. create new node
  23. call json%create_object(p,'PumpProblems')
  24. ! 2. add member of data type to new node
  25. call ProblemToJson(p,"Pump1PowerFail",data%problems%PumpProblems%Pump1PowerFail)
  26. call ProblemToJson(p,"Pump1BlowPopOffValve",data%problems%PumpProblems%Pump1BlowPopOffValve)
  27. call ProblemToJson(p,"Pump2PowerFail",data%problems%PumpProblems%Pump2PowerFail)
  28. call ProblemToJson(p,"Pump2BlowPopOffValve",data%problems%PumpProblems%Pump2BlowPopOffValve)
  29. call ProblemToJson(p,"CementPumpPowerFail",data%problems%PumpProblems%CementPumpPowerFail)
  30. call ProblemToJson(p,"CementPumpBlowPopOffValve",data%problems%PumpProblems%CementPumpBlowPopOffValve)
  31. ! 3. add new node to parent
  32. call json%add(parent,p)
  33. end subroutine
  34. subroutine ProcessPumpProblemsDueTime(time)
  35. implicit none
  36. integer :: time
  37. if(data%problems%PumpProblems%Pump1PowerFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%Pump1PowerFail, ChangePump1PowerFail, time)
  38. if(data%problems%PumpProblems%Pump1BlowPopOffValve%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%Pump1BlowPopOffValve, ChangePump1BlowPopOffValve, time)
  39. if(data%problems%PumpProblems%Pump2PowerFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%Pump2PowerFail, ChangePump2PowerFail, time)
  40. if(data%problems%PumpProblems%Pump2BlowPopOffValve%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%Pump2BlowPopOffValve, ChangePump2BlowPopOffValve, time)
  41. if(data%problems%PumpProblems%CementPumpPowerFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%CementPumpPowerFail, ChangeCementPumpPowerFail, time)
  42. if(data%problems%PumpProblems%CementPumpBlowPopOffValve%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%PumpProblems%CementPumpBlowPopOffValve, ChangeCementPumpBlowPopOffValve, time)
  43. end subroutine
  44. subroutine ProcessPumpProblemsDuePumpStrokes(strokes)
  45. implicit none
  46. integer :: strokes
  47. if(data%problems%PumpProblems%Pump1PowerFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%Pump1PowerFail, ChangePump1PowerFail, strokes)
  48. if(data%problems%PumpProblems%Pump1BlowPopOffValve%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%Pump1BlowPopOffValve, ChangePump1BlowPopOffValve, strokes)
  49. if(data%problems%PumpProblems%Pump2PowerFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%Pump2PowerFail, ChangePump2PowerFail, strokes)
  50. if(data%problems%PumpProblems%Pump2BlowPopOffValve%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%Pump2BlowPopOffValve, ChangePump2BlowPopOffValve, strokes)
  51. if(data%problems%PumpProblems%CementPumpPowerFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%CementPumpPowerFail, ChangeCementPumpPowerFail, strokes)
  52. if(data%problems%PumpProblems%CementPumpBlowPopOffValve%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%PumpProblems%CementPumpBlowPopOffValve, ChangeCementPumpBlowPopOffValve, strokes)
  53. end subroutine
  54. subroutine ProcessPumpProblemsDueVolumePumped(volume)
  55. implicit none
  56. real(8) :: volume
  57. if(data%problems%PumpProblems%Pump1PowerFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%Pump1PowerFail, ChangePump1PowerFail, volume)
  58. if(data%problems%PumpProblems%Pump1BlowPopOffValve%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%Pump1BlowPopOffValve, ChangePump1BlowPopOffValve, volume)
  59. if(data%problems%PumpProblems%Pump2PowerFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%Pump2PowerFail, ChangePump2PowerFail, volume)
  60. if(data%problems%PumpProblems%Pump2BlowPopOffValve%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%Pump2BlowPopOffValve, ChangePump2BlowPopOffValve, volume)
  61. if(data%problems%PumpProblems%CementPumpPowerFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%CementPumpPowerFail, ChangeCementPumpPowerFail, volume)
  62. if(data%problems%PumpProblems%CementPumpBlowPopOffValve%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%PumpProblems%CementPumpBlowPopOffValve, ChangeCementPumpBlowPopOffValve, volume)
  63. end subroutine
  64. subroutine ProcessPumpProblemsDueDistanceDrilled(distance)
  65. implicit none
  66. real(8) :: distance
  67. if(data%problems%PumpProblems%Pump1PowerFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%Pump1PowerFail, ChangePump1PowerFail, distance)
  68. if(data%problems%PumpProblems%Pump1BlowPopOffValve%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%Pump1BlowPopOffValve, ChangePump1BlowPopOffValve, distance)
  69. if(data%problems%PumpProblems%Pump2PowerFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%Pump2PowerFail, ChangePump2PowerFail, distance)
  70. if(data%problems%PumpProblems%Pump2BlowPopOffValve%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%Pump2BlowPopOffValve, ChangePump2BlowPopOffValve, distance)
  71. if(data%problems%PumpProblems%CementPumpPowerFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%CementPumpPowerFail, ChangeCementPumpPowerFail, distance)
  72. if(data%problems%PumpProblems%CementPumpBlowPopOffValve%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%PumpProblems%CementPumpBlowPopOffValve, ChangeCementPumpBlowPopOffValve, distance)
  73. end subroutine
  74. subroutine ChangePump1PowerFail(status)
  75. use SimulationVariables
  76. implicit none
  77. integer, intent (in) :: status
  78. !if(associated(Pump1PowerFailPtr)) call Pump1PowerFailPtr(status)
  79. if(status == Clear_StatusType) data%State%Pump(1)%PowerFailMalf=0
  80. if(status == Executed_StatusType) data%State%Pump(1)%PowerFailMalf=1
  81. endsubroutine
  82. subroutine ChangePump1BlowPopOffValve(status)
  83. use SimulationVariables
  84. implicit none
  85. integer, intent (in) :: status
  86. !if(associated(Pump1BlowPopOffValvePtr)) call Pump1BlowPopOffValvePtr(status)
  87. if(status == Clear_StatusType) data%State%Pump(1)%BlowPopOffMalf=0
  88. if(status == Executed_StatusType) data%State%Pump(1)%BlowPopOffMalf=1
  89. endsubroutine
  90. subroutine ChangePump2PowerFail(status)
  91. use SimulationVariables
  92. implicit none
  93. integer, intent (in) :: status
  94. !if(associated(Pump2PowerFailPtr)) call Pump2PowerFailPtr(status)
  95. if(status == Clear_StatusType) data%State%Pump(2)%PowerFailMalf=0
  96. if(status == Executed_StatusType) data%State%Pump(2)%PowerFailMalf=1
  97. endsubroutine
  98. subroutine ChangePump2BlowPopOffValve(status)
  99. use SimulationVariables
  100. implicit none
  101. integer, intent (in) :: status
  102. !if(associated(Pump2BlowPopOffValvePtr)) call Pump2BlowPopOffValvePtr(status)
  103. if(status == Clear_StatusType) data%State%Pump(2)%BlowPopOffMalf=0
  104. if(status == Executed_StatusType) data%State%Pump(2)%BlowPopOffMalf=1
  105. endsubroutine
  106. subroutine ChangeCementPumpPowerFail(status)
  107. use SimulationVariables
  108. implicit none
  109. integer, intent (in) :: status
  110. !if(associated(CementPumpPowerFailPtr)) call CementPumpPowerFailPtr(status)
  111. if(status == Clear_StatusType) data%State%Pump(3)%PowerFailMalf=0
  112. if(status == Executed_StatusType) data%State%Pump(3)%PowerFailMalf=1
  113. endsubroutine
  114. subroutine ChangeCementPumpBlowPopOffValve(status)
  115. use SimulationVariables
  116. implicit none
  117. integer, intent (in) :: status
  118. !if(associated(CementPumpBlowPopOffValvePtr)) call CementPumpBlowPopOffValvePtr(status)
  119. if(status == Clear_StatusType) data%State%Pump(3)%BlowPopOffMalf=0
  120. if(status == Executed_StatusType) data%State%Pump(3)%BlowPopOffMalf=1
  121. endsubroutine
  122. end module CPumpProblems