Skip to main content

SWITCH Power System Planning Model

Project description

This contains version 2 of the Switch electricity planning model. This optimization model is modular and can be used with varying levels of complexity. Look in the examples directory for demonstrations of using Switch for investment planning or production cost simulation. The examples enable varying levels of model complexity by choosing which modules to include.

See INSTALL for installation instructions.

To generate documentation, go to the doc folder and run ./make_doc.sh. This will build html documentation files from python doc strings which will include descriptions of each module, their intentions, model components they define, and what input files they expect.

TESTING To test the entire codebase, run this command from the root directory: python run_tests.py

EXAMPLES To run an example, navigate to an example directory and run the command: switch solve --verbose --log-run

CONFIGURING YOUR OWN MODELS

At a minimum, each model requires a list of SWITCH modules to define the model and a set of input files to provide the data. The SWITCH framework and individual modules also accept command-line arguments to change their behavior.

Each SWITCH model or collection of models is defined in a specific directory (e.g., examples/3zone_toy). This directory contains one or more subdirectories that hold input data and results (e.g., "inputs" and "outputs"). The models in the examples directory show the type of text files used to provide inputs for a model. You can change any of the model's input data by editing the *.tab files in the input directory.

SWITCH contains a number of different modules, which can be selected and combined to create models with different capabilities and amounts of detail. You can look through the *.py files within switch_mod and its subdirectories to see the standard modules that are available and the columns that each one will read from the input files. You can also add modules of your own by creating Python files in the main model directory and adding their name (without the ".py") to the module list, discussed below. These should define the same functions as the standard modules (e.g., define_components()).

Each model has a text file which lists the modules that will be used for that model. Normally this file is called "modules.txt" and is stored in the main model directory or in an inputs subdirectory. SWITCH will automatically look in those locations for this list; alternatively, you can specify a different file with the "--module-list" argument.

Use "switch --help", "switch solve --help" or "switch solve-scenarios --help" to see a list of command-line arguments that are available.

You can specify these arguments on the command line when you solve the model (e.g., "switch solve --solver cplex"). You can also place frequently used arguments in a file called "options.txt" in the main model directory. These can all be on one line, or they can be placed on multiple lines for easier readability (be sure to include the "--" part in all the argument names in options.txt). The "switch solve" command first reads all the arguments from options.txt, and then applies any arguments you specified on the command line. If the same argument is specified multiple times, the last one takes priority.

You can also define scenarios, which are sets of command-line arguments to define different models. These additional arguments can be placed in a scenario list file, usually called "scenarios.txt" in the main model directory (or you can use a different file specified by "--scenario-list"). Each scenario should be defined on a single line, which includes a "--scenario-name" argument and any other arguments needed to define the scenario. "switch solve-scenarios" will solve all the scenarios listed in this file. For each scenario, it will first apply all arguments from options.txt, then arguments from the relevant line of scenarios.txt, then any arguments specified on the command line.

After the model runs, results will be written in tab-separated text files (with extension .tsv or .tab) in the "outputs" directory (or some other directory specified via the "--outputs-dir" argument).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

switch_model-2.0.3.tar.gz (282.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

switch_model-2.0.3-py2-none-any.whl (366.2 kB view details)

Uploaded Python 2

File details

Details for the file switch_model-2.0.3.tar.gz.

File metadata

  • Download URL: switch_model-2.0.3.tar.gz
  • Upload date:
  • Size: 282.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for switch_model-2.0.3.tar.gz
Algorithm Hash digest
SHA256 a389790ae468ac007aece58b36abfc3ec3fb5c1f081ef0a669f52c8aa810392e
MD5 5ff42855e47d7dda8fe31e51fa6e48c0
BLAKE2b-256 39e06e11176fc3d6b4f80428eb50af04b6413ff2d86f68892b57d0ef503a1902

See more details on using hashes here.

File details

Details for the file switch_model-2.0.3-py2-none-any.whl.

File metadata

  • Download URL: switch_model-2.0.3-py2-none-any.whl
  • Upload date:
  • Size: 366.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for switch_model-2.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 e67d6d1eb18cb0d7a422f45dc2a00e159012fbfffa47af6b854bcf1d9b0dcc26
MD5 ba5644ba97cd23a0484e7cdc551cb572
BLAKE2b-256 677acb8b1599e60cc708f88456516ea9a435e71f8bf3eaab2202c9832c413fe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page