67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
# %%
|
|
import yaml
|
|
import logging
|
|
import numpy as np
|
|
import matplotlib.pyplot as pl
|
|
from Utilities.Shading import (
|
|
calculate_energy_production_horizontal,
|
|
calculate_energy_production_vertical,
|
|
)
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
)
|
|
|
|
stream_handler = logging.StreamHandler()
|
|
stream_handler.setLevel(logging.INFO)
|
|
stream_formatter = logging.Formatter("%(levelname)s: %(message)s")
|
|
stream_handler.setFormatter(stream_formatter)
|
|
logging.getLogger().addHandler(stream_handler)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
config_path = "config.yml"
|
|
|
|
with open(config_path, "r") as file:
|
|
c = yaml.safe_load(file)
|
|
logger.info("Configuration loaded successfully.")
|
|
logger.debug(f"Configuration: {c}")
|
|
|
|
# calculate energy production for horizontal and vertical panels
|
|
vertical_energy = calculate_energy_production_vertical(c)
|
|
logger.info("Energy production for vertical panels calculated successfully.")
|
|
logger.debug(f"Vertical Energy Production: {vertical_energy.sum()}")
|
|
|
|
horizontal_energy = calculate_energy_production_horizontal(c)
|
|
logger.info("Energy production for horizontal panels calculated successfully.")
|
|
logger.debug(f"Horizontal Energy Production: {horizontal_energy.sum()}")
|
|
|
|
|
|
NOVA_scaledown = 0.75
|
|
|
|
horizontal_energy_scaled = horizontal_energy * NOVA_scaledown
|
|
logger.info("Energy production for horizontal panels scaled down to NOVA requirement.")
|
|
|
|
logger.info(
|
|
f"Energy production for horizontal panels: {np.round(horizontal_energy_scaled.sum(),0)} kWh"
|
|
)
|
|
logger.info(
|
|
f"Energy production for vertical panels: {np.round(vertical_energy.sum(),0)} kWh"
|
|
)
|
|
|
|
# overlay horizontal and vertical energy production
|
|
pl.figure(figsize=(10, 6))
|
|
pl.plot(
|
|
horizontal_energy_scaled.index,
|
|
horizontal_energy_scaled.values,
|
|
label="Horizontal Panels",
|
|
)
|
|
pl.plot(vertical_energy.index, vertical_energy.values, label="Vertical Panels")
|
|
pl.title("Energy Production Comparison")
|
|
pl.xlabel("Time")
|
|
pl.ylabel("Energy Production (kWh)")
|
|
pl.legend()
|
|
pl.show()
|