Skip to content

Commit e0c9aca

Browse files
authored
Add files via upload
1 parent 8b7d160 commit e0c9aca

File tree

3 files changed

+1237
-0
lines changed

3 files changed

+1237
-0
lines changed

Model_withdata/analysis_genmix_cost_emi.ipynb

Lines changed: 518 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"%matplotlib inline \n",
10+
"import os\n",
11+
"import csv\n",
12+
"import pandas as pd\n",
13+
"import numpy as np\n",
14+
"import matplotlib.pyplot as plt"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 2,
20+
"metadata": {},
21+
"outputs": [],
22+
"source": [
23+
"yr = 2016\n",
24+
"run_no = 1 \n",
25+
"rundays = 365\n",
26+
"runhours = rundays*24\n",
27+
"\n",
28+
"hr_range = pd.date_range('1/1/'+str(yr)+'', periods=runhours, freq='H')\n",
29+
"day_range = pd.date_range('1/1/'+str(yr)+'', periods=rundays, freq='D')"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": 3,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"df_gen = pd.read_csv('input/data_camb_genparams.csv',header=0)\n",
39+
"df_load = pd.read_csv('input/data_camb_load_2016.csv',header=0)\n",
40+
" \n",
41+
"sys_load = (df_load.iloc[:,4:].sum(axis=1)).values\n",
42+
"#reserve = (sys_load*0.15).values"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 4,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"gen_name = df_gen['name']\n",
52+
"gen_type = df_gen['typ']"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 5,
58+
"metadata": {},
59+
"outputs": [
60+
{
61+
"data": {
62+
"text/plain": [
63+
"(7.999093686386829, 22.35092073298965)"
64+
]
65+
},
66+
"execution_count": 5,
67+
"metadata": {},
68+
"output_type": "execute_result"
69+
}
70+
],
71+
"source": [
72+
"srsv = pd.read_csv('output/out_camb_R'+str(run_no)+'_'+str(yr)+'_srsv.csv',header=0)\n",
73+
"nrsv = pd.read_csv('output/out_camb_R'+str(run_no)+'_'+str(yr)+'_nrsv.csv',header=0)\n",
74+
" \n",
75+
"###Include Generator_type to the srsv data\n",
76+
"for x in range(len(gen_name)):\n",
77+
" srsv.loc[srsv.Generator == gen_name[x], 'Type'] = gen_type[x]\n",
78+
" nrsv.loc[nrsv.Generator == gen_name[x], 'Type'] = gen_type[x]\n",
79+
" \n",
80+
"####Reserve_GWh by Type\n",
81+
"srsv_bytype = round(srsv.groupby(['Type'])['Value'].sum()/1000,1)\n",
82+
"nrsv_bytype = round(nrsv.groupby(['Type'])['Value'].sum()/1000,1)\n",
83+
" \n",
84+
"\n",
85+
"###Reserve_ratios by Time only\n",
86+
"srsv_bytime = srsv.groupby(['Time'])['Value'].sum().values\n",
87+
"nrsv_bytime = nrsv.groupby(['Time'])['Value'].sum().values\n",
88+
"trsv_bytime = srsv_bytime +nrsv_bytime \n",
89+
" \n",
90+
"srsv_ratio = srsv_bytime*100/sys_load\n",
91+
"nrsv_ratio = nrsv_bytime*100/sys_load\n",
92+
"trsv_ratio = trsv_bytime*100/sys_load\n",
93+
"\n",
94+
"avg_srsv = np.mean(srsv_ratio)\n",
95+
"avg_trsv = np.mean(trsv_ratio)\n",
96+
"\n",
97+
"\n",
98+
"avg_srsv,avg_trsv"
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": null,
104+
"metadata": {},
105+
"outputs": [],
106+
"source": []
107+
},
108+
{
109+
"cell_type": "code",
110+
"execution_count": null,
111+
"metadata": {},
112+
"outputs": [],
113+
"source": []
114+
}
115+
],
116+
"metadata": {
117+
"kernelspec": {
118+
"display_name": "Python 3",
119+
"language": "python",
120+
"name": "python3"
121+
},
122+
"language_info": {
123+
"codemirror_mode": {
124+
"name": "ipython",
125+
"version": 3
126+
},
127+
"file_extension": ".py",
128+
"mimetype": "text/x-python",
129+
"name": "python",
130+
"nbconvert_exporter": "python",
131+
"pygments_lexer": "ipython3",
132+
"version": "3.7.3"
133+
}
134+
},
135+
"nbformat": 4,
136+
"nbformat_minor": 2
137+
}

0 commit comments

Comments
 (0)