<jupyter_start><jupyter_text>Modeling and Simulation in PythonCopyright 2017 <NAME>License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0)<jupyter_code># Configure Jupyter so figures appear in the notebook
%matplotlib inline

# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'

# import functions from the modsim library
from modsim import *<jupyter_output><empty_output><jupyter_text>Bigbelly https://www.youtube.com/watch?v=frix_zTkPEsIf the following import fails, open a terminal and run`conda install -c conda-forge pysolar`<jupyter_code>from pysolar.solar import *
from datetime import datetime, timedelta
dt = datetime.now()
from pytz import timezone

dt = pytz.timezone('EST').localize(dt)
get_altitude(42.2931671, -71.263665, dt)
latitude_deg = 42.3
longitude_deg = -71.3
altitude_deg = get_altitude(latitude_deg, longitude_deg, dt)
azimuth_deg = get_azimuth(latitude_deg, longitude_deg, dt)
radiation.get_radiation_direct(dt, altitude_deg)

# result is in Watts per square meter
location = State(lat_deg=42.3, lon_deg=-71.3)
dt = datetime(year=2017, month=9, day=15, hour=12, minute=30)
dt = pytz.timezone('EST').localize(dt)
def compute_irradiance(location, dt):
    degree = UNITS.degree
    watt = UNITS.watt
    meter = UNITS.meter
    
    sun = State(
        altitude_deg = get_altitude(location.lat_deg, location.lon_deg, dt),
        azimuth_deg = get_azimuth(location.lat_deg, location.lon_deg, dt)
    )

    if sun.altitude_deg <= 0:
        irradiance = 0
    else:
        irradiance = radiation.get_radiation_direct(dt, sun.altitude_deg)

    sun.set(irradiance = irradiance * watt / meter**2)
    return sun
sun = compute_irradiance(location, dt)
dt = datetime(year=2017, month=9, day=15)
dt = pytz.timezone('EST').localize(dt)

delta_t = timedelta(minutes=15)

result = TimeSeries()
for i in range(24 * 4):
    dt += delta_t
    sun = compute_irradiance(location, dt)
    result[dt] = sun.irradiance.magnitude

result
result.plot()
cm = UNITS.centimeter
meter = UNITS.meter
watt = UNITS.watt
second = UNITS.second
joule = UNITS.joule
width = 45 * cm
area = width**2
power = sun.irradiance * area
area = area.to(meter**2)
power = sun.irradiance * area
delta_t = 1 * second
energy = power * delta_t
energy.to(joule)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10723192019950124, 'fraction_numerical': 0.02826267664172901, 'mean_word_length': 4.972704714640199, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '468040', 'license': 'MIT', 'n_tokens_mistral': 911, 'n_tokens_neox': 849, 'n_words': 199, 'path': 'notebooks/examples/bigbelly.ipynb', 'repo_name': 'pmalo46/ModSimPy', 'size': '2412'}