|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Solar Model" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": null, |
| 13 | + "metadata": { |
| 14 | + "collapsed": false |
| 15 | + }, |
| 16 | + "outputs": [], |
| 17 | + "source": [ |
| 18 | + "import sys\n", |
| 19 | + "import os\n", |
| 20 | + "import inspect\n", |
| 21 | + "import datetime as dt\n", |
| 22 | + "\n", |
| 23 | + "from opengrid.library import solarmodel as sm" |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + "cell_type": "code", |
| 28 | + "execution_count": null, |
| 29 | + "metadata": { |
| 30 | + "collapsed": false |
| 31 | + }, |
| 32 | + "outputs": [], |
| 33 | + "source": [ |
| 34 | + "import matplotlib.pyplot as plt\n", |
| 35 | + "%matplotlib inline\n", |
| 36 | + "plt.rcParams['figure.figsize'] = 16,8" |
| 37 | + ] |
| 38 | + }, |
| 39 | + { |
| 40 | + "cell_type": "markdown", |
| 41 | + "metadata": {}, |
| 42 | + "source": [ |
| 43 | + "## Solar Insolation object" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "markdown", |
| 48 | + "metadata": {}, |
| 49 | + "source": [ |
| 50 | + "The solar insolation object uses a location to lookup longitude, latitude and altitude (via Google)." |
| 51 | + ] |
| 52 | + }, |
| 53 | + { |
| 54 | + "cell_type": "code", |
| 55 | + "execution_count": null, |
| 56 | + "metadata": { |
| 57 | + "collapsed": false |
| 58 | + }, |
| 59 | + "outputs": [], |
| 60 | + "source": [ |
| 61 | + "SI = sm.SolarInsolation('Brussel')\n", |
| 62 | + "print(SI.location.latlng,\n", |
| 63 | + " SI.elevation)" |
| 64 | + ] |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "markdown", |
| 68 | + "metadata": {}, |
| 69 | + "source": [ |
| 70 | + "It uses this location to calculate the position of the sun and the mass of the air the sun has to penetrate for a given datetime (in UTC!)\n", |
| 71 | + "\n", |
| 72 | + "The airmass will be 1 when the sun is directly overhead and infinite when the sun has set" |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "cell_type": "code", |
| 77 | + "execution_count": null, |
| 78 | + "metadata": { |
| 79 | + "collapsed": false |
| 80 | + }, |
| 81 | + "outputs": [], |
| 82 | + "source": [ |
| 83 | + "date = dt.datetime(year=2015, month=10, day=22, hour=12)\n", |
| 84 | + "print(SI.solarElevation(date), #in radians\n", |
| 85 | + " SI.airMass(date),\n", |
| 86 | + " )" |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "cell_type": "markdown", |
| 91 | + "metadata": {}, |
| 92 | + "source": [ |
| 93 | + "This airmass, together with the altitude is then used to calculate the direct beam intensity of the sun for that given moment. 10% of that value is added to get the Global Irradiance, both in W/m^2\n", |
| 94 | + "\n", |
| 95 | + "This is the potential solar power which is theoretically available at that location at that moment." |
| 96 | + ] |
| 97 | + }, |
| 98 | + { |
| 99 | + "cell_type": "code", |
| 100 | + "execution_count": null, |
| 101 | + "metadata": { |
| 102 | + "collapsed": false |
| 103 | + }, |
| 104 | + "outputs": [], |
| 105 | + "source": [ |
| 106 | + "print(SI.directIntensity(date),\n", |
| 107 | + " SI.globalIrradiance(date)\n", |
| 108 | + " )" |
| 109 | + ] |
| 110 | + }, |
| 111 | + { |
| 112 | + "cell_type": "markdown", |
| 113 | + "metadata": {}, |
| 114 | + "source": [ |
| 115 | + "Use the method SI.df to get a dataframe with hourly global irradiance values between start and end" |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "code", |
| 120 | + "execution_count": null, |
| 121 | + "metadata": { |
| 122 | + "collapsed": false |
| 123 | + }, |
| 124 | + "outputs": [], |
| 125 | + "source": [ |
| 126 | + "start = dt.datetime(year = 2015, month = 10, day = 20)\n", |
| 127 | + "end = dt.datetime(year = 2015, month = 10, day = 21)" |
| 128 | + ] |
| 129 | + }, |
| 130 | + { |
| 131 | + "cell_type": "code", |
| 132 | + "execution_count": null, |
| 133 | + "metadata": { |
| 134 | + "collapsed": false, |
| 135 | + "scrolled": false |
| 136 | + }, |
| 137 | + "outputs": [], |
| 138 | + "source": [ |
| 139 | + "df = SI.df(start,end)\n", |
| 140 | + "df.plot()" |
| 141 | + ] |
| 142 | + }, |
| 143 | + { |
| 144 | + "cell_type": "markdown", |
| 145 | + "metadata": {}, |
| 146 | + "source": [ |
| 147 | + "# PV Model" |
| 148 | + ] |
| 149 | + }, |
| 150 | + { |
| 151 | + "cell_type": "markdown", |
| 152 | + "metadata": {}, |
| 153 | + "source": [ |
| 154 | + "The PV Model is an extension to the Insolation Class. It simulates an 'ideal' PV installation (with 100% efficiency), which includes tilt and orientation.\n", |
| 155 | + "\n", |
| 156 | + "This enables us to visualise the effect of wronly tilted or oriented PV installations" |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "cell_type": "code", |
| 161 | + "execution_count": null, |
| 162 | + "metadata": { |
| 163 | + "collapsed": false |
| 164 | + }, |
| 165 | + "outputs": [], |
| 166 | + "source": [ |
| 167 | + "PVM1 = sm.PVModel('Brussel')\n", |
| 168 | + "PVM2 = sm.PVModel('Brussel', tilt=15)\n", |
| 169 | + "PVM3 = sm.PVModel('Brussel', orient=250)" |
| 170 | + ] |
| 171 | + }, |
| 172 | + { |
| 173 | + "cell_type": "code", |
| 174 | + "execution_count": null, |
| 175 | + "metadata": { |
| 176 | + "collapsed": false |
| 177 | + }, |
| 178 | + "outputs": [], |
| 179 | + "source": [ |
| 180 | + "df1 = PVM1.df(start,end)\n", |
| 181 | + "df2 = PVM2.df(start,end)\n", |
| 182 | + "df3 = PVM3.df(start,end)" |
| 183 | + ] |
| 184 | + }, |
| 185 | + { |
| 186 | + "cell_type": "code", |
| 187 | + "execution_count": null, |
| 188 | + "metadata": { |
| 189 | + "collapsed": false |
| 190 | + }, |
| 191 | + "outputs": [], |
| 192 | + "source": [ |
| 193 | + "plt.figure()\n", |
| 194 | + "plt.plot_date(df.index, df['insolation'], '-', label='Insolation')\n", |
| 195 | + "plt.plot_date(df1.index, df1['insolation'], '-', label='south oriented, 35 degrees tilt')\n", |
| 196 | + "plt.plot_date(df2.index, df2['insolation'], '-', label='bad tilt')\n", |
| 197 | + "plt.plot_date(df3.index, df3['insolation'], '-', label='bad orientation')\n", |
| 198 | + "plt.legend()" |
| 199 | + ] |
| 200 | + }, |
| 201 | + { |
| 202 | + "cell_type": "code", |
| 203 | + "execution_count": null, |
| 204 | + "metadata": { |
| 205 | + "collapsed": true |
| 206 | + }, |
| 207 | + "outputs": [], |
| 208 | + "source": [] |
| 209 | + } |
| 210 | + ], |
| 211 | + "metadata": { |
| 212 | + "kernelspec": { |
| 213 | + "display_name": "Python 2", |
| 214 | + "language": "python", |
| 215 | + "name": "python2" |
| 216 | + }, |
| 217 | + "language_info": { |
| 218 | + "codemirror_mode": { |
| 219 | + "name": "ipython", |
| 220 | + "version": 2 |
| 221 | + }, |
| 222 | + "file_extension": ".py", |
| 223 | + "mimetype": "text/x-python", |
| 224 | + "name": "python", |
| 225 | + "nbconvert_exporter": "python", |
| 226 | + "pygments_lexer": "ipython2", |
| 227 | + "version": "2.7.6" |
| 228 | + } |
| 229 | + }, |
| 230 | + "nbformat": 4, |
| 231 | + "nbformat_minor": 0 |
| 232 | +} |
0 commit comments