Carbon
energypylinear
has the ability to optimize for both price and carbon as optimization objectives.
This ability comes from two things - an objective function, which can be either for price or carbon, along with accounting of both price and carbon emissions.
We can dispatch a battery to minimize carbon emissions by passing in objective='carbon'
:
Setup Interval Data
import energypylinear as epl
electricity_prices = [100, 50, 200, -100, 0, 200, 100, -100]
electricity_carbon_intensities = [0.1, 0.2, 0.1, 0.15, 0.01, 0.7, 0.5, 0.01]
Optimize for Carbon
asset = epl.Battery(
power_mw=2,
capacity_mwh=4,
efficiency_pct=0.9,
electricity_prices=electricity_prices,
electricity_carbon_intensities=electricity_carbon_intensities,
)
carbon = asset.optimize(objective="carbon", verbose=3)
carbon_account = epl.get_accounts(carbon.results, verbose=3)
print(f"{carbon_account=}")
Optimize for Money
We can compare these results above with a simulation that optimizes for price, using a energypylinear.accounting.Account
to compare both simulations.
Our optimization for price has a high negative cost.
The optimization for carbon has lower emissions, but at a higher cost:
asset = epl.Battery(
power_mw=2,
capacity_mwh=4,
efficiency_pct=0.9,
electricity_prices=electricity_prices,
electricity_carbon_intensities=electricity_carbon_intensities,
)
price = asset.optimize(
objective="price",
verbose=3
)
price_account = epl.get_accounts(price.results, verbose=3)
print(f"{price_account=}")