module CChokeManifold
!     use CChokeManifoldVariables
    use SimulationVariables
    use CManifolds
    use CLog2
    implicit none    
    public
    contains
    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