Class CompressorChartJsonReader

java.lang.Object
neqsim.process.equipment.compressor.CompressorChartJsonReader

public class CompressorChartJsonReader extends Object
Reader for compressor chart data from JSON files.

Expected JSON format:

{
  "compressorName": "Compressor Name",
  "headUnit": "kJ/kg",
  "maxDesignPower_kW": 16619.42,
  "speedCurves": [
    {
      "speed_rpm": 2000.0,
      "flow_m3h": [9598.75, 10892.21, ...],
      "head_kJkg": [33.36, 32.15, ...],
      "polytropicEfficiency_pct": [78.30, 78.20, ...]
    },
    ...
  ]
}
Version:
1.0
Author:
esol
  • Field Details

    • speeds

      private double[] speeds
    • flowLines

      private double[][] flowLines
    • headLines

      private double[][] headLines
    • polyEffLines

      private double[][] polyEffLines
    • surgeFlow

      private double[] surgeFlow
    • surgeHead

      private double[] surgeHead
    • chokeFlow

      private double[] chokeFlow
    • chokeHead

      private double[] chokeHead
    • headUnit

      private String headUnit
    • compressorName

      private String compressorName
    • maxDesignPower

      private double maxDesignPower
  • Constructor Details

    • CompressorChartJsonReader

      public CompressorChartJsonReader(String jsonFilePath) throws Exception
      Constructor for CompressorChartJsonReader.
      Parameters:
      jsonFilePath - path to JSON file
      Throws:
      Exception - if file cannot be read or parsed
    • CompressorChartJsonReader

      public CompressorChartJsonReader(Reader reader) throws Exception
      Constructor for CompressorChartJsonReader from Reader.
      Parameters:
      reader - a Reader containing JSON data
      Throws:
      Exception - if JSON cannot be parsed
    • CompressorChartJsonReader

      public CompressorChartJsonReader(String jsonString, boolean isJsonString) throws Exception
      Constructor for CompressorChartJsonReader from JSON string.
      Parameters:
      jsonString - JSON string containing chart data
      isJsonString - flag to indicate this is a JSON string (not file path)
      Throws:
      Exception - if JSON cannot be parsed
  • Method Details

    • parseJson

      private void parseJson(Reader reader) throws Exception
      Throws:
      Exception
    • parseJsonString

      private void parseJsonString(String jsonString) throws Exception
      Throws:
      Exception
    • parseJsonObject

      private void parseJsonObject(com.google.gson.JsonObject root) throws Exception
      Throws:
      Exception
    • minIndex

      private int minIndex(double[] array)
    • maxIndex

      private int maxIndex(double[] array)
    • setCurvesToCompressor

      public void setCurvesToCompressor(Compressor compressor)
      Apply the loaded chart data to a compressor.
      Parameters:
      compressor - the compressor to configure
    • getCompressorName

      public String getCompressorName()
      Get the compressor name from JSON.
      Returns:
      compressor name
    • getMaxDesignPower

      public double getMaxDesignPower()
      Get the max design power from JSON.
      Returns:
      max design power in kW
    • getHeadUnit

      public String getHeadUnit()
      Get the head unit from JSON.
      Returns:
      head unit string
    • getSpeeds

      public double[] getSpeeds()
      Get the speed values.
      Returns:
      array of speeds in RPM
    • getFlowLines

      public double[][] getFlowLines()
      Get the flow lines for each speed curve.
      Returns:
      2D array of flow values in m3/h
    • getHeadLines

      public double[][] getHeadLines()
      Get the head lines for each speed curve.
      Returns:
      2D array of head values
    • getPolyEffLines

      public double[][] getPolyEffLines()
      Get the polytropic efficiency lines for each speed curve.
      Returns:
      2D array of efficiency values in %
    • getSurgeFlow

      public double[] getSurgeFlow()
      Get surge flow for each speed curve.
      Returns:
      array of surge flow values
    • getSurgeHead

      public double[] getSurgeHead()
      Get surge head for each speed curve.
      Returns:
      array of surge head values
    • getChokeFlow

      public double[] getChokeFlow()
      Get choke flow for each speed curve.
      Returns:
      array of choke flow values
    • getChokeHead

      public double[] getChokeHead()
      Get choke head for each speed curve.
      Returns:
      array of choke head values