Class Heater

All Implemented Interfaces:
Serializable, Runnable, AutoSizeable, CapacityConstrainedEquipment, HeaterInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
Cooler, HeatExchanger, MultiStreamHeatExchanger, MultiStreamHeatExchanger2, NeqHeater, SteamHeater

Heater class.

Version:
$Id: $Id
Author:
Even Solbraa
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.
    • setTemperature

      boolean setTemperature
    • setOutPressure

      boolean setOutPressure
    • system

    • temperatureOut

      protected double temperatureOut
    • dT

      protected double dT
    • pressureOut

      protected double pressureOut
    • setEnergyInput

      private boolean setEnergyInput
    • energyInput

      private double energyInput
    • pressureDrop

      private double pressureDrop
    • temperatureUnit

      private String temperatureUnit
    • pressureUnit

      private String pressureUnit
    • coolingMediumTemperature

      double coolingMediumTemperature
    • maxOutletTemperatureLimit

      private double maxOutletTemperatureLimit
      Maximum outlet temperature limit in Kelvin. Double.MAX_VALUE means no limit.
    • minOutletTemperatureLimit

      private double minOutletTemperatureLimit
      Minimum outlet temperature limit in Kelvin. 0.0 means no limit.
    • temperatureLimitUnit

      private String temperatureLimitUnit
      Unit for temperature limits (for display/reporting purposes).
    • lastTemperature

      protected double lastTemperature
    • lastPressure

      protected double lastPressure
    • lastFlowRate

      protected double lastFlowRate
    • lastOutPressure

      protected double lastOutPressure
    • lastOutTemperature

      protected double lastOutTemperature
    • lastDuty

      protected double lastDuty
    • lastPressureDrop

      protected double lastPressureDrop
    • mechanicalDesign

      protected transient HeatExchangerMechanicalDesign mechanicalDesign
    • utilitySpecification

      private UtilityStreamSpecification utilitySpecification
    • autoSized

      private boolean autoSized
      Flag indicating if heater has been auto-sized.
    • MIN_DEFAULT_DESIGN_DUTY

      private static final double MIN_DEFAULT_DESIGN_DUTY
      Minimum default design duty in Watts when current duty is zero.
      See Also:
    • capacityConstraints

      private final Map<String, CapacityConstraint> capacityConstraints
      Storage for capacity constraints.
  • Constructor Details

    • Heater

      public Heater(String name)
      Constructor for Heater.
      Parameters:
      name - name of heater
    • Heater

      public Heater(String name, StreamInterface inStream)

      Constructor for Heater.

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

    • getMechanicalDesign

      public HeatExchangerMechanicalDesign getMechanicalDesign()

      Get a mechanicalDesign for the equipment.

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

      public void initMechanicalDesign()

      Initialize a initMechanicalDesign for the equipment.

      Specified by:
      initMechanicalDesign in interface ProcessEquipmentInterface
      Overrides:
      initMechanicalDesign in class ProcessEquipmentBaseClass
    • 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
    • getUtilitySpecification

      public UtilityStreamSpecification getUtilitySpecification()
      Returns the utility-side specification used by the mechanical design calculation.
      Returns:
      the utility specification instance for this heater/cooler
    • setUtilitySpecification

      public void setUtilitySpecification(UtilityStreamSpecification specification)
      Replace the current utility-side specification.
      Parameters:
      specification - new utility specification instance
    • setUtilitySupplyTemperature

      public void setUtilitySupplyTemperature(double temperature, String unit)
      Convenience method to set the utility supply temperature.
      Parameters:
      temperature - utility temperature value
      unit - unit of the provided value (e.g. "K" or "C")
    • setUtilityReturnTemperature

      public void setUtilityReturnTemperature(double temperature, String unit)
      Convenience method to set the utility return temperature.
      Parameters:
      temperature - utility temperature value
      unit - unit of the provided value (e.g. "K" or "C")
    • setUtilityApproachTemperature

      public void setUtilityApproachTemperature(double approach, String unit)
      Convenience method to set the minimum approach temperature between process and utility.
      Parameters:
      approach - minimum temperature difference
      unit - unit of the provided value (e.g. "K" or "C")
    • setUtilityHeatCapacityRate

      public void setUtilityHeatCapacityRate(double heatCapacityRate)
      Convenience method to set the assumed utility-side heat capacity rate.
      Parameters:
      heatCapacityRate - utility heat capacity rate in W/K
    • setUtilityOverallHeatTransferCoefficient

      public void setUtilityOverallHeatTransferCoefficient(double u)
      Convenience method to set the assumed overall heat-transfer coefficient for sizing.
      Parameters:
      u - overall heat-transfer coefficient in W/(m^2*K)
    • setdT

      public void setdT(double dT)

      setdT.

      Specified by:
      setdT in interface HeaterInterface
      Parameters:
      dT - a double
    • setOutletPressure

      public void setOutletPressure(double pressure)

      Set the outlet pressure of the heater.

      Specified by:
      setOutletPressure in interface TwoPortInterface
      Overrides:
      setOutletPressure in class TwoPortEquipment
      Parameters:
      pressure - Pressure in bara
    • setOutletPressure

      public void setOutletPressure(double pressure, String unit)
      Set outlet pressure of twoport with unit specification.
      Specified by:
      setOutletPressure in interface HeaterInterface
      Specified by:
      setOutletPressure in interface TwoPortInterface
      Overrides:
      setOutletPressure in class TwoPortEquipment
      Parameters:
      pressure - value to set
      unit - pressure unit (e.g., "bara", "barg", "Pa", "psi")
    • setOutletTemperature

      public void setOutletTemperature(double temperature)

      Set the outlet temperature of the heater.

      Specified by:
      setOutletTemperature in interface TwoPortInterface
      Overrides:
      setOutletTemperature in class TwoPortEquipment
      Parameters:
      temperature - Temperature in Kelvin
    • setOutTemperature

      @Deprecated public void setOutTemperature(double temperature)
      Deprecated.

      Set the outlet temperature of the heater.

      Specified by:
      setOutTemperature in interface TwoPortInterface
      Parameters:
      temperature - Temperature in Kelvin
    • setOutletTemperature

      public void setOutletTemperature(double temperature, String unit)
      Set outlet temperature of twoport with unit specification.
      Specified by:
      setOutletTemperature in interface HeaterInterface
      Specified by:
      setOutletTemperature in interface TwoPortInterface
      Overrides:
      setOutletTemperature in class TwoPortEquipment
      Parameters:
      temperature - value to set
      unit - temperature unit (e.g., "K", "C", "R", "F")
    • setOutTP

      public void setOutTP(double temperature, double pressure)

      Set the outlet temperature and pressure of the heater.

      Specified by:
      setOutTP in interface HeaterInterface
      Parameters:
      temperature - Temperature in Kelvin
      pressure - Pressure in bara
    • needRecalculation

      public boolean needRecalculation()

      Check if process equipment needs recalculating.

      Specified by:
      needRecalculation in interface ProcessEquipmentInterface
      Returns:
      true or false
    • 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
    • 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
    • displayResult

      public void displayResult()

      displayResult.

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

      public double getEnergyInput()

      Getter for the field energyInput.

      Returns:
      a double
    • getDuty

      public double getDuty()

      getDuty.

      Returns:
      a double
    • getDuty

      public double getDuty(String unit)

      getDuty.

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

      public void setEnergyInput(double energyInput)

      Setter for the field energyInput.

      Parameters:
      energyInput - a double
    • setDuty

      public void setDuty(double energyInput)

      setDuty.

      Parameters:
      energyInput - a double
    • setMaxDesignDuty

      public void setMaxDesignDuty(double maxDuty)
      Sets the maximum design duty (heating or cooling capacity) for capacity constraint checking.

      The duty is specified in Watts (W). Positive values indicate heating capacity, negative values indicate cooling capacity. For constraint checking, the absolute value is used.

      Parameters:
      maxDuty - maximum design duty in Watts [W]
    • setMaxDesignDuty

      public void setMaxDesignDuty(double maxDuty, String unit)
      Sets the maximum design duty with unit specification.
      Parameters:
      maxDuty - maximum design duty value
      unit - unit of the duty value (e.g., "W", "kW", "MW")
    • getMaxDesignDuty

      public double getMaxDesignDuty()
      Gets the maximum design duty for this heater/cooler.
      Returns:
      maximum design duty in Watts [W]
    • getMaxDesignDuty

      public double getMaxDesignDuty(String unit)
      Gets the maximum design duty in the specified unit.
      Parameters:
      unit - unit for the returned value (e.g., "W", "kW", "MW")
      Returns:
      maximum design duty in the specified unit
    • setMaxOutletTemperature

      public void setMaxOutletTemperature(double maxTemp)
      Sets the maximum outlet temperature limit in Kelvin.

      When set, this creates a capacity constraint that tracks whether the outlet temperature exceeds this limit. Useful for coolers where a maximum cooling temperature is desired.

      Parameters:
      maxTemp - maximum outlet temperature in Kelvin [K]
    • setMaxOutletTemperature

      public void setMaxOutletTemperature(double maxTemp, String unit)
      Sets the maximum outlet temperature limit with unit specification.
      Parameters:
      maxTemp - maximum outlet temperature value
      unit - unit of the temperature value (e.g., "K", "C")
    • getMaxOutletTemperature

      public double getMaxOutletTemperature()
      Gets the maximum outlet temperature limit.
      Returns:
      maximum outlet temperature in Kelvin [K], or Double.MAX_VALUE if not set
    • getMaxOutletTemperature

      public double getMaxOutletTemperature(String unit)
      Gets the maximum outlet temperature limit in the specified unit.
      Parameters:
      unit - unit for the returned value (e.g., "K", "C")
      Returns:
      maximum outlet temperature in the specified unit
    • setMinOutletTemperature

      public void setMinOutletTemperature(double minTemp)
      Sets the minimum outlet temperature limit in Kelvin.

      When set, this creates a capacity constraint that tracks whether the outlet temperature falls below this limit. Useful for heaters where a minimum heating temperature is desired.

      Parameters:
      minTemp - minimum outlet temperature in Kelvin [K]
    • setMinOutletTemperature

      public void setMinOutletTemperature(double minTemp, String unit)
      Sets the minimum outlet temperature limit with unit specification.
      Parameters:
      minTemp - minimum outlet temperature value
      unit - unit of the temperature value (e.g., "K", "C")
    • getMinOutletTemperature

      public double getMinOutletTemperature()
      Gets the minimum outlet temperature limit.
      Returns:
      minimum outlet temperature in Kelvin [K], or 0.0 if not set
    • getMinOutletTemperature

      public double getMinOutletTemperature(String unit)
      Gets the minimum outlet temperature limit in the specified unit.
      Parameters:
      unit - unit for the returned value (e.g., "K", "C")
      Returns:
      minimum outlet temperature in the specified unit
    • hasMaxOutletTemperatureLimit

      public boolean hasMaxOutletTemperatureLimit()
      Checks if a maximum outlet temperature limit has been set.
      Returns:
      true if a maximum outlet temperature limit is configured
    • hasMinOutletTemperatureLimit

      public boolean hasMinOutletTemperatureLimit()
      Checks if a minimum outlet temperature limit has been set.
      Returns:
      true if a minimum outlet temperature limit is configured
    • isSetEnergyInput

      public boolean isSetEnergyInput()

      isSetEnergyInput.

      Returns:
      a boolean
    • setSetEnergyInput

      public void setSetEnergyInput(boolean setEnergyInput)

      Setter for the field setEnergyInput.

      Parameters:
      setEnergyInput - a boolean
    • getPressureDrop

      public double getPressureDrop()

      Getter for the field pressureDrop.

      Returns:
      the pressureDrop
    • setPressureDrop

      public void setPressureDrop(double pressureDrop)

      Setter for the field pressureDrop.

      Parameters:
      pressureDrop - the pressureDrop to set
    • setOutStream

      @Deprecated public void setOutStream(StreamInterface outStream)
      Deprecated.

      Setter for the field outStream.

      Parameters:
      outStream - the outStream to set
    • 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
    • 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
    • autoSize

      public void autoSize(double safetyFactor)
      Automatically size the equipment based on connected stream conditions.

      This method calculates dimensions and design parameters using the inlet stream properties and applies the specified safety factor. The equipment must have a valid inlet stream connected before calling this method.

      Specified by:
      autoSize in interface AutoSizeable
      Parameters:
      safetyFactor - multiplier for design capacity, typically 1.1-1.3 (10-30% over design)
    • autoSize

      public void autoSize()
      Automatically size using default safety factor (1.2 = 20% margin).
      Specified by:
      autoSize in interface AutoSizeable
    • autoSize

      public void autoSize(String company, String trDocument)
      Automatically size using company-specific design standards.

      This method applies design rules from the specified company's technical requirements (TR) documents. The standards are loaded from the NeqSim design database.

      Specified by:
      autoSize in interface AutoSizeable
      Parameters:
      company - company name (e.g., "Equinor", "Shell", "TotalEnergies")
      trDocument - TR document reference (e.g., "TR2000", "DEP-31.38.01.11")
    • isAutoSized

      public boolean isAutoSized()
      Check if equipment has been auto-sized.
      Specified by:
      isAutoSized in interface AutoSizeable
      Returns:
      true if autoSize() has been called successfully
    • getSizingReport

      public String getSizingReport()
      Get a detailed sizing report after auto-sizing.

      The report includes:

      • Design basis (flow rates, pressures, temperatures)
      • Calculated dimensions
      • Design parameters (K-factor, Cv, velocity, etc.)
      • Safety margins
      Specified by:
      getSizingReport in interface AutoSizeable
      Returns:
      formatted sizing report string
    • getSizingReportJson

      public String getSizingReportJson()
      Get sizing report as JSON for programmatic access.
      Specified by:
      getSizingReportJson in interface AutoSizeable
      Returns:
      JSON string with sizing data
    • initializeCapacityConstraints

      protected void initializeCapacityConstraints()
      Initializes default capacity constraints for the heater.
    • getCapacityConstraints

      public Map<String, CapacityConstraint> getCapacityConstraints()
      Gets all capacity constraints defined for this equipment.

      The map keys are constraint names (e.g., "speed", "gasLoadFactor") and values are the corresponding CapacityConstraint objects containing design values, current values, and utilization calculations.

      Specified by:
      getCapacityConstraints in interface CapacityConstrainedEquipment
      Returns:
      unmodifiable map of constraint name to CapacityConstraint
    • getBottleneckConstraint

      public CapacityConstraint getBottleneckConstraint()
      Gets the constraint with the highest utilization (the bottleneck).

      This method identifies which constraint is closest to or exceeding its design limit. Use this to determine what is limiting equipment capacity.

      Specified by:
      getBottleneckConstraint in interface CapacityConstrainedEquipment
      Returns:
      the bottleneck constraint, or null if no constraints are defined
    • isCapacityExceeded

      public boolean isCapacityExceeded()
      Checks if any capacity constraint is violated (exceeds 100% utilization).

      A violated constraint means the equipment is operating beyond its design capacity. For HARD constraints, this may indicate equipment trip or failure. For SOFT constraints, this indicates reduced efficiency or accelerated wear.

      Specified by:
      isCapacityExceeded in interface CapacityConstrainedEquipment
      Returns:
      true if any constraint utilization exceeds 1.0 (100%)
    • isHardLimitExceeded

      public boolean isHardLimitExceeded()
      Checks if any HARD constraint limit is exceeded.

      HARD limits represent absolute equipment limits (e.g., maximum speed) that cannot be exceeded without equipment trip or damage. This is more severe than general capacity exceedance.

      Specified by:
      isHardLimitExceeded in interface CapacityConstrainedEquipment
      Returns:
      true if any HARD constraint's max value is exceeded
    • getMaxUtilization

      public double getMaxUtilization()
      Gets the maximum utilization across all constraints.

      This gives a single number representing how close the equipment is to its limiting constraint. Values above 1.0 indicate the equipment is over capacity.

      Specified by:
      getMaxUtilization in interface CapacityConstrainedEquipment
      Returns:
      maximum utilization as fraction (1.0 = 100% of design capacity)
    • addCapacityConstraint

      public void addCapacityConstraint(CapacityConstraint constraint)
      Adds a new capacity constraint to this equipment.

      This allows dynamic addition of constraints at runtime. Constraints can be added during equipment configuration or based on operating conditions.

      Specified by:
      addCapacityConstraint in interface CapacityConstrainedEquipment
      Parameters:
      constraint - the constraint to add
    • removeCapacityConstraint

      public boolean removeCapacityConstraint(String constraintName)
      Removes a capacity constraint by name.
      Specified by:
      removeCapacityConstraint in interface CapacityConstrainedEquipment
      Parameters:
      constraintName - the name of the constraint to remove
      Returns:
      true if the constraint was found and removed
    • clearCapacityConstraints

      public void clearCapacityConstraints()
      Clears all capacity constraints from this equipment.
      Specified by:
      clearCapacityConstraints in interface CapacityConstrainedEquipment