-
Notifications
You must be signed in to change notification settings - Fork 3
Airco sizing test #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Airco sizing test #452
Changes from all commits
aeab7f7
1d9048d
30cbe4e
bc6777e
ed5eb8e
c86a382
92e2962
afb2e9e
1bd9541
3986e70
e52ed4a
a1dc10c
d029f89
db99cdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| DateTime,HeatingDemand_9b90,CoolingDemand_15e8 | ||
| 01-01-2019 00:00, 50000., 150000. | ||
| 01-01-2019 01:00, 100000., 150000. | ||
| 01-01-2019 02:00, 1200000., 150000. | ||
| 01-01-2019 03:00, 2000000., 2000000. | ||
| 01-01-2019 04:00, 150000., 1500000. | ||
| 01-01-2019 05:00, 150000., 1000000. | ||
| 01-01-2019 06:00, 150000., 500000. | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ def test_insufficient_capacity(self): | |
|
|
||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| logger, logs_list = create_log_list_scaling("mesido") | ||
|
|
||
|
|
@@ -50,7 +50,7 @@ def test_insufficient_capacity(self): | |
| unittest.mock.patch("mesido.potential_errors.POTENTIAL_ERRORS", PotentialErrors()), | ||
| ): | ||
| _ = run_esdl_mesido_optimization( | ||
| HeatProblem, | ||
| HeatColdProblem, | ||
| base_folder=base_folder, | ||
| esdl_file_name="LT_wko_error_check.esdl", | ||
| esdl_parser=ESDLFileParser, | ||
|
|
@@ -83,12 +83,12 @@ def test_cold_demand(self): | |
|
|
||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| heat_problem = run_esdl_mesido_optimization( | ||
| HeatProblem, | ||
| HeatColdProblem, | ||
| base_folder=base_folder, | ||
| esdl_file_name="LT_wko.esdl", | ||
| esdl_parser=ESDLFileParser, | ||
|
|
@@ -106,44 +106,69 @@ def test_airco(self): | |
| This test is to check the basic physics for a network which includes an airco. In this | ||
| case we have a network with an air-water hp, a low temperature ates and both hot and cold | ||
| demand. In this case the demands are matched and the low temperature ates is utilized. | ||
| Only airco is optional. Airco sizing is done by minimization of airco investment cost | ||
|
|
||
| Checks: | ||
| 1. demand is matched | ||
| 2. energy conservation in the network | ||
| 3. heat to discharge | ||
| 4. variable operational and investment cost calculations | ||
| 5. airco sizing | ||
|
KobusVanRooyen marked this conversation as resolved.
|
||
|
|
||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblemSizing | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| heat_problem = run_esdl_mesido_optimization( | ||
| HeatProblem, | ||
| HeatColdProblemSizing, | ||
| base_folder=base_folder, | ||
| esdl_file_name="airco.esdl", | ||
| esdl_parser=ESDLFileParser, | ||
| profile_reader=ProfileReaderFromFile, | ||
| input_timeseries_file="timeseries.csv", | ||
| input_timeseries_file="timeseries_high_cold_demand.csv", | ||
| ) | ||
| results = heat_problem.extract_results() | ||
| parameters = heat_problem.parameters(0) | ||
| name_to_id_map = heat_problem.esdl_asset_name_to_id_map | ||
|
|
||
| hp_id = name_to_id_map["HeatPump_b97e"] | ||
| ac_id = name_to_id_map["Airco_23d6"] | ||
|
|
||
| demand_matching_test(heat_problem, results) | ||
| energy_conservation_test(heat_problem, results) | ||
| heat_to_discharge_test(heat_problem, results) | ||
|
|
||
| # Check how variable operation cost is calculated | ||
| # Check variable operation cost calculation | ||
| np.testing.assert_array_less(1e3, results[f"{hp_id}__variable_operational_cost"]) | ||
| np.testing.assert_allclose( | ||
| parameters[f"{hp_id}.variable_operational_cost_coefficient"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the heat_source var_opx is now 0, and initially this value was tested and it was not 0. Please reovle this so that the var_opex is tested again and > 0
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now i made changes in demand value in csv and cost coefficient of airco to ensure both heatpump and airco assets are used. Hence that both assets have non zero var-opex |
||
| * sum(results[f"{hp_id}.Heat_source"][1:]) | ||
| / parameters[f"{hp_id}.cop"], | ||
| results[f"{hp_id}__variable_operational_cost"], | ||
| ) | ||
|
|
||
| np.testing.assert_array_less(1e3, results[f"{ac_id}__variable_operational_cost"]) | ||
| np.testing.assert_allclose( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the variable operational cost = 0 due to an unintentional change by someone? Will this test still pass or fail? How can we update the test to cater for this?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable Operational cost has no influence in the problem. Problem objectives are DemandMatcing and MinimizeInvestmentCost. When I make var-opex coefficint zero, test still passes
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please resolve as discussed
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put additional check to ensure variable operational cost > 1e3 |
||
| parameters[f"{ac_id}.variable_operational_cost_coefficient"] | ||
| * sum(results[f"{ac_id}.Heat_airco"][1:]), | ||
| results[f"{ac_id}__variable_operational_cost"], | ||
| ) | ||
|
|
||
| # Check investment cost calculation | ||
| np.testing.assert_array_less(1e3, results[f"{ac_id}__investment_cost"]) | ||
| np.testing.assert_allclose( | ||
| parameters[f"{ac_id}.investment_cost_coefficient"] * results[f"{ac_id}__max_size"], | ||
| results[f"{ac_id}__investment_cost"], | ||
| ) | ||
|
|
||
| # Check airco sizing | ||
| np.testing.assert_allclose( | ||
| max(results[f"{ac_id}.Heat_airco"]), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the size = 0 due to an unintentional change by someone? Will this test still pass or fail? How can we update the test to cater for this?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, this problem do not consider variable operation cost in the objective. Because apart from demand matching objective we have MinimizeInvestmentCost. There we minize the size of asset. Hence, making var-opex coefficint zero will not fail the tests.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please resolve as discussed
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put additional check to ensure investment cost > 1e3. Hence, asset size > 0 |
||
| results[f"{ac_id}__max_size"], | ||
| ) | ||
|
|
||
| def test_wko(self): | ||
| """ | ||
| This test is to check the basic physics for a network which includes cold demand. In this | ||
|
|
@@ -168,13 +193,13 @@ def test_wko(self): | |
| - pipe heat losses excluded: excpect no heat losses or gains | ||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| # ------------------------------------------------------------------------------------------ | ||
| # Pipe heat losses inlcuded | ||
| class HeatingCoolingProblem(HeatProblem): | ||
| class HeatingCoolingProblem(HeatColdProblem): | ||
|
|
||
| def energy_system_options(self): | ||
| options = super().energy_system_options() | ||
|
|
@@ -300,11 +325,11 @@ def test_heat_cold_demand_peak_overlap(self): | |
| both peaks are on the same day. | ||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| class DiscretizationProblem(HeatProblem): | ||
| class DiscretizationProblem(HeatColdProblem): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.day_steps = 1 | ||
|
|
@@ -373,11 +398,11 @@ def test_heat_cold_demand_peak_back_to_back(self): | |
| both peaks are on consecutive days. | ||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| class DiscretizationProblem(HeatProblem): | ||
| class DiscretizationProblem(HeatColdProblem): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.day_steps = 1 | ||
|
|
@@ -446,11 +471,11 @@ def test_heat_cold_peak_before(self): | |
| the cold peak happens before the heat one. | ||
| """ | ||
| import models.wko.src.example as example | ||
| from models.wko.src.example import HeatProblem | ||
| from models.wko.src.example import HeatColdProblem | ||
|
|
||
| base_folder = Path(example.__file__).resolve().parent.parent | ||
|
|
||
| class DiscretizationProblem(HeatProblem): | ||
| class DiscretizationProblem(HeatColdProblem): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.day_steps = 1 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.