From 8f79d12c7d1980b2cf35b9e12c1532f2e57fbb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 09:59:48 +0200 Subject: [PATCH 1/7] Change 'res' attribute of network to 'residual' as part of issue #2. --- src/heatpumps/models/HeatPumpBase.py | 2 +- src/heatpumps/models/HeatPumpCascade.py | 10 +++++----- src/heatpumps/models/HeatPumpCascade2IHX.py | 10 +++++----- src/heatpumps/models/HeatPumpCascade2IHXTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpCascadeTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpEcon.py | 10 +++++----- src/heatpumps/models/HeatPumpEconIHX.py | 10 +++++----- src/heatpumps/models/HeatPumpEconIHXTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpEconTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpFlash.py | 10 +++++----- src/heatpumps/models/HeatPumpFlashTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpIC.py | 10 +++++----- src/heatpumps/models/HeatPumpICTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpIHX.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXEcon.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXEconTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXPC.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXPCIHX.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXPCIHXTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXPCTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpIHXTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpPC.py | 10 +++++----- src/heatpumps/models/HeatPumpPCIHX.py | 10 +++++----- src/heatpumps/models/HeatPumpPCIHXTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpPCTrans.py | 10 +++++----- src/heatpumps/models/HeatPumpSimple.py | 10 +++++----- src/heatpumps/models/HeatPumpSimpleTrans.py | 10 +++++----- 27 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/heatpumps/models/HeatPumpBase.py b/src/heatpumps/models/HeatPumpBase.py index 9c066bc..ed16403 100644 --- a/src/heatpumps/models/HeatPumpBase.py +++ b/src/heatpumps/models/HeatPumpBase.py @@ -80,7 +80,7 @@ def _solve_model(self, **kwargs): if 'print_results' in kwargs: if kwargs['print_results']: self.nw.print_results() - if self.nw.res[-1] < 1e-3: + if self.nw.residual[-1] < 1e-3: self.solved_design = True self.nw.save(self.design_path) diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index 2e201ee..f26ec9b 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -409,9 +409,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -424,7 +424,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -439,7 +439,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -464,7 +464,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index 30b77da..40185fc 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -463,9 +463,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -478,7 +478,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -493,7 +493,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -518,7 +518,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index 673538d..d25cdd4 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -462,9 +462,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -477,7 +477,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -492,7 +492,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -517,7 +517,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index f08ab5e..6a9dc0e 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -409,9 +409,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -424,7 +424,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -439,7 +439,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -464,7 +464,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpEcon.py b/src/heatpumps/models/HeatPumpEcon.py index 40fbc03..e30aa71 100644 --- a/src/heatpumps/models/HeatPumpEcon.py +++ b/src/heatpumps/models/HeatPumpEcon.py @@ -378,9 +378,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -393,7 +393,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -408,7 +408,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -433,7 +433,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpEconIHX.py b/src/heatpumps/models/HeatPumpEconIHX.py index 03eea07..a274661 100644 --- a/src/heatpumps/models/HeatPumpEconIHX.py +++ b/src/heatpumps/models/HeatPumpEconIHX.py @@ -436,9 +436,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -451,7 +451,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -466,7 +466,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -491,7 +491,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpEconIHXTrans.py b/src/heatpumps/models/HeatPumpEconIHXTrans.py index c8338ab..7be71ad 100644 --- a/src/heatpumps/models/HeatPumpEconIHXTrans.py +++ b/src/heatpumps/models/HeatPumpEconIHXTrans.py @@ -436,9 +436,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -451,7 +451,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -466,7 +466,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -491,7 +491,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpEconTrans.py b/src/heatpumps/models/HeatPumpEconTrans.py index 8df397f..13fb33f 100644 --- a/src/heatpumps/models/HeatPumpEconTrans.py +++ b/src/heatpumps/models/HeatPumpEconTrans.py @@ -379,9 +379,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -394,7 +394,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -409,7 +409,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -434,7 +434,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpFlash.py b/src/heatpumps/models/HeatPumpFlash.py index b978f53..aa55715 100644 --- a/src/heatpumps/models/HeatPumpFlash.py +++ b/src/heatpumps/models/HeatPumpFlash.py @@ -323,9 +323,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -338,7 +338,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -353,7 +353,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -378,7 +378,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpFlashTrans.py b/src/heatpumps/models/HeatPumpFlashTrans.py index 4580ee6..d6f772f 100644 --- a/src/heatpumps/models/HeatPumpFlashTrans.py +++ b/src/heatpumps/models/HeatPumpFlashTrans.py @@ -324,9 +324,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -339,7 +339,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -354,7 +354,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -379,7 +379,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIC.py b/src/heatpumps/models/HeatPumpIC.py index 948592a..84d0394 100644 --- a/src/heatpumps/models/HeatPumpIC.py +++ b/src/heatpumps/models/HeatPumpIC.py @@ -334,9 +334,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -349,7 +349,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -364,7 +364,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -389,7 +389,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpICTrans.py b/src/heatpumps/models/HeatPumpICTrans.py index 44f4012..da5b19a 100644 --- a/src/heatpumps/models/HeatPumpICTrans.py +++ b/src/heatpumps/models/HeatPumpICTrans.py @@ -334,9 +334,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -349,7 +349,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -364,7 +364,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -389,7 +389,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHX.py b/src/heatpumps/models/HeatPumpIHX.py index fbe28db..002e057 100644 --- a/src/heatpumps/models/HeatPumpIHX.py +++ b/src/heatpumps/models/HeatPumpIHX.py @@ -325,9 +325,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -340,7 +340,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -355,7 +355,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -380,7 +380,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXEcon.py b/src/heatpumps/models/HeatPumpIHXEcon.py index 78193dc..32c55b4 100644 --- a/src/heatpumps/models/HeatPumpIHXEcon.py +++ b/src/heatpumps/models/HeatPumpIHXEcon.py @@ -408,9 +408,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -423,7 +423,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -438,7 +438,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -463,7 +463,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXEconTrans.py b/src/heatpumps/models/HeatPumpIHXEconTrans.py index d4582c9..49dfddf 100644 --- a/src/heatpumps/models/HeatPumpIHXEconTrans.py +++ b/src/heatpumps/models/HeatPumpIHXEconTrans.py @@ -409,9 +409,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -424,7 +424,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -439,7 +439,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -464,7 +464,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXPC.py b/src/heatpumps/models/HeatPumpIHXPC.py index cecddd3..f633836 100644 --- a/src/heatpumps/models/HeatPumpIHXPC.py +++ b/src/heatpumps/models/HeatPumpIHXPC.py @@ -408,9 +408,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -423,7 +423,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -438,7 +438,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -463,7 +463,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXPCIHX.py b/src/heatpumps/models/HeatPumpIHXPCIHX.py index 43b9fd8..de11c79 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHX.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHX.py @@ -434,9 +434,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -449,7 +449,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -464,7 +464,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -489,7 +489,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py index 141299c..bf2778f 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py @@ -434,9 +434,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -449,7 +449,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -464,7 +464,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -489,7 +489,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXPCTrans.py b/src/heatpumps/models/HeatPumpIHXPCTrans.py index b881fe9..72d31fb 100644 --- a/src/heatpumps/models/HeatPumpIHXPCTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCTrans.py @@ -408,9 +408,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -423,7 +423,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -438,7 +438,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -463,7 +463,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpIHXTrans.py b/src/heatpumps/models/HeatPumpIHXTrans.py index 4f6669c..c9caa22 100644 --- a/src/heatpumps/models/HeatPumpIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXTrans.py @@ -324,9 +324,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -339,7 +339,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -354,7 +354,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -379,7 +379,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpPC.py b/src/heatpumps/models/HeatPumpPC.py index edea2cc..3a5e53e 100644 --- a/src/heatpumps/models/HeatPumpPC.py +++ b/src/heatpumps/models/HeatPumpPC.py @@ -379,9 +379,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -394,7 +394,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -409,7 +409,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -434,7 +434,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpPCIHX.py b/src/heatpumps/models/HeatPumpPCIHX.py index 228edde..1773829 100644 --- a/src/heatpumps/models/HeatPumpPCIHX.py +++ b/src/heatpumps/models/HeatPumpPCIHX.py @@ -408,9 +408,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -423,7 +423,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -438,7 +438,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -463,7 +463,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpPCIHXTrans.py b/src/heatpumps/models/HeatPumpPCIHXTrans.py index c9f0961..be048ec 100644 --- a/src/heatpumps/models/HeatPumpPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpPCIHXTrans.py @@ -408,9 +408,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -423,7 +423,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -438,7 +438,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -463,7 +463,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpPCTrans.py b/src/heatpumps/models/HeatPumpPCTrans.py index 438a764..30505b7 100644 --- a/src/heatpumps/models/HeatPumpPCTrans.py +++ b/src/heatpumps/models/HeatPumpPCTrans.py @@ -379,9 +379,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -394,7 +394,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -409,7 +409,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -434,7 +434,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpSimple.py b/src/heatpumps/models/HeatPumpSimple.py index 8a2dd59..8ef3582 100644 --- a/src/heatpumps/models/HeatPumpSimple.py +++ b/src/heatpumps/models/HeatPumpSimple.py @@ -297,9 +297,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -312,7 +312,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -327,7 +327,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -352,7 +352,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: diff --git a/src/heatpumps/models/HeatPumpSimpleTrans.py b/src/heatpumps/models/HeatPumpSimpleTrans.py index 456d7ae..c6fb928 100644 --- a/src/heatpumps/models/HeatPumpSimpleTrans.py +++ b/src/heatpumps/models/HeatPumpSimpleTrans.py @@ -295,9 +295,9 @@ def offdesign_simulation(self, log_simulations=False): '%H:%M:%S' ) log_entry = ( - f'{timestamp};{(self.nw.res[-1] < 1e-3)};' + f'{timestamp};{(self.nw.residual[-1] < 1e-3)};' + f'{T_hs_ff:.2f};{T_cons_ff:.2f};{pl:.1f};' - + f'{self.nw.res[-1]:.2e}\n' + + f'{self.nw.residual[-1]:.2e}\n' ) if not os.path.exists(logpath): with open(logpath, 'w', encoding='utf-8') as file: @@ -310,7 +310,7 @@ def offdesign_simulation(self, log_simulations=False): with open(logpath, 'a', encoding='utf-8') as file: file.write(log_entry) - if pl == self.pl_range[-1] and self.nw.res[-1] < 1e-3: + if pl == self.pl_range[-1] and self.nw.residual[-1] < 1e-3: self.nw.save(os.path.abspath(os.path.join( os.path.dirname(__file__), 'stable', f'{self.subdirname}_init' @@ -325,7 +325,7 @@ def offdesign_simulation(self, log_simulations=False): if inranges: empty_or_worse = ( pd.isnull(results_offdesign.loc[idx, 'Q']) - or (self.nw.res[-1] + or (self.nw.residual[-1] < results_offdesign.loc[idx, 'residual'] ) ) @@ -350,7 +350,7 @@ def offdesign_simulation(self, log_simulations=False): / results_offdesign.loc[idx, 'P'] ) results_offdesign.loc[idx, 'residual'] = ( - self.nw.res[-1] + self.nw.residual[-1] ) if self.params['offdesign']['save_results']: From e11af4e62251e351f46ae866c47123e37dec9540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 10:11:55 +0200 Subject: [PATCH 2/7] Remove fluids argument from Network instance (#2). --- src/heatpumps/models/HeatPumpBase.py | 1 - src/heatpumps/models/HeatPumpCascade.py | 1 - src/heatpumps/models/HeatPumpCascade2IHX.py | 1 - src/heatpumps/models/HeatPumpCascade2IHXTrans.py | 1 - src/heatpumps/models/HeatPumpCascadeTrans.py | 1 - 5 files changed, 5 deletions(-) diff --git a/src/heatpumps/models/HeatPumpBase.py b/src/heatpumps/models/HeatPumpBase.py index ed16403..0376d16 100644 --- a/src/heatpumps/models/HeatPumpBase.py +++ b/src/heatpumps/models/HeatPumpBase.py @@ -37,7 +37,6 @@ def __init__(self, params): self.buses = dict() self.nw = Network( - fluids=[fluid for fluid in self.fluid_vec_wf], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index f26ec9b..b3d409e 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -67,7 +67,6 @@ def __init__(self, params): self.buses = dict() self.nw = Network( - fluids=[fluid for fluid in self.fluid_vec_wf1], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index 40185fc..d06576d 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -67,7 +67,6 @@ def __init__(self, params): self.buses = dict() self.nw = Network( - fluids=[fluid for fluid in self.fluid_vec_wf1], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index d25cdd4..10a4adf 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -67,7 +67,6 @@ def __init__(self, params): self.buses = dict() self.nw = Network( - fluids=[fluid for fluid in self.fluid_vec_wf1], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index 6a9dc0e..016ec48 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -67,7 +67,6 @@ def __init__(self, params): self.buses = dict() self.nw = Network( - fluids=[fluid for fluid in self.fluid_vec_wf1], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) From d3d1075365169de132b7c70af16db963f1c1e418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 11:53:27 +0200 Subject: [PATCH 3/7] Replace full fluid vector of source and sink with only the respective fluids (#2). --- src/heatpumps/models/HeatPumpCascade.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHX.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpCascadeTrans.py | 4 ++-- src/heatpumps/models/HeatPumpEcon.py | 4 ++-- src/heatpumps/models/HeatPumpEconIHX.py | 4 ++-- src/heatpumps/models/HeatPumpEconIHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpEconTrans.py | 4 ++-- src/heatpumps/models/HeatPumpFlash.py | 4 ++-- src/heatpumps/models/HeatPumpFlashTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIC.py | 4 ++-- src/heatpumps/models/HeatPumpICTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIHX.py | 4 ++-- src/heatpumps/models/HeatPumpIHXEcon.py | 4 ++-- src/heatpumps/models/HeatPumpIHXEconTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIHXPC.py | 4 ++-- src/heatpumps/models/HeatPumpIHXPCIHX.py | 4 ++-- src/heatpumps/models/HeatPumpIHXPCIHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIHXPCTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpPC.py | 4 ++-- src/heatpumps/models/HeatPumpPCIHX.py | 4 ++-- src/heatpumps/models/HeatPumpPCIHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpPCTrans.py | 4 ++-- src/heatpumps/models/HeatPumpSimple.py | 4 ++-- src/heatpumps/models/HeatPumpSimpleTrans.py | 4 ++-- 26 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index b3d409e..bb7a6f6 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -243,7 +243,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -251,7 +251,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index d06576d..b909304 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -279,7 +279,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -287,7 +287,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index 10a4adf..97eca70 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -278,7 +278,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -286,7 +286,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index 016ec48..a07d9d1 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -246,7 +246,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -254,7 +254,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpEcon.py b/src/heatpumps/models/HeatPumpEcon.py index e30aa71..6325511 100644 --- a/src/heatpumps/models/HeatPumpEcon.py +++ b/src/heatpumps/models/HeatPumpEcon.py @@ -213,7 +213,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -221,7 +221,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpEconIHX.py b/src/heatpumps/models/HeatPumpEconIHX.py index a274661..04dc1d9 100644 --- a/src/heatpumps/models/HeatPumpEconIHX.py +++ b/src/heatpumps/models/HeatPumpEconIHX.py @@ -260,7 +260,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -268,7 +268,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpEconIHXTrans.py b/src/heatpumps/models/HeatPumpEconIHXTrans.py index 7be71ad..620bc3f 100644 --- a/src/heatpumps/models/HeatPumpEconIHXTrans.py +++ b/src/heatpumps/models/HeatPumpEconIHXTrans.py @@ -260,7 +260,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -268,7 +268,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpEconTrans.py b/src/heatpumps/models/HeatPumpEconTrans.py index 13fb33f..e300bc4 100644 --- a/src/heatpumps/models/HeatPumpEconTrans.py +++ b/src/heatpumps/models/HeatPumpEconTrans.py @@ -214,7 +214,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -222,7 +222,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpFlash.py b/src/heatpumps/models/HeatPumpFlash.py index aa55715..839c84f 100644 --- a/src/heatpumps/models/HeatPumpFlash.py +++ b/src/heatpumps/models/HeatPumpFlash.py @@ -166,7 +166,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -174,7 +174,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpFlashTrans.py b/src/heatpumps/models/HeatPumpFlashTrans.py index d6f772f..3f987f0 100644 --- a/src/heatpumps/models/HeatPumpFlashTrans.py +++ b/src/heatpumps/models/HeatPumpFlashTrans.py @@ -167,7 +167,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -175,7 +175,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIC.py b/src/heatpumps/models/HeatPumpIC.py index 84d0394..f8ab70c 100644 --- a/src/heatpumps/models/HeatPumpIC.py +++ b/src/heatpumps/models/HeatPumpIC.py @@ -167,7 +167,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -175,7 +175,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpICTrans.py b/src/heatpumps/models/HeatPumpICTrans.py index da5b19a..650b17c 100644 --- a/src/heatpumps/models/HeatPumpICTrans.py +++ b/src/heatpumps/models/HeatPumpICTrans.py @@ -167,7 +167,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -175,7 +175,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHX.py b/src/heatpumps/models/HeatPumpIHX.py index 002e057..df8d432 100644 --- a/src/heatpumps/models/HeatPumpIHX.py +++ b/src/heatpumps/models/HeatPumpIHX.py @@ -167,7 +167,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -175,7 +175,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXEcon.py b/src/heatpumps/models/HeatPumpIHXEcon.py index 32c55b4..d498061 100644 --- a/src/heatpumps/models/HeatPumpIHXEcon.py +++ b/src/heatpumps/models/HeatPumpIHXEcon.py @@ -232,7 +232,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -240,7 +240,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXEconTrans.py b/src/heatpumps/models/HeatPumpIHXEconTrans.py index 49dfddf..5b6e12d 100644 --- a/src/heatpumps/models/HeatPumpIHXEconTrans.py +++ b/src/heatpumps/models/HeatPumpIHXEconTrans.py @@ -233,7 +233,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -241,7 +241,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXPC.py b/src/heatpumps/models/HeatPumpIHXPC.py index f633836..cec5d66 100644 --- a/src/heatpumps/models/HeatPumpIHXPC.py +++ b/src/heatpumps/models/HeatPumpIHXPC.py @@ -232,7 +232,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -240,7 +240,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXPCIHX.py b/src/heatpumps/models/HeatPumpIHXPCIHX.py index de11c79..0cd07c4 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHX.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHX.py @@ -249,7 +249,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -257,7 +257,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py index bf2778f..489aae8 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py @@ -249,7 +249,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -257,7 +257,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXPCTrans.py b/src/heatpumps/models/HeatPumpIHXPCTrans.py index 72d31fb..8cc9a05 100644 --- a/src/heatpumps/models/HeatPumpIHXPCTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCTrans.py @@ -232,7 +232,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -240,7 +240,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpIHXTrans.py b/src/heatpumps/models/HeatPumpIHXTrans.py index c9caa22..1cea2b2 100644 --- a/src/heatpumps/models/HeatPumpIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXTrans.py @@ -166,7 +166,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -174,7 +174,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpPC.py b/src/heatpumps/models/HeatPumpPC.py index 3a5e53e..8c76c87 100644 --- a/src/heatpumps/models/HeatPumpPC.py +++ b/src/heatpumps/models/HeatPumpPC.py @@ -213,7 +213,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -221,7 +221,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpPCIHX.py b/src/heatpumps/models/HeatPumpPCIHX.py index 1773829..33af86e 100644 --- a/src/heatpumps/models/HeatPumpPCIHX.py +++ b/src/heatpumps/models/HeatPumpPCIHX.py @@ -232,7 +232,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -240,7 +240,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpPCIHXTrans.py b/src/heatpumps/models/HeatPumpPCIHXTrans.py index be048ec..56baf01 100644 --- a/src/heatpumps/models/HeatPumpPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpPCIHXTrans.py @@ -232,7 +232,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -240,7 +240,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpPCTrans.py b/src/heatpumps/models/HeatPumpPCTrans.py index 30505b7..5ddfc93 100644 --- a/src/heatpumps/models/HeatPumpPCTrans.py +++ b/src/heatpumps/models/HeatPumpPCTrans.py @@ -213,7 +213,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -221,7 +221,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpSimple.py b/src/heatpumps/models/HeatPumpSimple.py index 8ef3582..25cd9a9 100644 --- a/src/heatpumps/models/HeatPumpSimple.py +++ b/src/heatpumps/models/HeatPumpSimple.py @@ -148,7 +148,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -156,7 +156,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) diff --git a/src/heatpumps/models/HeatPumpSimpleTrans.py b/src/heatpumps/models/HeatPumpSimpleTrans.py index c6fb928..cb90fcc 100644 --- a/src/heatpumps/models/HeatPumpSimpleTrans.py +++ b/src/heatpumps/models/HeatPumpSimpleTrans.py @@ -149,7 +149,7 @@ def init_simulation(self, **kwargs): # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], - fluid=self.fluid_vec_so + fluid={self.so: 1} ) self.conns['B2'].set_attr(T=self.params['B2']['T']) self.conns['B3'].set_attr(p=self.params['B1']['p']) @@ -157,7 +157,7 @@ def init_simulation(self, **kwargs): # Heat sink self.conns['C3'].set_attr( T=self.params['C3']['T'], p=self.params['C3']['p'], - fluid=self.fluid_vec_si + fluid={self.si: 1} ) self.conns['C0'].set_attr(T=self.params['C0']['T']) From 77caed45d4d0014ef9ccc4e6393450e6835534ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 12:19:39 +0200 Subject: [PATCH 4/7] Replace working fluid vector with dict (#2). --- src/heatpumps/models/HeatPumpCascade.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHX.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHXTrans.py | 6 ++++-- src/heatpumps/models/HeatPumpCascadeTrans.py | 4 ++-- src/heatpumps/models/HeatPumpEcon.py | 2 +- src/heatpumps/models/HeatPumpEconIHX.py | 2 +- src/heatpumps/models/HeatPumpEconIHXTrans.py | 2 +- src/heatpumps/models/HeatPumpEconTrans.py | 4 +++- src/heatpumps/models/HeatPumpFlashTrans.py | 4 +++- src/heatpumps/models/HeatPumpIC.py | 2 +- src/heatpumps/models/HeatPumpICTrans.py | 4 +++- src/heatpumps/models/HeatPumpIHX.py | 2 +- src/heatpumps/models/HeatPumpIHXEcon.py | 2 +- src/heatpumps/models/HeatPumpIHXEconTrans.py | 4 +++- src/heatpumps/models/HeatPumpIHXPC.py | 2 +- src/heatpumps/models/HeatPumpIHXPCIHX.py | 2 +- src/heatpumps/models/HeatPumpIHXPCIHXTrans.py | 4 +++- src/heatpumps/models/HeatPumpIHXPCTrans.py | 4 +++- src/heatpumps/models/HeatPumpIHXTrans.py | 4 +++- src/heatpumps/models/HeatPumpPC.py | 2 +- src/heatpumps/models/HeatPumpPCIHX.py | 2 +- src/heatpumps/models/HeatPumpPCIHXTrans.py | 4 +++- src/heatpumps/models/HeatPumpPCTrans.py | 4 +++- src/heatpumps/models/HeatPumpSimple.py | 2 +- src/heatpumps/models/HeatPumpSimpleTrans.py | 2 +- 25 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index bb7a6f6..8912715 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -237,9 +237,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap2) - self.conns['A0'].set_attr(p=p_cond2, fluid=self.fluid_vec_wf2) + self.conns['A0'].set_attr(p=p_cond2, fluid={self.wf2: 1}) self.conns['D3'].set_attr(x=self.params['D3']['x'], p=p_evap1) - self.conns['D0'].set_attr(p=p_cond1, fluid=self.fluid_vec_wf1) + self.conns['D0'].set_attr(p=p_cond1, fluid={self.wf1: 1}) # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index b909304..b4aa035 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -271,10 +271,10 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A4'].set_attr(x=self.params['A4']['x'], p=p_evap2) - self.conns['A0'].set_attr(p=p_cond2, fluid=self.fluid_vec_wf2) + self.conns['A0'].set_attr(p=p_cond2, fluid={self.wf2: 1}) self.conns['A5'].set_attr(h=h_superheat2) self.conns['D4'].set_attr(x=self.params['D4']['x'], p=p_evap1) - self.conns['D0'].set_attr(p=p_cond1, fluid=self.fluid_vec_wf1) + self.conns['D0'].set_attr(p=p_cond1, fluid={self.wf1: 1}) self.conns['D5'].set_attr(h=h_superheat1) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index 97eca70..1a72670 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -270,10 +270,12 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A4'].set_attr(x=self.params['A4']['x'], p=p_evap2) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf2) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf2: 1} + ) self.conns['A5'].set_attr(h=h_superheat2) self.conns['D4'].set_attr(x=self.params['D4']['x'], p=p_evap1) - self.conns['D0'].set_attr(p=p_cond1, fluid=self.fluid_vec_wf1) + self.conns['D0'].set_attr(p=p_cond1, fluid={self.wf1: 1}) self.conns['D5'].set_attr(h=h_superheat1) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index a07d9d1..6b7ebca 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -239,10 +239,10 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap2) self.conns['A0'].set_attr( - p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf2 + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf2: 1} ) self.conns['D3'].set_attr(x=self.params['D3']['x'], p=p_evap1) - self.conns['D0'].set_attr(p=p_cond1, fluid=self.fluid_vec_wf1) + self.conns['D0'].set_attr(p=p_cond1, fluid={self.wf1: 1}) # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], diff --git a/src/heatpumps/models/HeatPumpEcon.py b/src/heatpumps/models/HeatPumpEcon.py index 6325511..b78a03b 100644 --- a/src/heatpumps/models/HeatPumpEcon.py +++ b/src/heatpumps/models/HeatPumpEcon.py @@ -202,7 +202,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A5'].set_attr(x=self.params['A5']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A9'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': self.conns['A9'].set_attr(x=1) diff --git a/src/heatpumps/models/HeatPumpEconIHX.py b/src/heatpumps/models/HeatPumpEconIHX.py index 04dc1d9..a1bb4c8 100644 --- a/src/heatpumps/models/HeatPumpEconIHX.py +++ b/src/heatpumps/models/HeatPumpEconIHX.py @@ -225,7 +225,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) if self.params['C3']['T'] == 90: self.conns['A7'].set_attr(h=h_sattdampf_evap) else: diff --git a/src/heatpumps/models/HeatPumpEconIHXTrans.py b/src/heatpumps/models/HeatPumpEconIHXTrans.py index 620bc3f..4cea8ca 100644 --- a/src/heatpumps/models/HeatPumpEconIHXTrans.py +++ b/src/heatpumps/models/HeatPumpEconIHXTrans.py @@ -225,7 +225,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1}) if self.params['C3']['T'] == 90: self.conns['A7'].set_attr(h=h_sattdampf_evap) else: diff --git a/src/heatpumps/models/HeatPumpEconTrans.py b/src/heatpumps/models/HeatPumpEconTrans.py index e300bc4..e0fa0cb 100644 --- a/src/heatpumps/models/HeatPumpEconTrans.py +++ b/src/heatpumps/models/HeatPumpEconTrans.py @@ -203,7 +203,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A5'].set_attr(x=self.params['A5']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A9'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': self.conns['A9'].set_attr(x=1) diff --git a/src/heatpumps/models/HeatPumpFlashTrans.py b/src/heatpumps/models/HeatPumpFlashTrans.py index 3f987f0..8ad4fa5 100644 --- a/src/heatpumps/models/HeatPumpFlashTrans.py +++ b/src/heatpumps/models/HeatPumpFlashTrans.py @@ -163,7 +163,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A5'].set_attr(x=self.params['A5']['x'], p=p_evap) self.conns['A7'].set_attr(p=p_mid) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], diff --git a/src/heatpumps/models/HeatPumpIC.py b/src/heatpumps/models/HeatPumpIC.py index f8ab70c..7477c6a 100644 --- a/src/heatpumps/models/HeatPumpIC.py +++ b/src/heatpumps/models/HeatPumpIC.py @@ -162,7 +162,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A5'].set_attr(p=p_mid, h=h_s_mid) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpICTrans.py b/src/heatpumps/models/HeatPumpICTrans.py index 650b17c..28d7c54 100644 --- a/src/heatpumps/models/HeatPumpICTrans.py +++ b/src/heatpumps/models/HeatPumpICTrans.py @@ -162,7 +162,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A5'].set_attr(p=p_mid, h=h_s_mid) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpIHX.py b/src/heatpumps/models/HeatPumpIHX.py index df8d432..4bbcf1c 100644 --- a/src/heatpumps/models/HeatPumpIHX.py +++ b/src/heatpumps/models/HeatPumpIHX.py @@ -162,7 +162,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A4'].set_attr(x=self.params['A4']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A5'].set_attr(h=h_superheat) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpIHXEcon.py b/src/heatpumps/models/HeatPumpIHXEcon.py index d498061..cea04c3 100644 --- a/src/heatpumps/models/HeatPumpIHXEcon.py +++ b/src/heatpumps/models/HeatPumpIHXEcon.py @@ -220,7 +220,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A7'].set_attr(h=h_superheat) self.conns['A11'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpIHXEconTrans.py b/src/heatpumps/models/HeatPumpIHXEconTrans.py index 5b6e12d..fcdbba2 100644 --- a/src/heatpumps/models/HeatPumpIHXEconTrans.py +++ b/src/heatpumps/models/HeatPumpIHXEconTrans.py @@ -221,7 +221,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A7'].set_attr(h=h_superheat) self.conns['A11'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpIHXPC.py b/src/heatpumps/models/HeatPumpIHXPC.py index cec5d66..c76e0c6 100644 --- a/src/heatpumps/models/HeatPumpIHXPC.py +++ b/src/heatpumps/models/HeatPumpIHXPC.py @@ -220,7 +220,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A7'].set_attr(h=h_superheat) self.conns['A10'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpIHXPCIHX.py b/src/heatpumps/models/HeatPumpIHXPCIHX.py index 0cd07c4..a5716a8 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHX.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHX.py @@ -236,7 +236,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A7'].set_attr(x=self.params['A7']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A8'].set_attr(h=h_superheat1) self.conns['A12'].set_attr(h=h_superheat2) self.conns['A11'].set_attr(p=p_mid) diff --git a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py index 489aae8..d58d03d 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py @@ -236,7 +236,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A7'].set_attr(x=self.params['A7']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A8'].set_attr(h=h_superheat1) self.conns['A12'].set_attr(h=h_superheat2) self.conns['A11'].set_attr(p=p_mid) diff --git a/src/heatpumps/models/HeatPumpIHXPCTrans.py b/src/heatpumps/models/HeatPumpIHXPCTrans.py index 8cc9a05..b24bf27 100644 --- a/src/heatpumps/models/HeatPumpIHXPCTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCTrans.py @@ -220,7 +220,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A7'].set_attr(h=h_superheat) self.conns['A10'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpIHXTrans.py b/src/heatpumps/models/HeatPumpIHXTrans.py index 1cea2b2..3789d37 100644 --- a/src/heatpumps/models/HeatPumpIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXTrans.py @@ -161,7 +161,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A4'].set_attr(x=self.params['A4']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A5'].set_attr(h=h_superheat) # Heat source self.conns['B1'].set_attr( diff --git a/src/heatpumps/models/HeatPumpPC.py b/src/heatpumps/models/HeatPumpPC.py index 8c76c87..1f29d3d 100644 --- a/src/heatpumps/models/HeatPumpPC.py +++ b/src/heatpumps/models/HeatPumpPC.py @@ -202,7 +202,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A5'].set_attr(x=self.params['A5']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A8'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': self.conns['A8'].set_attr(x=1) diff --git a/src/heatpumps/models/HeatPumpPCIHX.py b/src/heatpumps/models/HeatPumpPCIHX.py index 33af86e..639e805 100644 --- a/src/heatpumps/models/HeatPumpPCIHX.py +++ b/src/heatpumps/models/HeatPumpPCIHX.py @@ -220,7 +220,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) self.conns['A7'].set_attr(h=h_superheat) self.conns['A10'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpPCIHXTrans.py b/src/heatpumps/models/HeatPumpPCIHXTrans.py index 56baf01..a288886 100644 --- a/src/heatpumps/models/HeatPumpPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpPCIHXTrans.py @@ -220,7 +220,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A6'].set_attr(x=self.params['A6']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A7'].set_attr(h=h_superheat) self.conns['A10'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': diff --git a/src/heatpumps/models/HeatPumpPCTrans.py b/src/heatpumps/models/HeatPumpPCTrans.py index 5ddfc93..5d4f033 100644 --- a/src/heatpumps/models/HeatPumpPCTrans.py +++ b/src/heatpumps/models/HeatPumpPCTrans.py @@ -202,7 +202,9 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A5'].set_attr(x=self.params['A5']['x'], p=p_evap) - self.conns['A0'].set_attr(p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr( + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} + ) self.conns['A8'].set_attr(p=p_mid) if self.econ_type.lower() == 'closed': self.conns['A8'].set_attr(x=1) diff --git a/src/heatpumps/models/HeatPumpSimple.py b/src/heatpumps/models/HeatPumpSimple.py index 25cd9a9..d6cddb5 100644 --- a/src/heatpumps/models/HeatPumpSimple.py +++ b/src/heatpumps/models/HeatPumpSimple.py @@ -144,7 +144,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap) - self.conns['A0'].set_attr(p=p_cond, fluid=self.fluid_vec_wf) + self.conns['A0'].set_attr(p=p_cond, fluid={self.wf: 1}) # Heat source self.conns['B1'].set_attr( T=self.params['B1']['T'], p=self.params['B1']['p'], diff --git a/src/heatpumps/models/HeatPumpSimpleTrans.py b/src/heatpumps/models/HeatPumpSimpleTrans.py index cb90fcc..742ed26 100644 --- a/src/heatpumps/models/HeatPumpSimpleTrans.py +++ b/src/heatpumps/models/HeatPumpSimpleTrans.py @@ -144,7 +144,7 @@ def init_simulation(self, **kwargs): # Main cycle self.conns['A3'].set_attr(x=self.params['A3']['x'], p=p_evap) self.conns['A0'].set_attr( - p=self.params['A0']['p'], h=h_trans_out, fluid=self.fluid_vec_wf + p=self.params['A0']['p'], h=h_trans_out, fluid={self.wf: 1} ) # Heat source self.conns['B1'].set_attr( From b36906555c50463289c139f11bc15800def42861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 12:39:06 +0200 Subject: [PATCH 5/7] Replace deprecated HeatExchangerSimple with SimpleHeatExchanger (#2). --- src/heatpumps/models/HeatPumpCascade.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHX.py | 4 ++-- src/heatpumps/models/HeatPumpCascade2IHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpCascadeTrans.py | 4 ++-- src/heatpumps/models/HeatPumpEcon.py | 8 ++++---- src/heatpumps/models/HeatPumpEconIHX.py | 8 ++++---- src/heatpumps/models/HeatPumpEconIHXTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpEconTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpFlashTrans.py | 4 ++-- src/heatpumps/models/HeatPumpIC.py | 6 +++--- src/heatpumps/models/HeatPumpICTrans.py | 6 +++--- src/heatpumps/models/HeatPumpIHX.py | 4 ++-- src/heatpumps/models/HeatPumpIHXEcon.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXEconTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXPC.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXPCIHX.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXPCIHXTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXPCTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpIHXTrans.py | 4 ++-- src/heatpumps/models/HeatPumpPC.py | 8 ++++---- src/heatpumps/models/HeatPumpPCIHX.py | 8 ++++---- src/heatpumps/models/HeatPumpPCIHXTrans.py | 8 ++++---- src/heatpumps/models/HeatPumpPCTrans.py | 4 ++-- src/heatpumps/models/HeatPumpSimple.py | 4 ++-- src/heatpumps/models/HeatPumpSimpleTrans.py | 6 +++--- 25 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index 8912715..dcb8e4b 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection from tespy.networks import Network @@ -95,7 +95,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index b4aa035..64ce789 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.networks import Network @@ -95,7 +95,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index 1a72670..f57e38a 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.networks import Network @@ -95,7 +95,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index 6b7ebca..2a68f1c 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection from tespy.networks import Network @@ -95,7 +95,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpEcon.py b/src/heatpumps/models/HeatPumpEcon.py index b78a03b..d39ea7a 100644 --- a/src/heatpumps/models/HeatPumpEcon.py +++ b/src/heatpumps/models/HeatPumpEcon.py @@ -5,9 +5,9 @@ import numpy as np import pandas as pd from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -36,7 +36,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpEconIHX.py b/src/heatpumps/models/HeatPumpEconIHX.py index a1bb4c8..4271a77 100644 --- a/src/heatpumps/models/HeatPumpEconIHX.py +++ b/src/heatpumps/models/HeatPumpEconIHX.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpEconIHXTrans.py b/src/heatpumps/models/HeatPumpEconIHXTrans.py index 4cea8ca..bddec85 100644 --- a/src/heatpumps/models/HeatPumpEconIHXTrans.py +++ b/src/heatpumps/models/HeatPumpEconIHXTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpEconTrans.py b/src/heatpumps/models/HeatPumpEconTrans.py index e0fa0cb..590bf32 100644 --- a/src/heatpumps/models/HeatPumpEconTrans.py +++ b/src/heatpumps/models/HeatPumpEconTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpFlashTrans.py b/src/heatpumps/models/HeatPumpFlashTrans.py index 8ad4fa5..8a44ed9 100644 --- a/src/heatpumps/models/HeatPumpFlashTrans.py +++ b/src/heatpumps/models/HeatPumpFlashTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, Drum, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection from tespy.tools.characteristics import CharLine @@ -31,7 +31,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpIC.py b/src/heatpumps/models/HeatPumpIC.py index 7477c6a..d31e7f0 100644 --- a/src/heatpumps/models/HeatPumpIC.py +++ b/src/heatpumps/models/HeatPumpIC.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine @@ -31,7 +31,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') @@ -39,7 +39,7 @@ def generate_components(self): self.comps['valve'] = Valve('Valve') self.comps['evap'] = HeatExchanger('Evaporator') self.comps['comp1'] = Compressor('Compressor 1') - self.comps['ic'] = HeatExchangerSimple('Intercooler') + self.comps['ic'] = SimpleHeatExchanger('Intercooler') self.comps['comp2'] = Compressor('Compressor 2') def generate_connections(self): diff --git a/src/heatpumps/models/HeatPumpICTrans.py b/src/heatpumps/models/HeatPumpICTrans.py index 28d7c54..31a7bd7 100644 --- a/src/heatpumps/models/HeatPumpICTrans.py +++ b/src/heatpumps/models/HeatPumpICTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine @@ -31,7 +31,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') @@ -39,7 +39,7 @@ def generate_components(self): self.comps['valve'] = Valve('Valve') self.comps['evap'] = HeatExchanger('Evaporator') self.comps['comp1'] = Compressor('Compressor 1') - self.comps['ic'] = HeatExchangerSimple('Intercooler') + self.comps['ic'] = SimpleHeatExchanger('Intercooler') self.comps['comp2'] = Compressor('Compressor 2') def generate_connections(self): diff --git a/src/heatpumps/models/HeatPumpIHX.py b/src/heatpumps/models/HeatPumpIHX.py index 4bbcf1c..300a2de 100644 --- a/src/heatpumps/models/HeatPumpIHX.py +++ b/src/heatpumps/models/HeatPumpIHX.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine @@ -31,7 +31,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpIHXEcon.py b/src/heatpumps/models/HeatPumpIHXEcon.py index cea04c3..3ee4ff2 100644 --- a/src/heatpumps/models/HeatPumpIHXEcon.py +++ b/src/heatpumps/models/HeatPumpIHXEcon.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpIHXEconTrans.py b/src/heatpumps/models/HeatPumpIHXEconTrans.py index fcdbba2..93594e2 100644 --- a/src/heatpumps/models/HeatPumpIHXEconTrans.py +++ b/src/heatpumps/models/HeatPumpIHXEconTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpIHXPC.py b/src/heatpumps/models/HeatPumpIHXPC.py index c76e0c6..e695ec4 100644 --- a/src/heatpumps/models/HeatPumpIHXPC.py +++ b/src/heatpumps/models/HeatPumpIHXPC.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpIHXPCIHX.py b/src/heatpumps/models/HeatPumpIHXPCIHX.py index a5716a8..f0f5c81 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHX.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHX.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py index d58d03d..8a33abb 100644 --- a/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCIHXTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpIHXPCTrans.py b/src/heatpumps/models/HeatPumpIHXPCTrans.py index b24bf27..c625aa0 100644 --- a/src/heatpumps/models/HeatPumpIHXPCTrans.py +++ b/src/heatpumps/models/HeatPumpIHXPCTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpIHXTrans.py b/src/heatpumps/models/HeatPumpIHXTrans.py index 3789d37..a4e5e7c 100644 --- a/src/heatpumps/models/HeatPumpIHXTrans.py +++ b/src/heatpumps/models/HeatPumpIHXTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine @@ -31,7 +31,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpPC.py b/src/heatpumps/models/HeatPumpPC.py index 1f29d3d..b26aadc 100644 --- a/src/heatpumps/models/HeatPumpPC.py +++ b/src/heatpumps/models/HeatPumpPC.py @@ -5,9 +5,9 @@ import numpy as np import pandas as pd from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -36,7 +36,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpPCIHX.py b/src/heatpumps/models/HeatPumpPCIHX.py index 639e805..8180bc0 100644 --- a/src/heatpumps/models/HeatPumpPCIHX.py +++ b/src/heatpumps/models/HeatPumpPCIHX.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpPCIHXTrans.py b/src/heatpumps/models/HeatPumpPCIHXTrans.py index a288886..a634cb1 100644 --- a/src/heatpumps/models/HeatPumpPCIHXTrans.py +++ b/src/heatpumps/models/HeatPumpPCIHXTrans.py @@ -6,9 +6,9 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, Condenser, CycleCloser, - DropletSeparator, HeatExchanger, - HeatExchangerSimple, Merge, Pump, Sink, Source, - Splitter, Valve) + DropletSeparator, HeatExchanger, Merge, Pump, + SimpleHeatExchanger, Sink, Source, Splitter, + Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -37,7 +37,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpPCTrans.py b/src/heatpumps/models/HeatPumpPCTrans.py index 5d4f033..f432186 100644 --- a/src/heatpumps/models/HeatPumpPCTrans.py +++ b/src/heatpumps/models/HeatPumpPCTrans.py @@ -6,7 +6,7 @@ import pandas as pd from CoolProp.CoolProp import PropsSI as PSI from tespy.components import (Compressor, CycleCloser, DropletSeparator, - HeatExchanger, HeatExchangerSimple, Merge, Pump, + HeatExchanger, Merge, Pump, SimpleHeatExchanger, Sink, Source, Splitter, Valve) from tespy.connections import Bus, Connection, Ref from tespy.tools.characteristics import CharLine @@ -36,7 +36,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') diff --git a/src/heatpumps/models/HeatPumpSimple.py b/src/heatpumps/models/HeatPumpSimple.py index d6cddb5..9469cf3 100644 --- a/src/heatpumps/models/HeatPumpSimple.py +++ b/src/heatpumps/models/HeatPumpSimple.py @@ -5,7 +5,7 @@ import numpy as np import pandas as pd from tespy.components import (Compressor, Condenser, CycleCloser, - HeatExchanger, HeatExchangerSimple, Pump, Sink, + HeatExchanger, Pump, SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection from tespy.tools.characteristics import CharLine @@ -30,7 +30,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['cond'] = Condenser('Condenser') diff --git a/src/heatpumps/models/HeatPumpSimpleTrans.py b/src/heatpumps/models/HeatPumpSimpleTrans.py index 742ed26..9420e66 100644 --- a/src/heatpumps/models/HeatPumpSimpleTrans.py +++ b/src/heatpumps/models/HeatPumpSimpleTrans.py @@ -5,8 +5,8 @@ import numpy as np import pandas as pd from CoolProp.CoolProp import PropsSI as PSI -from tespy.components import (Compressor, CycleCloser, HeatExchanger, - HeatExchangerSimple, Pump, Sink, Source, Valve) +from tespy.components import (Compressor, CycleCloser, HeatExchanger, Pump, + SimpleHeatExchanger, Sink, Source, Valve) from tespy.connections import Bus, Connection from tespy.tools.characteristics import CharLine from tespy.tools.characteristics import load_default_char as ldc @@ -30,7 +30,7 @@ def generate_components(self): # Heat sink self.comps['cons_cc'] = CycleCloser('Consumer Cycle Closer') self.comps['cons_pump'] = Pump('Consumer Recirculation Pump') - self.comps['cons'] = HeatExchangerSimple('Consumer') + self.comps['cons'] = SimpleHeatExchanger('Consumer') # Main cycle self.comps['trans'] = HeatExchanger('Transcritical Heat Exchanger') From 22b81ffa55984183b2f4fd8021b9b0955851dfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 12:59:25 +0200 Subject: [PATCH 6/7] Remove fluid_vec occurrence and other clean up (#2). --- src/heatpumps/models/HeatPumpBase.py | 12 +------ src/heatpumps/models/HeatPumpCascade.py | 34 +------------------ src/heatpumps/models/HeatPumpCascade2IHX.py | 34 +------------------ .../models/HeatPumpCascade2IHXTrans.py | 34 +------------------ src/heatpumps/models/HeatPumpCascadeTrans.py | 34 +------------------ 5 files changed, 5 insertions(+), 143 deletions(-) diff --git a/src/heatpumps/models/HeatPumpBase.py b/src/heatpumps/models/HeatPumpBase.py index 0376d16..602996d 100644 --- a/src/heatpumps/models/HeatPumpBase.py +++ b/src/heatpumps/models/HeatPumpBase.py @@ -23,22 +23,12 @@ def __init__(self, params): self.si = self.params['fluids']['si'] self.so = self.params['fluids']['so'] - if self.si == self.so: - self.fluid_vec_wf = {self.wf: 1, self.si:0} - self.fluid_vec_si = {self.wf: 0, self.si: 1} - self.fluid_vec_so = {self.wf: 0, self.si: 1} - else: - self.fluid_vec_wf = {self.wf: 1, self.si: 0, self.so: 0} - self.fluid_vec_si = {self.wf: 0, self.si: 1, self.so: 0} - self.fluid_vec_so = {self.wf: 0, self.si: 0, self.so: 1} - self.comps = dict() self.conns = dict() self.buses = dict() self.nw = Network( - T_unit='C', p_unit='bar', h_unit='kJ / kg', - m_unit='kg / s' + T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) self.cop = np.nan diff --git a/src/heatpumps/models/HeatPumpCascade.py b/src/heatpumps/models/HeatPumpCascade.py index dcb8e4b..3330573 100644 --- a/src/heatpumps/models/HeatPumpCascade.py +++ b/src/heatpumps/models/HeatPumpCascade.py @@ -31,44 +31,12 @@ def __init__(self, params): self.si = self.params['fluids']['si'] self.so = self.params['fluids']['so'] - if self.wf1 == self.wf2: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.si: 1} - else: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1, self.so: 0} - self.fluid_vec_so = {self.wf1: 0, self.si: 0, self.so: 1} - else: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.wf2: 0, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 0, self.wf2: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.wf2: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.wf2: 0, self.si: 1} - else: - self.fluid_vec_wf1 = { - self.wf1: 1, self.wf2: 0, self.si: 0, self.so: 0 - } - self.fluid_vec_wf2 = { - self.wf1: 0, self.wf2: 1, self.si: 0, self.so: 0 - } - self.fluid_vec_si = { - self.wf1: 0, self.wf2: 0, self.si: 1, self.so: 0 - } - self.fluid_vec_so = { - self.wf1: 0, self.wf2: 0, self.si: 0, self.so: 1 - } - self.comps = dict() self.conns = dict() self.buses = dict() self.nw = Network( - T_unit='C', p_unit='bar', h_unit='kJ / kg', - m_unit='kg / s' + T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) self.cop = np.nan diff --git a/src/heatpumps/models/HeatPumpCascade2IHX.py b/src/heatpumps/models/HeatPumpCascade2IHX.py index 64ce789..8718b43 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHX.py +++ b/src/heatpumps/models/HeatPumpCascade2IHX.py @@ -31,44 +31,12 @@ def __init__(self, params): self.si = self.params['fluids']['si'] self.so = self.params['fluids']['so'] - if self.wf1 == self.wf2: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.si: 1} - else: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1, self.so: 0} - self.fluid_vec_so = {self.wf1: 0, self.si: 0, self.so: 1} - else: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.wf2: 0, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 0, self.wf2: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.wf2: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.wf2: 0, self.si: 1} - else: - self.fluid_vec_wf1 = { - self.wf1: 1, self.wf2: 0, self.si: 0, self.so: 0 - } - self.fluid_vec_wf2 = { - self.wf1: 0, self.wf2: 1, self.si: 0, self.so: 0 - } - self.fluid_vec_si = { - self.wf1: 0, self.wf2: 0, self.si: 1, self.so: 0 - } - self.fluid_vec_so = { - self.wf1: 0, self.wf2: 0, self.si: 0, self.so: 1 - } - self.comps = dict() self.conns = dict() self.buses = dict() self.nw = Network( - T_unit='C', p_unit='bar', h_unit='kJ / kg', - m_unit='kg / s' + T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) self.cop = np.nan diff --git a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py index f57e38a..ef63d77 100644 --- a/src/heatpumps/models/HeatPumpCascade2IHXTrans.py +++ b/src/heatpumps/models/HeatPumpCascade2IHXTrans.py @@ -31,44 +31,12 @@ def __init__(self, params): self.si = self.params['fluids']['si'] self.so = self.params['fluids']['so'] - if self.wf1 == self.wf2: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.si: 1} - else: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1, self.so: 0} - self.fluid_vec_so = {self.wf1: 0, self.si: 0, self.so: 1} - else: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.wf2: 0, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 0, self.wf2: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.wf2: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.wf2: 0, self.si: 1} - else: - self.fluid_vec_wf1 = { - self.wf1: 1, self.wf2: 0, self.si: 0, self.so: 0 - } - self.fluid_vec_wf2 = { - self.wf1: 0, self.wf2: 1, self.si: 0, self.so: 0 - } - self.fluid_vec_si = { - self.wf1: 0, self.wf2: 0, self.si: 1, self.so: 0 - } - self.fluid_vec_so = { - self.wf1: 0, self.wf2: 0, self.si: 0, self.so: 1 - } - self.comps = dict() self.conns = dict() self.buses = dict() self.nw = Network( - T_unit='C', p_unit='bar', h_unit='kJ / kg', - m_unit='kg / s' + T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) self.cop = np.nan diff --git a/src/heatpumps/models/HeatPumpCascadeTrans.py b/src/heatpumps/models/HeatPumpCascadeTrans.py index 2a68f1c..e86e423 100644 --- a/src/heatpumps/models/HeatPumpCascadeTrans.py +++ b/src/heatpumps/models/HeatPumpCascadeTrans.py @@ -31,44 +31,12 @@ def __init__(self, params): self.si = self.params['fluids']['si'] self.so = self.params['fluids']['so'] - if self.wf1 == self.wf2: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.si: 1} - else: - self.fluid_vec_wf1 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_wf2 = {self.wf1: 1, self.si: 0, self.so: 0} - self.fluid_vec_si = {self.wf1: 0, self.si: 1, self.so: 0} - self.fluid_vec_so = {self.wf1: 0, self.si: 0, self.so: 1} - else: - if self.si == self.so: - self.fluid_vec_wf1 = {self.wf1: 1, self.wf2: 0, self.si: 0} - self.fluid_vec_wf2 = {self.wf1: 0, self.wf2: 1, self.si: 0} - self.fluid_vec_si = {self.wf1: 0, self.wf2: 0, self.si: 1} - self.fluid_vec_so = {self.wf1: 0, self.wf2: 0, self.si: 1} - else: - self.fluid_vec_wf1 = { - self.wf1: 1, self.wf2: 0, self.si: 0, self.so: 0 - } - self.fluid_vec_wf2 = { - self.wf1: 0, self.wf2: 1, self.si: 0, self.so: 0 - } - self.fluid_vec_si = { - self.wf1: 0, self.wf2: 0, self.si: 1, self.so: 0 - } - self.fluid_vec_so = { - self.wf1: 0, self.wf2: 0, self.si: 0, self.so: 1 - } - self.comps = dict() self.conns = dict() self.buses = dict() self.nw = Network( - T_unit='C', p_unit='bar', h_unit='kJ / kg', - m_unit='kg / s' + T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s' ) self.cop = np.nan From 69efaaa3536245e2ffabe702c243489d2732807d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Frei=C3=9Fmann?= Date: Wed, 19 Jun 2024 13:48:34 +0200 Subject: [PATCH 7/7] Bump tespy version to 0.7.x in dependencies. --- requirements.txt | 11 ----------- setup.py | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f301521..0000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -tespy == 0.6.3 -streamlit >= 1.32.0 -numpy >= 1.24.0 -pandas >= 1.5.3 -scipy >= 1.10.0 -scikit-learn >= 1.2.1 -matplotlib >= 3.6.3 -fluprodia >= 2.0 -coolprop >= 6.4.1 -darkdetect >=0.8.0 -plotly >= 5.20.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 23e52df..2a06063 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ }, python_requires='>=3.9', install_requires=[ - 'tespy==0.6.3', + 'tespy>=0.7.0', 'streamlit>=1.32.0', 'numpy>=1.24.0', 'pandas>=1.5.3',