BioSTEAMDevelopmentGroup / biosteam

The Biorefinery Simulation and Techno-Economic Analysis Modules; Life Cycle Assessment; Chemical Process Simulation Under Uncertainty
Other
179 stars 35 forks source link

Compressor type and adding Cooling Agent #191

Closed Omotola94 closed 8 months ago

Omotola94 commented 8 months ago

1) I tried creating ammonia as a cooling agent and adding it but it did not work 2) Also selecting a compressor type for example blower 3) I have issues loading my flow diagram, it brings an a error 'label'

Omotola94 commented 8 months ago

Screenshot 2024-02-23 101206

image

yoelcortes commented 8 months ago

@Omotola94, could you ctrl+paste the code (not images), including all the code used to get the outputs you are getting as well as the output? I need to be able to reproduce what you are seeing.

Thanks,

Omotola94 commented 8 months ago

Ammonia_utility=bst.UtilityAgent('Referigerant', phase= 'g', T= 263.15, P = 101325*3,units=None, thermo = None,T_limit=None, heat_transfer_price =1.32e-05, heat_transfer_efficiency = 1, regeneration_price=0,)

K1 = bst.PolytropicCompressor('K1', ins=Feed, outs = ('Outlet'), P=101325*1.25, eta=0.8, method = 'schultz', vle= False)

Omotola94 commented 8 months ago

@yoelcortes Water_utility=bst.UtilityAgent('cooling_water', phase= 'l', T= 298.15, P = 101325*3,units=None, thermo = None,T_limit=None, heat_transfer_price =1.32e-05, heat_transfer_efficiency = 1, regeneration_price=0, )

i think cooling water automatically becomes a cooling agent when using a cooler.

Omotola94 commented 8 months ago

Just Reading your message well

Omotola94 commented 8 months ago

some issues with the reactor as well

sarangbhagwat commented 8 months ago

The third issue you mentioned -- the one with the 'label' -- is fixed as of commit 63f2248867751a479d812ab33968692a8cf84c4f. I would suggest pulling the most recent changes to the master branch (git pull origin master).

Omotola94 commented 8 months ago

Thank you ,I have been able to sort that out.

Omotola94 commented 8 months ago

tmo.settings.set_thermo(['Methane', 'Carbon-dioxide','Nitrogen', 'Oxygen',],cache=True)

Feed = tmo.Stream('Feed', Methane= 900, CO2 = 500, Nitrogen=300, Oxygen=200, units ='m3/hr', T=307, P=101325, phase='g') Feed.show(flow ='m3/hr') Feed.cost

Water_utility=bst.UtilityAgent('cooling_water', phase= 'l', T= 298.15, P = 1013253,units=None, thermo = None,T_limit=None, heat_transfer_price =1.32e-05, heat_transfer_efficiency = 1, regeneration_price=0, ) Ammonia_utility=bst.UtilityAgent('Referigerant', phase= 'g', T= 263.15, P = 1013253,units=None, thermo = None,T_limit=None, heat_transfer_price =1.32e-05, heat_transfer_efficiency = 1, regeneration_price=0,)

Unit Operation

K1 = bst.PolytropicCompressor('K1', ins=Feed, outs = ('Outlet'), P=101325*1.25, eta=0.8, method = 'schultz', vle= False)

recycle = bst.Stream('Ammonia_recycle') V_recycled= bst.Stream('Vapour_Ammonia')

Expansion Valve

V1= valve.IsenthalpicValve('V1',ins=recycle, outs = ('Expanded_vapor'), P=101325, vle= 0)

Evaporator

E1 = HXprocess('Evaporator', ins=(K1-0, V1-0), outs=('out_Outlet', V_recycled))

Ammonia Vapor for recirculation

K2 = bst.PolytropicCompressor('K2', ins= V_recycled,outs = ('Compressed_ammonia'), P=101325*3, eta=0.8, method = 'hundseid', vle= False)

C1 = HXprocess('Condenser', ins=(E1-0, K2-0), outs=('Biogas', recycle))

yoelcortes commented 8 months ago

@Omotola94,

Thanks for the clarifications. Please follow the new example in the tutorial for how to remove/add utility agents (it is at the end of the Process settings chapter):

https://biosteam.readthedocs.io/en/latest/tutorial/Getting_started.html#Process-settings

Please follow these instructions for additional help:

As a rule to find the time to help as many users as I can, I do not fill-in any missing code or try to guess what is the error. Here are some examples of issues people post. Note that their code can reproduce what they saw and a concise explanation is included.

https://github.com/BioSTEAMDevelopmentGroup/biosteam/issues/187 https://github.com/BioSTEAMDevelopmentGroup/biosteam/issues/135 https://github.com/BioSTEAMDevelopmentGroup/biosteam/issues/115

Thanks,

Omotola94 commented 8 months ago

@yoelcortes Sorry about the inconvenience, this is the code below attached with the results I am getting

import biosteam as bst from biosteam import main_flowsheet as F

from biosteam import settings import thermosteam as tmo from biosteam import PowerUtility from biosteam import HeatUtility from thermosteam import Stream, Chemical from biosteam import units import warnings

tmo.settings.set_thermo(['Methane', 'Carbon-dioxide','Nitrogen', 'Oxygen',],cache=True) Feed = tmo.Stream('Feed', Methane= 9900, CO2 = 5100, Nitrogen=3000, Oxygen=2000, units ='m3/hr', T=307, P=101325, price=0.305, phase='g') Feed.show(flow ='m3/hr') bst.settings.CEPCI = 790.8 bst.settings.electricity_price = 0.1619

K1 = bst.PolytropicCompressor('K1', ins=Feed, outs = ('Outlet'), P=101325*1.25, eta=0.8, method = 'schultz', vle= False, type = 'blower') Screenshot 2024-02-24 150602

However when the argument "type" is removed and i run code this is the result I get, it defaults to screw.

Screenshot 2024-02-24 150928

Thank you

yoelcortes commented 8 months ago

@Omotola94,

This helps a ton. There was an error in the documentation: it should be compressor_type, not type. Thanks for letting me know about the bug.

Unfortunately, blowers are still not implemented in biosteam. You'll get the following error if you try "Blower":

ValueError: compressor type 'Blower' not available; only 'Screw', 'Centrifugal', and 'Reciprocating' are available

Fortunately, implementing blowers is not that difficult. I should be able to find the time within the next two weeks.

Thanks,

Omotola94 commented 8 months ago

@yoelcortes Once again sorry for not put out the explanation well

About the reactor it had to with the CSTR operating at an high temperature say 500K, I added a line of code to the compressor code,Attached is the error i got.

K1 = bst.PolytropicCompressor('K1', ins=Feed, outs = ('Outlet'), P=1013251.25, eta=0.8, method = 'schultz', vle= False) R1 = bst.CSTR('R1' , tau = 8, ins = (K1-0) , outs= ('Product'), T = 500, P=1013251.25, vessel_type= 'Horizontal', V_max = 100 )

Screenshot 2024-02-24 154405

please what do suggest?

Omotola94 commented 8 months ago

As for the refrigerant, I will make adjustments to that Thank you so much

yoelcortes commented 8 months ago

@Omotola94, Please read the documentation on StirredTankReactor (i.e. CSTR) , it is an abstract class. You need to subclass and define the _run method to dictate the mass and energy balance. Please read the tutorial for subclassing for detailed instructions.

The code you posted for the new reactor issue does not run (missing imports) and it doesn't actually run the reactor (does not reproduce the error). Additionally, this question is unrelated to your original issue. Please do not stack multiple issues in a single post on github. We can try to figure out your issue, but it will lead to a delayed response. If an issue is too unclear, we simply will ask to clarify (but this leads to more delays).