This class processes data from a CSV file containing power-related information. It performs the following steps:
This library provides a powerful tool for processing and interpolating data related to heat pump systems. The main class, `HeatPump`, is designed to handle the following tasks:
1. Data Preparation:
- Reads the CSV file into a pandas DataFrame.
- Sorts the DataFrame by 'n_comp_perc', 'T_source_in', 'T_sink_out', and 'Q_dot_H'.
- Create an array with all unique n_comp_perc values.
- Converts per 'n_comp_perc' value the relevant columns into a numpy 2D array, with T_source_in and T_sink_out as coordinates.
- Assigns the relevant 'P_comp' value to each point in the array.
2. KD-Tree Creation:
- Constructs a KD-Tree for each of the 2D arrays.
- Saves the KD-Trees within the class.
3. User Queries:
- Users can request information for a specific point (given 'T_source_in', 'T_sink_out', and 'Q_dot_H').
- Choose either 'n_comp_perc', 'P_comp', 'COP' or 'eta_II'.
- If the requested point does not exist in the 3D array, the KD-Tree identifies the closest points.
- Interpolates values from these nearby points to estimate the requested value.
4. Interpolation Method:
- Utilizes a normalized inverse distance weighting (IDW) technique.
- Reads a CSV file containing information, such as compressor rpm percentage, source and sink temperatures, heating power, and electrical power.
- Sorts the data and extracts unique compressor rpm percentage values.
- Organizes the data into separate sets based on the unique rpm percentages, storing the corresponding coordinate values (T_source_in, T_sink_out) and power values (heating power, electrical power).
- Constructs efficient KD-Trees for each set of coordinate data to enable fast nearest neighbor searches.
2. Interpolation:
- Provides a method to calculate the interpolated value at a specified coordinate point (T_source_in, T_sink_out) using an inverse distance weighting (IDW) technique.
- The interpolation can be performed for various power-related values, such as compressor rpm percentage, electrical power, Coefficient of Performance (COP), and second law efficiency (exergetic efficiency).
3. User-Friendly Interfaces:
- Offers several methods to directly calculate the interpolated values for specific use cases, such as `getN_comp_perc`, `getElectricalPower`, `getCOP`, and `getEta_II`.
- These methods handle the underlying interpolation process and return the desired values, making it easy for users to integrate the library into their applications.
The `HeatPump` class is designed to be efficient, accurate, and user-friendly, providing a comprehensive solution for working with heat pump data and performing various interpolations. It can be particularly useful for researchers, engineers, or anyone involved in the design, optimization, or analysis of heat pump systems.
Union[float, tuple]: Interpolated compressor rpm-percentage value or a tuple of (rpm-percentage value, indices of the 2 sets this value is located between).
Notes:
- The function uses interpolation to estimate the compressor rpm-percentage based on the given temperatures and heating power.
- It considers the K nearest neighbors to perform the interpolation.
- Ensure that the provided coordinate point lies within the valid range of data for accurate results.
- Uses interpolation to estimate the compressor rpm-percentage based on the given temperatures and heating power.
- Considers the K nearest neighbors to perform the interpolation.
- Ensures that the provided coordinate point lies within the valid range of data for accurate results.
- The argument _returnIndices is intended for internal use within the class. It passes the relevant sets for a next interpolation step.