def create_IRR_metrics(IRR): def get_IRR_based_MPSP(): lactic_tea.IRR = IRR return get_MPSP() return [ Metric('Minimum product selling price', get_IRR_based_MPSP, '$/kg', f'IRR={IRR:.0%}'), Metric('Net present value', get_NPV, '$', f'IRR={IRR:.0%}') ]
def create_price_metris(price): def get_price_based_MPSP(): price_per_kg = price / _kg_per_ton * 0.8 feedstock.price = price_per_kg return get_MPSP() return [ Metric('Minimum product selling price', get_price_based_MPSP, '$/kg', f'Price={price:.0f} [$/dry-ton]'), Metric('Net present value', get_NPV, '$', f'Price={price:.0f} [$/dry-ton]') ]
return lambda: sum([i.duty for i in cooling_utilities]) biomass_IDs = ('Glucose', 'Lignin', 'Solids', 'Ash', 'Sucrose', 'Cellulose', 'Hemicellulose', 'Water') total_biomass = sugar_cane.imass[biomass_IDs].sum() get_combusted_mass = lambda: (sum( [i.imass[biomass_IDs].sum() for i in BT.ins[0:1]])) get_combusted_biomass_ratio = lambda: (sum( [i.imass[biomass_IDs].sum() for i in BT.ins[0:1]])) / total_biomass #metrics for LCA metrics = [ # Metric('Fixed capital investment', get_FCI, 'USD'), Metric('Minimum ethanol selling price', get_MESP, 'USD/gal'), # Metric('Co-product credit', get_coproduct_credit, 'USD/yr'), Metric('Ethanol production', get_ethanol_production, 'kg/hr'), Metric('Steam demand', get_steam_demand, 'kg/hr'), Metric('Excess electricity', get_excess_electricity, 'MW'), Metric('Cooling duty', cooling_duty_biorefinery(), 'KJ/hr'), Metric('H2SO4 input', get_acid_innput, 'kg/hr'), Metric('Lime_input', get_lime_input, 'kg/hr'), Metric('Polymer_input', get_polymer_input, 'kg/hr'), Metric('Yeast_input', get_yeast_input, 'kg/hr'), Metric('Makeup_water', get_makeup_water, 'kg/hr'), Metric('Biomass goes to combustion', get_combusted_mass, 'kg/hr'), Metric('Share of total biomass goes to combustion', get_combusted_biomass_ratio, '100&') ]
get_overall_AOC = lambda: lactic_tea.AOC / 1e6 get_material_cost = lambda: lactic_tea.material_cost / 1e6 # Annual sale revenue from products, note that electricity credit is not included, # but negative sales from waste disposal are included # (i.e., wastes are products of negative selling price) get_annual_sale = lambda: lactic_tea.sales / 1e6 # System power usage, individual unit power usage should be positive CHP = system.CHP excess_power = lambda: CHP.electricity_generated electricity_price = bst.PowerUtility.price # Electricity credit is positive if getting revenue from excess electricity get_electricity_credit = lambda: (excess_power() * electricity_price * get_annual_factor()) / 1e6 metrics = [ Metric('Minimum product selling price', get_MPSP, '$/kg'), Metric('Product yield', get_yield, '10^6 kg/yr'), Metric('Product purity', get_purity, '%'), Metric('Product recovery', get_recovery, '%'), Metric('Total capital investment', get_overall_TCI, '10^6 $'), Metric('Annual operating cost', get_overall_AOC, '10^6 $/yr'), Metric('Annual material cost', get_material_cost, '10^6 $/yr'), Metric('Annual product sale', get_annual_sale, '10^6 $/yr'), Metric('Annual electricity credit', get_electricity_credit, '10^6 $/yr') ] # ============================================================================= # Capital cost breakdown # ============================================================================= process_groups = system.process_groups
BT = sc.system.BT sc_sys = sc.sugarcane_sys def get_steam(): return sum([i.flow for i in BT.steam_utilities])*18.01528*tea._annual_factor/1000 power_utils = ([i._power_utility for i in sc_sys.units if (i._power_utility and i is not BT)]) excess_electricity = [0] def get_consumed_electricity(): factor = tea._annual_factor/1000 electricity_generated = -BT._power_utility.rate * factor consumed_electricity = sum([i.rate for i in power_utils]) * factor excess_electricity[0] = electricity_generated - consumed_electricity return consumed_electricity get_excess_electricity = lambda: excess_electricity[0] metrics = (Metric('Internal rate of return', sc.sugarcane_tea.solve_IRR, '%'), Metric('Ethanol production cost', get_prodcost, 'USD/yr'), Metric('Fixed capital investment', get_FCI, 'USD'), Metric('Ethanol production', get_prod, 'kg/hr'), Metric('Steam', get_steam, 'MT/yr'), Metric('Consumed electricity', get_consumed_electricity, 'MWhr/yr'), Metric('Excess electricity', get_excess_electricity, 'MWhr/yr')) sugarcane_model = Model(sc.sugarcane_sys, metrics, skip=False) sugarcane_model.load_default_parameters(sc.system.Sugar_cane) param = sugarcane_model.parameter # Fermentation efficiency fermentation = sc.system.P24 @param(element=fermentation, distribution=triang(fermentation.efficiency), kind='coupled')
get_MESP = lambda: cornstover_tea.solve_price(ethanol, ethanol_tea ) * ethanol_density_kggal get_FCI = lambda: sum([i._FCI_cached for i in cornstover_tea.TEAs]) get_coproduct_credit = lambda: sum( [i._utility_cost_cached for i in cornstover_tea.TEAs]) get_ethanol_production = lambda: ethanol.massnet get_steam_demand = lambda: BT.steam_demand.massnet pws = [ i._power_utility for i in cornstover_sys.units if i._power_utility and i._power_utility.rate > 0 ] get_excess_electricity = lambda: BT._Design['Work'] - sum( [i.rate for i in pws]) metrics = [ Metric('Minimum ethanol selling price', get_MESP, 'USD/gal'), Metric('Fixed capital investment', get_FCI, 'USD'), Metric('Co-product credit', get_coproduct_credit, 'USD/yr'), Metric('Ethanol production', get_ethanol_production, 'kg/hr'), Metric('Steam demand', get_steam_demand, 'kg/hr'), Metric('Excess electricity', get_excess_electricity, 'kW') ] def electricity_rate_function(tea): power_utilities = [ i._power_utility for i in tea.units if i._has_power_utility ] if tea is Area700: boiler_item = BT.cost_items['Boiler'] Design = BT._Design
tea = lc.lipidcane_tea ugroup = UnitGroup('Biorefinery', tea.units) get_steam_demand = lambda: sum([i.flow for i in lc.BT.steam_utilities] ) * 18.01528 * tea._annual_factor / 1000 get_electricity_consumption = ugroup.get_electricity_consumption get_electricity_production = ugroup.get_electricity_production get_excess_electricity = lambda: get_electricity_production( ) - get_electricity_consumption() get_ethanol_production = lambda: lc.ethanol.F_mass * tea._annual_factor / 907.185 get_biodiesel_production = lambda: lc.biodiesel.F_mass * tea._annual_factor / 907.185 get_MESP = lambda: tea.solve_price(lc.ethanol) * ethanol_density get_MFPP = lambda: tea.solve_price(lc.lipidcane) get_IRR = lambda: tea.solve_IRR() * 100 get_FCI = lambda: tea.FCI / 10**6 metrics = (Metric('IRR', get_IRR, '%'), Metric('MFPP', get_MFPP, 'USD/kg'), Metric('MESP', get_MESP, 'USD/gal'), Metric('FCI', get_FCI, 'million USD'), Metric('Biodiesel production', get_biodiesel_production, 'ton/yr'), Metric('Ethanol production', get_ethanol_production, 'ton/yr'), Metric('Steam demand', get_steam_demand, 'MT/yr'), Metric('Consumed electricity', get_electricity_consumption, 'MW'), Metric('Excess electricity', get_excess_electricity, 'MW')) # Used to index metrics by name metrics_by_name = {i.name: i for i in metrics} # %% Create model and populate parameters #: [float] Plant size process specification in ton / yr plant_size_ = lc.lipidcane.F_mass * lc.lipidcane_tea.operating_days * 24 / 907.185
from biorefineries.cornstover import \ cornstover_sys, cornstover_tea, \ ethanol, cornstover, R301, ethanol_density_kggal, \ areas, BT, Area700, AllAreas cornstover_sys.simulate() get_MESP = lambda: cornstover_tea.solve_price(ethanol) * ethanol_density_kggal get_FCI = lambda: cornstover_tea.FCI get_coproduct_credit = lambda: cornstover_tea.utility_cost get_ethanol_production = lambda: ethanol.F_mass get_steam_demand = lambda: BT.steam_demand.F_mass get_electricity_demand = AllAreas.get_electricity_consumption get_electricity_production = AllAreas.get_electricity_production get_excess_electricity = lambda: get_electricity_production() - get_electricity_demand() metrics =[Metric('Minimum ethanol selling price', get_MESP, 'USD/gal'), Metric('Fixed capital investment', get_FCI, 'USD'), Metric('Co-product credit', get_coproduct_credit, 'USD/yr'), Metric('Ethanol production', get_ethanol_production, 'kg/hr'), Metric('Steam demand', get_steam_demand, 'kg/hr'), Metric('Excess electricity', get_excess_electricity, 'MW'), Metric('Electricity production', get_electricity_production, 'MW'), Metric('Total electricity demand', get_electricity_demand, 'MW')] for i, area in enumerate(areas, 1): Area = f'Area {i}00' metrics.extend( (Metric('Electricity', area.get_electricity_consumption, 'MW', Area), Metric('Cooling duty', area.get_cooling_duty, 'GJ/hr', Area), Metric('Installed equipment cost', area.get_installed_cost, '10^6 USD', Area)))
etoh_prodcost = [0] products = (biodiesel, ethanol) def get_biodiesel_prodcost(): bd, etoh_prodcost[0] = tea.production_cost(products) return bd get_etoh_prodcost = lambda: etoh_prodcost[0] get_FCI = lambda: tea._FCI_cached get_ethanol_production = lambda: lc.ethanol.F_mass * tea._annual_factor get_biodiesel_production = lambda: lc.biodiesel.F_mass * tea._annual_factor get_steam = lambda: sum([i.flow for i in lc.BT.steam_utilities])*18.01528*tea._annual_factor/1000 get_electricity_consumption = lambda: tea._annual_factor * ugroup.get_electricity_consumption() get_electricity_production = lambda: tea._annual_factor * ugroup.get_electricity_production() get_excess_electricity = lambda: get_electricity_production() - get_electricity_consumption() metrics = (Metric('Internal rate of return', lc.lipidcane_tea.solve_IRR), Metric('Biodiesel production cost', get_biodiesel_prodcost, 'USD/yr'), Metric('Ethanol production cost', get_etoh_prodcost, 'USD/yr'), Metric('Fixed capital investment', get_FCI, 'USD'), Metric('Biodiesel production', get_biodiesel_production, 'kg/yr'), Metric('Ethanol production', get_ethanol_production, 'kg/yr'), Metric('Steam', get_steam, 'MT/yr'), Metric('Consumed electricity', get_electricity_consumption, 'MWhr/yr'), Metric('Excess electricity', get_excess_electricity, 'MWhr/yr')) lipidcane_model = Model(lc.lipidcane_sys, metrics) lipidcane_model.load_default_parameters(lipidcane) param = lipidcane_model.parameter # Lipid extraction rate Mill = lc.U201