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.i90 5.8 KiB

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