Example output for USA:
Example aggregate of all economy's with confidence intervals. (note the bottom half of the total's conf int. is covered by the data centres conf. int.):
The code is based around the main.py function, except in the case of estimate_inputs.py - which is better to be run as it's own independent script.
The outputs are dictated by what is in the config/parameters.yml file. These can be edited en-masse using the estimate_inputs.py script, or manually edited where you need specific edits. Chances are that as you complete the model for each economy, you will want to remove them from the estiamte_inputs.py process using the ECONOMIES_TO_KEEP_AS_IS list variable. Also the script will save a dated copy of the previous parameters file to config/previous_parameter_versions/parameters_{date_id}.yml just in case you screw something up. This is pretty useful for testing things.
This is where the magic happens. Main.py will run project_energy_use() which will produce a projectino for each economy in parameters.yml. Then after that everything is to do with creating charts and comparisons to data from the buildings model and previous 8th/9th outlook projections. Below I've written (or chatgpt has written) a guide to project energy use. I think reading the code at the same time is most useful.
Hope you enjoy my chatgpt generated (and slightly adjusted manually) doucmentation with emojis.
The project_energy_use
function π projects the energy β‘ consumption for data π activity and AI π€ training activity over a specified ποΈ time period for one or more π economies. It allows users π₯ to model how different growth π rates, intensity π§ improvements, and scheduled π
infrastructure ποΈ builds affect overall energy β‘ use.
def project_energy_use(config):
config
(dict
): A configuration π dictionary containing:start_year
(int
): The starting year ποΈ for the projection.end_year
(int
): The ending year ποΈ for the projection.economies
(list
ofdict
): A list π of economies π to model, each with their own parameters.
Each economy dictionary within config['economies']
should include:
name
(str
): Name π·οΈ of the economy.initial_data_activity_growth_rate
(float
): Initial growth rate π for data activity (e.g.,0.15
for 15%).initial_ai_training_activity_growth_rate
(float
): Initial growth rate π for AI π€ training activity.initial_data_intensity_improvement_rate
(float
): Initial rate π of improvement in data intensity.initial_ai_training_intensity_improvement_rate
(float
): Initial rate π of improvement in AI π€ training intensity.initial_data_to_ai_training_ratio
(float
): Initial ratio βοΈ of data activity to AI π€ training activity energy use (value between0
and1
).
Specify one of the following to indicate initial energy β‘ consumption:
initial_energy_pj
(float
): Initial energy in petajoules (PJ).initial_energy_mw
(float
): Initial energy capacity in megawatts (MW).initial_energy_mwh
(float
): Initial energy in megawatt-hours (MWh).initial_energy_twh
(float
): Initial energy in terawatt-hours (TWh).
scheduled_builds
(list
ofdict
): Scheduled ποΈ infrastructure ποΈ additions with parameters:year
(int
): Year ποΈ of the scheduled build.- π Additional Energy: Specify one of the following:
additional_energy_pj
(float
)additional_energy_mw
(float
)additional_energy_mwh
(float
)additional_energy_twh
(float
)
new_data_to_ai_training_ratio
(float
, optional): New ratio βοΈ applied to this years build and onwards.
new_activity_growth_rates
(list
ofdict
): Changes π in growth rates:year
(int
): Year ποΈ the new growth rates take effect.new_data_growth_rate
(float
): New data π activity growth rate.new_ai_growth_rate
(float
): New AI π€ training activity growth rate.
new_intensity_improvement_rates
(list
ofdict
): Changes π in intensity improvement rates:year
(int
): Year ποΈ the new rates take effect.new_data_intensity_improvement_rate
(float
): New data π intensity improvement rate.new_ai_training_intensity_improvement_rate
(float
): New AI π€ training intensity improvement rate.
combined_projections
(pandas.DataFrame
): A DataFrame π containing projected energy use data for all economies π over the specified time period ποΈ.
- Extract Configuration:
- Retrieves
start_year
,end_year
, and iterates π over each economy inconfig['economies']
. - Initializes an empty list π
all_projections
to store projections for each economy π.
- Retrieves
-
Extract Parameters:
- Retrieves initial growth π rates, intensity π§ improvement rates, and the data-to-AI π€ training ratio βοΈ.
- Calculates
initial_energy_pj
based on the specified initial energy (converts units if necessary).
-
Set Up DataFrame:
- Creates a DataFrame
df
π with years fromstart_year
toend_year
. - Initializes columns for growth rates π, intensity rates π§, activities π, intensities π§, and ratios βοΈ.
- Creates a DataFrame
-
Apply New Rates:
- Updates growth rates π and intensity improvement rates π§ in
df
based onnew_activity_growth_rates
andnew_intensity_improvement_rates
.
- Updates growth rates π and intensity improvement rates π§ in
-
Initial Calculations:
- Calculates initial activities π and intensities π§ for data and AI π€ training based on the initial energy β‘ and ratio βοΈ.
For each subsequent year ποΈ:
-
Update Intensities:
- Applies intensity improvements π§ based on the improvement rates.
-
Scheduled Builds:
- Checks if there is a scheduled build ποΈ for the current year ποΈ.
- If found:
- Adjusts activities π based on additional energy β‘ and applies them according to any new ratios βοΈ (if no new ratios, will use the last one available)
- If not:
- Grows activities π based on growth rates π.
- If found:
- Checks if there is a scheduled build ποΈ for the current year ποΈ.
-
Calculate Energy Use:
- Calculates energy β‘ use for data π and AI π€ training activities using the newly projected activity and intensity.
-
Index Activities:
- Normalizes activities π to the base year ποΈ for comparative analysis π.
- Appends the DataFrame
df
π for the current economy π toall_projections
π.
- Concatenates all individual economy projections π into
combined_projections
.
By following these steps π, the function provides a detailed projection π of energy use β‘, considering various factors like growth rates π, intensity improvements π§, and scheduled builds ποΈ, allowing for comprehensive energy planning and analysis π.
data_to_ai_training_ratio
(float
): Ratio βοΈ of data activity to AI π€ training activity for scheduled builds only. To make it work with the rest of the process, the energy is converted to activity using the intensity value and then back again using the intensity value. So it doesn't matter what the intensity value is for these scheduled build years, but it is really important what the data_to_ai_training_ratio is. Also, the activity growth rates don't matter for these scheduled build years because the change in activity in that year is determined by the scheduled build, if there is one.