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.
 
 
 
 
 
 

160 lines
9.7 KiB

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