This is a cost calculator for a datacenter powered by solar, batteries, and gas generation.
It can simulate a datacenter of any load anywhere in the world, with any combination of solar, battery, and gas generation. The output is a Levelized Cost of Energy (LCOE) in $/MWh, and a yearly financial model.
The code calculates the LCOE using the following steps:
- It pulls weather data for the speciifed
(lat, long)
- It simulates the solar power from the weather data
- It simulates the powerflow of the system between the solar, battery, generator, and datacenter.
- It calculates the annual cashflows and the LCOE of the system.
There are three ways to use this code:
streamlit run app.py
This simulates a single case.
python calculate_lcoe_one_shot.py --lat 31.9 --long -106.2 --solar-mw 250 --bess-mw 100 --generator-mw 125 --datacenter-load-mw 100
(See calculate_lcoe_one_shot.py
for all possible args)
This simulates a range of cases and saves the results to a CSV file. The "raw results" for every case are saved as a CSV, as well as the Pareto-optimal frontier on LCOE vs renewable-percentage.
python run_ensemble.py
You can define the test cases in run_ensemble.py
.
"""There are three steps to calculate the LCOE:
1. Get solar weather data
2. Simulate powerflow
3. Calculate LCOE
"""
# 1. Get solar weather data
solar_ac_dataframe = get_solar_ac_dataframe(lat, long)
# 2. Simulate powerflow
powerflow_results = simulate_system(lat, long, solar_ac_dataframe, ...)
# 3. Create DataCenter instance and calculate LCOE
datacenter = DataCenter(
powerflow_results=powerflow_results,
solar=100,
bess=100,
generator=125,
generator_type="Gas Engine",
# CAPEX rates
solar_capex_total_dollar_per_w=0.25,
bess_capex_total_dollar_per_kwh=0.10,
# O&M rates
solar_om_fixed_dollar_per_kw=0.01,
bess_om_fixed_dollar_per_kw=0.01,
... # See `datacenter.py` for all options and defaults
)
lcoe = datacenter.calculate_lcoe()