<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Solar Model
Step1:  Solar Insolation object
The solar insolation object uses a location to lookup longitude, latitude and altitude (via Google).
Step2:  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
Step3:  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.
Step4:  Use the method SI.df to get a dataframe with hourly global irradiance values between start and end
Step5:  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
<ASSISTANT_TASK:>
Python Code:
import sys
import os
import inspect
import datetime as dt
from opengrid.library import solarmodel as sm
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = 16,8
Explanation: Solar Model
End of explanation
SI = sm.SolarInsolation('Brussel')
print(SI.location.latlng,
      SI.elevation)
Explanation: Solar Insolation object
The solar insolation object uses a location to lookup longitude, latitude and altitude (via Google).
End of explanation
date = dt.datetime(year=2015, month=10, day=22, hour=12)
print(SI.solarElevation(date), #in radians
      SI.airMass(date),
     )
Explanation: 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
End of explanation
print(SI.directIntensity(date),
      SI.globalIrradiance(date)
     )
Explanation: 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.
End of explanation
start = dt.datetime(year = 2015, month = 10, day = 20)
end = dt.datetime(year = 2015, month = 10, day = 21)
df = SI.df(start,end)
df.plot()
Explanation: Use the method SI.df to get a dataframe with hourly global irradiance values between start and end
End of explanation
PVM1 = sm.PVModel('Brussel')
PVM2 = sm.PVModel('Brussel', tilt=15)
PVM3 = sm.PVModel('Brussel', orient=250)
df1 = PVM1.df(start,end)
df2 = PVM2.df(start,end)
df3 = PVM3.df(start,end)
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()
Explanation: 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
End of explanation
<END_TASK>