def _load_system(): import biosteam as bst from biosteam import main_flowsheet as F global sugarcane_sys, sugarcane_tea, specs, flowsheet, _system_loaded flowsheet = bst.Flowsheet('sugarcane') F.set_flowsheet(flowsheet) bst.settings.set_thermo(chemicals) load_process_settings() sugarcane_sys = create_system() sugarcane_sys.simulate() sugarcane_tea = create_tea(sugarcane_sys) sugarcane_tea.IRR = sugarcane_tea.solve_IRR() _system_loaded = True
def _load_system(): import biosteam as bst from biosteam import main_flowsheet as F global wheatstraw_sys, wheatstraw_tea, specs, flowsheet, _system_loaded flowsheet = bst.Flowsheet('wheatstraw') F.set_flowsheet(flowsheet) bst.settings.set_thermo(chemicals) load_process_settings() wheatstraw_sys = create_system() wheatstraw_sys.simulate() u = F.unit OSBL_units = (u.WWTC, u.CWP, u.CT, u.PWC, u.ADP, u.BT) wheatstraw_tea = create_tea(wheatstraw_sys, OSBL_units) ethanol = F.stream.ethanol ethanol.price = wheatstraw_tea.solve_price(ethanol) _system_loaded = True
def _load_system(): import biosteam as bst from biosteam import main_flowsheet as F global cornstover_sys, cornstover_tea, specs, flowsheet, _system_loaded global Area100, Area200, Area300, Area400, Area500, Area600, Area700, Area800 global AllAreas, areas, ethanol_price_gal flowsheet = bst.Flowsheet('cornstover') F.set_flowsheet(flowsheet) bst.settings.set_thermo(chemicals) load_process_settings() cornstover_sys = create_system() cornstover_sys.simulate() u = F.unit OSBL_units = (u.WWTC, u.CWP, u.CT, u.PWC, u.ADP, u.T701, u.T702, u.P701, u.P702, u.M701, u.FT, u.CSL_storage, u.DAP_storage, u.BT) cornstover_tea = create_tea(cornstover_sys, OSBL_units, [u.U101]) ethanol = F.stream.ethanol ethanol.price = cornstover_tea.solve_price(ethanol) ethanol_price_gal = ethanol.price * ethanol_density_kggal UnitGroup = bst.process_tools.UnitGroup Area100 = UnitGroup('Area 100', (u.U101, )) Area200 = UnitGroup('Area 200', (u.T201, u.M201, u.R201, u.P201, u.T202, u.F201, u.H201, u.M210, u.T203)) Area300 = UnitGroup('Area 300', (u.H301, u.M301, u.R301, u.R302, u.T301, u.T302)) Area400 = UnitGroup('Area 400', (u.D401, u.H401, u.D402, u.P401, u.M402, u.D403, u.P402, u.H402, u.U401, u.H403, u.M701, u.S401)) Area500 = UnitGroup('Area 500', (u.WWTC, )) Area600 = UnitGroup('Area 600', (u.T701, u.T702, u.P701, u.P702, u.M701, u.FT, u.CSL_storage, u.DAP_storage)) Area700 = UnitGroup('Area 700', (u.BT, )) Area800 = UnitGroup('Area 800', (u.CWP, u.CT, u.PWC, u.ADP, u.CIP_package)) areas = (Area100, Area200, Area300, Area400, Area500, Area600, Area700, Area800) AllAreas = UnitGroup('All Areas', cornstover_sys.units) _system_loaded = True
""" # %% import biosteam as bst import thermosteam as tmo from biosteam import System from thermosteam import Stream from ethanol_adipic import units, facilities from ethanol_adipic.chemicals import chems, chemical_groups, soluble_organics, combustibles from ethanol_adipic.process_settings import price from ethanol_adipic.utils import baseline_feedflow, convert_ethanol_wt_2_mol, \ find_split, splits_df from ethanol_adipic.tea import ethanol_adipic_TEA flowsheet = bst.Flowsheet('ethanol') bst.main_flowsheet.set_flowsheet(flowsheet) bst.CE = 541.7 # year 2016 System.maxiter = 400 System.converge_method = 'fixed-point' System.molar_tolerance = 0.01 tmo.settings.set_thermo(chems) # %% # ============================================================================= # Feedstock preprocessing # =============================================================================
if stream.F_mass == 0: WIS = 0 else: WIS = sum(split * stream.mass) / stream.F_mass return WIS def find_TS(stream): TS = (stream.F_mass - stream.imass['Water']) / stream.F_mass return TS # %% Streams #tmo.settings.set_thermo(wheatstraw_chemicals) bst.main_flowsheet.set_flowsheet(bst.Flowsheet('wheatstraw')) pretreatment_chemical_IDs = [ 'Acetate', 'AceticAcid', 'Arabinan', 'Ash', 'Cellulase', 'Ethanol', 'Extract', 'ExtractVol', 'ExtractNonVol', 'Furfural', 'Glucan', 'Glucose', 'GlucoseOligomer', 'Water', 'H2SO4', 'HMF', 'Lignin', 'Mannan', 'NH3', 'Protein', 'SolubleLignin', 'Sucrose', 'Xylan', 'Xylose', 'Arabinose', 'XyloseOligomer', 'ArabinoseOligomer', 'Mannose', 'MannoseOligomer', 'Galactan', 'Galactose', 'GalactoseOligomer' ] non_soluble = [ 'Xylan', 'Glucan', 'Arabinan', 'Lignin', 'Extract', 'Ash', 'Mannan', 'Galactan', 'Acetate' ] pretreatment_chemicals = wheatstraw_chemicals.subgroup(
def find_split(IDs, flow0, flow1): flow0 = np.asarray(flow0) splits = flow0 / (flow0 + np.asarray(flow1)) species = Stream.species array = np.zeros(len(species)) for ID, split in zip(IDs, splits): if ID in species_groups: array[species.indices(species_groups[ID])] = split else: array[species.index(ID)] = split return array # %% Streams bst.find.set_flowsheet(bst.Flowsheet('cornstover')) synonym = species.set_synonym synonym('CaO', 'Lime') synonym('Water', 'H2O') synonym('H2SO4', 'SulfuricAcid') synonym('NH3', 'Ammonia') synonym('Denaturant', 'Octane') synonym('CO2', 'CarbonDioxide') bst.Stream.species = pretreatment_species = bst.WorkingSpecies.subgroup( species, [ 'Acetate', 'AceticAcid', 'Arabinan', 'Ash', 'Cellulase', 'Ethanol', 'Extract', 'Furfural', 'Glucan', 'Glucose', 'GlucoseOligomer', 'Water', 'H2SO4', 'HMF', 'Lignin', 'Mannan', 'NH3', 'Protein', 'SolubleLignin', 'Sucrose', 'Xylan', 'Xylose', 'Arabinose', 'XyloseOligomer', 'ArabinoseOligomer', 'Mannose', 'MannoseOligomer', 'Galactan', 'Galactose', 'GalactoseOligomer'
split = find_split_solids(stream, IDs) if stream.F_mass == 0: WIS = 0 else: WIS = sum(split * stream.mass) / stream.F_mass return WIS def find_TS(stream): TS = (stream.F_mass - stream.imass['Water']) / stream.F_mass return TS # %% Streams bst.main_flowsheet.set_flowsheet(bst.Flowsheet('bedding')) pretreatment_chemical_IDs = [ 'Acetate', 'AceticAcid', 'Arabinan', 'Ash', 'Cellulase', 'Ethanol', 'Extract', 'ExtractVol', 'ExtractNonVol', 'Furfural', 'Glucan', 'Glucose', 'GlucoseOligomer', 'Water', 'H2SO4', 'HMF', 'Lignin', 'ManureOrg', 'ManureInorg', 'ManureOrgSol', 'ManureInorgSol', 'Mannan', 'NH3', 'Protein', 'SolubleLignin', 'Sucrose', 'Xylan', 'Xylose', 'Arabinose', 'XyloseOligomer', 'ArabinoseOligomer', 'Mannose', 'MannoseOligomer', 'Galactan', 'Galactose', 'GalactoseOligomer' ] non_soluble = [ 'Xylan', 'Glucan', 'Arabinan', 'Lignin', 'Extract', 'Ash', 'Mannan', 'Galactan', 'Acetate', 'ManureOrg', 'ManureInorg' ]
flow0 = np.asarray(flow0) splits = flow0 / (flow0 + np.asarray(flow1)) thermo = tmo.settings.get_thermo() chemicals = thermo.chemicals array = np.zeros(chemicals.size) for ID, split in zip(IDs, splits): if ID in chemical_groups: array[chemicals.get_index(chemical_groups[ID])] = split else: array[chemicals.index(ID)] = split return array # %% Streams bst.main_flowsheet.set_flowsheet(bst.Flowsheet('cornstover')) pretreatment_chemical_IDs = [ 'Acetate', 'AceticAcid', 'Arabinan', 'Ash', 'Cellulase', 'Ethanol', 'Extract', 'Furfural', 'Glucan', 'Glucose', 'GlucoseOligomer', 'Water', 'H2SO4', 'HMF', 'Lignin', 'Mannan', 'NH3', 'Protein', 'SolubleLignin', 'Sucrose', 'Xylan', 'Xylose', 'Arabinose', 'XyloseOligomer', 'ArabinoseOligomer', 'Mannose', 'MannoseOligomer', 'Galactan', 'Galactose', 'GalactoseOligomer' ] pretreatment_chemicals = cornstover_chemicals.subgroup( pretreatment_chemical_IDs) tmo.settings.set_thermo(pretreatment_chemicals) # tmo.Stream.default_ID_number = 100 # feed flow
# %% Setup import biosteam as bst import thermosteam as tmo from flexsolve import aitken_secant, IQ_interpolation from biosteam import System from biosteam.process_tools import UnitGroup from thermosteam import Stream from lactic import units, facilities from lactic.hx_network import HX_Network from lactic.process_settings import price from lactic.utils import baseline_feedflow, set_yield, find_split, splits_df from lactic.chemicals import chems, chemical_groups, soluble_organics, combustibles from lactic.tea import LacticTEA flowsheet = bst.Flowsheet('lactic') bst.main_flowsheet.set_flowsheet(flowsheet) bst.CE = 541.7 # year 2016 # Set default thermo object for the system tmo.settings.set_thermo(chems) # These settings are sufficient to get lactic acid price error below $0.005/kg # after three simulations System.converge_method = 'fixed-point' # aitken isn't stable System.maxiter = 1500 System.molar_tolerance = 0.1 # %% # =============================================================================
# %% Setup import biosteam as bst import thermosteam as tmo from flexsolve import IQ_interpolation from biosteam import System from thermosteam import Stream from ethanol_adipic import units, facilities from ethanol_adipic.chemicals import chems, chemical_groups, soluble_organics, combustibles from ethanol_adipic.process_settings import price from ethanol_adipic.utils import baseline_feedflow, convert_ethanol_wt_2_mol, \ find_split, splits_df from ethanol_adipic.tea import ethanol_adipic_TEA flowsheet = bst.Flowsheet('ethanol_adipic') bst.main_flowsheet.set_flowsheet(flowsheet) bst.CE = 541.7 # year 2016 System.maxiter = 400 System.converge_method = 'fixed-point' System.molar_tolerance = 0.01 tmo.settings.set_thermo(chems) # %% # ============================================================================= # Feedstock preprocessing # =============================================================================