Skip to content
Even Solbraa edited this page Nov 17, 2024 · 13 revisions

Compressor Calculations using fan law

https://github.com/equinor/neqsim/blob/master/src/main/java/neqsim/process/equipment/compressor/CompressorChart.java

Overview

The setCurves method initializes the compressor performance curves, including speed, flow, head, and polytropic efficiency. It takes various inputs to initialize internal variables for different performance parameters, normalize them, and calculate reduced values.

The method also fits polynomial functions to represent relationships between the reduced parameters, which are later used for compressor performance analysis.

Parameters

  • chartConditions (double[]): An array of conditions used for the compressor chart. (Currently unused)
  • speed (double[]): An array representing the compressor speed values.
  • flow (double[][]): A 2D array representing the flow rates at different speeds.
  • head (double[][]): A 2D array representing the head values at different speeds.
  • polyEff (double[][]): A 2D array representing the polytropic efficiency values at different speeds.

Method Workflow

  1. Initialize Variables: The method starts by assigning the input values to the class-level variables for speed, flow, head, and polytropic efficiency.

  2. Determine Maximum Length: It then determines the maximum length among the flow, head, and polytropic efficiency arrays to dynamically initialize arrays (redhead, redpolytropicEfficiency, redflow) for storing reduced values.

  3. Iterate Through Speed Values:

    • For each speed, it creates a CompressorCurve object representing the compressor's performance at that speed, and adds it to the chartValues list.
    • It computes the reduced values (redflow, redhead, redpolytropicEfficiency) by normalizing the original values with respect to speed. These reduced values are used to add data points to curve fitters (reducedHeadFitter, reducedPolytropicEfficiencyFitter, fanLawCorrectionFitter).
    • A fan law correction is also computed, but a TODO note indicates that the current implementation may require adjustment.

    The reduced values are computed using the following equations:

    • Reduced Flow:

      Q_red = Q / N

      Where:

      • Q is the flow rate at a given speed.
      • N is the speed.
    • Reduced Head:

      H_red = H / N^2

      Where:

      • H is the head at a given speed.
      • N is the speed.
    • Fan Law Correction:

      Q_fanlaw = Q * (N / N_0)

      Where:

      • Q_fanlaw is the flow rate corrected by the fan law.
      • N_0 is the reference speed.
  4. Fill Remaining Slots: If any of the original arrays (flow, head, polyEff) have fewer elements than the maximum length, the remaining slots are filled with default values (e.g., 0).

  5. Calculate Reference Speed: The reference speed is calculated as the average of the maximum and minimum speed values.

    N_ref = (N_max + N_min) / 2

  6. Fit Polynomial Functions: Polynomial functions are fitted to the reduced head, polytropic efficiency, and fan law correction data using a second-degree polynomial curve fitter (PolynomialCurveFitter).

  7. Enable Compressor Chart: Finally, the use of the compressor chart is enabled by calling setUseCompressorChart(true).

Example Usage

The setCurves method is typically used to set up compressor performance charts, which are critical for analyzing the performance of compressors under different operating conditions. This is useful in both simulation and optimization tasks.

Clone this wiki locally