TNO Intern

Commit 36968946 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Merge branch '36-get-the-scenarios-for-the-ga4a-working' into 'main'

Resolve "Get the scenarios for the GA4A working"

Closes #36

See merge request AGS/pythermogis!38
parents 450cd113 6d5f362f
Loading
Loading
Loading
Loading
+121 −1
Original line number Diff line number Diff line
@@ -236,7 +236,127 @@ results = calculate_doublet_performance(input_data, utc_properties=utc_propertie
print(results)
```

If you have a valid configuration file, you can parse a utc_properties class using the method: `instantiate_utc_properties_from_xml`, some example configuration xml files are found in `tests/resources/scenarios`.
## ThermoGIS Scenario Configuration Files

If you have a valid configuration file, you can parse a utc_properties class using the method: `instantiate_utc_properties_from_xml`.
Examples of valid configuration files are found in `tests/resources/test_input/scenarios`.
The vast majority of the parameters in the xml are not used by this python API; but are required by the ThermoGIS java code, unfortunately they are still needed in the xml file to enable parsing.

The minimum parameters which are required in the XML file are:

| #   | Parameter Name                                                           |
|-----|--------------------------------------------------------------------------|
| 1   | input_data_directory                                                     |
| 2   | results_directory                                                        |
| 3   | comparison_directory                                                     |
| 4   | compare_results                                                          |
| 5   | output_maps_for_petrel                                                   |
| 6   | max_number_of_processors_for_calculations                               |
| 7   | copy_aquifer_files                                                       |
| 8   | validate_input_grids                                                     |
| 9   | validate_output_grids                                                    |
| 10  | aquifers_to_calculate                                                    |
| 11  | output_scenario_name                                                     |
| 12  | temperature_from_input_grids                                             |
| 13  | exclude_hydrocarbon_areas                                                |
| 14  | use_boundary_shapefile                                                   |
| 15  | output_grid_file_type___zmap___asc___nc_                                 |
| 16  | pvalues_to_calculate                                                     |
| 17  | temperature_voxet_file                                                   |
| 18  | surface_temperature                                                      |
| 19  | temp_gradient__surface_temp__below__also_used_                          |
| 20  | max_undefined_cells__of_surrounding_4__for_interp                        |
| 21  | xy_grid_size_factor_for_thickness_grid__integer_                         |
| 22  | remove_padding_from_input_grids                                          |
| 23  | use_heat_pump                                                            |
| 24  | heating_return_temperature                                               |
| 25  | rosim_settings_file__must_contain__aquifer__layer_                       |
| 26  | scale_factor_for_h_and_lnk_standard_deviations                          |
| 27  | calculate_cop                                                            |
| 28  | application_mode                                                         |
| 29  | goal_temperature                                                         |
| 30  | unit_technical_cost_cutoff                                               |
| 31  | unit_technical_cost_cutoff_deep                                          |
| 32  | depth_for_deep_unit_technical_cost_cutoff                                |
| 33  | calculate_mean_over_last_nyears_for_efficiency__energyin_and_energyout_ |
| 34  | rosim_simulation_time__constant_power_after_                             |
| 35  | maximum_depth_for_calculations                                           |
| 36  | ates_minimum_depth__speed_up_calculation_                                |
| 37  | ates_maximum_depth__speed_up_calculation_                                |
| 38  | minimum_production_temperature                                           |
| 39  | kh_cutoff__speed_up_calculation_                                         |
| 40  | stimulate_well_s_                                                        |
| 41  | maximum_kh_value_for_stimulation                                         |
| 42  | maximum_cooling_temperature_range                                        |
| 43  | _minimum__injection_temperature                                          |
| 44  | ates_charge_temperature                                                  |
| 45  | use_kestin_viscosity                                                     |
| 46  | economic_lifetime                                                        |
| 47  | ates_minimum_flow_rate__speed_up_calculation_                            |
| 48  | include__non_sde__electric_power_in_output                               |
| 49  | use_values_from_last_rosim_year_for_all_years                            |
| 50  | maximum_flow                                                             |
| 51  | ates_charge_temperature                                                  |
| 52  | ates_aquifer_anisotropy                                                  |
| 53  | ates_filter_fraction__of_aquifer_thickness_                              |
| 54  | salinity_at_surface__ppm_                                                |
| 55  | salinity_gradient__ppm_m_                                                |
| 56  | ates_injection_production_period__max_182_days_                          |
| 57  | ates_clogging_velocity                                                   |
| 58  | ates_membrane_filter_index                                               |
| 59  | ates_depth_multiplication_factor                                         |
| 60  | thermal_radius_factor                                                    |
| 61  | maximum_pump_pressure                                                    |
| 62  | minimum_pump_pressure                                                    |
| 63  | hydraulic_gradient_injection_water__sodm_max_inj_pres_                   |
| 64  | optimize_well_distance                                                   |
| 65  | minimum_well_distance                                                    |
| 66  | maximum_well_distance                                                    |
| 67  | lifetime                                                                 |
| 68  | max_tvd_stepout_factor                                                   |
| 69  | rock_heat_capacity                                                       |
| 70  | rock_density                                                             |
| 71  | allowed_temperature_drop_as_fraction_of_deltat                           |
| 72  | well_distance                                                            |
| 73  | pump_efficiency                                                          |
| 74  | pump_depth                                                               |
| 75  | calculation_segment_length                                               |
| 76  | casing_roughness                                                         |
| 77  | added_skin_injector__negative_increases_flow_                            |
| 78  | added_skin_producer__negative_increases_flow_                            |
| 79  | stimulation_capex__for_both_wells_                                       |
| 80  | calculate_cop                                                            |
| 81  | coefficient_of_performance                                               |
| 82  | heat_pump_capex                                                          |
| 83  | heat_pump_annual_opex                                                    |
| 84  | alternative_heating_price                                                |
| 85  | economic_lifetime                                                        |
| 86  | drilling_time                                                            |
| 87  | tax_rate                                                                 |
| 88  | interest_on_loan                                                         |
| 89  | inflation                                                                |
| 90  | required_return_on_equity                                                |
| 91  | debt_equity                                                              |
| 92  | tolerance_of_utc_increase___bar_                                         |
| 93  | annual_load_hours                                                        |
| 94  | annual_opex_base                                                         |
| 95  | annual_opex_per_unit_power                                               |
| 96  | opex_electricity_purchase_price_for_operations                           |
| 97  | annual_opex_per_unit_energy_produced                                     |
| 98  | annual_opex_based_on_capex                                               |
| 99  | well_costs_scaling                                                       |
| 100 | well_costs_base                                                          |
| 101 | well_costs_depth__along_hole__factor                                     |
| 102 | well_costs_depth_2__along_hole__factor                                   |
| 103 | capex_base_expenses__excl_wells_                                         |
| 104 | capex_variable_expenses__excl_wells_                                     |
| 105 | capex_contingency                                                        |
| 106 | well_trajectory_curvature_scaling_factor__0__vert_wells_                 |
| 107 | use_orc                                                                  |
| 108 | heat_conversion_efficiency                                               |
| 109 | parasitic_power_fraction_of_net_power                                    |
| 110 | base_temperature                                                         |


```python
from pythermogis import calculate_doublet_performance, instantiate_utc_properties_from_xml
+2 −2
Original line number Diff line number Diff line
@@ -2293,8 +2293,8 @@ packages:
  timestamp: 1740946648058
- pypi: .
  name: pythermogis
  version: 0.1.25
  sha256: d9fecb41ae23b43e1805038c4a2aba398a39af1dc24e28df528a2856b875ac36
  version: 0.1.26
  sha256: 9b1767ad9ca9e30a6ce1446b7fc61351f08f4bb2048143ce754d7e848911b850
  requires_dist:
  - jpype1>=1.5.2,<2
  - xarray==2024.9.0.*
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pythermogis"
version = "0.1.25"
version = "0.1.26"
description = "This repository is used as a python API for the ThermoGIS Doublet simulations"
authors = [
    { name = "Hen Brett", email = "hen.brett@tno.nl" },
+15 −6
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ from thermogis_classes.utc_properties import instantiate_utc_properties_builder
def calculate_doublet_performance(input_data: xr.Dataset,
                                  utc_properties = None,
                                  rng_seed = None,
                                  p_values: List[float] = [50.0]
                                  p_values: List[float] = [50.0],
                                  ) -> xr.Dataset:
    """
    Perform a ThermoGIS Doublet performance simulation. This will occur across all dimensions of the input_data (ie. input data can have a single value for each required variable, or it can be 1Dimensional or a 2Dimensional grid)
@@ -253,10 +253,19 @@ def set_doublet_parameters(doublet, transmissivity_with_ntg: float, depth: float
    doublet.doubletCalc1DData.setNtg(ntg)
    doublet.doubletCalc1DData.setReservoirTemp(temperature)

    if not utc_properties.useHeatPump():
        doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()]))
    elif utc_properties.useHeatPump() and utc_properties.calculateCop() and not utc_properties.hpApplicationMode():
    if utc_properties.useHeatPump():
        if utc_properties.calculateCop() and not utc_properties.hpApplicationMode():
            doublet.doubletCalc1DData.setInjectionTemp(doublet.calculateInjectionTempWithHeatPump(temperature, utc_properties.hpDirectHeatInputTemp()))
        else:
            doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.hpMinimumInjectionTemperature()]))
    else:
        doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()]))

    # # old:
    # if not utc_properties.useHeatPump():
    #     doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()]))
    # elif utc_properties.useHeatPump() and utc_properties.calculateCop() and not utc_properties.hpApplicationMode():
    #     doublet.doubletCalc1DData.setInjectionTemp(doublet.calculateInjectionTempWithHeatPump(temperature, utc_properties.hpDirectHeatInputTemp()))
    # else:
    #     doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.hpMinimumInjectionTemperature()]))

tests/test_JVM_start.py

deleted100644 → 0
+0 −20
Original line number Diff line number Diff line
from unittest.case import TestCase, skip
from thermogis_classes.jvm_start import start_jvm
import os

class JVM(TestCase):
    @skip
    def test_JVM_start_JAVA_HOME_environment_variable_not_set(self):
        os.environ["JAVA_HOME"] = "dummy"

        # Act & Assert
        with self.assertRaises(FileNotFoundError):
            start_jvm()

    @skip
    def test_JVM_start_THERMOGIS_JAR_environment_variable_not_set(self):
        os.environ["THERMOGIS_JAR"] = "dummy"

        # Act & Assert
        with self.assertRaises(FileNotFoundError):
            start_jvm()
 No newline at end of file
Loading