<jupyter_start><jupyter_text>Solar Model<jupyter_code>import sys
import os
import inspect
import datetime as dt

from opengrid_dev.library import solarmodel as sm
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = 16,8<jupyter_output><empty_output><jupyter_text>Solar Insolation object The solar insolation object uses a location to lookup longitude, latitude and altitude (via Google).<jupyter_code>SI = sm.SolarInsolation('Brussel')
print(SI.location.latlng,
      SI.elevation)<jupyter_output><empty_output><jupyter_text>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<jupyter_code>date = dt.datetime(year=2015, month=10, day=22, hour=12)
print(SI.solarElevation(date), #in radians
      SI.airMass(date),
     )<jupyter_output><empty_output><jupyter_text>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^2This is the potential solar power which is theoretically available at that location at that moment.<jupyter_code>print(SI.directIntensity(date),
      SI.globalIrradiance(date)
     )<jupyter_output><empty_output><jupyter_text>Use the method SI.df to get a dataframe with hourly global irradiance values between start and end<jupyter_code>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()<jupyter_output><empty_output><jupyter_text>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<jupyter_code>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()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1064684612294094, 'fraction_numerical': 0.023302531137002813, 'mean_word_length': 6.155172413793103, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '131072', 'license': 'Apache-2.0', 'n_tokens_mistral': 870, 'n_tokens_neox': 802, 'n_words': 253, 'path': 'opengrid_dev/notebooks/Demo/Demo_SolarModel.ipynb', 'repo_name': 'opengridcc/opengrid_dev', 'size': '2489'}