Skip to content

Commit

Permalink
Merge pull request #263 from greco-project/fix/release_bugs
Browse files Browse the repository at this point in the history
Fix bugs before release
  • Loading branch information
SabineHaas authored Mar 23, 2021
2 parents 2fcc9e0 + 2c931bc commit 0d045c4
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Here is a template for new release sections
### Removed
-
### Fixed
-
- Bug fix `fixcosts.csv` in test data (#263)
- Bug fix in setup.py (#263)

## [0.0.1] - 2021-03-22

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def read(fname):
"multi_vector_simulator==0.5.5",
"greco_technologies @ git+https://github.com/greco-project/greco_technologies.git@dev#egg=greco_technologies-0",
"cpvlib @ git+https://github.com/isi-ies-group/cpvlib.git@2020-11#egg=cpvlib-0",
"mock>=3.0.5" "plotly==4.14.2",
"mock>=3.0.5",
"plotly==4.14.2",
"seaborn",
"Pyomo==5.7.2",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
,unit,distribution_grid,engineering,operation
age_installed,year,0,0,0
lifetime,year,0,0,0
age_installed,year,10,0,0
lifetime,year,30,20,20
development_costs,currency,0.0,0,0
specific_costs_om,currency/year,0,0,0
specific_costs,currency,0.0,0,0
specific_costs,currency,0.0,0,0
specific_costs_om,currency/year,0,0,4600
37 changes: 34 additions & 3 deletions tests/test_heat_pump_and_chiller.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def test_calculate_cops_and_eers_process_temperatures_hp_temp_high(self):
for file in files:
filepath = os.path.join(self.mvs_inputs_directory, "time_series", file)
if os.path.exists(filepath):
os.remove(filepath)
if file != "file_exists.csv":
os.remove(filepath)

filename_3 = "temperatures_heat_pump.csv"
filepath_3 = os.path.join(self.user_inputs_pvcompare_directory, filename_3)
Expand Down Expand Up @@ -418,7 +419,8 @@ def test_calculate_cops_and_eers_process_temperatures_hp_temp_low(self):
for file in files:
filepath = os.path.join(self.mvs_inputs_directory, "time_series", file)
if os.path.exists(filepath):
os.remove(filepath)
if file != "file_exists.csv":
os.remove(filepath)

filename_3 = "temperatures_heat_pump.csv"
filepath_3 = os.path.join(self.user_inputs_pvcompare_directory, filename_3)
Expand Down Expand Up @@ -559,7 +561,8 @@ def test_calculate_cops_and_eers_process_temperatures_chiller_temp_low(self):
for file in files:
filepath = os.path.join(self.mvs_inputs_directory, "time_series", file)
if os.path.exists(filepath):
os.remove(filepath)
if file != "file_exists.csv":
os.remove(filepath)

filename_3 = "temperatures_chiller.csv"
filepath_3 = os.path.join(self.user_inputs_pvcompare_directory, filename_3)
Expand Down Expand Up @@ -913,6 +916,11 @@ def _select_columns(columns):

def test_add_sector_coupling_heat_pump_file_already_exists(self, select_conv_tech):
select_conv_tech(columns="heat_pump_file_exists")

original_data_conversion = pd.read_csv(
self.filename_conversion, header=0, index_col=0
)

hc.add_sector_coupling(
weather=self.weather_2019,
lat=self.lat,
Expand All @@ -932,10 +940,17 @@ def test_add_sector_coupling_heat_pump_file_already_exists(self, select_conv_tec
df = pd.read_csv(self.filename_conversion, header=0, index_col=0)
assert ("file_exists.csv" in df.loc["efficiency"].heat_pump_file_exists) == True

original_data_conversion.to_csv(self.filename_conversion, na_rep="NaN")

def test_add_sector_coupling_heat_pump_file_already_exists_overwrite_True(
self, select_conv_tech
):
select_conv_tech(columns="heat_pump_file_exists")

original_data_conversion = pd.read_csv(
self.filename_conversion, header=0, index_col=0
)

hc.add_sector_coupling(
weather=self.weather_2019,
lat=self.lat,
Expand All @@ -958,8 +973,15 @@ def test_add_sector_coupling_heat_pump_file_already_exists_overwrite_True(
in df.loc["efficiency"].heat_pump_file_exists
) == True

original_data_conversion.to_csv(self.filename_conversion, na_rep="NaN")

def test_add_sector_coupling_heat_pump_file_created(self, select_conv_tech):
select_conv_tech(columns="heat_pump_file_non_existent")

original_data_conversion = pd.read_csv(
self.filename_conversion, header=0, index_col=0
)

hc.add_sector_coupling(
weather=self.weather,
lat=self.lat,
Expand All @@ -982,8 +1004,15 @@ def test_add_sector_coupling_heat_pump_file_created(self, select_conv_tech):
in df.loc["efficiency"].heat_pump_file_non_existent
) == True

original_data_conversion.to_csv(self.filename_conversion, na_rep="NaN")

def test_add_sector_coupling_heat_pump_constant_efficiency(self, select_conv_tech):
select_conv_tech(columns="heat_pump_constant_eff")

original_data_conversion = pd.read_csv(
self.filename_conversion, header=0, index_col=0
)

hc.add_sector_coupling(
weather=self.weather,
lat=self.lat,
Expand All @@ -1003,6 +1032,8 @@ def test_add_sector_coupling_heat_pump_constant_efficiency(self, select_conv_tec
df = pd.read_csv(self.filename_conversion, header=0, index_col=0)
assert float(df.loc["efficiency"].heat_pump_constant_eff) == 0.9

original_data_conversion.to_csv(self.filename_conversion, na_rep="NaN")

def test_add_sector_coupling_multiple_heat_pumps(self):
pass

Expand Down
49 changes: 48 additions & 1 deletion tests/test_stratified_thermal_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ def test_raiseError_temperature_match_hp(self, margs):

for file in time_series_files:
if os.path.exists(time_series_path):
os.remove(os.path.join(time_series_path, file))
if file != "file_exists.csv":
os.remove(os.path.join(time_series_path, file))


class TestCalcStratTesParam:
Expand All @@ -451,8 +452,15 @@ def setup_class(self):
columns=["no_unit"],
index=self.date_range,
)
self.filename_storage_xx = os.path.join(
TEST_USER_INPUTS_MVS_SECTOR_COUPLING, "csv_elements", "storage_TES.csv"
)

def test_calc_strat_tes_param(self):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

(
nominal_storage_capacity,
loss_rate,
Expand Down Expand Up @@ -487,7 +495,13 @@ def test_calc_strat_tes_param(self):
for item, value in enumerate(fixed_losses_absolute):
assert np.round(value, 7) == np.round(expected_abs_losses[item], 7)

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def test_calc_strat_tes_param_nominal_storage_capacity_nan_to_zero(self):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

(
nominal_storage_capacity,
loss_rate,
Expand All @@ -509,7 +523,13 @@ def test_calc_strat_tes_param_nominal_storage_capacity_nan_to_zero(self):
assert math.isnan(height) == True
assert nominal_storage_capacity == 0

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def test_add_strat_tes_calculate_losses_saved_file(self):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

sts.add_strat_tes(
weather=self.weather,
lat=self.lat,
Expand All @@ -533,7 +553,13 @@ def test_add_strat_tes_calculate_losses_saved_file(self):
)
)

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def test_save_time_dependent_values(self):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

file_name = "fixed_thermal_losses_relative_test.csv"
file_path = os.path.join(
TEST_USER_INPUTS_MVS_SECTOR_COUPLING, "time_series", file_name
Expand All @@ -548,6 +574,8 @@ def test_save_time_dependent_values(self):

assert os.path.exists(file_path) == True

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def teardown_method(self):
# delete file
filename = os.path.join(
Expand Down Expand Up @@ -592,6 +620,10 @@ def _select_columns(columns):
original_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def test_add_sector_coupling_strat_tes_file_already_exists(self, select_conv_tech):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

select_conv_tech(columns="storage capacity")
sts.add_strat_tes(
weather=self.weather_2017,
Expand Down Expand Up @@ -629,9 +661,15 @@ def test_add_sector_coupling_strat_tes_file_already_exists(self, select_conv_tec
in df.loc["fixed_thermal_losses_absolute"].item()
) == True

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def test_add_sector_coupling_strat_tes_file_already_exists_overwrite_true(
self, select_conv_tech
):
original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

select_conv_tech(columns="storage capacity")
sts.add_strat_tes(
weather=self.weather_2019,
Expand All @@ -655,6 +693,8 @@ def test_add_sector_coupling_strat_tes_file_already_exists_overwrite_true(
in df.loc["fixed_thermal_losses_absolute"].item()
) == True

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def teardown_method(self):
# delete file
filename_1 = os.path.join(
Expand Down Expand Up @@ -687,6 +727,11 @@ def teardown_method(self):
os.remove(file)

def test_add_sector_coupling_strat_tes_file_non_existent(self, select_conv_tech):

original_storage_xx_data = pd.read_csv(
self.filename_storage_xx, header=0, index_col=0
)

select_conv_tech(columns="storage capacity")
sts.add_strat_tes(
weather=self.weather_2017,
Expand All @@ -710,6 +755,8 @@ def test_add_sector_coupling_strat_tes_file_non_existent(self, select_conv_tech)
in df.loc["fixed_thermal_losses_absolute"].item()
) == True

original_storage_xx_data.to_csv(self.filename_storage_xx, na_rep="NaN")

def teardown_method(self):
# delete file
filename_1 = os.path.join(
Expand Down

0 comments on commit 0d045c4

Please sign in to comment.