From 94ddec5e699f3b2915a365333514134abd2dc67e Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 14 May 2024 13:53:28 -0700 Subject: [PATCH] Stub implementation of JEDI geothermal https://github.com/NREL/GEOPHIRES-X/issues/169 --- src/jedi_geothermal/__init__.py | 51 +++++++++++++++++++ tests/jedi_geothermal_tests/__init__.py | 0 .../test_jedi_geothermal.py | 23 +++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/jedi_geothermal/__init__.py create mode 100644 tests/jedi_geothermal_tests/__init__.py create mode 100644 tests/jedi_geothermal_tests/test_jedi_geothermal.py diff --git a/src/jedi_geothermal/__init__.py b/src/jedi_geothermal/__init__.py new file mode 100644 index 00000000..b8e2c544 --- /dev/null +++ b/src/jedi_geothermal/__init__.py @@ -0,0 +1,51 @@ +import logging +from dataclasses import dataclass +from enum import Enum + +_logger = logging.getLogger(__name__) + + +class ProjectGeothermalTechnology(Enum): + HYDROTHERMAL = 'Hydrothermal' + EGS = 'EGS' + + +class ProjectPlantType(Enum): + FLASH = 'Flash' + BINARY = 'Binary' + + +@dataclass +class JediGeothermalResult: + construction_period_total_jobs: int = None + construction_period_earnings_MUSD: float = None + construction_period_output_MUSD: float = None + construction_period_value_added: float = None + + operating_years_annual_total_jobs: int = None + operating_years_annual_earnings_MUSD: float = None + operating_years_annual_output_MUSD: float = None + operating_years_annual_value_added_MUSD: float = None + + +@dataclass +class JediGeothermalInputParameters: + # TODO set default values to None, fake values are stubbed here for demonstration + project_location_state = 'ID' + year_of_construction = 2010 + construction_period_months = 21 + nominal_plant_size_mw_net_output = 10 + technology = ProjectGeothermalTechnology.HYDROTHERMAL + resource_temperature_degC = 200 + resource_depth_m = 2250 + + # TODO define all input parameters + + +class JediGeothermalClient: + def __init__(self): + self._logger = _logger + + def get_jedi_geothermal_result(self, input_params: JediGeothermalInputParameters) -> JediGeothermalResult: + self._logger.info(f'Calculating JEDI result for: {input_params}') + raise NotImplementedError('Implement me please! =]') diff --git a/tests/jedi_geothermal_tests/__init__.py b/tests/jedi_geothermal_tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/jedi_geothermal_tests/test_jedi_geothermal.py b/tests/jedi_geothermal_tests/test_jedi_geothermal.py new file mode 100644 index 00000000..444af20f --- /dev/null +++ b/tests/jedi_geothermal_tests/test_jedi_geothermal.py @@ -0,0 +1,23 @@ +from base_test_case import BaseTestCase +from jedi_geothermal import JediGeothermalClient +from jedi_geothermal import JediGeothermalInputParameters +from jedi_geothermal import JediGeothermalResult + + +class JediGeothermalTest(BaseTestCase): + + def test_basic_example(self): + client = JediGeothermalClient() + + input_params = JediGeothermalInputParameters() + input_params.resource_depth_m = 2250 + # TODO define rest of input_params properties + + result: JediGeothermalResult = client.get_jedi_geothermal_result(input_params) + self.assertIsNotNone(result) + + # TODO assert result properties are calculated from inputs correctly + # i.e. + # self.assertEqual(183, result.construction_period_total_jobs) + # self.assertEqual(1.70, result.operating_years_annual_value_added_MUSD) + # etc.