Skip to content

SolarHeatingBase

SolarHeatingBase

SolarHeatingBase(
    latitude: floatArrayLike,
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    turbidity: floatArrayLike,
    datetime_utc: datetimeArrayLike,
    outer_diameter: floatArrayLike,
    solar_absorptivity: floatArrayLike,
    est: _SRad,
    solar_irradiance: floatArrayLike,
    **kwargs: Any,
)

Bases: PowerTerm

Solar heating term.

Source code in src/thermohl/power/solar_heating.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
def __init__(
    self,
    latitude: floatArrayLike,
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    turbidity: floatArrayLike,
    datetime_utc: datetimeArrayLike,
    outer_diameter: floatArrayLike,
    solar_absorptivity: floatArrayLike,
    est: _SRad,
    solar_irradiance: floatArrayLike,
    **kwargs: Any,
):
    self.solar_absorptivity = solar_absorptivity

    mask = np.isnan(solar_irradiance)
    self.solar_irradiance = np.empty_like(solar_irradiance)
    if np.any(~mask):
        self.solar_irradiance[~mask] = np.maximum(solar_irradiance, 0.0)
    if np.any(mask):
        self.solar_irradiance[mask] = est(
            np.deg2rad(latitude),
            altitude,
            np.deg2rad(cable_azimuth),
            turbidity,
            datetime_utc,
        )

    self.outer_diameter = outer_diameter

derivative

derivative(
    conductor_temperature: floatArrayLike,
) -> floatArrayLike

Compute solar heating derivative.

:param conductor_temperature: Conductor temperature. :return: Derivative of solar heating.

Source code in src/thermohl/power/solar_heating.py
134
135
136
137
138
139
140
def derivative(self, conductor_temperature: floatArrayLike) -> floatArrayLike:
    """Compute solar heating derivative.

    :param conductor_temperature: Conductor temperature.
    :return: Derivative of solar heating.
    """
    return np.zeros_like(conductor_temperature)

value

value(
    conductor_temperature: floatArrayLike,
) -> floatArrayLike

Compute solar heating.

:param conductor_temperature: Conductor temperature (°C). :return: Power term value (W·m⁻¹).

Source code in src/thermohl/power/solar_heating.py
121
122
123
124
125
126
127
128
129
130
131
132
def value(self, conductor_temperature: floatArrayLike) -> floatArrayLike:
    """Compute solar heating.

    :param conductor_temperature: Conductor temperature (°C).
    :return: Power term value (W·m⁻¹).
    """
    return (
        self.solar_absorptivity
        * self.solar_irradiance
        * self.outer_diameter
        * np.ones_like(conductor_temperature)
    )

_SRad

_SRad

_SRad(clean: List[float], indus: List[float])

Solar radiation calculator.

:param clean: Coefficients for the polynomial function to compute atmospheric turbidity in clean air conditions. :param indus: Coefficients for the polynomial function to compute atmospheric turbidity in industrial (polluted) air conditions.

Source code in src/thermohl/power/solar_heating.py
19
20
21
22
23
24
25
26
def __init__(self, clean: List[float], indus: List[float]):
    """Initialize the solar radiation calculator.

    :param clean: Coefficients for the polynomial function to compute atmospheric turbidity in clean air conditions.
    :param indus: Coefficients for the polynomial function to compute atmospheric turbidity in industrial (polluted) air conditions.
    """
    self.clean = clean
    self.indus = indus

__call__

__call__(
    latitude: floatArrayLike,
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    turbidity: floatArrayLike,
    datetime_utc: datetimeArrayLike,
) -> floatArrayLike

Compute solar radiation.

Source code in src/thermohl/power/solar_heating.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
def __call__(
    self,
    latitude: floatArrayLike,
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    turbidity: floatArrayLike,
    datetime_utc: datetimeArrayLike,
) -> floatArrayLike:
    """Compute solar radiation."""
    date = datetime_utc.astype("datetime64[D]")
    hour = sun.time_to_float_hours(datetime_utc)
    computed_solar_altitude = sun.solar_altitude(latitude, date, hour)
    computed_solar_azimuth = sun.solar_azimuth(latitude, date, hour)
    computed_incidence_angle = np.arccos(
        np.cos(computed_solar_altitude)
        * np.cos(computed_solar_azimuth - cable_azimuth)
    )
    altitude_factor = 1.0 + 1.148e-04 * altitude - 1.108e-08 * altitude**2
    clearness_factor = self.atmosphere_turbidity(
        np.rad2deg(computed_solar_altitude), turbidity
    )
    solar_irradiance = (
        altitude_factor * clearness_factor * np.sin(computed_incidence_angle)
    )
    return np.where(solar_irradiance > 0.0, solar_irradiance, 0.0)

atmosphere_turbidity

atmosphere_turbidity(
    solar_altitude: floatArrayLike,
    turbidity: Optional[floatArrayLike] = 0.0,
) -> floatArrayLike

Compute coefficient for atmosphere turbidity. This method calculates the atmospheric turbidity coefficient using a polynomial function of the solar altitude. The coefficients of the polynomial are a weighted average of the clean air and industrial air coefficients, with the weights determined by the turbidity factor.

:param solar_altitude: Solar altitude in degrees. :param turbidity: Atmospheric turbidity factor (0 for clean air, 1 for industrial air). :return: Coefficient for atmospheric turbidity.

Source code in src/thermohl/power/solar_heating.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def atmosphere_turbidity(
    self,
    solar_altitude: floatArrayLike,
    turbidity: Optional[floatArrayLike] = 0.0,
) -> floatArrayLike:
    """Compute coefficient for atmosphere turbidity.
    This method calculates the atmospheric turbidity coefficient using a polynomial
    function of the solar altitude. The coefficients of the polynomial are a weighted
    average of the clean air and industrial air coefficients, with the weights
    determined by the turbidity factor.

    :param solar_altitude: Solar altitude in degrees.
    :param turbidity: Atmospheric turbidity factor (0 for clean air, 1 for industrial air).
    :return: Coefficient for atmospheric turbidity.
    """
    clean_weight = 1.0 - turbidity
    coeff_6 = clean_weight * self.clean[6] + turbidity * self.indus[6]
    coeff_5 = clean_weight * self.clean[5] + turbidity * self.indus[5]
    coeff_4 = clean_weight * self.clean[4] + turbidity * self.indus[4]
    coeff_3 = clean_weight * self.clean[3] + turbidity * self.indus[3]
    coeff_2 = clean_weight * self.clean[2] + turbidity * self.indus[2]
    coeff_1 = clean_weight * self.clean[1] + turbidity * self.indus[1]
    coeff_0 = clean_weight * self.clean[0] + turbidity * self.indus[0]
    return (
        coeff_6 * solar_altitude**6
        + coeff_5 * solar_altitude**5
        + coeff_4 * solar_altitude**4
        + coeff_3 * solar_altitude**3
        + coeff_2 * solar_altitude**2
        + coeff_1 * solar_altitude**1
        + coeff_0
    )