-
Notifications
You must be signed in to change notification settings - Fork 39
Compressor curves
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.
-
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.
-
Initialize Variables: The method starts by assigning the input values to the class-level variables for speed, flow, head, and polytropic efficiency.
-
Determine Maximum Length: It then determines the maximum length among the
flow,head, andpolytropic efficiencyarrays to dynamically initialize arrays (redhead,redpolytropicEfficiency,redflow) for storing reduced values. -
Iterate Through Speed Values:
- For each speed, it creates a
CompressorCurveobject representing the compressor's performance at that speed, and adds it to thechartValueslist. - 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).
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.
- For each speed, it creates a
-
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). -
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
-
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). -
Enable Compressor Chart: Finally, the use of the compressor chart is enabled by calling
setUseCompressorChart(true).
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.
Description:
Retrieves a list of reference speeds that are closest to the given speed. This method helps in identifying reference speeds for further calculations such as interpolation.
Parameters:
-
speed(double): The speed value for which the closest reference speeds are sought.
Returns:
-
ArrayList<Double>: A list containing the closest reference speeds.
-
Sort the Reference Speeds:
Let the reference speeds be represented by an arrayspeedArrayof sizen.
SortspeedArrayin ascending order. -
Check for Exact Match:
Iterate through the sortedspeedArrayto check if the inputspeedmatches any value.
If a match is found, add the speed to the list of closest reference speeds. -
Determine the Closest Reference Speeds:
If no exact match is found, use a method similar to binary search (bisect_left) to determine the positionposwherespeedwould fit in the sorted array.- If
pos == 0, the input speed is lower than the lowest reference speed. The closest reference speed is the first element inspeedArray. - If
pos == n, the input speed is higher than the highest reference speed. The closest reference speed is the last element inspeedArray. - Otherwise, the input speed lies between two reference speeds. The closest reference speeds are the elements at positions
pos - 1andpos.
- If
-
Add the Closest Speeds to the List:
Based on the determined position, add the closest reference speeds to the result list.
Consider an array of reference speeds: speedArray = [50, 100, 200, 300, 400].
- If
speed = 250, the method will identify thatspeedlies between200and300. Thus, the closest reference speeds are[200, 300]. - If
speed = 100, the exact match is found, and the closest reference speed is[100]. - If
speed = 50, which is below the lowest reference speed, the closest reference speed is[50].
Description:
Calculates the polytropic head for a given flow rate and speed using spline interpolation.
-
Find the Closest Reference Speeds:
UsegetClosestRefSpeedsto determine the reference speeds closest to the given speed. -
Spline Interpolation:
For each reference speed, interpolate the polytropic head using spline interpolation.Spline Interpolation Process:
Given a set of data points(xi, yi), wherexirepresents the flow rate andyirepresents the polytropic head at that flow rate, spline interpolation is used to create a smooth curve that passes through all the given points.
The interpolation is performed using a piecewise cubic polynomial known as a cubic spline. This ensures that the first and second derivatives are continuous at each of the data points, resulting in a smooth curve.Mathematical Formulation:
For each interval[xi, xi+1], the cubic spline is represented by a polynomial of the form:
Si(x) = ai + bi * (x - xi) + ci * (x - xi)^2 + di * (x - xi)^3
whereai,bi,ci, anddiare coefficients determined based on the boundary conditions and continuity requirements of the spline. -
Calculate Polytropic Head:
Use the interpolated values from the spline to determine the polytropic head for the given flow rate at the specific reference speed. -
Combine Results:
Combine the interpolated results from each reference speed to provide a comprehensive polytropic head calculation.
This class is part of the neqsim.process.equipment.compressor package and extends the CompressorChartAlternativeMapLookup class. It provides methods for interpolating or extrapolating compressor data, including polytropic head and efficiency, based on flow and speed. The class also supports determining the closest reference speeds to a given speed.
Description: Retrieves the closest reference speeds to the given speed from the compressor chart values.
- If the given speed matches a reference speed, the method returns that speed.
- If the given speed is between two reference speeds, both speeds are returned.
- If the given speed is outside the range of reference speeds, the closest boundary speed is returned.
-
speed: The speed to find the closest reference speeds for.
- A list of the closest reference speeds.
-
IllegalStateExceptionif no reference speeds are available.
Description: Calculates the polytropic head for a given flow and speed by interpolating or extrapolating between reference compressor curves.
-
flow: Flow rate for which the polytropic head is calculated. -
speed: Operating speed of the compressor.
- The polytropic head at the given flow and speed.
- For interpolation or extrapolation: Head = Spline(flow) or: Head = Linear Interpolation/Extrapolation using speeds and heads
Description: Calculates the polytropic efficiency for a given flow and speed by interpolating or extrapolating between reference compressor curves.
-
flow: Flow rate for which the efficiency is calculated. -
speed: Operating speed of the compressor.
- The polytropic efficiency at the given flow and speed.
-
IllegalArgumentExceptionif no valid reference speeds are found or if the curve data is invalid.
- For interpolation or extrapolation: Efficiency = Spline(flow) or: Efficiency = Linear Interpolation/Extrapolation using speeds and efficiencies
extrapolateOrInterpolate(double flow, double[] flowData, double[] valueData, PolynomialSplineFunction spline)
Description: Performs extrapolation or interpolation for a given flow based on flow data, value data, and a spline function.
-
flow: Flow value for extrapolation or interpolation. -
flowData: Array of flow data points. -
valueData: Array of value data points corresponding toflowData. -
spline: Polynomial spline function created fromflowDataandvalueData.
- The interpolated or extrapolated value at the given flow.
- Below range: Value = Value[0] + Slope * (Flow - Flow[0])
- Above range: Value = Value[last] + Slope * (Flow - Flow[last])
extrapolateOrInterpolateSpeed(double speed, double speed1, double speed2, double value1, double value2)
Description: Performs extrapolation or interpolation based on speed and two reference speeds with corresponding values.
-
speed: Speed for extrapolation or interpolation. -
speed1,speed2: Reference speeds. -
value1,value2: Values corresponding tospeed1andspeed2.
- The interpolated or extrapolated value at the given speed.
- Below range: Value = Value1 + Slope * (Speed - Speed1)
- Above range: Value = Value2 + Slope * (Speed - Speed2)
Description: Performs linear interpolation for a value based on two known points.
-
x: X-value at which to interpolate. -
x1,x2: Known x-values. -
y1,y2: Known y-values corresponding tox1andx2.
- The interpolated y-value at the given x.
y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1)
This class generates compressor charts for a given compressor based on specified options. It supports generating normal curves and alternative curves while ensuring realistic flow, head, and efficiency values.
Description: Initializes the generator with the given compressor.
-
Parameter:
-
inpCompressor: The compressor object for which charts are generated.
-
Description: Generates a compressor chart based on the specified generation option.
-
Parameter:
-
generationOption: Specifies the chart type. Use"normal curves"for normalized data or other values for alternative curves.
-
-
Returns: A
CompressorChartobject containing the generated curves.
-
Flow Data:
- For "normal curves":
Flow[0] = Reference Flow / 1.3 Flow[1] = Reference Flow Flow[2] = Reference Flow * (2.5 / 1.3) - For other options:
Flow[0] = Reference Flow * 0.7 Flow[1] = Reference Flow Flow[2] = Reference Flow * 1.43
- For "normal curves":
-
Head Data:
- For "normal curves":
Head[0] = Reference Head * 1.2 Head[1] = Reference Head Head[2] = Reference Head * 1.2 * 0.4 - For other options:
Head[0] = Reference Head * 1.5 Head[1] = Reference Head Head[2] = Reference Head * 0.5
- For "normal curves":
-
Efficiency Data: Efficiency[0] = Reference Efficiency * 100.0 * 0.9 Efficiency[1] = Reference Efficiency * 100.0 Efficiency[2] = Reference Efficiency * 100.0 * 0.85
markdown Kopier kode
- Surge Flow:
- For "normal curves":
Surge Flow Min = Reference Flow * 0.7 Surge Flow Ref = Reference Flow / 1.3 Surge Flow Max = Reference Flow * 0.9 - For other options:
Surge Flow Min = Reference Flow * 0.7 Surge Flow Ref = Reference Flow * 0.8 Surge Flow Max = Reference Flow * 0.9
- Surge Head:
- Calculated using the
getPolytropicHeadmethod fromCompressorChart:Head[Min] = getPolytropicHead(Min Flow, Min Speed) Head[Ref] = getPolytropicHead(Reference Flow, Reference Speed) Head[Max] = getPolytropicHead(Max Flow, Max Speed)
- Initialize Conditions:
- Retrieve reference speed, flow, and head from the compressor.
- Initialize arrays for flow, head, and efficiency based on the chosen generation option.
- Configure Compressor Chart:
- Use normalized or alternative data for chart conditions.
- Set head unit as
"kJ/kg".
- Generate Surge Curve:
- Define surge flow and head values for minimum, reference, and maximum conditions.
- Create a
SurgeCurveobject and add it to the compressor chart.
- The flow, head, and efficiency data are normalized or scaled based on the generation option.
- Surge points are calculated to ensure realistic and accurate compressor performance curves.
- This implementation adheres to best practices for compressor modeling, supporting both normal and alternative configurations.
Wiki:
- Getting started with NeqSim and GitHub
- Getting started as a NeqSim developer
- The NeqSim parameter database
Docs:
- Modules Overview
- Reference Manual Index
- Developer Setup
- Contributing Structure
- Getting Started Guide
- Usage Examples
- FAQ
Wiki: 4. Setting up a fluid and flash calculations 5. Select EOS and mixing rule 6. Flash and phase envelope calculations 7. Thermodynamic and physical properties
Docs - Fundamentals:
- Thermo Module Overview
- Thermodynamics Guide
- Fluid Creation Guide
- Component Database Guide
- Mathematical Models
Docs - Equations of State:
Docs - Flash & Operations:
- Flash Calculations Guide
- Flash Equations and Tests
- Thermodynamic Operations
- Thermodynamic Workflows
- Property Flash Workflows
Wiki: 8. Oil Characterization 9. Aqueous fluids 10. Electrolytes
Docs:
- Fluid Characterization
- TBP Fraction Models
- PVT Fluid Characterization
- Fluid Characterization Mathematics
Docs - Overview:
Docs - Specific Models:
- Viscosity Models
- Viscosity Models (Physical Properties)
- Density Models
- Thermal Conductivity Models
- Diffusivity Models
- Interfacial Properties
- Steam Tables IF97
- Humid Air Calculations
Wiki: 11. Process Calculations
Docs - Fundamentals:
- Process Module Overview
- Process Simulation Guide
- Advanced Process Simulation
- Logical Unit Operations
- Process Control
- Process Controllers
Docs - Advanced Process Logic:
- Process Logic Framework
- Process Logic Implementation
- Process Logic Enhancements
- Advanced Process Logic
- Runtime Logic Flexibility
- Integrated Workflow Guide
- Equipment Factory
- Process Calculator
- Graph-Based Process Simulation
- Parallel Process Simulation
- Recycle Acceleration Guide
- Differentiable Thermodynamics
- Derivatives and Gradients
Compressors & Turbomachinery:
- Compressor Calculations (Wiki)
- Compressor Curves (Wiki)
- Compressors
- Expanders
- Turboexpander Compressor Model
- Ejectors
Pumps:
Separation:
Heat Transfer:
Valves & Flow Control:
Tanks & Storage:
Streams & Mixers:
Reactors:
Wells:
Energy & Special Equipment:
Docs - Overview:
Docs - Single Phase Flow:
Docs - Two-Phase & Multiphase:
Docs - Pressure Drop & Friction:
Docs - Heat & Mass Transfer:
- Pipeline Heat Transfer
- Pipe Wall Heat Transfer
- Heat Transfer
- Interphase Heat Mass Transfer
- Mass Transfer
Docs - Transient Flow:
- Multiphase Transient Model
- Transient Multiphase Pipe
- Pipeline Transient Simulation
- Pipeline Model Recommendations
- Water Hammer Implementation
- Two-Phase Flow Development Plan
Docs - PVT Simulation:
Docs - Black Oil:
Docs - Gas Quality:
Docs - Asphaltene:
- Flow Assurance Overview
- Asphaltene Modeling
- Asphaltene CPA Calculations
- Asphaltene DeBoer Screening
- Asphaltene Method Comparison
- Asphaltene Parameter Fitting
- Asphaltene Validation
Wiki: 18. Dynamic process simulations
Docs:
Docs - Overview:
Docs - Relief & Blowdown:
- PSV Dynamic Sizing
- PSV Dynamic Sizing (Safety)
- Rupture Disk Dynamic Behavior
- ESD Blowdown System
- Fire Blowdown Capabilities
- Fire Heat Transfer Enhancements
Docs - HIPPS:
Docs - Safety Systems:
- Integrated Safety Systems
- SIS Logic Implementation
- Pressure Monitoring ESD
- PSD Valve HIHI Trip
- ESD Fire Alarm System
- Choke Collapse Protection
- Alarm System Guide
- Alarm Triggered Logic Example
- Integration Safety Chain Tests
- Process Safety Scenarios
Docs:
- Standards Overview
- ASTM D6377 RVP
- Dew Point Standards
- ISO 15403 CNG Quality
- ISO 6578 LNG Density
- ISO 6976 Calorific Values
- Sales Contracts
Docs:
Wiki: 15. How to make a NeqSim API
Docs - Overview:
Docs - AI/ML:
Docs - MPC & Control:
Docs - Risk & Safety:
Docs:
- Bottleneck Analysis
- Field Development Planning
- Field Development Engine
- Batch Studies
- Calibration
- Sustainability & Emissions
- Future Infrastructure
- Future API Reference
- Lifecycle Management
Wiki: 12. Adding a thermodynamic model 13. Adding a viscosity model 14. Adding a unit operation
Docs:
Wiki: 16. Create native image using GraalVM 17. Profiling calculations
Jupyter Notebooks:
- ESP Pump Tutorial
- PVT Simulation and Tuning
- MPC Integration Tutorial
- AI Platform Integration
- Graph-Based Simulation
Java Examples:
- Java Test Examples
- Flow Regime Detection
- Multiphase Pressure Drop Comparison
- Transient Pipeline Liquid Accumulation
- Well to Oil Stabilization
External: