moncenterlib.station_power_simulator.solar_power module

Solar panel power generation simulator.

The module estimates hourly electrical power produced by a solar panel using historical meteorological data and solar geometry calculations.

class moncenterlib.station_power_simulator.solar_power.SolarPanelPower(config: dict)

Bases: object

Solar panel power generation simulator.

The class estimates hourly electrical power produced by a solar panel using historical meteorological data and solar geometry calculations.

__init__(config: dict)

Initialize the solar panel power calculator.

The class simulates hourly power generation of a solar panel using historical weather data from Open-Meteo and solar position modeling.

Parameters:

config (dict) – Configuration dictionary containing location, simulation period and solar panel parameters.

Note

Default configuration can be obtained using the method SolarPanelPower.get_default_config().

Example

>>> config = {
...     "latitude": 54.9874,
...     "longitude": 82.8646,
...     "start_date": "2025-01-01",
...     "end_date": "2026-01-01",
...     "tilt_deg": 90,
...     "panel_azimuth_deg": 180,
...     "area_m2": 0.627,
...     "panel_efficiency": 0.1923,
...     "dc_efficiency": 1,
...     "timezone": "Asia/Novosibirsk"
... }
>>> solar_power = SolarPanelPower(config)
calculate()

Calculate hourly solar panel power generation.

This method retrieves historical meteorological data from Open-Meteo, computes solar position using pvlib, estimates plane-of-array (POA) irradiance, and calculates the resulting electrical power produced by the solar panel.

The result is stored in the attribute self.df.

The index of the DataFrame represents hourly timestamps localized to the configured timezone.

Raises:

ValueError – If configuration parameters are invalid or required meteorological data cannot be retrieved.

Example

>>> solar_power = SolarPanelPower(config)
>>> solar_power.calculate()
>>> df = solar_power.get_hourly_power()
get_all_period_metrics(path_protocol: str = '') DataFrame

Calculate solar generation statistics for the entire simulation period.

The method computes summary metrics such as total energy production, generation hours, radiation statistics and average panel power.

Parameters:

path_protocol (str, optional) – Path to a text file where the detailed textual report will be saved. If empty, the report is not written to a file.

Returns:

Table containing calculated metrics for the full simulation period.

Return type:

pd.DataFrame

Raises:

Exception – If calculate() has not been executed and no data is available.

Example

>>> solar_power.calculate()
>>> metrics_df = solar_power.get_all_period_metrics()
get_default_config() dict

Return the default configuration for the solar panel calculator.

Returns:

Default configuration dictionary with all required parameters.

Return type:

dict

Example

>>> config = SolarPanelPower.get_default_config()
>>> config["latitude"] = 54.9874
>>> config["longitude"] = 82.8646
>>> solar_power = SolarPanelPower(config)
get_hourly_power() DataFrame

Return the calculated hourly power generation time series.

The method returns the DataFrame generated by calculate(). The DataFrame uses a timezone-aware datetime index and contains hourly values of wind speed and the corresponding turbine power.

Returns:

Hourly time series.

Return type:

pd.DataFrame

Raises:

Exception – If the method calculate() has not been executed yet and the internal DataFrame is empty.

Example

>>> wind = WindTurbinePower(config)
>>> wind.calculate()
>>> df = wind.get_hourly_power()
get_monthly_metrics(path_protocol: str = '') DataFrame

Calculate solar generation statistics for each month.

The simulation period is split into monthly intervals and met rics are calculated independently for every month.

Parameters:

path_protocol (str, optional) – Path to a file where the textual report will be saved. If empty, the report is not saved.

Returns:

Table containing metrics for each month of the simulation period.

Return type:

pd.DataFrame

Raises:

Exception – If calculate() has not been executed.

Example

>>> solar_power.calculate()
>>> monthly_metrics = solar_power.get_monthly_metrics()
get_seasonal_metrics(path_protocol: str = '') DataFrame

Calculate solar generation statistics grouped by seasons.

Seasons are defined using meteorological convention:

  • Winter: December – February

  • Spring: March – May

  • Summer: June – August

  • Autumn: September – November

Parameters:

path_protocol (str, optional) – Path to a file where the textual report will be saved.

Returns:

Table containing metrics for each season.

Return type:

pd.DataFrame

Raises:

Exception – If calculate() has not been executed.

Example

>>> solar_power.calculate()
>>> seasonal_metrics = solar_power.get_seasonal_metrics()