BioSTEAMDevelopmentGroup / Bioindustrial-Park

BioSTEAM's Premier Repository for Biorefinery Models and Results
MIT License
38 stars 18 forks source link

Request for power utility #70

Open zasddsgg opened 1 year ago

zasddsgg commented 1 year ago

Hello, I encountered some problems when checking the power of unit, may I ask you the following questions about power utility? Thanks for your help. Wish you a good day.

a)For @cost in Class PretreatmentReactorSystem, could I consult you why power is calculated at dry flow rate and what formula is used to get 83333 and 4578? Besides, why does the pretreatment reactor (which is just a tank with chemical reaction) have power consumption? Moreover, what is the use of dry flow rate in the results exported via sys.save_report? Shouldn't we focus on flow rate? In tutorial of Inheriting_from_Unit (https://biosteam.readthedocs.io/en/latest/tutorial/Inheriting_from_Unit.html), does the original size value in cost decorator refer to the flow into or out of the reactor?

b)In the example class ContinuousFermentation(bst.CSTR) from the tutorial on CSTR (https://biosteam.readthedocs.io/en/latest/API/units/cstr.html), according to the power calculation method in the CSTR source code self.add_power_utility(self.kW_per_m3volume), the power obtained is 3190.9854= 1256.86 kW, which is different from 1340 kW in the result. May I ask you how is 1340 kW calculated? Since there is no pump in add_power_utility(self.kW_per_m3 volume), so it doesn't seem to be the difference in pump power.

c)I modified kW_per_m3 in the following way, but the result seems to be still the power as kW_per_m3=0.985: class ContinuousFermentation(bst.CSTR): _N_ins = 1 _N_outs = 2 T_default = 32. + 273.15 P_default = 101325. tau_default = 8. kW_per_m3=0

d)When inheriting CSTR, the default kW_per_m3(0.985) in CSTR seems to be for liquid -- liquid reaction or extraction, if only stir for chemical reaction, could I consult you which power value should be used?

e)Do I need to add heat utility and power utility when create reactor by inheriting CSTR?

f)Could I consult you is it both OK to add the power consumption of unit in either of the following ways? Are there any differences or usage scenarios for them? def _cost(self): self.add_power_utility or @cost('Dry flow rate', 'PretreatmentReactorSystem', units='kg/hr',S=83333, CE=522, cost=19812400 * 0.993, n=0.6, kW=4578, BM=1.5) def _cost(self) self._decorated_cost()

yoelcortes commented 1 year ago

@zasddsgg, thanks for the questions. The following should help:

a) The pretreatment reactor system is defined based on the Humbird 2011 report, which is costed based on dry flow rate and it includes much more than just a tank. The dry flow rate is based on the inlets. The code is given in https://github.com/BioSTEAMDevelopmentGroup/biosteam/blob/ab86814d22ef0dd2eb0a4b1d17b58c6c1bca03e1/biosteam/units/decorators/_design.py#L147

b) The pump is an auxiliary unit, so the pump's power requirement is automatically added at the end of simulation.

c) You are creating a new class attribute that gets replaced during init. Just pass the value as a parameter. Please review python basics online for additional help.

d) Checkout Seider, W. D.; Lewin, D. R.; Seader, J. D.; Widagdo, S.; Gani, R.; Ng, M. K. Cost Accounting and Capital Cost Estimation. In Product and Process Design Principles; Wiley, 2017; pp 470

e) No, just add a _run method.

f) I do not understand this code. It would help if you use code that will run on Python. Regardless, both cost decorators or cost methods work and are equally valid. The documentation has some examples.

zasddsgg commented 1 year ago

Thank you for your answer. I have checked the relevant materials according to your suggestion. May I confirm with you whether my understanding of the following points is correct. Thanks a lot.

a) For page 116 in Humbird 2011 report,the dry flow rate of stream 105 and 214 is 83334 (104167-20833, given in left corner of report), and 2034 (38801-36767) kg/h,respectively. So the total dry flow rate to the pretreatment system is 83334+2034=85368 kg/h. The power of pretreatment system is WC201 +WC202 +WC203 +WC204+WC205 +WC206+WC207 +WM201 +WM202 +WM203 +WM204 +WM205+WM206 +WM207 +WP201+WT203= 80+80+160+75+80+20+40+80+30+2000+45+30+2000+82+1+170=4973 kW (given in right corner of report). If the total dry flow rate is converted into 83333 kg/h as BioSTEAM, the power is 83333/85368*4973=4854 kW, which seems different from 4578 kW given by BioSTEAM. May I ask you whether 4578 kW of BioSTEAM is calculated by the above method?

b) For the example class continuoustreatment (bst.CSTR) (https://biosteam.readthedocs.io/en/latest/API/units/cstr.html), is the difference between the power obtained by kW_per_m3 multiplied by volume (1256.86kW) and power in the result (1340kW) the pump power in CSTR? For the example class continuoustreatment (bst.CSTR), is it correct to change the agitator power as follows: I add kW_per_m3=0.5 in def _setup() and self. kW_per_m3=kW_per_m3 class ContinuousFermentation(bst.CSTR): _N_ins = 1 _N_outs = 2 T_default = 32. + 273.15 P_default = 101325. tau_default = 8.

     def _setup(self, kW_per_m3=0.5):
           super()._setup()        
           chemicals = self. Chemicals
           self. kW_per_m3=kW_per_m3
           self.hydrolysis_reaction = bst.Reaction('Sucrose + Water -> 2Glucose', 'Sucrose', 1.00, chemicals)
           self.fermentation_reaction = bst.Reaction('Glucose -> 2Ethanol + 2CO2',  'Glucose', 0.9, chemicals)
           self.cell_growth_reaction = cell_growth = bst.Reaction('Glucose -> Yeast', 'Glucose', 0.70, chemicals, basis='wt')

     def _run(self):
           vent, effluent = self. Outs
           effluent.mix_from(self.ins, energy_balance=False)
           self.hydrolysis_reaction(effluent)
          self.fermentation_reaction(effluent)
          self.cell_growth_reaction(effluent)
          effluent.T = vent.T = self.T
          effluent.P = vent.P = self.P
          vent. Phase = 'g'
          vent. Empty()
          vent.receive_vent(effluent, energy_balance=False)

c)I found the book you recommended, and it gave power of blending miscible liquids (0.5 Hp/1,000 Gallons) and homogeneous liquid reaction (1.5 Hp/1,000 Gallons), if just stir the miscible solution to promote the reaction, could I ask you which of these two power do you recommend?

d)Is it both OK to add the power consumption of unit in either of the following ways: One way: like CSTR source code (https://biosteam.readthedocs.io/en/latest/_modules/biosteam/units/cstr.html#CSTR), namely def _cost(self)+self.add_power_utility(self.kW_per_m3 volume) code is as follows: class CSTR(PressureVessel, Unit, isabstract=True): the code of def init() and def _design() is omitted def _cost(self): Design = self.design_results baseline_purchase_costs = self.baseline_purchase_costs volume = Design['Single reactor volume'] if volume != 0: baseline_purchase_costs.update( self._vessel_purchase_cost( Design['Weight'], Design['Diameter'], Design['Length'], ) ) self.add_power_utility(self.kW_per_m3 volume)

The other way: like pretreatment reactor system (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/cellulosic/units.py), namely cost decorators and def _cost(self)+self._decorated_cost() code is as follows: @cost('Dry flow rate', 'Pretreatment reactor system', units='kg/hr', S=83333, CE=522, cost=19812400 * 0.993, n=0.6, kW=4578, BM=1.5) class PretreatmentReactorSystem(bst.units.design_tools.PressureVessel, Unit): the code of def init() , def _run(self) and def _design() is omitted def _cost(self): Design = self.design_results self.baseline_purchase_costs.update( self._vessel_purchase_cost( Design['Weight'], Design['Diameter'], Design['Length'] ) ) self._decorated_cost()