Class HeatMaterialBalance

java.lang.Object
neqsim.process.util.report.HeatMaterialBalance
All Implemented Interfaces:
Serializable

public class HeatMaterialBalance extends Object implements Serializable
Generates industry-standard Heat and Material Balance (HMB) reports from a ProcessSystem.

Produces two main sections:

  • Stream Table: All stream conditions (T, P, flow, composition) in a tabular format
  • Equipment Summary: Duties, power, pressure changes for all equipment

Usage:

ProcessSystem process = ...;
process.run();

HeatMaterialBalance hmb = new HeatMaterialBalance(process);
String json = hmb.toJson();
String csv = hmb.streamTableToCSV();
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

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

      private static final org.apache.logging.log4j.Logger logger
      Logger object for class.
    • process

      private final ProcessSystem process
      The process system to report on.
    • temperatureUnit

      private String temperatureUnit
      Unit for temperature display.
    • pressureUnit

      private String pressureUnit
      Unit for pressure display.
    • flowUnit

      private String flowUnit
      Unit for mass flow display.
  • Constructor Details

    • HeatMaterialBalance

      public HeatMaterialBalance(ProcessSystem process)
      Creates an HMB report generator for the given process.
      Parameters:
      process - the process system (must have been run)
  • Method Details

    • setTemperatureUnit

      public HeatMaterialBalance setTemperatureUnit(String unit)
      Sets the temperature unit for display.
      Parameters:
      unit - temperature unit (e.g., "C", "K", "F")
      Returns:
      this for chaining
    • setPressureUnit

      public HeatMaterialBalance setPressureUnit(String unit)
      Sets the pressure unit for display.
      Parameters:
      unit - pressure unit (e.g., "bara", "barg", "psi", "kPa")
      Returns:
      this for chaining
    • setFlowUnit

      public HeatMaterialBalance setFlowUnit(String unit)
      Sets the mass flow unit for display.
      Parameters:
      unit - flow unit (e.g., "kg/hr", "kg/sec", "lb/hr")
      Returns:
      this for chaining
    • getAllStreams

      public List<StreamInterface> getAllStreams()
      Collects all unique streams from the process system.
      Returns:
      ordered list of all streams
    • getStreamData

      public Map<String,Object> getStreamData(StreamInterface stream)
      Creates a stream data map for one stream.
      Parameters:
      stream - the stream to extract data from
      Returns:
      map of property name to value
    • getEquipmentData

      public Map<String,Object> getEquipmentData(ProcessEquipmentInterface unit)
      Creates an equipment summary for one unit operation.
      Parameters:
      unit - the equipment to summarize
      Returns:
      map of property name to value, or null if no relevant data
    • toJson

      public String toJson()
      Generates the complete HMB report as a JSON string.
      Returns:
      JSON representation of the HMB
    • streamTableToCSV

      public String streamTableToCSV()
      Generates a CSV-formatted stream table.

      Columns: Stream Name, Temperature (C), Pressure (bara), Mass Flow (unit), Molar Mass, Density, Vapour Fraction, then one column per component.

      Returns:
      CSV string of the stream table
    • round

      private static double round(double value, int places)
      Rounds a double to the specified number of decimal places.
      Parameters:
      value - the value to round
      places - number of decimal places
      Returns:
      rounded value