We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, when I execute HXN, the following error will be reported, which is caused by unit H102, which is heating N2 under high pressure (Nitrogen is used to provide an inert environment for the glucose reaction). May I ask how to solve this error? Is it because N2.Cn.l.method = N2.Cn.g.method = "COOLPROP" (https://biosteam.readthedocs.io/en/latest/tutorial/Convergence.html#Importance-of-thermodynamic-property-package:~:text=N2.Cn.l.method%20%3D%20N2.Cn.g.method%20%3D%20%22COOLPROP%22%20%23%20You%20may%20need%20to%20%22pip%20install%20coolprop%22%20for%20this%0AN2.reset_free_energies()%20%23%20This%20is%20necessary%20to%20update%20enthalpy%20and%20entropy%20algorithms%20with%20new%20heat%20capacities%0Asys.reset_cache()) is not added? Some of the code for H102 is as follows.
HXN
H102
N2.Cn.l.method = N2.Cn.g.method = "COOLPROP"
import biosteam as bst bst.nbtutorial() bst.settings.set_thermo(['nitrogen']) nitrogen = bst.Stream( ID='nitrogen', total_flow=100, units='kg/hr', N2=1, phase='g', ) C101 = bst.units.IsothermalCompressor('C101', nitrogen, P=7000000) H102 = bst.units.HXutility('H102', C101-0, T=200+273.15, rigorous=True) HXN = bst.HeatExchangerNetwork('HXN', T_min_app = 10) sys = bst.main_flowsheet.create_system('sys') sys.simulate()
The error information is as follows.
File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_system.py:2631, in System.simulate(self, update_configuration, units, design_and_cost, **kwargs) 2611 def simulate(self, update_configuration: Optional[bool]=None, units=None, 2612 design_and_cost=None, **kwargs): 2613 """ 2614 If system is dynamic, run the system dynamically. Otherwise, converge 2615 the path of unit operations to steady state. After running/converging (...) 2629 2630 """ -> 2631 with self.flowsheet.temporary(): 2632 specifications = self._specifications 2633 if specifications and not self._running_specifications: File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_flowsheet.py:38, in TemporaryFlowsheet.__exit__(self, type, exception, traceback) 36 def __exit__(self, type, exception, traceback): 37 main_flowsheet.set_flowsheet(self.original) ---> 38 if exception: raise exception File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_system.py:2687, in System.simulate(self, update_configuration, units, design_and_cost, **kwargs) 2681 outputs = self.simulate( 2682 update_configuration=True, 2683 design_and_cost=design_and_cost, 2684 **kwargs 2685 ) 2686 else: -> 2687 raise error 2688 else: 2689 if (not update_configuration # Avoid infinite loop 2690 and self._connections != [i.get_connection() for i in self.streams]): 2691 # Connections has been updated within simulation. File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_system.py:2675, in System.simulate(self, update_configuration, units, design_and_cost, **kwargs) 2673 try: 2674 outputs = self.converge(**kwargs) -> 2675 if design_and_cost: self._summary() 2676 except Exception as error: 2677 if update_configuration: raise error # Avoid infinite loop File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_system.py:2390, in System._summary(self) 2388 f(i, i._summary) 2389 for i in self._facilities: -> 2390 if isa(i, Unit): f(i, i.simulate) 2391 elif isa(i, System): 2392 f(i, i.converge) File D:\anaconda\envs\zddd\lib\site-packages\thermosteam\exceptions.py:94, in try_method_with_object_stamp(object, method, args) 92 raise StampedKeyError(message_with_object_stamp(object, repr(error.args[0]))) 93 except Exception as error: ---> 94 raise_error_with_object_stamp(object, error) File D:\anaconda\envs\zddd\lib\site-packages\thermosteam\exceptions.py:84, in raise_error_with_object_stamp(object, error) 82 error.args = (message_with_object_stamp(object, msg), *args) 83 except: pass ---> 84 raise error File D:\anaconda\envs\zddd\lib\site-packages\thermosteam\exceptions.py:88, in try_method_with_object_stamp(object, method, args) 86 def try_method_with_object_stamp(object, method, args=()): 87 try: ---> 88 return method(*args) 89 except StampedKeyError as error: 90 raise StampedKeyError(message_with_object_stamp(object, error.args[0])) File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_unit.py:1097, in Unit.simulate(self, run, design_kwargs, cost_kwargs) 1095 self._load_stream_links() 1096 self.run() -> 1097 self._summary(design_kwargs, cost_kwargs) File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_unit.py:975, in Unit._summary(self, design_kwargs, cost_kwargs, lca_kwargs) 973 if not self._skip_simulation_when_inlets_are_empty or not all([i.isempty() for i in self._ins]): 974 self._design(**design_kwargs) if design_kwargs else self._design() --> 975 self._cost(**cost_kwargs) if cost_kwargs else self._cost() 976 self._lca(**lca_kwargs) if lca_kwargs else self._lca() 977 self._check_utilities() File D:\anaconda\envs\zddd\lib\site-packages\biosteam\facilities\hxn\_heat_exchanger_network.py:155, in HeatExchangerNetwork._cost(self) 150 hxs = [hu.unit for hu in hx_utils] 151 use_cached_network = ( 152 sorted(hxs, key=lambda x: x.ID) 153 == sorted(self.original_heat_exchangers, key=lambda x: x.ID) 154 ) --> 155 with flowsheet.temporary(), bst.IgnoreDockingWarnings(): 156 if use_cached_network: 157 hx_heat_utils_rearranged = [i.heat_utilities[0] for i in hxs] File D:\anaconda\envs\zddd\lib\site-packages\biosteam\_flowsheet.py:38, in TemporaryFlowsheet.__exit__(self, type, exception, traceback) 36 def __exit__(self, type, exception, traceback): 37 main_flowsheet.set_flowsheet(self.original) ---> 38 if exception: raise exception File D:\anaconda\envs\zddd\lib\site-packages\biosteam\facilities\hxn\_heat_exchanger_network.py:155, in HeatExchangerNetwork._cost(self) 150 hxs = [hu.unit for hu in hx_utils] 151 use_cached_network = ( 152 sorted(hxs, key=lambda x: x.ID) 153 == sorted(self.original_heat_exchangers, key=lambda x: x.ID) 154 ) --> 155 with flowsheet.temporary(), bst.IgnoreDockingWarnings(): 156 if use_cached_network: 157 hx_heat_utils_rearranged = [i.heat_utilities[0] for i in hxs] File D:\anaconda\envs\zddd\lib\site-packages\thermosteam\network.py:270, in IgnoreDockingWarnings.__exit__(self, type, exception, traceback) 268 global DOCKING_WARNINGS 269 DOCKING_WARNINGS = self.original_value --> 270 if exception: raise exception File D:\anaconda\envs\zddd\lib\site-packages\biosteam\facilities\hxn\_heat_exchanger_network.py:191, in HeatExchangerNetwork._cost(self) 186 self.HXN_flowsheet = HXN_F = bst.main_flowsheet 187 for i in HXN_F.registries: i.clear() 188 HXs_hot_side, HXs_cold_side, new_HX_utils, hxs, T_in_arr,\ 189 T_out_arr, pinch_T_arr, C_flow_vector, hx_heat_utils_rearranged, streams_inlet, stream_HXs_dict,\ 190 hot_indices, cold_indices = \ --> 191 synthesize_network(hx_utils, self.T_min_app, self.Qmin, 192 self.force_ideal_thermo, self.avoid_recycle) 193 new_HXs = HXs_hot_side + HXs_cold_side 194 self.cold_indices = cold_indices File D:\anaconda\envs\zddd\lib\site-packages\biosteam\facilities\hxn\hxn_synthesis.py:541, in synthesize_network(hus, T_min_app, Qmin, force_ideal_thermo, avoid_recycle) 539 new_HX_util._run() 540 s_out = new_HX_util.outs[0] --> 541 np.testing.assert_allclose(s_out.H, H_out_arr[cold], rtol=1e-2, atol=1.) 542 atol_T = 5. if 's' in hxs[cold].outs[0].phases else 0.001 543 np.testing.assert_allclose(s_out.T, T_out_arr[cold], rtol=5e-2, atol=atol_T) [... skipping hidden 1 frame] File D:\anaconda\envs\zddd\lib\contextlib.py:79, in ContextDecorator.__call__.<locals>.inner(*args, **kwds) 76 @wraps(func) 77 def inner(*args, **kwds): 78 with self._recreate_cm(): ---> 79 return func(*args, **kwds) File D:\anaconda\envs\zddd\lib\site-packages\numpy\testing\_private\utils.py:797, in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf, strict) 793 err_msg += '\n' + '\n'.join(remarks) 794 msg = build_err_msg([ox, oy], err_msg, 795 verbose=verbose, header=header, 796 names=('x', 'y'), precision=precision) --> 797 raise AssertionError(msg) 798 except ValueError: 799 import traceback AssertionError: <HeatExchangerNetwork: HXN> Not equal to tolerance rtol=0.01, atol=1 Mismatched elements: 1 / 1 (100%) Max absolute difference: 584904.311 Max relative difference: 0.178 x: array(2693095.764976) y: array(3278000.076034)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello, when I execute
HXN
, the following error will be reported, which is caused by unitH102
, which is heating N2 under high pressure (Nitrogen is used to provide an inert environment for the glucose reaction). May I ask how to solve this error? Is it becauseN2.Cn.l.method = N2.Cn.g.method = "COOLPROP"
(https://biosteam.readthedocs.io/en/latest/tutorial/Convergence.html#Importance-of-thermodynamic-property-package:~:text=N2.Cn.l.method%20%3D%20N2.Cn.g.method%20%3D%20%22COOLPROP%22%20%23%20You%20may%20need%20to%20%22pip%20install%20coolprop%22%20for%20this%0AN2.reset_free_energies()%20%23%20This%20is%20necessary%20to%20update%20enthalpy%20and%20entropy%20algorithms%20with%20new%20heat%20capacities%0Asys.reset_cache()) is not added?Some of the code for H102 is as follows.
The error information is as follows.
The text was updated successfully, but these errors were encountered: