{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Day 4: Demand I - Enhancing the model with demand\n", "\n", "We will continue our modeling exercise by adding carbon taxes, renewable subsidies, and investment to the model.\n", "\n", "This will allow us to consider the policy impacts of alternative energy transition policies.\n", "\n", "The data and code are based on the paper \"The Efficiency and Sectoral Distributional Implications of Large-Scale Renewable Policies,\" by Mar Reguant." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "We first load relevant libraries, same as last session." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General.toml`\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.8/Project.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.8/Manifest.toml`\n" ] } ], "source": [ "using Pkg\n", "Pkg.add([\"DataFrames\", \"CSV\", \"JuMP\", \"Ipopt\", \"Cbc\", \"Plots\", \"Printf\"])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "begin \n", " using DataFrames\n", " using CSV\n", " using JuMP\n", " using Ipopt, Cbc\n", " using Plots\n", " using Printf\n", "end" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Remember to set your path correctly:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"/Users/marreguant/Documents/GitHub/em-course/materials/day4/\"" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dirpath = \"/Users/marreguant/Documents/GitHub/em-course/materials/day4/\"" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Building the model\n", "\n", "We load the same data as usual, and also clean it up to simplify it further and create the demand and import curves." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
12 rows × 7 columns
variable | mean | min | median | max | nmissing | eltype | |
---|---|---|---|---|---|---|---|
Symbol | Float64 | Float64 | Float64 | Float64 | Int64 | DataType | |
1 | price | 38.5055 | 1.66311 | 37.2797 | 137.116 | 0 | Float64 |
2 | imports | 7.52426 | 4.2479 | 7.57055 | 9.79814 | 0 | Float64 |
3 | q_commercial | 12.9532 | 9.26236 | 12.3881 | 22.1766 | 0 | Float64 |
4 | q_industrial | 4.1224 | 2.60049 | 3.83347 | 7.62003 | 0 | Float64 |
5 | q_residential | 11.0753 | 4.3995 | 10.0075 | 20.4922 | 0 | Float64 |
6 | wind_cap | 0.340955 | 0.0935896 | 0.334676 | 0.681777 | 0 | Float64 |
7 | solar_cap | 0.260549 | 0.00155919 | 0.0679638 | 0.793407 | 0 | Float64 |
8 | hydronuc | 5.0346 | 2.36316 | 4.56859 | 9.68051 | 0 | Float64 |
9 | weights | 0.0876 | 0.00787044 | 0.0788053 | 0.227839 | 0 | Float64 |
10 | demand | 28.1509 | 20.6052 | 27.0938 | 41.8096 | 0 | Float64 |
11 | bm | 0.0771438 | 0.0128668 | 0.061616 | 1.13582 | 0 | Float64 |
12 | am | 5.26698 | 2.97353 | 5.29939 | 6.8587 | 0 | Float64 |
7 rows × 15 columns (omitted printing of 7 columns)
techname | heatrate | heatrate2 | F | capLB | capUB | new | renewable | |
---|---|---|---|---|---|---|---|---|
String15 | Float64 | Float64 | Float64 | Float64 | Float64 | Int64 | Int64 | |
1 | Hydro/Nuclear | 10.0 | 0.0 | 0.0 | 1.0 | 1.0 | 0 | 0 |
2 | Existing 1 | 6.67199 | 0.0929123 | 0.0 | 11.5 | 11.5 | 0 | 0 |
3 | Existing 2 | 9.79412 | 0.286247 | 0.0 | 14.5 | 14.5 | 0 | 0 |
4 | Existing 3 | 13.8181 | 20.5352 | 0.0 | 0.578 | 0.578 | 0 | 0 |
5 | New Gas | 6.6 | 0.0 | 78.4773 | 0.0 | 100.0 | 1 | 0 |
6 | Wind | 0.0 | 0.0 | 100.303 | 0.0 | 100.0 | 1 | 1 |
7 | Solar | 0.0 | 0.0 | 100.303 | 0.0 | 100.0 | 1 | 1 |
15 rows × 5 columns
alpha | tax | tariff | wind_gw | solar_gw | |
---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | Float64 | |
1 | 0.1 | 0.0 | 36.7197 | 9.71004e-8 | -9.92054e-9 |
2 | 0.1 | 15.0 | 39.0117 | 18.2435 | -9.90921e-9 |
3 | 0.1 | 30.0 | 40.956 | 24.3233 | -9.96835e-9 |
4 | 0.3 | 0.0 | 36.7501 | 7.96077e-8 | -9.91989e-9 |
5 | 0.3 | 15.0 | 39.1037 | 17.7348 | -9.97e-9 |
6 | 0.3 | 30.0 | 41.0483 | 23.2496 | -9.9023e-9 |
7 | 0.5 | 0.0 | 36.7819 | 7.90818e-8 | -9.92014e-9 |
8 | 0.5 | 15.0 | 39.1966 | 17.0416 | -9.90907e-9 |
9 | 0.5 | 30.0 | 41.1834 | 21.9431 | -9.89743e-9 |
10 | 0.7 | 0.0 | 36.821 | 8.2906e-8 | -9.91776e-9 |
11 | 0.7 | 15.0 | 39.3224 | 16.5239 | -9.90711e-9 |
12 | 0.7 | 30.0 | 41.3772 | 20.5208 | -9.89108e-9 |
13 | 0.9 | 0.0 | 36.8726 | 8.59851e-8 | -9.91396e-9 |
14 | 0.9 | 15.0 | 39.4582 | 15.6445 | -9.90379e-9 |
15 | 0.9 | 30.0 | 41.6423 | 19.352 | -9.87847e-9 |