{ "cells": [ { "cell_type": "markdown", "id": "70ed1efb-dbce-4648-a1de-fa52adcb4bb0", "metadata": {}, "source": [ "# Battery and Solar Investment" ] }, { "cell_type": "markdown", "id": "b0d8cff6-0f2c-4a52-90e6-c8295dbdee79", "metadata": {}, "source": [ "**1. Load packages**\n", " - We are using the gurobipy package to formulate a mathematical model and solve it. " ] }, { "cell_type": "code", "execution_count": 27, "id": "2b72550a-b426-4d29-9e05-57f307b8ac95", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "\n", "import gurobipy as gp\n", "from gurobipy import GRB\n", "\n", "import matplotlib.pyplot as plt\n", "\n", "import plotly.express as px" ] }, { "cell_type": "markdown", "id": "ac96bb93-37a2-4310-8d31-bd43ac976d78", "metadata": {}, "source": [ "**2. Load and inspect data**" ] }, { "cell_type": "code", "execution_count": 28, "id": "3bf573f7-c30a-4079-a3f5-e2c98a51180d", "metadata": {}, "outputs": [], "source": [ "# Data source:\n", "# https://www.eia.gov/consumption/commercial/\n", "# actual 1-year data for a commercial building in NJ\n", "# solar data modified from PECAN streeet\n", "# https://www.pecanstreet.org/dataport/\n", "\n", "# load data\n", "building_data_file = 'building1h.csv'\n", "building_df = pd.read_csv(building_data_file)\n", "elec = building_df['elec'].to_numpy() # in kWh\n", "solar = building_df['solar'].to_numpy() # relative avalability [1]\n", "is_peak = building_df['is_peak'].to_numpy() # binary" ] }, { "cell_type": "code", "execution_count": 29, "id": "61e63ed5-9aca-4d71-ab42-6db187e2b78c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | hour | \n", "is_peak | \n", "elec | \n", "solar | \n", "
---|---|---|---|---|
0 | \n", "0 | \n", "0 | \n", "1.4369 | \n", "0.0 | \n", "
1 | \n", "1 | \n", "0 | \n", "1.3840 | \n", "0.0 | \n", "
2 | \n", "2 | \n", "0 | \n", "1.4896 | \n", "0.0 | \n", "
3 | \n", "3 | \n", "0 | \n", "1.5717 | \n", "0.0 | \n", "
4 | \n", "4 | \n", "0 | \n", "2.2712 | \n", "0.0 | \n", "