Skip to content

asia-pacific-energy-research-centre/data-centres

Repository files navigation

Example output for USA: us datacentres first pass 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.): aggregate with confidence intervals first pass

General structure:

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.

estimate_inputs.py and parameters.yml

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.

main.py and projection_functions.py

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.

πŸ“„ Documentation for project_energy_use(config)

Hope you enjoy my chatgpt generated (and slightly adjusted manually) doucmentation with emojis.

🎯 Purpose

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.

πŸ“ Function Signature

def project_energy_use(config):

πŸ“₯ Parameters

  • 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 of dict): A list πŸ“œ of economies 🌍 to model, each with their own parameters.

🌍 Economy Configuration

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 between 0 and 1).

πŸ”‹ Initial Energy

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).

πŸ”§ Optional Parameters

  • scheduled_builds (list of dict): 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 of dict): 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 of dict): 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.

πŸ“€ Returns

  • combined_projections (pandas.DataFrame): A DataFrame πŸ“Š containing projected energy use data for all economies 🌍 over the specified time period πŸ—“οΈ.

πŸ” How It Works

πŸ› οΈ Initialization

  1. Extract Configuration:
    • Retrieves start_year, end_year, and iterates πŸ”„ over each economy in config['economies'].
    • Initializes an empty list πŸ“‹ all_projections to store projections for each economy 🌍.

βš™οΈ Processing Each Economy

  1. 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).
  2. Set Up DataFrame:

    • Creates a DataFrame df πŸ“Š with years from start_year to end_year.
    • Initializes columns for growth rates πŸ“ˆ, intensity rates πŸ”§, activities πŸ“Š, intensities πŸ”§, and ratios βš–οΈ.
  3. Apply New Rates:

    • Updates growth rates πŸ“ˆ and intensity improvement rates πŸ”§ in df based on new_activity_growth_rates and new_intensity_improvement_rates.
  4. Initial Calculations:

    • Calculates initial activities πŸ“Š and intensities πŸ”§ for data and AI πŸ€– training based on the initial energy ⚑ and ratio βš–οΈ.

πŸ”„ Projection Loop

For each subsequent year πŸ—“οΈ:

  1. Update Intensities:

    • Applies intensity improvements πŸ”§ based on the improvement rates.
  2. 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 πŸ“ˆ.
  3. Calculate Energy Use:

    • Calculates energy ⚑ use for data πŸ“Š and AI πŸ€– training activities using the newly projected activity and intensity.
  4. Index Activities:

    • Normalizes activities πŸ“Š to the base year πŸ—“οΈ for comparative analysis πŸ“ˆ.

πŸ“¦ Collect Projections

  • Appends the DataFrame df πŸ“Š for the current economy 🌍 to all_projections πŸ“‹.

πŸ“Š Combining Results

  • 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 πŸ”.

some clarifications:

  • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published