Skip to content

Commit

Permalink
Add inflation input; remove extraneous cost code (ammonia)
Browse files Browse the repository at this point in the history
  • Loading branch information
camirmas committed Feb 26, 2024
1 parent 46ed431 commit a10d6a0
Showing 1 changed file with 19 additions and 168 deletions.
187 changes: 19 additions & 168 deletions greenheart/simulation/technologies/ammonia/ammonia.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class AmmoniaFinanceModelConfig:
empty dict but should be populated with relevant values.
install_years (int): Number of years over which the plant is installed and
ramped up to full production, default is 3 years.
gen_inflation (float): General inflation rate, default is 0.0.
"""

plant_life: int
Expand All @@ -313,6 +314,7 @@ class AmmoniaFinanceModelConfig:
costs: Union[AmmoniaCosts, AmmoniaCostModelOutputs]
financial_assumptions: Dict[str, float] = Factory(dict)
install_years: int = 3
gen_inflation: float = 0.0


@define
Expand All @@ -337,7 +339,6 @@ class AmmoniaFinanceModelOutputs:
sol: dict
summary: dict
price_breakdown: pd.DataFrame
ammonia_price_breakdown: dict


def run_ammonia_finance_model(
Expand Down Expand Up @@ -379,20 +380,19 @@ def run_ammonia_finance_model(
analysis_start = int(list(config.grid_prices.keys())[0]) - config.install_years

# Fill these in - can have most of them as 0 also
gen_inflation = 0.00
pf.set_params(
"commodity",
{
"name": "Ammonia",
"unit": "kg",
"initial price": 1000,
"escalation": gen_inflation,
"escalation": config.gen_inflation,
},
)
pf.set_params("capacity", config.plant_capacity_kgpy / 365) # units/day
pf.set_params(
"maintenance",
{"value": 0, "escalation": gen_inflation},
{"value": 0, "escalation": config.gen_inflation},
)
pf.set_params("analysis start year", analysis_start)
pf.set_params("operating life", config.plant_life)
Expand All @@ -409,19 +409,21 @@ def run_ammonia_finance_model(
pf.set_params("non depr assets", costs.land_cost)
pf.set_params(
"end of proj sale non depr assets",
costs.land_cost * (1 + gen_inflation) ** config.plant_life,
costs.land_cost * (1 + config.gen_inflation) ** config.plant_life,
)
pf.set_params("demand rampup", 0)
pf.set_params("long term utilization", config.plant_capacity_factor)
pf.set_params("credit card fees", 0)
pf.set_params("sales tax", 0)
pf.set_params("license and permit", {"value": 00, "escalation": gen_inflation})
pf.set_params("rent", {"value": 0, "escalation": gen_inflation})
pf.set_params(
"license and permit", {"value": 00, "escalation": config.gen_inflation}
)
pf.set_params("rent", {"value": 0, "escalation": config.gen_inflation})
pf.set_params("property tax and insurance", 0)
pf.set_params("admin expense", 0)
pf.set_params("sell undepreciated cap", True)
pf.set_params("tax losses monetized", True)
pf.set_params("general inflation rate", gen_inflation)
pf.set_params("general inflation rate", config.gen_inflation)
pf.set_params("debt type", "Revolving debt")
pf.set_params("cash onhand", 1)

Expand Down Expand Up @@ -468,21 +470,21 @@ def run_ammonia_finance_model(
usage=1,
unit="$/year",
cost=costs.labor_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_fixed_cost(
name="Maintenance Cost",
usage=1,
unit="$/year",
cost=costs.maintenance_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_fixed_cost(
name="Administrative Expense",
usage=1,
unit="$/year",
cost=costs.general_administration_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_fixed_cost(
name="Property tax and insurance",
Expand All @@ -498,197 +500,46 @@ def run_ammonia_finance_model(
usage=feedstocks.hydrogen_consumption,
unit="kilogram of hydrogen per kilogram of ammonia",
cost=feedstocks.hydrogen_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)

pf.add_feedstock(
name="Electricity",
usage=feedstocks.electricity_consumption,
unit="MWh per kilogram of ammonia",
cost=config.grid_prices,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_feedstock(
name="Cooling water",
usage=feedstocks.cooling_water_consumption,
unit="Gallon per kilogram of ammonia",
cost=feedstocks.cooling_water_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_feedstock(
name="Iron based catalyst",
usage=feedstocks.iron_based_catalyst_consumption,
unit="kilogram of catalyst per kilogram of ammonia",
cost=feedstocks.iron_based_catalyst_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)
pf.add_coproduct(
name="Oxygen byproduct",
usage=feedstocks.oxygen_byproduct,
unit="kilogram of oxygen per kilogram of ammonia",
cost=feedstocks.oxygen_cost,
escalation=gen_inflation,
escalation=config.gen_inflation,
)

# ------------------------------ Sovle for breakeven price ---------------------------
# ------------------------------ Set up outputs ---------------------------

sol = pf.solve_price()

summary = pf.get_summary_vals()

price_breakdown = pf.get_cost_breakdown()

price_breakdown_air_separation_by_cryogenic = price_breakdown.loc[
price_breakdown["Name"] == "Air Separation by Cryogenic", "NPV"
].tolist()[0]
price_breakdown_Haber_Bosch = price_breakdown.loc[
price_breakdown["Name"] == "Haber Bosch", "NPV"
].tolist()[0]
price_breakdown_boiler_and_steam_turbine = price_breakdown.loc[
price_breakdown["Name"] == "Boiler and Steam Turbine", "NPV"
].tolist()[0]
price_breakdown_cooling_tower = price_breakdown.loc[
price_breakdown["Name"] == "Cooling Tower", "NPV"
].tolist()[0]
price_breakdown_depreciable_nonequipment = price_breakdown.loc[
price_breakdown["Name"] == "Depreciable Nonequipment", "NPV"
].tolist()[0]
price_breakdown_installation = price_breakdown.loc[
price_breakdown["Name"] == "Installation cost", "NPV"
].tolist()[0]

price_breakdown_labor_cost_annual = price_breakdown.loc[
price_breakdown["Name"] == "Labor Cost", "NPV"
].tolist()[0]
price_breakdown_maintenance_cost = price_breakdown.loc[
price_breakdown["Name"] == "Maintenance Cost", "NPV"
].tolist()[0]
price_breakdown_administrative_expense = price_breakdown.loc[
price_breakdown["Name"] == "Administrative Expense", "NPV"
].tolist()[0]
price_breakdown_property_tax_and_insurance = price_breakdown.loc[
price_breakdown["Name"] == "Property tax and insurance", "NPV"
].tolist()[0]

if feedstocks.hydrogen_cost < 0:
price_breakdown_hydrogen = (
-1
* price_breakdown.loc[
price_breakdown["Name"] == "Hydrogen", "NPV"
].tolist()[0]
)
else:
price_breakdown_hydrogen = price_breakdown.loc[
price_breakdown["Name"] == "Hydrogen", "NPV"
].tolist()[0]
price_breakdown_electricity = price_breakdown.loc[
price_breakdown["Name"] == "Electricity", "NPV"
].tolist()[0]
price_breakdown_cooling_water = price_breakdown.loc[
price_breakdown["Name"] == "Cooling water", "NPV"
].tolist()[0]
price_breakdown_iron_based_catalyst = price_breakdown.loc[
price_breakdown["Name"] == "Iron based catalyst", "NPV"
].tolist()[0]
price_breakdown_oxygen_byproduct = -price_breakdown.loc[
price_breakdown["Name"] == "Oxygen byproduct", "NPV"
].tolist()[0]

price_breakdown_taxes = (
price_breakdown.loc[
price_breakdown["Name"] == "Income taxes payable", "NPV"
].tolist()[0]
- price_breakdown.loc[
price_breakdown["Name"] == "Monetized tax losses", "NPV"
].tolist()[0]
)
if gen_inflation > 0:
price_breakdown_taxes = (
price_breakdown_taxes
+ price_breakdown.loc[
price_breakdown["Name"] == "Capital gains taxes payable", "NPV"
].tolist()[0]
)
# Calculate financial expense associated with equipment
price_breakdown_financial_equipment = (
price_breakdown.loc[
price_breakdown["Name"] == "Repayment of debt", "NPV"
].tolist()[0]
+ price_breakdown.loc[
price_breakdown["Name"] == "Interest expense", "NPV"
].tolist()[0]
+ price_breakdown.loc[
price_breakdown["Name"] == "Dividends paid", "NPV"
].tolist()[0]
- price_breakdown.loc[
price_breakdown["Name"] == "Inflow of debt", "NPV"
].tolist()[0]
- price_breakdown.loc[
price_breakdown["Name"] == "Inflow of equity", "NPV"
].tolist()[0]
)
# Calculate remaining financial expenses
price_breakdown_financial_remaining = (
price_breakdown.loc[
price_breakdown["Name"] == "Non-depreciable assets", "NPV"
].tolist()[0]
+ price_breakdown.loc[
price_breakdown["Name"] == "Cash on hand reserve", "NPV"
].tolist()[0]
+ price_breakdown.loc[
price_breakdown["Name"] == "Property tax and insurance", "NPV"
].tolist()[0]
- price_breakdown.loc[
price_breakdown["Name"] == "Sale of non-depreciable assets", "NPV"
].tolist()[0]
- price_breakdown.loc[
price_breakdown["Name"] == "Cash on hand recovery", "NPV"
].tolist()[0]
)
price_check = (
price_breakdown_air_separation_by_cryogenic
+ price_breakdown_Haber_Bosch
+ price_breakdown_boiler_and_steam_turbine
+ price_breakdown_cooling_tower
+ price_breakdown_depreciable_nonequipment
+ price_breakdown_installation
+ price_breakdown_labor_cost_annual
+ price_breakdown_maintenance_cost
+ price_breakdown_administrative_expense
+ price_breakdown_hydrogen
+ price_breakdown_electricity
+ price_breakdown_cooling_water
+ price_breakdown_iron_based_catalyst
- price_breakdown_oxygen_byproduct
+ price_breakdown_taxes
+ price_breakdown_financial_equipment
+ price_breakdown_financial_remaining
)
ammonia_price_breakdown = {
"Ammonia price: Air Separation by Cryogenic ($/kg)": price_breakdown_air_separation_by_cryogenic,
"Ammonia price: Haber Bosch ($/kg)": price_breakdown_Haber_Bosch,
"Ammonia price: Boiler and Steam Turbine ($/kg)": price_breakdown_boiler_and_steam_turbine,
"Ammonia price: Cooling Tower ($/kg)": price_breakdown_cooling_tower,
"Ammonia price: Depreciable Nonequipment ($/kg)": price_breakdown_depreciable_nonequipment,
"Ammonia price: Labor Cost ($/kg)": price_breakdown_labor_cost_annual,
"Ammonia price: Maintenance Cost ($/kg)": price_breakdown_maintenance_cost,
"Ammonia price: Administrative Expense ($/kg)": price_breakdown_administrative_expense,
"Ammonia price: Hydrogen ($/kg)": price_breakdown_hydrogen,
"Ammonia price: Electricity ($/kg)": price_breakdown_electricity,
"Ammonia price: Cooling water ($/kg)": price_breakdown_cooling_water,
"Ammonia price: Iron based catalyst ($/kg)": price_breakdown_iron_based_catalyst,
"Ammonia price: Oxygen byproduct ($/kg)": price_breakdown_oxygen_byproduct,
"Ammonia price: Taxes ($/kg)": price_breakdown_taxes,
"Ammonia price: Equipment Financing ($/kg)": price_breakdown_financial_equipment,
"Ammonia price: Remaining Financial ($/kg)": price_breakdown_financial_remaining,
"Ammonia price: Total ($/kg)": price_check,
}

price_breakdown = price_breakdown.drop(columns=["Amount"])

return AmmoniaFinanceModelOutputs(
sol=sol,
summary=summary,
price_breakdown=price_breakdown,
ammonia_price_breakdown=ammonia_price_breakdown,
)

0 comments on commit a10d6a0

Please sign in to comment.