From de753a675ef4b1eec160e1efd76f17814c566fa5 Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:39:49 +0100 Subject: [PATCH 1/8] changed jar --- resources/thermogis_jar/thermogis-1.7.0-shaded.jar | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/thermogis_jar/thermogis-1.7.0-shaded.jar b/resources/thermogis_jar/thermogis-1.7.0-shaded.jar index 131c95d..a4c2d4f 100644 --- a/resources/thermogis_jar/thermogis-1.7.0-shaded.jar +++ b/resources/thermogis_jar/thermogis-1.7.0-shaded.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4eba994664c590c1ad026c1544c00bde3b6cdcb7e498b3968ff7b203d3170ac0 -size 131514517 +oid sha256:40c921919714169a4a699e16e6544891864b4ca74014317a5df9a832913daeb8 +size 173390196 -- GitLab From eb1ee701745cc07b40c1027e220bf8b2592733a7 Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:39:57 +0100 Subject: [PATCH 2/8] fixed first test --- tests/test_ThermoGISDoublet_Benchmark.py | 43 ++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index 37b586c..07a0fa2 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -19,39 +19,48 @@ class ThermoGISDoubletBenchmark(TestCase): Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") UTCPropertiesBuilder = JClass("thermogis.properties.builders.UTCPropertiesBuilder") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class utc_properties = (UTCPropertiesBuilder() .setViscosityMode(ViscosityMode.KESTIN) + .setDhReturnTemp(40) .build()) + permeability = 175 + thickness = 100 + transmissivity = thickness * permeability + temperature = 76 + + input = DoubletInput( + -999.0, # unknowninput + thickness, + transmissivity, + 0.0, # transmissivityWithNtg + 1.0, # ntg + 2000.0, # depth + 0.0,# porosity + temperature, + None, # ates input + ) # Create an instance of a ThermoGISDoublet doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) - # Setting input values - thickness = 100 - permeability = 175 - transmissivity = thickness * permeability - doublet.setReservoirTemp(76) - doublet.setDepth(2000) - doublet.setInjectionTemp(40) - doublet.setNtg(1.0) - doublet.setNoStimulation() # Act - doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # Assert self.assertTrue(np.isclose(17500, transmissivity, 0.001)) - self.assertTrue(np.isclose(227.2757568359375, doublet.getFlowrate(), 1)) - self.assertTrue(np.isclose(60, doublet.getDrawdownPressure() / 1e5, 0.001)) - self.assertTrue(np.isclose(6.616096470753937, doublet.getUtcPeurctkWh(), 0.001)) - self.assertTrue(np.isclose(1159.17968, doublet.getWellDistance(), 0.001)) - self.assertTrue(np.isclose(8.636903762817383, doublet.getHeatPowerPerDoublet(), 0.001)) - self.assertTrue(np.isclose(13.627557754516602, doublet.getCop(), 0.001)) + self.assertTrue(np.isclose(227.2757568359375, results.flow(), 1)) + self.assertTrue(np.isclose(60, results.pres(), 0.001)) + self.assertTrue(np.isclose(6.616096470753937, results.utc(), 0.001)) + self.assertTrue(np.isclose(1159.17968, results.welld(), 0.001)) + self.assertTrue(np.isclose(8.636903762817383, results.power(), 0.001)) + self.assertTrue(np.isclose(13.627557754516602, results.cop(), 0.001)) def test_calculateDoubletPerformance_directHeat(self): """ -- GitLab From 9341fad7d4d9a5c87dac3f7d00345e5e95bebe0a Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:48:21 +0100 Subject: [PATCH 3/8] fixed another test --- tests/test_ThermoGISDoublet_Benchmark.py | 53 ++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index 07a0fa2..ca01117 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -72,40 +72,48 @@ class ThermoGISDoubletBenchmark(TestCase): Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class utc_properties = (self.setup_template_utc_properties_builder() .setOpexBase(0) + .setDhReturnTemp(40) .setViscosityMode(ViscosityMode.KESTIN) + .setUseStimulation(False) .build()) - # Create an instance of a ThermoGISDoublet - doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) - - # Setting input values thickness = 100 permeability = 175 transmissivity = thickness * permeability - doublet.setReservoirTemp(76) - doublet.setDepth(2000) - doublet.setInjectionTemp(40) - doublet.setNtg(1.0) - doublet.setNoStimulation() + temperature = 76 + + input = DoubletInput( + -999.0, # unknowninput + thickness, + transmissivity, + 0.0, # transmissivityWithNtg + 1.0, # ntg + 2000.0, # depth + 0.0,# porosity + temperature, + None, # ates input + ) + doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) # Act - doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # Assert self.assertTrue(np.isclose(17500, transmissivity, 0.001)) - self.assertTrue(np.isclose(227.2757568359375, doublet.getFlowrate(), 1)) - self.assertTrue(np.isclose(60, doublet.getDrawdownPressure() / 1e5, 0.001)) - self.assertTrue(np.isclose(1159.1796, doublet.getWellDistance(), 0.001)) - self.assertTrue(np.isclose(13.623167037963867, doublet.getCop(), 0.001)) - self.assertTrue(np.isclose(5.229816400909403, doublet.getUtcPeurctkWh(), 0.001)) - self.assertTrue(np.isclose(16.439682499211536, doublet.getSumcapex(), 0.001)) - self.assertTrue(np.isclose(8.624696731567383, doublet.getHeatPowerPerDoublet(), 0.001)) + self.assertTrue(np.isclose(227.2757568359375, results.flow(), 1)) + self.assertTrue(np.isclose(60, results.pres(), 0.001)) + self.assertTrue(np.isclose(1159.1796, results.welld(), 0.001)) + self.assertTrue(np.isclose(13.623167037963867, results.cop(), 0.001)) + self.assertTrue(np.isclose(5.229816400909403, results.utc(), 0.001)) + self.assertTrue(np.isclose(16.439682499211536, results.capex(), 0.001)) + self.assertTrue(np.isclose(8.624696731567383, results.power(), 0.001)) def test_calculateDoubletPerformance_chiller(self): """ @@ -117,7 +125,8 @@ class ThermoGISDoubletBenchmark(TestCase): Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class @@ -164,7 +173,8 @@ class ThermoGISDoubletBenchmark(TestCase): Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class @@ -214,7 +224,8 @@ class ThermoGISDoubletBenchmark(TestCase): Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class -- GitLab From e5d9d2691459248cc67c125e926ebd0241ab58c2 Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:49:48 +0100 Subject: [PATCH 4/8] fixed another test --- tests/test_ThermoGISDoublet_Benchmark.py | 38 ++++++++++++++---------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index ca01117..22c4a05 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -138,30 +138,36 @@ class ThermoGISDoubletBenchmark(TestCase): .build()) # Create an instance of a ThermoGISDoublet - doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) - - # Setting input values thickness = 100 permeability = 175 transmissivity = thickness * permeability - doublet.setReservoirTemp(76) - doublet.setDepth(2000) - doublet.setInjectionTemp(60) - doublet.setNtg(1.0) - doublet.setNoStimulation() + temperature = 76 + + input = DoubletInput( + -999.0, # unknowninput + thickness, + transmissivity, + 0.0, # transmissivityWithNtg + 1.0, # ntg + 2000.0, # depth + 0.0,# porosity + temperature, + None, # ates input + ) + doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) # Act - doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) # Assert self.assertTrue(np.isclose(17500, transmissivity, 0.001)) - self.assertTrue(np.isclose(256.59625244140625, doublet.getFlowrate(), 1)) - self.assertTrue(np.isclose(60, doublet.getDrawdownPressure() / 1e5, 0.001)) - self.assertTrue(np.isclose(20.470115103822685, doublet.getUtcPeurctkWh(), 0.001)) - self.assertTrue(np.isclose(1227.1484375, doublet.getWellDistance(), 0.001)) - self.assertTrue(np.isclose(1.8887300754346803, doublet.getCop(), 0.001)) - self.assertTrue(np.isclose(1.6594701766967774, doublet.getHeatPowerPerDoublet(), 0.001)) - self.assertTrue(np.isclose(12.748051248109613, doublet.getSumcapex(), 0.001)) + self.assertTrue(np.isclose(256.59625244140625, results.flow(), 1)) + self.assertTrue(np.isclose(60, results.pres() / 1e5, 0.001)) + self.assertTrue(np.isclose(20.470115103822685, results.utc(), 0.001)) + self.assertTrue(np.isclose(1227.1484375, results.welld(), 0.001)) + self.assertTrue(np.isclose(1.8887300754346803, results.cop(), 0.001)) + self.assertTrue(np.isclose(1.6594701766967774, results.power(), 0.001)) + self.assertTrue(np.isclose(12.748051248109613, results.capex(), 0.001)) def test_calculateDoubletPerformance_directheatHP(self): """ -- GitLab From 16b8f57398e344306195f57e7917ba317664353c Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:51:19 +0100 Subject: [PATCH 5/8] fixed another test --- tests/test_ThermoGISDoublet_Benchmark.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index 22c4a05..6b0d229 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -130,10 +130,12 @@ class ThermoGISDoubletBenchmark(TestCase): ViscosityMode = JClass("tno.geoenergy.ViscosityMode") # Instantiate the UTC properties class - utc_properties = (self.setup_template_utc_properties_builder().setCapexConst(0.5) + utc_properties = (self.setup_template_utc_properties_builder() + .setCapexConst(0.5) .setCapexVariable(1100) .setHeatExchangerEfficiency(0.4) .setHeatExchangerParasitic(0.1) + .setDhReturnTemp(60) .setViscosityMode(ViscosityMode.KESTIN) .build()) @@ -157,12 +159,12 @@ class ThermoGISDoubletBenchmark(TestCase): doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) # Act - results = doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # Assert self.assertTrue(np.isclose(17500, transmissivity, 0.001)) self.assertTrue(np.isclose(256.59625244140625, results.flow(), 1)) - self.assertTrue(np.isclose(60, results.pres() / 1e5, 0.001)) + self.assertTrue(np.isclose(60, results.pres(), 0.001)) self.assertTrue(np.isclose(20.470115103822685, results.utc(), 0.001)) self.assertTrue(np.isclose(1227.1484375, results.welld(), 0.001)) self.assertTrue(np.isclose(1.8887300754346803, results.cop(), 0.001)) -- GitLab From e09e2cc4ac4c323f535bc2c9a57475bc4db3654e Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 13:59:25 +0100 Subject: [PATCH 6/8] fixed another test --- tests/test_ThermoGISDoublet_Benchmark.py | 43 +++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index 6b0d229..b6dfd7c 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -189,37 +189,42 @@ class ThermoGISDoubletBenchmark(TestCase): utc_properties = (self.setup_template_utc_properties_builder() .setOpexPerPower(100) .setOpexBase(0) + .setHpDirectHeatInputTemp(70) .setUseHeatPump(True) - .setHpApplicationMode(True) - .setHpDirectHeatInputTemp(80) + .setDhReturnTemp(35) .setViscosityMode(ViscosityMode.KESTIN) .build()) # Create an instance of a ThermoGISDoublet - doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) - - # Setting input values thickness = 100 permeability = 175 transmissivity = thickness * permeability - doublet.setReservoirTemp(50) - doublet.setDepth(2000) - doublet.setDhReturnTemp(35) - doublet.setInjectionTemp(15) - doublet.setNtg(1.0) - doublet.setNoStimulation() + temperature = 50 + + input = DoubletInput( + -999.0, # unknowninput + thickness, + transmissivity, + 0.0, # transmissivityWithNtg + 1.0, # ntg + 2000.0, # depth + 0.0,# porosity + temperature, + None, # ates input + ) + doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) # Act - doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # Assert self.assertTrue(np.isclose(17499.99940, transmissivity, 0.001)) - self.assertTrue(np.isclose(163.99771118164062, doublet.getFlowrate(), 1)) - self.assertTrue(np.isclose(60, doublet.getDrawdownPressure() / 1e5, 0.001)) - self.assertTrue(np.isclose(5.67, doublet.getHeatPowerPerDoublet(), 0.001)) - self.assertTrue(np.isclose(955.27, doublet.getWellDistance(), 0.001)) - self.assertTrue(np.isclose(3.51, doublet.getCop(), 0.001)) - self.assertTrue(np.isclose(10.9, doublet.getUtcPeurctkWh(), 0.001)) - self.assertTrue(np.isclose(17.56, doublet.getSumcapex(), 0.001)) + self.assertTrue(np.isclose(163.99771118164062, results.flow(), 1)) + self.assertTrue(np.isclose(60, results.pres(), 0.001)) + self.assertTrue(np.isclose(4.97566556930542, results.power(), 0.001)) + self.assertTrue(np.isclose(989.2578125, results.welld(), 0.001)) + self.assertTrue(np.isclose(4.383212200392486, results.cop(), 0.001)) + self.assertTrue(np.isclose(10.401010755009017, results.utc(), 0.001)) + self.assertTrue(np.isclose(16.50359210062243, results.capex(), 0.001)) def test_calculateDoubletPerformance_ORC(self): -- GitLab From b0d74286e35fd8ee235a1e2be28c7c6a2aade24a Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 14:01:58 +0100 Subject: [PATCH 7/8] fixed another test --- tests/test_ThermoGISDoublet_Benchmark.py | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/tests/test_ThermoGISDoublet_Benchmark.py b/tests/test_ThermoGISDoublet_Benchmark.py index b6dfd7c..dca7e23 100644 --- a/tests/test_ThermoGISDoublet_Benchmark.py +++ b/tests/test_ThermoGISDoublet_Benchmark.py @@ -14,7 +14,6 @@ class ThermoGISDoubletBenchmark(TestCase): returns the same values. """ # Arrange - # Import Java Classes start_jvm() Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") @@ -24,7 +23,6 @@ class ThermoGISDoubletBenchmark(TestCase): UTCPropertiesBuilder = JClass("thermogis.properties.builders.UTCPropertiesBuilder") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") - # Instantiate the UTC properties class utc_properties = (UTCPropertiesBuilder() .setViscosityMode(ViscosityMode.KESTIN) .setDhReturnTemp(40) @@ -46,7 +44,6 @@ class ThermoGISDoubletBenchmark(TestCase): None, # ates input ) - # Create an instance of a ThermoGISDoublet doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) @@ -76,7 +73,6 @@ class ThermoGISDoubletBenchmark(TestCase): DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") - # Instantiate the UTC properties class utc_properties = (self.setup_template_utc_properties_builder() .setOpexBase(0) .setDhReturnTemp(40) @@ -129,7 +125,6 @@ class ThermoGISDoubletBenchmark(TestCase): DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") - # Instantiate the UTC properties class utc_properties = (self.setup_template_utc_properties_builder() .setCapexConst(0.5) .setCapexVariable(1100) @@ -139,7 +134,6 @@ class ThermoGISDoubletBenchmark(TestCase): .setViscosityMode(ViscosityMode.KESTIN) .build()) - # Create an instance of a ThermoGISDoublet thickness = 100 permeability = 175 transmissivity = thickness * permeability @@ -185,7 +179,6 @@ class ThermoGISDoubletBenchmark(TestCase): DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") - # Instantiate the UTC properties class utc_properties = (self.setup_template_utc_properties_builder() .setOpexPerPower(100) .setOpexBase(0) @@ -194,7 +187,7 @@ class ThermoGISDoubletBenchmark(TestCase): .setDhReturnTemp(35) .setViscosityMode(ViscosityMode.KESTIN) .build()) - # Create an instance of a ThermoGISDoublet + thickness = 100 permeability = 175 transmissivity = thickness * permeability @@ -241,39 +234,45 @@ class ThermoGISDoubletBenchmark(TestCase): DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") ViscosityMode = JClass("tno.geoenergy.ViscosityMode") - # Instantiate the UTC properties class - utc_properties = (self.setup_template_utc_properties_builder().setCapexConst(0) + utc_properties = (self.setup_template_utc_properties_builder() + .setCapexConst(0) .setCapexVariable(2300) .setHeatExchangerEfficiency(0.6) .setUseORC(True) .setViscosityMode(ViscosityMode.KESTIN) + .setDhReturnTemp(60) .setHeatExchangerBasetemp(20).build()) - # Create an instance of a ThermoGISDoublet - doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) - - # Setting input values thickness = 100 permeability = 175 transmissivity = thickness * permeability - doublet.setReservoirTemp(100) - doublet.setDepth(2000) - doublet.setInjectionTemp(60) - doublet.setNtg(1.0) - doublet.setNoStimulation() + temperature = 100 + + input = DoubletInput( + -999.0, # unknowninput + thickness, + transmissivity, + 0.0, # transmissivityWithNtg + 1.0, # ntg + 2000.0, # depth + 0.0,# porosity + temperature, + None, # ates input + ) + doublet = ThermoGISDoublet(Mockito.mock(Logger), RNG(0), utc_properties) # Act - doublet.calculateDoubletPerformance(-999, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # Assert self.assertTrue(np.isclose(17499.99940, transmissivity, 0.001)) - self.assertTrue(np.isclose(293.6246643066406, doublet.getFlowrate(), 1)) - self.assertTrue(np.isclose(60, doublet.getDrawdownPressure() / 1e5, 0.001)) - self.assertTrue(np.isclose(36.98296076530068, doublet.getUtcPeurctkWh(), 0.001)) - self.assertTrue(np.isclose(0.05274631495788107, doublet.getHeatPowerPerDoublet(), 0.01)) - self.assertTrue(np.isclose(1306.4453125, doublet.getWellDistance(), 0.001)) - self.assertTrue(np.isclose(0.06459403120103477, doublet.getCop(), 0.001)) - self.assertTrue(np.isclose(12.44409167482118, doublet.getSumcapex(), 0.001)) + self.assertTrue(np.isclose(293.6246643066406, results.flow(), 1)) + self.assertTrue(np.isclose(60, results.pres(), 0.001)) + self.assertTrue(np.isclose(36.98296076530068, results.utc(), 0.001)) + self.assertTrue(np.isclose(0.05274631495788107, results.power(), 0.01)) + self.assertTrue(np.isclose(1306.4453125, results.welld(), 0.001)) + self.assertTrue(np.isclose(0.06459403120103477, results.cop(), 0.001)) + self.assertTrue(np.isclose(12.44409167482118, results.capex(), 0.001)) def setup_template_utc_properties_builder(self): return (instantiate_utc_properties_builder() -- GitLab From f8453d2f3f4532b0f3ec09ebd61de5cccdf16859 Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 4 Nov 2025 14:40:59 +0100 Subject: [PATCH 8/8] fixed all other tests --- src/pythermogis/thermogis_classes/doublet.py | 95 +++++++------------- 1 file changed, 30 insertions(+), 65 deletions(-) diff --git a/src/pythermogis/thermogis_classes/doublet.py b/src/pythermogis/thermogis_classes/doublet.py index 5c1e8d7..5cad3f4 100644 --- a/src/pythermogis/thermogis_classes/doublet.py +++ b/src/pythermogis/thermogis_classes/doublet.py @@ -106,13 +106,25 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes # Instantiate ThermoGIS doublet doublet = instantiate_thermogis_doublet(utc_properties, rng_seed) - set_doublet_parameters(doublet, transmissivity_with_ntg, depth, porosity, ntg, temperature, utc_properties) + + DoubletInput = JClass("thermogis.calc.utc.doublet.records.DoubletInput") + input = DoubletInput( + -9999.0, # unknowninput + thickness, + transmissivity, + transmissivity_with_ntg, + ntg, + depth, + porosity, + temperature, + None, # ates input + ) # The Java routine which calculates DoubletPerformance, for more detail on the simulation inspect the Java source code - doublet.calculateDoubletPerformance(-9999.0, thickness, transmissivity, False) + results = doublet.calculateDoubletPerformance(input) # If calculation was not successful, return mask value - if doublet.getUtcPeurctkWh() == -9999.0: + if results.utc() == -9999.0: return (mask_value,) * 14 # calculate net-present-value using the utc-cutoffs @@ -121,28 +133,27 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes else: utc_cut = utc_properties.utcCutoff() - hprod = doublet.getDiscountedHeatProducedP() - npv = 1e-6 * (utc_cut - doublet.getUtcPeurctkWh()) * 3.6 * hprod * (1 - utc_properties.taxRate()) + hprod = results.hprod() + npv = 1e-6 * (utc_cut - results.utc()) * 3.6 * hprod * (1 - utc_properties.taxRate()) # get values from doublet - output_values = {"power": doublet.getHpP(), - "heat_pump_power": doublet.getHeatPowerPerDoublet(), - "capex": doublet.getSumcapex(), - "opex": doublet.getOpexFirstProdYear(), - "utc": doublet.getUtcPeurctkWh(), + output_values = {"power": results.power(), + "heat_pump_power": results.hppower(), + "capex": results.capex(), + "opex": results.opex(), + "utc": results.utc(), "npv": npv, "hprod": hprod, - "cop": doublet.getCop(), - "cophp": doublet.getCopHpP(), - "pres": doublet.getPresP() / 1e5, - "flow_rate": doublet.getFlowrate(), - "welld": doublet.getWellDistP(), - "inj_temp": doublet.getInjectionTemp(), - "prd_temp": doublet.getProductionTemp() + "cop": results.cop(), + "cophp": results.cophp(), + "pres": results.pres(), + "flow_rate": results.flow(), + "welld": results.welld(), + "inj_temp": 0, #TODO: this is ATES output. Is ATES supported in pytg? + "prd_temp": 0 #TODO: this is ATES output. Is ATES supported in pytg? } # Reset doublet variables for next calculation - doublet.setProjectVariables(False, 0.0) return output_values["power"], output_values["heat_pump_power"], output_values["capex"], output_values["opex"], output_values["utc"], output_values["npv"], output_values["hprod"], output_values["cop"], output_values[ "cophp"], output_values["pres"], output_values["flow_rate"], output_values["welld"], output_values["inj_temp"], output_values["prd_temp"] @@ -186,7 +197,7 @@ def instantiate_thermogis_doublet(utc_properties, rng_seed: int = None) -> JClas Logger = JClass("logging.Logger") Mockito = JClass("org.mockito.Mockito") RNG = JClass("tno.geoenergy.stochastic.RandomNumberGenerator") - ThermoGISDoublet = JClass("thermogis.calc.doublet.ThermoGisDoublet") + ThermoGISDoublet = JClass("thermogis.calc.utc.doublet.ThermoGisDoublet") # Create an instance of a ThermoGISDoublet if rng_seed is not None: @@ -196,50 +207,4 @@ def instantiate_thermogis_doublet(utc_properties, rng_seed: int = None) -> JClas doublet = ThermoGISDoublet(Mockito.mock(Logger), rng, utc_properties) - # Set parameters that do not change across simulations - doublet.setSurfaceTemperature(utc_properties.surfaceTemperature()) - doublet.setDhReturnTemp(utc_properties.dhReturnTemp()) - return doublet - -def set_doublet_parameters(doublet, transmissivity_with_ntg: float, depth: float, porosity: float, ntg: float, temperature: float, utc_properties: JClass): - """ - Set necessary data on the doublet class for a single location prior to simulation. - - Parameters - ---------- - utc_properties : dict - Dictionary containing UTC properties. - doublet : object - An instance of the ThermoGIS doublet class. - transmissivity_with_ntg : float - Product of transmissivity and net-to-gross. - depth : float - Depth of the aquifer in meters. - porosity : float - Porosity of the aquifer (fraction). - ntg : float - Net-to-gross ratio of the aquifer (fraction). - temperature : float - Temperature of the aquifer in degrees Celsius. - - Returns - ------- - None - """ - - if not utc_properties.useStimulation() or transmissivity_with_ntg > utc_properties.stimKhMax(): - doublet.setNoStimulation() - - doublet.setDepth(depth) - doublet.setPorosity(porosity) - doublet.setNtg(ntg) - doublet.setReservoirTemp(temperature) - - if utc_properties.useHeatPump(): - if utc_properties.calculateCop() and not utc_properties.hpApplicationMode(): - doublet.setInjectionTemp(doublet.calculateInjectionTempWithHeatPump(temperature, utc_properties.hpDirectHeatInputTemp())) - else: - doublet.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.hpMinimumInjectionTemperature()])) - else: - doublet.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()])) -- GitLab