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.
 
 
 
 
 
 

144 line
9.0 KiB

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