def test_feed_forward_recycle_loop():
    f.set_flowsheet('feed_forward_recycle_loop')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    water = Stream('water', Water=10)
    recycle = Stream('recycle')
    inner_recycle = Stream('inner_recycle')
    product = Stream('product')
    P1 = Pump('P1', feedstock)
    P2 = Pump('P2', water)
    M1 = Mixer('M1', [P1 - 0, recycle, inner_recycle])
    S1 = Splitter('S1', M1 - 0, ['', recycle], split=0.5)
    M2 = Mixer('M2', [P2 - 0, S1 - 0])
    S2 = Splitter('S2', M2 - 0, [inner_recycle, product], split=0.5)
    P3 = Pump('P3', product)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = (Network(
        [P1, P2,
         Network([M1, S1, M2, S2], recycle={S2 - 0, S1 - 1}), P3]))
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = np.vstack([recycle.mol, inner_recycle.mol])
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (P1, P2, M1, S1, M2, S2, P3)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([recycle.mol, inner_recycle.mol])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    f.clear()
def test_inner_recycle_loop_with_bifurcated_feed():
    f.set_flowsheet('simple_recycle_loop_with_bifurcated_feed')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    water = Stream('water', Water=10)
    recycle = Stream('recycle')
    product = Stream('product')
    side_product = Stream('side_product')
    P1 = Pump('P1', feedstock)
    P2 = Pump('P2', water)
    S1 = Splitter('S1', P2 - 0, split=0.5)
    M1 = Mixer('M1', [P1 - 0, S1 - 1, recycle])
    S2 = Splitter('S2', M1 - 0, [side_product, ''], split=0.5)
    M2 = Mixer('M2', [S1 - 0, S2 - 1])
    S3 = Splitter('S3', M2 - 0, [product, recycle], split=0.5)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = Network(
        [P1, P2, S1, Network([M1, S2, M2, S3], recycle=S3 - 1)])
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = recycle.mol.copy()
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (P1, P2, S1, M1, S2, M2, S3)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = recycle.mol.copy()
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    f.clear()
def test_unconnected_case():
    f.set_flowsheet('unconnected_case')
    settings.set_thermo(['Water'], cache=True)
    feedstock_a = Stream('feedstock_a', Water=1000)
    water_a = Stream('water_a', Water=10)
    byproduct_a = Stream('byproduct_a')
    product_a = Stream('product_a')
    M1_a = Mixer('M1_a', [feedstock_a, water_a])
    S1_a = Splitter('S1_a', M1_a - 0, [product_a, byproduct_a], split=0.5)

    feedstock_b = Stream('feedstock_b', Water=1000)
    water_b = Stream('water_b', Water=10)
    byproduct_b = Stream('byproduct_b')
    product_b = Stream('product_b')
    M1_b = Mixer('M1_b', [feedstock_b, water_b])
    S1_b = Splitter('S1_b', M1_b - 0, [product_b, byproduct_b], split=0.5)
    parallel_sys = f.create_system('parallel_sys')
    network = parallel_sys.to_network()
    actual_network = Network([M1_a, S1_a, M1_b, S1_b])
    assert network == actual_network
    parallel_sys.simulate()
    parallel_sys.flatten()
    assert parallel_sys.path == (M1_a, S1_a, M1_b, S1_b)
    parallel_sys.empty_recycles()
    parallel_sys.simulate()
    f.clear()
def test_unconnected_recycle_loops():
    f.set_flowsheet('unconnected_recycle_loops')
    settings.set_thermo(['Water'], cache=True)
    feedstock_a = Stream('feedstock_a', Water=1000)
    water_a = Stream('water_a', Water=10)
    recycle_a = Stream('recycle_a')
    product_a = Stream('product_a')
    M1_a = Mixer('M1_a', [feedstock_a, water_a, recycle_a])
    S1_a = Splitter('S1_a', M1_a - 0, [product_a, recycle_a], split=0.5)

    feedstock_b = Stream('feedstock_b', Water=800)
    water_b = Stream('water_b', Water=10)
    recycle_b = Stream('recycle_b')
    product_b = Stream('product_b')
    M1_b = Mixer('M1_b', [feedstock_b, water_b, recycle_b])
    S1_b = Splitter('S1_b', M1_b - 0, [product_b, recycle_b], split=0.5)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = Network([
        Network([M1_a, S1_a], recycle=S1_a - 1),
        Network([M1_b, S1_b], recycle=S1_b - 1)
    ])
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = np.vstack([recycle_a.mol, recycle_b.mol])
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (M1_a, S1_a, M1_b, S1_b)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([recycle_a.mol, recycle_b.mol])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    f.clear()
def test_trivial_case():
    f.set_flowsheet('trivial_case')
    settings.set_thermo(['Water'], cache=True)
    trivial_sys_a = f.create_system('trivial_sys_a')
    network_a = trivial_sys_a.to_network()
    Stream('feedstock', Water=1000)
    Stream('water', Water=10)
    trivial_sys_b = f.create_system('trivial_sys_b')
    network_b = trivial_sys_b.to_network()
    actual_network = Network([])
    assert network_a == network_b == actual_network
    trivial_sys_b.simulate()
    trivial_sys_b.flatten()
    assert trivial_sys_b.path == ()
    trivial_sys_b.empty_recycles()
    trivial_sys_b.simulate()
    f.clear()
def test_linear_case():
    f.set_flowsheet('linear_case')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    water = Stream('water', Water=10)
    byproduct = Stream('byproduct')
    product = Stream('product')
    M1 = Mixer('M1', [feedstock, water])
    S1 = Splitter('S1', M1 - 0, [product, byproduct], split=0.5)
    linear_sys = f.create_system('linear_sys')
    network = linear_sys.to_network()
    actual_network = Network([M1, S1])
    assert network == actual_network
    linear_sys.simulate()
    linear_sys.flatten()
    assert linear_sys.path == (M1, S1)
    linear_sys.empty_recycles()
    linear_sys.simulate()
    f.clear()
def test_simple_recycle_loop():
    f.set_flowsheet('simple_recycle_loop')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    water = Stream('water', Water=10)
    recycle = Stream('recycle')
    product = Stream('product')
    M1 = Mixer('M1', [feedstock, water, recycle])
    S1 = Splitter('S1', M1 - 0, [product, recycle], split=0.5)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = Network([M1, S1], recycle=recycle)
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = recycle.mol.copy()
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (M1, S1)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = recycle.mol.copy()
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
def test_two_recycle_loops_with_complete_overlap():
    f.set_flowsheet('two_recycle_loops_with_complete_overlap')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    water = Stream('water', Water=10)
    recycle = Stream('recycle')
    inner_recycle = Stream('inner_recycle')
    product = Stream('product')
    inner_water = Stream('inner_water', Water=10)
    P1 = Pump('P1', feedstock)
    P2 = Pump('P2', water)
    P3 = Pump('P3', inner_water)
    M1 = Mixer('M1', [P1 - 0, P2 - 0, recycle])
    M2 = Mixer('M2', [M1 - 0, P3 - 0, inner_recycle])
    S2 = Splitter('S2', M2 - 0, ['', inner_recycle], split=0.5)
    S1 = Splitter('S1', S2 - 0, [product, recycle], split=0.5)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = Network([
        P1, P2, P3,
        Network([M1, Network([M2, S2], recycle=inner_recycle), S1],
                recycle=recycle)
    ])
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = np.vstack([recycle.mol, inner_recycle.mol])
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (P1, P2, P3, M1, M2, S2, S1)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([recycle.mol, inner_recycle.mol])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    f.clear()
def test_bifurcated_recycle_loops():
    f.set_flowsheet('bifurcated_recycle_loops')
    settings.set_thermo(['Water'], cache=True)
    feed_a = Stream('feed_a', Water=10)
    water_a = Stream('water_a', Water=10)
    recycle_a = Stream('recycle_a')
    P1_a = Pump('P1_a', feed_a)
    P2_a = Pump('P2_a', water_a)
    S1_a = Splitter('S1_a', P2_a - 0, split=0.5)
    M1_a = Mixer('M1_a', [P1_a - 0, S1_a - 1, recycle_a])
    S2_a = Splitter('S2_a', M1_a - 0, split=0.5)
    M2_a = Mixer('M2_a', [S1_a - 0, S2_a - 1])
    S3_a = Splitter('S3_a', M2_a - 0, ['', recycle_a], split=0.5)

    feedstock_b = Stream('feedstock_b', Water=1000)
    recycle_b = Stream('recycle_b')
    product_b = Stream('product_b')
    side_product_b = Stream('side_product_b')
    P1_b = Pump('P1_b', feedstock_b)
    P2_b = Pump('P2_b', S2_a - 0)
    S1_b = Splitter('S1_b', P2_b - 0, split=0.5)
    M1_b = Mixer('M1_b', [P1_b - 0, S1_b - 1, recycle_b])
    S2_b = Splitter('S2_b', M1_b - 0, [side_product_b, ''], split=0.5)
    M2_b = Mixer('M2_b', [S1_b - 0, S2_b - 1, S3_a - 0])
    S3_b = Splitter('S3_b', M2_b - 0, [product_b, recycle_b], split=0.5)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    network = recycle_loop_sys.to_network()
    actual_network = Network([
        P1_b, P1_a, P2_a, S1_a,
        Network([M1_a, S2_a, M2_a, S3_a], recycle=S3_a - 1), P2_b, S1_b,
        Network([M1_b, S2_b, M2_b, S3_b], recycle=S3_b - 1)
    ])
    assert network == actual_network
    recycle_loop_sys.simulate()
    x_nested_solution = np.vstack([recycle_a.mol, recycle_b.mol])
    recycle_loop_sys.flatten()
    assert recycle_loop_sys.path == (P1_b, P1_a, P2_a, S1_a, M1_a, S2_a, M2_a,
                                     S3_a, P2_b, S1_b, M1_b, S2_b, M2_b, S3_b)
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([recycle_a.mol, recycle_b.mol])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    f.clear()
def test_separate_recycle_loops():
    f.set_flowsheet('separate_recycle_loops')
    settings.set_thermo(['Water'], cache=True)
    feedstock_a = Stream('feedstock_a', Water=1000)
    water_a = Stream('water_a', Water=10)
    recycle_a = Stream('recycle_a')
    product_a = Stream('product_a')
    P1_a = Pump('P1_a', feedstock_a)
    P2_a = Pump('P2_a', water_a)
    M1_a = Mixer('M1_a', [P1_a - 0, P2_a - 0, recycle_a])
    S1_a = Splitter('S1_a', M1_a - 0, [product_a, recycle_a], split=0.5)
    feedstock_b = Stream('feedstock_b', Water=1000)
    water_b = Stream('water_b', Water=10)
    recycle_b = Stream('recycle_b')
    product_b = Stream('product_b')
    P1_b = Pump('P1_b', feedstock_b)
    P2_b = Pump('P2_b', water_b)
    M1_b = Mixer('M1_b', [P1_b - 0, P2_b - 0, recycle_b])
    S1_b = Splitter('S1_b', M1_b - 0, [product_b, recycle_b], split=0.5)
    recycles = [recycle_a, recycle_b]
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    recycle_loop_sys.simulate()
    network = recycle_loop_sys.to_network()
    actual_network = Network([
        P1_a, P2_a,
        Network([M1_a, S1_a], recycle=S1_a - 1), P1_b, P2_b,
        Network([M1_b, S1_b], recycle=S1_b - 1)
    ])
    assert network == actual_network
    x_nested_solution = np.vstack([i.mol for i in recycles])
    recycle_loop_sys.flatten()
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([i.mol for i in recycles])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=1e-2)
    assert recycle_loop_sys.path == (P1_a, P2_a, M1_a, S1_a, P1_b, P2_b, M1_b,
                                     S1_b)
    f.clear()
예제 #11
0
from biosteam.biorefineries.lipidcane.species import biodiesel_species
from biosteam.biorefineries.lipidcane.process_settings import price
from numpy import array

__all__ = ('area_400', )

# %% Stream Settings

# Set species library
Stream.species = biodiesel_species
# Stream.default_ID_number = 400

# %% Fresh Streams

# Fresh degummed oil
oil = Stream('oil', Lipid=8853.49, Water=1.00e-02, units='kg/hr', T=347.15)

# Fresh methanol
methanol = Stream('methanol', Methanol=1, price=price['Methanol'])

# Catalyst
catalyst = Stream('catalyst',
                  NaOCH3=0.25,
                  Methanol=0.75,
                  units='kg/hr',
                  price=price['NaOCH3'])
# price=0.25*price['NaOCH3'] + 0.75*Methanol.price)

# Water to remove glycerol
biodiesel_wash_water = Stream('biodiesel_wash_water',
                              Water=13.6,
from biosteam.units.facilities import CoolingTower, \
                                      BoilerTurbogenerator, \
                                      ChilledWaterPackage, \
                                      ProcessWaterCenter
from biosteam import System, Stream, find, Species
from biosteam.units import Junction, Splitter
from biosteam.biorefineries.lipidcane.utils import set_lipid_fraction
import warnings

warnings.filterwarnings('ignore')

__all__ = ('lipidcane_sys', 'lipidcane_tea', 'area_500', 'area_600', 'BT')

# %% Facilities
Stream.species = pretreatment_species
emission = Stream('emission')
water = Species('Water',)
stream = find.stream

# Stream.default_ID_number = 500

BT = BoilerTurbogenerator('BT',
                          ins=U202-0, # Bagasse from conveyor belt
                          outs=emission,
                          boiler_efficiency=0.80,
                          turbogenerator_efficiency=0.85)

Stream.default_ID_number = 600

Stream.species = water
CT = CoolingTower('CT')
예제 #13
0
                                              Xylan=0.1953,
                                              Lignin=0.1576,
                                              Ash=0.0493,
                                              Acetate=0.0181,
                                              Protein=0.0310,
                                              Extract=0.1465,
                                              Arabinan=0.0238,
                                              Galactan=0.0143,
                                              Mannan=0.0060,
                                              Sucrose=0.0077)
moisture_content = pretreatment_species.kwarray(Water=0.20)
netflow = 104167.0
feedflow = netflow * (drycomposition * 0.8 + moisture_content)

cornstover = Stream('cornstover',
                    feedflow,
                    units='kg/hr',
                    price=price['Feedstock'])
warm_process_water = Stream('warm_process_water',
                            T=368.15,
                            P=4.7 * 101325,
                            Water=140000,
                            units='kg/hr')
rectifier_bottoms_product = Stream('',
                                   T=114 + 273.15,
                                   P=6.1 * 101325,
                                   Ethanol=18,
                                   Water=36629,
                                   Furfural=72,
                                   HMF=100,
                                   units='kg/hr')
sulfuric_acid = Stream('sulfuric_acid',
예제 #14
0
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 17:02:39 2019

@author: cyshi
"""

from biorefineries.lipidcane.chemicals import ethanol_chemicals
# from biosteam.units import Fermentation
from biosteam_lca.units.fermentation_e import Fermentation
from biosteam import Stream, settings
settings.set_thermo(ethanol_chemicals)
feed = Stream('feed',
              Water=1.20e+05,
              Glucose=1.89e+03,
              Sucrose=4.14e+04,
              DryYeast=1.03e+04,
              units='kg/hr',
              T=32 + 273.15)
F1 = Fermentation('F1',
                  ins=feed,
                  outs=('CO2', 'product'),
                  tau=8,
                  efficiency=0.90,
                  N=8)
F1.simulate()
F1.show()

#import numpy as np
#results = []
#for i in np.arange(0.7, 0.9, 0.01):
def test_nested_recycle_loops():
    f.set_flowsheet('nested_recycle_loops')
    settings.set_thermo(['Water'], cache=True)
    feedstock = Stream('feedstock', Water=1000)
    recycle_1, recycle_2, recycle_3, recycle_4, recycle_5 = recycles = [
        Stream('recycle_1'),
        Stream('recycle_2'),
        Stream('recycle_3'),
        Stream('recycle_4'),
        Stream('recycle_5'),
    ]
    feed_1 = Stream('feed_1', Water=10)
    feed_2 = Stream('feed_2', Water=10)
    feed_3 = Stream('feed_3', Water=10)
    feed_4 = Stream('feed_4', Water=10)
    inner_recycle = Stream('inner_recycle')
    product = Stream('product')
    P1 = Pump('P1', feedstock)
    M1 = Mixer('M1', [P1 - 0, recycle_1])
    P2 = Pump('P2', M1 - 0)
    H1 = HXprocess('H1', [P2 - 0, recycle_2])
    P3 = Pump('P3', feed_1)
    M3 = Mixer('M3', [H1 - 0, P3 - 0], recycle_2)
    P4 = Pump('P4', H1 - 1)
    M4 = Mixer('M4', [P4 - 0, recycle_3])
    P5 = Pump('P5', feed_2)
    P6 = Pump('P6', feed_3)
    M5 = Mixer('M5', [M4 - 0, P5 - 0, P6 - 0])
    H2 = HXprocess('H2', [M5 - 0, recycle_4])
    P7 = Pump('P7', feed_4)
    M6 = Mixer('M6', [H2 - 0, P7 - 0])
    S1 = Splitter('S1', M6 - 0, [recycle_4, ''], split=0.5)
    S2 = Splitter('S2', H2 - 1, split=0.5)
    P8 = Pump('P8', S2 - 1)
    S3 = Splitter('S3', P8 - 0, split=0.5)
    H3 = HXprocess('H3', [S2 - 0, recycle_5], ['', recycle_3])
    M7 = Mixer('M7', [H3 - 0, S3 - 0])
    S4 = Splitter('S4', M7 - 0, ['', recycle_5], split=0.5)
    S5 = Splitter('S5', S4 - 0, ['', recycle_1], split=0.5)
    M8 = Mixer('M8', [S3 - 1, S1 - 1, S5 - 0], product)
    recycle_loop_sys = f.create_system('recycle_loop_sys')
    recycle_loop_sys.simulate()
    network = recycle_loop_sys.to_network()
    actual_network = Network([
        P1, P3, P5, P6, P7,
        Network([
            M1, P2,
            Network([H1, M3], recycle=M3 - 0), P4,
            Network([
                M4, M5,
                Network([H2, M6, S1], recycle=S1 - 0), S2,
                Network([M7, S4, H3], recycle=H3 - 0), P8, S3
            ],
                    recycle=H3 - 1), S5
        ],
                recycle=S5 - 1), M8
    ])
    assert network == actual_network
    x_nested_solution = np.vstack([i.mol for i in recycles])
    recycle_loop_sys.flatten()
    recycle_loop_sys.empty_recycles()
    recycle_loop_sys.simulate()
    x_flat_solution = np.vstack([i.mol for i in recycles])
    assert_allclose(x_nested_solution, x_flat_solution, rtol=5e-2)
    f.clear()
Stream.species = pretreatment_species
psp = ('Ash', 'CaO', 'Cellulose', 'Ethanol', 'Flocculant', 'Glucose',
       'Hemicellulose', 'Lignin', 'Lipid', 'Solids', 'H3PO4', 'Sucrose',
       'Water')
psp1 = ('Ash', 'Cellulose', 'Glucose', 'Hemicellulose', 'Lignin', 'Lipid',
        'Solids', 'Sucrose', 'Water')
psp2 = ('Ash', 'CaO', 'Cellulose', 'Flocculant', 'Glucose', 'Hemicellulose',
        'Lignin', 'Lipid', 'H3PO4', 'Sucrose', 'Water')

# %% Streams

f1 = (2000.042, 26986.69, 2007.067, 15922.734, 14459.241, 10035.334, 5017.667,
      22746.761, 234157.798)
lipidcane = lipid_cane = Stream('lipid_cane',
                                f1,
                                psp1,
                                units='kg/hr',
                                price=price['Lipid cane'])

enzyme = Stream('enzyme',
                Cellulose=100,
                Water=900,
                units='kg/hr',
                price=price['Protease'])

imbibition_water = Stream('imbibition_water',
                          Water=87023.35,
                          T=338.15,
                          units='kg/hr')

H3PO4 = Stream('H3PO4',
예제 #17
0
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 17:02:39 2019

@author: cyshi
"""
from biorefineries.lipidcane.chemicals import lipidcane_chemicals
from biosteam import settings, Stream
from units_e import LLECentrifuge

settings.set_thermo(lipidcane_chemicals)
feed = Stream('feed',
              T=333.15,
              Lipid=0.996,
              Biodiesel=26.9,
              Methanol=32.9,
              Glycerol=8.97)
C1 = LLECentrifuge('C1', ins=feed, outs=('light', 'heavy'))
C1.simulate()
C1.show()
예제 #18
0
# %% Streams
Stream.species = sugarcane_species
sugar_cane_composition = {
    'Glucose': 0.0120811,
    'Lignin': 0.0327653,
    'Solids': 0.015,
    'Sucrose': 0.136919,
    'Ash': 0.006,
    'Cellulose': 0.0611531,
    'Hemicellulose': 0.036082,
    'Water': 0.7
}
Sugar_cane = Stream(
    'sugar_cane',
    units='kg/hr',
    **{i: j * 333334
       for i, j in sugar_cane_composition.items()},
    price=price['Sugar cane'])

enzyme = Stream('enzyme',
                Cellulose=100,
                Water=900,
                units='kg/hr',
                price=price['Protease'])

imbibition_water = Stream('imbibition_water',
                          Water=87023.35,
                          T=338.15,
                          units='kg/hr')

H3PO4 = Stream('H3PO4',
예제 #19
0
 def _P_at_flow(mol_water, P, mol_array, index_water, mixed, ins):
     mol_array[index_water] = mol_water
     Stream.sum(mixed, ins)
     P_new = mixed.species.Water.VaporPressure(mixed.T)
     return P - P_new
예제 #20
0
Stream.species = species = pretreatment_species
getattr_ = getattr
carbs_IDs = ('Glucose', 'Sucrose')
fiber_IDs = ('Lignin', 'Cellulose', 'Hemicellulose')
lipid_IDs = ('Lipid', )
water_IDs = ('Water', )

indices = lipid_cane.indices
carbs_index = indices(carbs_IDs)
fiber_index = indices(fiber_IDs)
lipid_index = indices(lipid_IDs)
water_index = indices(water_IDs)

lc = lipid_cane
mol = lc.mol
carbs = Stream('Carbs', mol[carbs_index], carbs_IDs)
fiber = Stream('Fiber', mol[fiber_index], fiber_IDs)
lipid = Stream('Lipid', mol[lipid_index], lipid_IDs)
streams = (carbs, fiber, lipid)

# Mass property arrays
carbs_mass = lc.mass[carbs_index]
fiber_mass = lc.mass[fiber_index]
lipid_mass = lc.mass[lipid_index]

# Net weight
carbs_massnet = carbs_mass.sum()
fiber_massnet = fiber_mass.sum()
lipid_massnet = lipid_mass.sum()

# Heats of combustion per kg
예제 #21
0
sp_r = ('Ethanol', 'Glucose', 'H3PO4', 'Water', 'DryYeast')

# %% Other

MW_etoh = ethanol_species.Ethanol.MW
MW_water = ethanol_species.Water.MW

def Ethanol_molfrac(e: 'Ethanol mass fraction'):
    """Return ethanol mol fraction in a ethanol water mixture"""
    return e/MW_etoh / (e/MW_etoh + (1-e)/MW_water)


# %% Input Streams

# Fresh water
stripping_water = Stream('stripping_water', Water=5000, units='kg/hr')

# Gasoline
denaturant = Stream('denaturant', Octane=230.69,
                  units='kg/hr', price=price['Gasoline'])

# Yeast
yeast = Stream('yeast', Water=24700, DryYeast=10300,
               units='kg/hr')

# Sugar Stream (from Pretreatment section)
sugar_solution = Stream('sugar_solution', Glucose=1888.23, H3PO4=0,
                        Sucrose=21399.94, Water=264523.53,
                        units='kg/hr', T=99+273.15)

# Ethanol product
예제 #22
0
 def _P_at_flow(mol_water, P, mol_array, index_water, mixed, ins):
     mol_array[index_water] = mol_water
     Stream.sum(mixed, ins)
     P_new = mixed.bubble_P()[0]
     return P - P_new
예제 #23
0
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 17:02:39 2019

@author: cyshi
"""
from biorefineries.lipidcane.chemicals import lipidcane_chemicals
from biosteam import settings, Stream
from biosteam_lca.units import Flash

settings.set_thermo(['Water', 'Glycerol'])
feed = Stream('feed', Glycerol=300, Water=1000)
bp = feed.bubble_point_at_P() # Feed at bubble point T
feed.T = bp.T
F1 = Flash('F1',
            ins=feed,
            outs=('vapor', 'crude_glycerin'),
            P=101325, # Pa
            T=410.15) # K
F1.simulate()
F1.show(T='degC', P='atm')