Skip to content

Latest commit

 

History

History
110 lines (74 loc) · 4.79 KB

Overiew.md

File metadata and controls

110 lines (74 loc) · 4.79 KB

Switch / Ream Overview

What is Switch?

Switch is a tool based on linear programming that allows us to model the electricity grid. Like all linear programming tools it has 4 components:

  • Fixed parameters (e.g. region X requires 200MW of energy at a given time and date)

  • An objective (in our case to minimize the total cost)

  • Variables (e.g. how much power should power plant Y produce at a given time and date)

  • Constraints (e.g. by 2050 there should be no CO2 emitting plans in operation)

Switch will automatically find the optimal set of variables (the variables that minimize the total cost) while still respecting the constraints. By varying our constraints and parameters we can study how different scenarios affect the optimal electricity grid.

Now, Switch is a capacity expansion model which means it optimizes two things: what to build and how to dispatch. More specifically, it optimizes the following:

  • Variables that optimize what to build:

    • BuildGen : How much power capacity (units MW) to build at given power plants.
    • BuildStorageEnergy : How much energy storage (units MWh) to build at given storage plants.
    • BuildTx : How much transmission lines to build between regions (called load zones).
  • Variables that optimize how to dispatch:

    • DispatchGen: How much power should a plant provide at a give date and time (called timepoint)
    • DispatchTx : How much power to transmit through the transmission lines at a given timepoint
    • ChargeStorage: How much energy should go into a storage plant during a given timepoint

There are a few other variables in the model, but they go beyond the scope of this overview.

The organizational stuff

  • This repository of Switch is a fork (a modified copy) of https://github.com/switch-model/switch (referred to as the upstream repository).

  • The upstream repository is used by many research groups beyond REAM.

  • Since creating the fork, we have made improvements and changes to the upstream code.

  • We occasionally contribute to the upstream code to make that code available to other groups.

Switch from a software perspective

The switch_model library

The core software component of Switch is the Python library switch_model stored in this repository. The library defines the constraints, parameters, objectives and variables of the model. Internally, it uses the Pyomo, a Python optimization library. It also provides a command line tool, switch to interact with the model. For example, after installing the library (see Usage.md), you could run switch solve to get the optimized variables.

One useful command is switch --help to lists all the available switch commands.

Switch workflow

The diagram below gives an overview of the Switch workflow from start to finish.

Workflow Overview

Here's a breakdown of the steps. Details of how to actually perform each step are found in Usage.md.

  1. All the input data (i.e. fixed parameters, which constraints to apply, etc.) are stored in a PostgreSQL database at UCSD.

  2. To get started, you pull the input data that you need from the server into your local input folder (switch get_inputs). Now the input data is stored in .csv files.

  3. Now you run the switch model with the inputs folder (switch solve --recommended). The data gets loaded and then passed on to a linear program solver via Pyomo. The solver will take a few hours to find the optimal variables before returning the results to the switch model which will automatically create an outputs folder will all the variables in .csv files.

  4. You can run switch graph to produce a graphs folder with useful graphics to help analyze the results.

Modularity

One central concept in Switch is modularity. The code is divided into modules that can be added or removed from a specific scenario. For example, the module switch_model.policies.carbon_policies adds a carbon cap to the model. In the inputs folder, the file modules.txt lists all the modules that are to be used. By adding or removing switch_model.policies.carbon_policies from modules.txt you can specify whether you want to include a carbon cap or not. modules.txt is autogenerated based on the scenario you're retrieving.

Scenarios

Research involves studying numerous scenarios. For example, one scenario might require zero-emissions by 2050 while another might only require an 80% reduction in emissions.

Our database is structured to support many scenarios. The scenario table stores all the scenarios that have been created up to now.

When solving the model, each scenario is also stored in its own folder.