# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeManifold.f90" module CChokeManifold ! use CChokeManifoldVariables use SimulationVariables use CManifolds use CLog2 implicit none public contains subroutine ChokeManifoldFromJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pval ! 1. get related root call json%get(parent,'ChokeManifold',p) ! 2. get member of data type from node call json%get(p,'ChokeManifoldValve1',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve1) call json%get(p,'ChokeManifoldValve2',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve2) call json%get(p,'LeftManualChoke',pval) call json%get(pval,data%Equipments%ChokeManifold%LeftManualChoke) call json%get(p,'ChokeManifoldValve4',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve4) call json%get(p,'ChokeManifoldValve5',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve5) call json%get(p,'RightManualChoke',pval) call json%get(pval,data%Equipments%ChokeManifold%RightManualChoke) call json%get(p,'ChokeManifoldValve7',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve7) call json%get(p,'ChokeManifoldValve8',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve8) call json%get(p,'ChokeManifoldValve9',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve9) call json%get(p,'ChokeManifoldValve10',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve10) call json%get(p,'ChokeManifoldValve11',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve11) call json%get(p,'ChokeManifoldValve12',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve12) call json%get(p,'ChokeManifoldValve13',pval) call json%get(pval,data%Equipments%ChokeManifold%ChokeManifoldValve13) ! call json%get(p,'HydraulicChock1',pval) ! call json%get(pval,data%Equipments%ChokeManifold%HydraulicChock1) ! call json%get(p,'HydraulicChock2',pval) ! call json%get(pval,data%Equipments%ChokeManifold%HydraulicChock2) call json%get(p,'HyChock1OnProblem',pval) call json%get(pval,data%Equipments%ChokeManifold%HyChock1OnProblem) call json%get(p,'HyChock2OnProblem',pval) call json%get(pval,data%Equipments%ChokeManifold%HyChock2OnProblem) call json%get(p,'LeftManChokeOnProblem',pval) call json%get(pval,data%Equipments%ChokeManifold%LeftManChokeOnProblem) call json%get(p,'RightManChokeOnProblem',pval) call json%get(pval,data%Equipments%ChokeManifold%RightManChokeOnProblem) end subroutine subroutine ChokeManifoldToJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p ! 1. create new node call json%create_object(p,'ChokeManifold') ! call json%add(p,"ChokeManifoldValve1",data%Equipments%ChokeManifold%ChokeManifoldValve1) ! call json%add(p,"ChokeManifoldValve2",data%Equipments%ChokeManifold%ChokeManifoldValve2) ! call json%add(p,"LeftManualChoke",data%Equipments%ChokeManifold%LeftManualChoke) ! call json%add(p,"ChokeManifoldValve4",data%Equipments%ChokeManifold%ChokeManifoldValve4) ! call json%add(p,"ChokeManifoldValve5",data%Equipments%ChokeManifold%ChokeManifoldValve5) ! call json%add(p,"RightManualChoke",data%Equipments%ChokeManifold%RightManualChoke) ! call json%add(p,"ChokeManifoldValve7",data%Equipments%ChokeManifold%ChokeManifoldValve7) ! call json%add(p,"ChokeManifoldValve8",data%Equipments%ChokeManifold%ChokeManifoldValve8) ! call json%add(p,"ChokeManifoldValve9",data%Equipments%ChokeManifold%ChokeManifoldValve9) ! call json%add(p,"ChokeManifoldValve10",data%Equipments%ChokeManifold%ChokeManifoldValve10) ! call json%add(p,"ChokeManifoldValve11",data%Equipments%ChokeManifold%ChokeManifoldValve11) ! call json%add(p,"ChokeManifoldValve12",data%Equipments%ChokeManifold%ChokeManifoldValve12) ! call json%add(p,"ChokeManifoldValve13",data%Equipments%ChokeManifold%ChokeManifoldValve13) call json%add(p,"HydraulicChock1",data%Equipments%ChokeManifold%HydraulicChock1) call json%add(p,"HydraulicChock2",data%Equipments%ChokeManifold%HydraulicChock2) call json%add(p,"HyChock1OnProblem",data%Equipments%ChokeManifold%HyChock1OnProblem) call json%add(p,"HyChock2OnProblem",data%Equipments%ChokeManifold%HyChock2OnProblem) call json%add(p,"LeftManChokeOnProblem",data%Equipments%ChokeManifold%LeftManChokeOnProblem) call json%add(p,"RightManChokeOnProblem",data%Equipments%ChokeManifold%RightManChokeOnProblem) call json%add(parent,p) end subroutine subroutine SetHydraulicChock1(v) implicit none integer, intent(in) :: v data%Equipments%ChokeManifold%HydraulicChock1 = v if(data%Equipments%ChokeManifold%HyChock1OnProblem) then call ChangeValve(33, .true.) else if(v == 100) then if(Manifold%Valve(33)%Status) call ChangeValve(33, .false.) else if(.not.Manifold%Valve(33)%Status) call ChangeValve(33, .true.) endif endif !WRITE (*,*) ' valve 33 ', Valve(33)%Status, ' arg ', v end subroutine subroutine SetHydraulicChock2(v) implicit none integer, intent(in) :: v data%Equipments%ChokeManifold%HydraulicChock2 = v if(data%Equipments%ChokeManifold%HyChock2OnProblem) then call ChangeValve(34, .true.) else if(v==100) then if(Manifold%Valve(34)%Status) call ChangeValve(34, .false.) else if(.not.Manifold%Valve(34)%Status) call ChangeValve(34, .true.) endif endif !WRITE (*,*) ' valve 34 ', Valve(34)%Status, ' arg ', v end subroutine end module CChokeManifold