Solar Model


In [ ]:
import sys
import os
import inspect
import datetime as dt

from opengrid.library import solarmodel as sm

In [ ]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = 16,8

Solar Insolation object

The solar insolation object uses a location to lookup longitude, latitude and altitude (via Google).


In [ ]:
SI = sm.SolarInsolation('Brussel')
print(SI.location.latlng,
      SI.elevation)

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!)

The airmass will be 1 when the sun is directly overhead and infinite when the sun has set


In [ ]:
date = dt.datetime(year=2015, month=10, day=22, hour=12)
print(SI.solarElevation(date), #in radians
      SI.airMass(date),
     )

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

This is the potential solar power which is theoretically available at that location at that moment.


In [ ]:
print(SI.directIntensity(date),
      SI.globalIrradiance(date)
     )

Use the method SI.df to get a dataframe with hourly global irradiance values between start and end


In [ ]:
start = dt.datetime(year = 2015, month = 10, day = 20)
end = dt.datetime(year = 2015, month = 10, day = 21)

In [ ]:
df = SI.df(start,end)
df.plot()

PV Model

The PV Model is an extension to the Insolation Class. It simulates an 'ideal' PV installation (with 100% efficiency), which includes tilt and orientation.

This enables us to visualise the effect of wronly tilted or oriented PV installations


In [ ]:
PVM1 = sm.PVModel('Brussel')
PVM2 = sm.PVModel('Brussel', tilt=15)
PVM3 = sm.PVModel('Brussel', orient=250)

In [ ]:
df1 = PVM1.df(start,end)
df2 = PVM2.df(start,end)
df3 = PVM3.df(start,end)

In [ ]:
plt.figure()
plt.plot_date(df.index, df['insolation'], '-', label='Insolation')
plt.plot_date(df1.index, df1['insolation'], '-', label='south oriented, 35 degrees tilt')
plt.plot_date(df2.index, df2['insolation'], '-', label='bad tilt')
plt.plot_date(df3.index, df3['insolation'], '-', label='bad orientation')
plt.legend()

In [ ]: