module CChokeManifold ! use CChokeManifoldVariables use SimulationVariables use CManifolds use CLog2 implicit none public contains 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%EquipmentControl%ChokeManifold%ChokeManifoldValve1) call json%add(p,"ChokeManifoldValve2",data%EquipmentControl%ChokeManifold%ChokeManifoldValve2) call json%add(p,"LeftManualChoke",data%EquipmentControl%ChokeManifold%LeftManualChoke) call json%add(p,"ChokeManifoldValve4",data%EquipmentControl%ChokeManifold%ChokeManifoldValve4) call json%add(p,"ChokeManifoldValve5",data%EquipmentControl%ChokeManifold%ChokeManifoldValve5) call json%add(p,"RightManualChoke",data%EquipmentControl%ChokeManifold%RightManualChoke) call json%add(p,"ChokeManifoldValve7",data%EquipmentControl%ChokeManifold%ChokeManifoldValve7) call json%add(p,"ChokeManifoldValve8",data%EquipmentControl%ChokeManifold%ChokeManifoldValve8) call json%add(p,"ChokeManifoldValve9",data%EquipmentControl%ChokeManifold%ChokeManifoldValve9) call json%add(p,"ChokeManifoldValve10",data%EquipmentControl%ChokeManifold%ChokeManifoldValve10) call json%add(p,"ChokeManifoldValve11",data%EquipmentControl%ChokeManifold%ChokeManifoldValve11) call json%add(p,"ChokeManifoldValve12",data%EquipmentControl%ChokeManifold%ChokeManifoldValve12) call json%add(p,"ChokeManifoldValve13",data%EquipmentControl%ChokeManifold%ChokeManifoldValve13) call json%add(p,"HydraulicChock1",data%EquipmentControl%ChokeManifold%HydraulicChock1) call json%add(p,"HydraulicChock2",data%EquipmentControl%ChokeManifold%HydraulicChock2) call json%add(p,"HyChock1OnProblem",data%EquipmentControl%ChokeManifold%HyChock1OnProblem) call json%add(p,"HyChock2OnProblem",data%EquipmentControl%ChokeManifold%HyChock2OnProblem) call json%add(p,"LeftManChokeOnProblem",data%EquipmentControl%ChokeManifold%LeftManChokeOnProblem) call json%add(p,"RightManChokeOnProblem",data%EquipmentControl%ChokeManifold%RightManChokeOnProblem) call json%add(parent,p) end subroutine subroutine SetHydraulicChock1(v) implicit none integer, intent(in) :: v data%EquipmentControl%ChokeManifold%HydraulicChock1 = v if(data%EquipmentControl%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%EquipmentControl%ChokeManifold%HydraulicChock2 = v if(data%EquipmentControl%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