Skip to content

Commit

Permalink
Added class Same_Built to find heatpumps more easily
Browse files Browse the repository at this point in the history
  • Loading branch information
xihaui committed Jul 3, 2022
1 parent 917539f commit ed4578e
Show file tree
Hide file tree
Showing 7 changed files with 26,334 additions and 26,251 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include setup.py
include hplib/hplib_database.csv
include hplib/hplib.py
include hplib/same_built_type.pkl
include hplib_database.csv
include hplib/hplib_database_all.csv

global-exclude __pycache__
global-exclude *.pyc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For the simulation, it is possible to calculate outputs of a **specific manufact

**For reference purposes:**
- DOI: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5521597.svg)](https://doi.org/10.5281/zenodo.5521597)
- Citation: Tjarko Tjaden, Hauke Hoops, Kai Rösken. (2021). RE-Lab-Projects/hplib: heat pump library (v1.7). Zenodo. https://doi.org/10.5281/zenodo.5521597
- Citation: Tjarko Tjaden, Hauke Hoops, Kai Rösken. (2021). RE-Lab-Projects/hplib: heat pump library (v1.8). Zenodo. https://doi.org/10.5281/zenodo.5521597

## Documentation

Expand Down
55 changes: 55 additions & 0 deletions hplib/hplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ def load_database() -> pd.DataFrame:
return df


def load_all_heat_pumps() -> pd.DataFrame:
"""
Loads data from all heat pumps for heating.
Returns
-------
df : pd.DataFrame
Content of the database
"""
df = pd.read_csv(cwd()+r'/hplib_database_all.csv')
return df


def get_parameters(model: str, group_id: int = 0,
t_in: int = 0, t_out: int = 0, p_th: int = 0) -> pd.DataFrame:
"""
Expand Down Expand Up @@ -768,3 +781,45 @@ def calc_heating_dist_temp(self, t_avg_d: float):
t_dist = [t_hf, t_hr]

return t_dist

class Same_Built:
def __init__(self):
"""
Init function to load Database.
Parameters:
----------
"""
self.all_hp=load_all_heat_pumps()
self.df = pd.read_csv(cwd()+r'/hplib_database.csv', delimiter=',')

def all_to_database(self, modelname: string) -> str:
"""
If the heatpump is in hplib/hplib_database_all.csv but not in hplib/hplib_database.csv use this function to find the heatpump with equivalent fitting parameters.
Parameters
----------
modelname : the modelname which is in the hplib_database_all.csv
Returns
----------
same_built : modelname of the model in hplib_database.csv
"""
model=self.df.loc[self.df['p3_P_el_h [-]']==(self.all_hp.loc[self.all_hp['Model']==modelname,'p3_P_el_h [-]'][self.all_hp.loc[self.all_hp['Model']==modelname].index[0]]),'Model'].values[0]
return model

def database_to_all(self, modelname: string) -> list:
"""
If the heatpump is in hplib/hplib_database.csv use this function to find the heatpumps with equivalent fitting parameters.
Returns all models which have the same parameters. But different names.
Parameters
----------
modelname : the modelname which is in the hplib_database.csv
Returns
----------
same_built : list of all models with same fitting parameters
"""
same_built=pd.read_pickle(cwd()+r'/same_built_type.pkl')[modelname]
return (same_built)
1,020 changes: 510 additions & 510 deletions hplib/hplib_database.csv

Large diffs are not rendered by default.

Loading

0 comments on commit ed4578e

Please sign in to comment.