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.

CChokeManifold.f90 5.8 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. module CChokeManifold
  2. ! use CChokeManifoldVariables
  3. use SimulationVariables
  4. use CManifolds
  5. use CLog2
  6. implicit none
  7. public
  8. contains
  9. subroutine ChokeManifoldFromJson(parent)
  10. type(json_value),pointer :: parent
  11. type(json_core) :: json
  12. type(json_value),pointer :: p,pval
  13. ! 1. get related root
  14. call json%get(parent,'ChokeManifold',p)
  15. ! 2. get member of data type from node
  16. call json%get(p,'ChokeManifoldValve1',pval)
  17. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve1)
  18. call json%get(p,'ChokeManifoldValve2',pval)
  19. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve2)
  20. call json%get(p,'LeftManualChoke',pval)
  21. call json%get(pval,data%Equipments%ChokeManifold%LeftManualChoke)
  22. call json%get(p,'ChokeManifoldValve4',pval)
  23. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve4)
  24. call json%get(p,'ChokeManifoldValve5',pval)
  25. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve5)
  26. call json%get(p,'RightManualChoke',pval)
  27. call json%get(pval,data%Equipments%ChokeManifold%RightManualChoke)
  28. call json%get(p,'ChokeManifoldValve7',pval)
  29. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve7)
  30. call json%get(p,'ChokeManifoldValve8',pval)
  31. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve8)
  32. call json%get(p,'ChokeManifoldValve9',pval)
  33. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve9)
  34. call json%get(p,'ChokeManifoldValve10',pval)
  35. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve10)
  36. call json%get(p,'ChokeManifoldValve11',pval)
  37. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve11)
  38. call json%get(p,'ChokeManifoldValve12',pval)
  39. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve12)
  40. call json%get(p,'ChokeManifoldValve13',pval)
  41. call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve13)
  42. ! call json%get(p,'HydraulicChock1',pval)
  43. ! call json%get(pval,data%Equipments%ChokeManifold%HydraulicChock1)
  44. ! call json%get(p,'HydraulicChock2',pval)
  45. ! call json%get(pval,data%Equipments%ChokeManifold%HydraulicChock2)
  46. call json%get(p,'HyChock1OnProblem',pval)
  47. call json%get(pval,data%Equipments%ChokeManifold%HyChock1OnProblem)
  48. call json%get(p,'HyChock2OnProblem',pval)
  49. call json%get(pval,data%Equipments%ChokeManifold%HyChock2OnProblem)
  50. call json%get(p,'LeftManChokeOnProblem',pval)
  51. call json%get(pval,data%Equipments%ChokeManifold%LeftManChokeOnProblem)
  52. call json%get(p,'RightManChokeOnProblem',pval)
  53. call json%get(pval,data%Equipments%ChokeManifold%RightManChokeOnProblem)
  54. end subroutine
  55. subroutine ChokeManifoldToJson(parent)
  56. type(json_value),pointer :: parent
  57. type(json_core) :: json
  58. type(json_value),pointer :: p
  59. ! 1. create new node
  60. call json%create_object(p,'ChokeManifold')
  61. ! call json%add(p,"ChokeManifoldValve1",data%Equipments%ChokeManifold%ChokeManifoldValve1)
  62. ! call json%add(p,"ChokeManifoldValve2",data%Equipments%ChokeManifold%ChokeManifoldValve2)
  63. ! call json%add(p,"LeftManualChoke",data%Equipments%ChokeManifold%LeftManualChoke)
  64. ! call json%add(p,"ChokeManifoldValve4",data%Equipments%ChokeManifold%ChokeManifoldValve4)
  65. ! call json%add(p,"ChokeManifoldValve5",data%Equipments%ChokeManifold%ChokeManifoldValve5)
  66. ! call json%add(p,"RightManualChoke",data%Equipments%ChokeManifold%RightManualChoke)
  67. ! call json%add(p,"ChokeManifoldValve7",data%Equipments%ChokeManifold%ChokeManifoldValve7)
  68. ! call json%add(p,"ChokeManifoldValve8",data%Equipments%ChokeManifold%ChokeManifoldValve8)
  69. ! call json%add(p,"ChokeManifoldValve9",data%Equipments%ChokeManifold%ChokeManifoldValve9)
  70. ! call json%add(p,"ChokeManifoldValve10",data%Equipments%ChokeManifold%ChokeManifoldValve10)
  71. ! call json%add(p,"ChokeManifoldValve11",data%Equipments%ChokeManifold%ChokeManifoldValve11)
  72. ! call json%add(p,"ChokeManifoldValve12",data%Equipments%ChokeManifold%ChokeManifoldValve12)
  73. ! call json%add(p,"ChokeManifoldValve13",data%Equipments%ChokeManifold%ChokeManifoldValve13)
  74. call json%add(p,"HydraulicChock1",data%Equipments%ChokeManifold%HydraulicChock1)
  75. call json%add(p,"HydraulicChock2",data%Equipments%ChokeManifold%HydraulicChock2)
  76. call json%add(p,"HyChock1OnProblem",data%Equipments%ChokeManifold%HyChock1OnProblem)
  77. call json%add(p,"HyChock2OnProblem",data%Equipments%ChokeManifold%HyChock2OnProblem)
  78. call json%add(p,"LeftManChokeOnProblem",data%Equipments%ChokeManifold%LeftManChokeOnProblem)
  79. call json%add(p,"RightManChokeOnProblem",data%Equipments%ChokeManifold%RightManChokeOnProblem)
  80. call json%add(parent,p)
  81. end subroutine
  82. subroutine SetHydraulicChock1(v)
  83. implicit none
  84. integer, intent(in) :: v
  85. data%Equipments%ChokeManifold%HydraulicChock1 = v
  86. if(data%Equipments%ChokeManifold%HyChock1OnProblem) then
  87. call ChangeValve(33, .true.)
  88. else
  89. if(v == 100) then
  90. if(Manifold%Valve(33)%Status) call ChangeValve(33, .false.)
  91. else
  92. if(.not.Manifold%Valve(33)%Status) call ChangeValve(33, .true.)
  93. endif
  94. endif
  95. !WRITE (*,*) ' valve 33 ', Valve(33)%Status, ' arg ', v
  96. end subroutine
  97. subroutine SetHydraulicChock2(v)
  98. implicit none
  99. integer, intent(in) :: v
  100. data%Equipments%ChokeManifold%HydraulicChock2 = v
  101. if(data%Equipments%ChokeManifold%HyChock2OnProblem) then
  102. call ChangeValve(34, .true.)
  103. else
  104. if(v==100) then
  105. if(Manifold%Valve(34)%Status) call ChangeValve(34, .false.)
  106. else
  107. if(.not.Manifold%Valve(34)%Status) call ChangeValve(34, .true.)
  108. endif
  109. endif
  110. !WRITE (*,*) ' valve 34 ', Valve(34)%Status, ' arg ', v
  111. end subroutine
  112. end module CChokeManifold