Skip to content

Commit

Permalink
Merge pull request #22 from bilwint/main
Browse files Browse the repository at this point in the history
Models especially at higher sink Temperature fails (Singularity in Jacobian matrix) #21
  • Loading branch information
jfreissmann authored Jun 21, 2024
2 parents 9f8a121 + 06a2169 commit 24f0e0a
Show file tree
Hide file tree
Showing 67 changed files with 83 additions and 83 deletions.
8 changes: 4 additions & 4 deletions src/heatpumps/hp_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,18 @@ def info_df(label, refrigs):
'Temperatur Vorlauf', min_value=0, max_value=T_crit,
value=params['C3']['T'], format='%d°C', key='T_consumer_ff'
)
params['C0']['T'] = st.slider(
params['C1']['T'] = st.slider(
'Temperatur Rücklauf', min_value=0, max_value=T_crit,
value=params['C0']['T'], format='%d°C', key='T_consumer_bf'
value=params['C1']['T'], format='%d°C', key='T_consumer_bf'
)

invalid_temp_diff = params['C0']['T'] >= params['C3']['T']
invalid_temp_diff = params['C1']['T'] >= params['C3']['T']
if invalid_temp_diff:
st.error(
'Die Rücklauftemperatur muss niedriger sein, als die '
+ 'Vorlauftemperatur.'
)
invalid_temp_diff = params['C0']['T'] <= params['B1']['T']
invalid_temp_diff = params['C1']['T'] <= params['B1']['T']
if invalid_temp_diff:
st.error(
'Die Temperatur der Wärmesenke muss höher sein, als die '
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpCascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpCascade2IHX.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpCascade2IHXTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -517,7 +517,7 @@ def get_pressure_levels(self, T_mid):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
self.wf2
) * 1e-3

Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpCascadeTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -462,7 +462,7 @@ def get_pressure_levels(self, T_mid):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p']*1e5,
'T', self.params['C3']['T']+self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T']+self.params['trans']['ttd_l'] + 273.15,
self.wf2
) * 1e-3

Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpEcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpEconIHX.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpEconIHXTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -515,7 +515,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpEconTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -459,7 +459,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C3']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpFlash.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpFlashTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -405,7 +405,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpICTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -415,7 +415,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p']*1e5,
'T', self.params['C3']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpIHX.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpIHXEcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpIHXEconTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -490,7 +490,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpIHXPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpIHXPCIHX.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpIHXPCIHXTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -514,7 +514,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpIHXPCTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -488,7 +488,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpIHXTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -407,7 +407,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p']*1e5,
'T', self.params['C0']['T']+self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T']+self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3

Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpPCIHX.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpPCIHXTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -488,7 +488,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpPCTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -459,7 +459,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p'] * 1e5,
'T', self.params['C0']['T'] + self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T'] + self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3
p_mid = np.sqrt(p_evap * self.params['A0']['p'])
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/HeatPumpSimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions src/heatpumps/models/HeatPumpSimpleTrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def init_simulation(self, **kwargs):
T=self.params['C3']['T'], p=self.params['C3']['p'],
fluid={self.si: 1}
)
self.conns['C0'].set_attr(T=self.params['C0']['T'])
self.conns['C1'].set_attr(T=self.params['C1']['T'])

# Perform initial simulation and unset starting values
self._solve_model(**kwargs)
Expand Down Expand Up @@ -376,7 +376,7 @@ def get_pressure_levels(self, wf=None):
) * 1e-5
h_trans_out = PSI(
'H', 'P', self.params['A0']['p']*1e5,
'T', self.params['C3']['T']+self.params['trans']['ttd_l'] + 273.15,
'T', self.params['C1']['T']+self.params['trans']['ttd_l'] + 273.15,
wf
) * 1e-3

Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/input/params_hp_cascade.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"B2": {
"T": 5
},
"C0": {
"C1": {
"T": 50
},
"C3": {
Expand Down
2 changes: 1 addition & 1 deletion src/heatpumps/models/input/params_hp_cascade_2ihx.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"B2": {
"T": 5
},
"C0": {
"C1": {
"T": 50
},
"C3": {
Expand Down
Loading

0 comments on commit 24f0e0a

Please sign in to comment.