Class ThrottlingValve

All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, TwoPortInterface, ValveInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
BlowdownValve, CheckValve, ControlValve, ESDValve, HIPPSValve, PressureDrop, PSDValve, RuptureDisk, SafetyReliefValve, SafetyValve

public class ThrottlingValve extends TwoPortEquipment implements ValveInterface

ThrottlingValve class.

Version:
$Id: $Id
Author:
esol
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • thermoSystem

      SystemInterface thermoSystem
    • valveKvSet

      private boolean valveKvSet
    • isoThermal

      private boolean isoThermal
    • pressure

      double pressure
    • Kv

      private double Kv
    • maxMolarFlow

      private double maxMolarFlow
    • minMolarFlow

      private double minMolarFlow
    • maxValveOpening

      private double maxValveOpening
    • minValveOpening

      private double minValveOpening
    • percentValveOpening

      private double percentValveOpening
    • requestedValveOpening

      private double requestedValveOpening
    • valveTravelTimeSec

      private double valveTravelTimeSec
    • valveOpeningTravelTimeSec

      private double valveOpeningTravelTimeSec
    • valveClosingTravelTimeSec

      private double valveClosingTravelTimeSec
    • valveTimeConstantSec

      private double valveTimeConstantSec
    • travelModel

      private ValveTravelModel travelModel
    • molarFlow

      double molarFlow
    • pressureUnit

      private String pressureUnit
    • acceptNegativeDP

      private boolean acceptNegativeDP
    • valveMechanicalDesign

      ValveMechanicalDesign valveMechanicalDesign
    • isCalcPressure

      boolean isCalcPressure
    • gasValve

      private boolean gasValve
    • Fp

      private double Fp
    • deltaPressure

      private double deltaPressure
    • allowChoked

      private boolean allowChoked
    • allowLaminar

      private boolean allowLaminar
    • xt

      private double xt
    • minimumMolarFlow

      private static final double minimumMolarFlow
      See Also:
  • Constructor Details

    • ThrottlingValve

      public ThrottlingValve(String name)
      * Constructor for ThrottlingValve.
      Parameters:
      name - name of valve
    • ThrottlingValve

      public ThrottlingValve(String name, StreamInterface inletStream)

      Constructor for ThrottlingValve.

      Parameters:
      name - a String object
      inletStream - a StreamInterface object
  • Method Details

    • getDeltaPressure

      public double getDeltaPressure(String unit)

      getDeltaPressure.

      Parameters:
      unit - a String object
      Returns:
      a double
    • getCapacityDuty

      public double getCapacityDuty()

      getCapacityDuty.

      Specified by:
      getCapacityDuty in interface ProcessEquipmentInterface
      Returns:
      a double
    • getCapacityMax

      public double getCapacityMax()

      getCapacityMax.

      Specified by:
      getCapacityMax in interface ProcessEquipmentInterface
      Returns:
      a double
    • getOutletPressure

      public double getOutletPressure()
      Get outlet pressure of twoport.
      Specified by:
      getOutletPressure in interface TwoPortInterface
      Overrides:
      getOutletPressure in class TwoPortEquipment
      Returns:
      outlet pressure of TwoPortEquipment in unit bara
    • getThermoSystem

      public SystemInterface getThermoSystem()

      getThermoSystem.

      Specified by:
      getThermoSystem in interface ProcessEquipmentInterface
      Specified by:
      getThermoSystem in interface ValveInterface
      Overrides:
      getThermoSystem in class ProcessEquipmentBaseClass
      Returns:
      a SystemInterface object
    • getInletPressure

      public double getInletPressure()
      Get inlet pressure of twoport.
      Specified by:
      getInletPressure in interface TwoPortInterface
      Overrides:
      getInletPressure in class TwoPortEquipment
      Returns:
      inlet pressure of TwoPortEquipment in unit bara
    • setPressure

      public void setPressure(double pressure)

      Setter for the field pressure.

      Specified by:
      setPressure in interface ProcessEquipmentInterface
      Overrides:
      setPressure in class ProcessEquipmentBaseClass
      Parameters:
      pressure - a double
    • setPressure

      public void setPressure(double pressure, String unit)

      Setter for the field pressure.

      Parameters:
      pressure - a double
      unit - a String object
    • setOutletPressure

      public void setOutletPressure(double pressure)
      Set outlet pressure of twoport.
      Specified by:
      setOutletPressure in interface TwoPortInterface
      Overrides:
      setOutletPressure in class TwoPortEquipment
      Parameters:
      pressure - value to set in unit bara
    • setOutletPressure

      public void setOutletPressure(double pressure, String unit)

      setOutletPressure.

      Parameters:
      pressure - a double
      unit - a String object
    • needRecalculation

      public boolean needRecalculation()

      Check if process equipment needs recalculating.

      Specified by:
      needRecalculation in interface ProcessEquipmentInterface
      Returns:
      true or false
    • calcKv

      public void calcKv()
      calcKv.
    • calculateMolarFlow

      public double calculateMolarFlow()
      Calculates molar flow for a gas based on IEC 60534 standards. This method accounts for choked (critical) flow.
      Returns:
      Molar flow in mole/sec.
    • calculateOutletPressure

      public double calculateOutletPressure(double KvAdjusted)
      Calculates the outlet pressure based on the adjusted Kv value.
      Parameters:
      KvAdjusted - the adjusted flow coefficient (Kv)
      Returns:
      the calculated outlet pressure
    • adjustKv

      private double adjustKv(double Kv, double percentValveOpening)
      Adjusts the flow coefficient (Kv) based on the percentage valve opening.
      Parameters:
      Kv - Flow coefficient SI (for 100% opening)
      percentValveOpening - Percentage valve opening (0 to 100).
      Returns:
      Adjusted flow coefficient (Kv)
    • run

      public void run(UUID id)

      In this method all thermodynamic and unit operations will be calculated in a steady state calculation.

      Specified by:
      run in interface SimulationInterface
      Parameters:
      id - UUID
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
      Overrides:
      displayResult in class ProcessEquipmentBaseClass
    • getResultTable

      public String[][] getResultTable()

      getResultTable.

      Specified by:
      getResultTable in interface ProcessEquipmentInterface
      Overrides:
      getResultTable in class ProcessEquipmentBaseClass
      Returns:
      an array of String objects
    • runTransient

      public void runTransient(double dt, UUID id)

      runTransient

      This method calculates thermodynamic and unit operations using difference equations if available and calculateSteadyState is true. Use setCalculateSteadyState to set the parameter. Sets calc identifier UUID.
      Specified by:
      runTransient in interface SimulationInterface
      Parameters:
      dt - Delta time [s]
      id - Calculation identifier
    • ensureValidMolarFlow

      private double ensureValidMolarFlow(double flow)
    • isNegligibleFlow

      private boolean isNegligibleFlow(double flow)
    • applyZeroFlowState

      private void applyZeroFlowState(UUID id)
    • runController

      public void runController(double dt, UUID id)

      runController.

      Parameters:
      dt - a double
      id - Calculation identifier
    • clampValveOpening

      private double clampValveOpening(double value)
    • applyTravelDynamics

      private double applyTravelDynamics(double current, double target, double dt)
    • getEffectiveOpeningTravelTime

      private double getEffectiveOpeningTravelTime()
    • getEffectiveClosingTravelTime

      private double getEffectiveClosingTravelTime()
    • setMinimumValveOpening

      public void setMinimumValveOpening(double minopen)

      setMinimumValveOpening.

      Parameters:
      minopen - a double
    • setMaximumValveOpening

      public void setMaximumValveOpening(double maxopen)
      Sets the maximum valve opening in percent.
      Parameters:
      maxopen - a double representing the maximum permitted opening
    • getKv

      public double getKv()
      Gets the Kv (metric flow coefficient) of the valve.
      Specified by:
      getKv in interface ValveInterface
      Returns:
      the metric flow coefficient
    • getCv

      public double getCv()

      getCv.

      Specified by:
      getCv in interface ValveInterface
      Returns:
      a double
    • getCv

      public double getCv(String unit)

      getCv.

      Specified by:
      getCv in interface ValveInterface
      Parameters:
      unit - can be SI or US SI is unit litre/minute US is gallons per minute
      Returns:
      a double
    • setCv

      public void setCv(double Cv)

      setCv.

      Specified by:
      setCv in interface ValveInterface
      Parameters:
      Cv - a double
    • setKv

      public void setKv(double Kv)
      Sets the Kv (metric flow coefficient) of the valve.
      Specified by:
      setKv in interface ValveInterface
      Parameters:
      Kv - the metric flow coefficient
    • setCv

      public void setCv(double cv, String unit)

      setCv.

      Specified by:
      setCv in interface ValveInterface
      Parameters:
      cv - a double
      unit - can be SI or US SI is unit litre/minute US is gallons per minute
    • setTravelTime

      public void setTravelTime(double travelTimeSec)
      Sets the total travel time (seconds) corresponding to a movement from fully closed to fully open.
      Specified by:
      setTravelTime in interface ValveInterface
      Parameters:
      travelTimeSec - full travel time in seconds
    • getTravelTime

      public double getTravelTime()
      Returns the configured full travel time (seconds) for the valve.
      Specified by:
      getTravelTime in interface ValveInterface
      Returns:
      full travel time in seconds
    • setOpeningTravelTime

      public void setOpeningTravelTime(double travelTimeSec)
      Sets the travel time for opening actions (seconds). When not specified, the symmetric travel time is used.
      Specified by:
      setOpeningTravelTime in interface ValveInterface
      Parameters:
      travelTimeSec - opening travel time in seconds
    • getOpeningTravelTime

      public double getOpeningTravelTime()
      Returns the configured opening travel time (seconds).
      Specified by:
      getOpeningTravelTime in interface ValveInterface
      Returns:
      opening travel time in seconds
    • setClosingTravelTime

      public void setClosingTravelTime(double travelTimeSec)
      Sets the travel time for closing actions (seconds). When not specified, the symmetric travel time is used.
      Specified by:
      setClosingTravelTime in interface ValveInterface
      Parameters:
      travelTimeSec - closing travel time in seconds
    • getClosingTravelTime

      public double getClosingTravelTime()
      Returns the configured closing travel time (seconds).
      Specified by:
      getClosingTravelTime in interface ValveInterface
      Returns:
      closing travel time in seconds
    • setTravelTimeConstant

      public void setTravelTimeConstant(double timeConstantSec)
      Sets the time constant (seconds) for first-order travel dynamics.
      Specified by:
      setTravelTimeConstant in interface ValveInterface
      Parameters:
      timeConstantSec - time constant in seconds
    • getTravelTimeConstant

      public double getTravelTimeConstant()
      Returns the configured time constant (seconds) for first-order travel dynamics.
      Specified by:
      getTravelTimeConstant in interface ValveInterface
      Returns:
      time constant in seconds
    • setTravelModel

      public void setTravelModel(ValveTravelModel travelModel)
      Sets the valve travel model used to translate requested opening to actual position.
      Specified by:
      setTravelModel in interface ValveInterface
      Parameters:
      travelModel - travel model implementation
    • getTravelModel

      public ValveTravelModel getTravelModel()
      Returns the current valve travel model.
      Specified by:
      getTravelModel in interface ValveInterface
      Returns:
      travel model
    • getCg

      public double getCg()

      getCg.

      Specified by:
      getCg in interface ValveInterface
      Returns:
      a double
    • getPercentValveOpening

      public double getPercentValveOpening()

      getPercentValveOpening.

      Specified by:
      getPercentValveOpening in interface ValveInterface
      Returns:
      a double
    • setPercentValveOpening

      public void setPercentValveOpening(double percentValveOpening)

      setPercentValveOpening.

      Specified by:
      setPercentValveOpening in interface ValveInterface
      Parameters:
      percentValveOpening - a double
    • getTargetPercentValveOpening

      public double getTargetPercentValveOpening()
      Returns the requested (target) valve opening before dynamic travel limitations are applied.
      Specified by:
      getTargetPercentValveOpening in interface ValveInterface
      Returns:
      requested valve opening in percent
    • setTargetPercentValveOpening

      public void setTargetPercentValveOpening(double percentValveOpening)
      Sets the requested (target) valve opening in percent. The actual valve opening may lag the request depending on the selected travel model.
      Specified by:
      setTargetPercentValveOpening in interface ValveInterface
      Parameters:
      percentValveOpening - target valve opening in percent
    • isValveKvSet

      public boolean isValveKvSet()

      isValveKvSet.

      Returns:
      a boolean
    • setValveKvSet

      public void setValveKvSet(boolean valveKvSet)

      Setter for the field valveKvSet.

      Parameters:
      valveKvSet - a boolean
    • isIsoThermal

      public boolean isIsoThermal()

      isIsoThermal.

      Specified by:
      isIsoThermal in interface ValveInterface
      Returns:
      a boolean
    • setIsoThermal

      public void setIsoThermal(boolean isoThermal)

      setIsoThermal.

      Specified by:
      setIsoThermal in interface ValveInterface
      Parameters:
      isoThermal - a boolean
    • getEntropyProduction

      public double getEntropyProduction(String unit)

      getEntropyProduction.

      Specified by:
      getEntropyProduction in interface ProcessEquipmentInterface
      Overrides:
      getEntropyProduction in class ProcessEquipmentBaseClass
      Parameters:
      unit - a String object
      Returns:
      a double
    • getExergyChange

      public double getExergyChange(String unit, double surroundingTemperature)
      Get exergy change production of the process equipment.
      Specified by:
      getExergyChange in interface ProcessEquipmentInterface
      Overrides:
      getExergyChange in class ProcessEquipmentBaseClass
      Parameters:
      unit - Supported units are J and kJ
      surroundingTemperature - The surrounding temperature in Kelvin
      Returns:
      change in exergy in specified unit
    • isAcceptNegativeDP

      public boolean isAcceptNegativeDP()

      isAcceptNegativeDP.

      Returns:
      a boolean
    • setAcceptNegativeDP

      public void setAcceptNegativeDP(boolean acceptNegativeDP)

      Setter for the field acceptNegativeDP.

      Parameters:
      acceptNegativeDP - a boolean
    • initMechanicalDesign

      public void initMechanicalDesign()

      Initialize a initMechanicalDesign for the equipment.

      Specified by:
      initMechanicalDesign in interface ProcessEquipmentInterface
      Overrides:
      initMechanicalDesign in class ProcessEquipmentBaseClass
    • getMechanicalDesign

      public ValveMechanicalDesign getMechanicalDesign()

      Get a mechanicalDesign for the equipment.

      Specified by:
      getMechanicalDesign in interface ProcessEquipmentInterface
      Overrides:
      getMechanicalDesign in class ProcessEquipmentBaseClass
      Returns:
      a MechanicalDesign object
    • setIsCalcOutPressure

      public void setIsCalcOutPressure(boolean isSetPres)

      setIsCalcOutPressure.

      Parameters:
      isSetPres - a boolean
    • toJson

      public String toJson()

      Serializes the Process Equipment along with its state to a JSON string.

      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class TwoPortEquipment
      Returns:
      json string.
    • toJson

      public String toJson(ReportConfig cfg)
      Serializes the Process Equipment with configurable level of detail.
      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class TwoPortEquipment
      Parameters:
      cfg - report configuration
      Returns:
      json string
    • isGasValve

      public boolean isGasValve()

      isGasValve.

      Returns:
      a boolean
    • setGasValve

      public void setGasValve(boolean gasValve)

      Setter for the field gasValve.

      Parameters:
      gasValve - a boolean
    • getFp

      public double getFp()

      getFp.

      Returns:
      a double
    • setFp

      public void setFp(double fp)

      setFp.

      Parameters:
      fp - a double
    • getDeltaPressure

      public double getDeltaPressure()

      Getter for the field deltaPressure.

      Returns:
      a double
    • setDeltaPressure

      public void setDeltaPressure(double deltaPressure, String unit)

      Setter for the field deltaPressure.

      Parameters:
      deltaPressure - a double
      unit - a String object
    • isAllowChoked

      public boolean isAllowChoked()

      isAllowChoked.

      Returns:
      a boolean
    • setAllowChoked

      public void setAllowChoked(boolean allowChoked)

      Setter for the field allowChoked.

      Parameters:
      allowChoked - a boolean
    • isAllowLaminar

      public boolean isAllowLaminar()

      isAllowLaminar.

      Returns:
      a boolean
    • setAllowLaminar

      public void setAllowLaminar(boolean allowLaminar)

      Setter for the field allowLaminar.

      Parameters:
      allowLaminar - a boolean