Class DifferentialPressureFlowCalculator

java.lang.Object
neqsim.process.equipment.diffpressure.DifferentialPressureFlowCalculator

public final class DifferentialPressureFlowCalculator extends Object
Utility for calculating mass flow rates from differential pressure devices using NeqSim thermodynamic properties. The implementation mirrors the calculation logic used in the tilstandomatic flow calculation tool.
  • Field Details

    • DEFAULT_STANDARD_PRESSURE_BARA

      private static final double DEFAULT_STANDARD_PRESSURE_BARA
      See Also:
    • DEFAULT_STANDARD_TEMPERATURE_K

      private static final double DEFAULT_STANDARD_TEMPERATURE_K
      See Also:
    • BARG_TO_BARA_OFFSET

      private static final double BARG_TO_BARA_OFFSET
      See Also:
    • BAR_TO_PA

      private static final double BAR_TO_PA
      See Also:
    • CELSIUS_TO_KELVIN

      private static final double CELSIUS_TO_KELVIN
      See Also:
    • CONVERGING_MASS_COUNT_MAX

      private static final int CONVERGING_MASS_COUNT_MAX
      See Also:
    • DEFAULT_DISCHARGE_COEFFICIENTS

      private static final Map<String,Double> DEFAULT_DISCHARGE_COEFFICIENTS
    • DEFAULT_COMPONENTS

      private static final String[] DEFAULT_COMPONENTS
    • DEFAULT_FRACTIONS

      private static final double[] DEFAULT_FRACTIONS
  • Constructor Details

    • DifferentialPressureFlowCalculator

      private DifferentialPressureFlowCalculator()
  • Method Details

    • calculate

      public static DifferentialPressureFlowCalculator.FlowCalculationResult calculate(double[] pressureBarg, double[] temperatureC, double[] differentialPressureMbar, String flowType, double[] flowData, List<String> components, double[] fractions, boolean normalizeFractions)
      Calculates flow rates for the provided operating conditions.
      Parameters:
      pressureBarg - pressure values in barg
      temperatureC - temperature values in degrees Celsius
      differentialPressureMbar - differential pressure across restriction in mbar
      flowType - device type (Venturi, Orifice, ISA1932, V-Cone, DallTube, Annubar, Nozzle, Simplified, Perrys-Orifice)
      flowData - geometry parameters (see individual calculation methods)
      components - gas component names
      fractions - component fractions (mole basis)
      normalizeFractions - whether to normalise the composition fractions
      Returns:
      flow calculation result
    • calculate

      public static DifferentialPressureFlowCalculator.FlowCalculationResult calculate(double[] pressureBarg, double[] temperatureC, double[] differentialPressureMbar, String flowType, double[] flowData)
      Convenience overload using default composition and normalisation.
      Parameters:
      pressureBarg - pressure values in barg
      temperatureC - temperature values in degrees Celsius
      differentialPressureMbar - differential pressure across restriction in mbar
      flowType - device type (Venturi, Orifice, ISA1932, V-Cone, DallTube, Annubar, Nozzle, Simplified, Perrys-Orifice)
      flowData - geometry parameters (see individual calculation methods)
      Returns:
      flow calculation result
    • calculate

      public static DifferentialPressureFlowCalculator.FlowCalculationResult calculate(double[] pressureBarg, double[] temperatureC, double[] differentialPressureMbar, String flowType)
      Convenience overload with default flow data and composition.
      Parameters:
      pressureBarg - pressure values in barg
      temperatureC - temperature values in degrees Celsius
      differentialPressureMbar - differential pressure across restriction in mbar
      flowType - device type (Venturi, Orifice, ISA1932, V-Cone, DallTube, Annubar, Nozzle, Simplified, Perrys-Orifice)
      Returns:
      flow calculation result
    • createBaseSystem

      private static SystemInterface createBaseSystem(List<String> components, double[] fractions, boolean normalize)
    • calculateStandardDensity

      private static double calculateStandardDensity(SystemInterface standardSystem)
    • setState

      private static void setState(SystemInterface system, double temperatureK, double pressureAbar)
    • calculateMassFlow

      private static double[] calculateMassFlow(String flowTypeRaw, double[] flowData, double[] p, double[] rho, double[] mu, double[] kappa, double[] dp)
    • normaliseFlowType

      private static String normaliseFlowType(String flowTypeRaw)
    • resolveDischargeCoefficient

      private static double resolveDischargeCoefficient(String flowType, double[] flowData)
    • calcVenturi

      private static double[] calcVenturi(double[] dp, double[] p, double[] rho, double[] kappa, double D, double d, double C)
    • calcOrifice

      private static double[] calcOrifice(double[] dp, double[] p, double[] rho, double[] kappa, double[] mu, double D, double d)
    • calcVCone

      private static double[] calcVCone(double[] dp, double[] p, double[] rho, double[] kappa, double D, double d, double C)
    • calcDallTube

      private static double[] calcDallTube(double[] dp, double[] p, double[] rho, double[] kappa, double D, double d)
    • calcAnnubar

      private static double[] calcAnnubar(double[] dp, double[] p, double[] rho, double[] kappa, double D, double elementSize)
    • calcNozzle

      private static double[] calcNozzle(double[] dp, double[] p, double[] rho, double[] kappa, double[] mu, double D, double d)
    • calcSimplified

      private static double[] calcSimplified(double[] dp, double[] rho, double[] flowData)
    • calcPerrysOrifice

      private static double[] calcPerrysOrifice(double[] p1, double[] dp, double[] rho, double D, double d, double[] kappa)
    • calculateDpFromFlowVenturi

      public static double calculateDpFromFlowVenturi(double massFlowKgPerHour, double pressureBara, double density, double kappa, double pipeDiameterMm, double throatDiameterMm, double dischargeCoefficient)
      Calculates differential pressure from mass flow rate for a Venturi meter.

      This is the inverse of the flow calculation. Given the mass flow rate and fluid properties, it calculates the differential pressure across the Venturi. Uses an iterative approach since the expansibility factor depends on the pressure ratio.

      Parameters:
      massFlowKgPerHour - mass flow rate in kg/h
      pressureBara - upstream pressure in bara
      density - fluid density in kg/m³
      kappa - isentropic exponent (Cp/Cv)
      pipeDiameterMm - pipe diameter in mm
      throatDiameterMm - throat diameter in mm
      dischargeCoefficient - discharge coefficient (default 0.985 for Venturi)
      Returns:
      differential pressure in mbar
    • calculateDpFromFlowVenturi

      public static double calculateDpFromFlowVenturi(double massFlowKgPerHour, double pressureBara, double density, double kappa, double pipeDiameterMm, double throatDiameterMm)
      Calculates differential pressure from mass flow rate for a Venturi meter using default discharge coefficient.
      Parameters:
      massFlowKgPerHour - mass flow rate in kg/h
      pressureBara - upstream pressure in bara
      density - fluid density in kg/m³
      kappa - isentropic exponent (Cp/Cv)
      pipeDiameterMm - pipe diameter in mm
      throatDiameterMm - throat diameter in mm
      Returns:
      differential pressure in mbar
    • calculateDpFromFlow

      public static double calculateDpFromFlow(double massFlowKgPerHour, double pressureBarg, double temperatureC, String flowType, double[] flowData, List<String> components, double[] fractions, boolean normalizeFractions)
      Calculates differential pressure from mass flow rate using NeqSim thermodynamic properties.
      Parameters:
      massFlowKgPerHour - mass flow rate in kg/h
      pressureBarg - pressure in barg
      temperatureC - temperature in degrees Celsius
      flowType - device type (currently only "Venturi" supported)
      flowData - geometry parameters [pipeDiameterMm, throatDiameterMm, dischargeCoefficient]
      components - gas component names
      fractions - component fractions (mole basis)
      normalizeFractions - whether to normalise the composition fractions
      Returns:
      differential pressure in mbar