Skip to content

incorrect horizon test in tracker.singleaxis #569

@cwhanse

Description

@cwhanse

Describe the bug
wid[zp <= 0] = np.nan sets the tracker rotation angle to np.nan when the sun is behind the array plane, but the array plane is not yet defined. At this line, the array plane is defined only by the tracker tilt and azimuth, but not its rotation.

To Reproduce

import pvlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

loc = pvlib.location.Location(latitude=30, longitude=110)
sat = pvlib.tracking.SingleAxisTracker(axis_tilt=90, axis_azimuth=180, backtrack=False, max_angle=180)
sat.localize(location=loc)

solar_azimuth = pd.Series(data=np.arange(0.0, 359.0))
solar_zenith = 45.0 * solar_azimuth / solar_azimuth

df = sat.singleaxis(apparent_zenith=solar_zenith, apparent_azimuth=solar_azimuth)

p1 = plt.plot(df)
plt.legend(df.columns)

The plot shows that the tracker rotation tracker_theta is limited to between -90 and 90.

Expected behavior
In the above example, the sun rotates in azimuth at 45 zenith. The vertical tracker without rotation limit should follow the sun around the complete circle.

Screenshots
test_sat

Versions:

  • pvlib.__version__: 0.5.2

Additional context

One fix would be to substitute a test for solar zenith, so that the tracker rotation is not set when the sun is below the visible horizon. I also wonder if we should set the rotation to 0 (stow position) instead of np.nan in this case.

wid[z <= 0] = np.nan
wid[z <= 0] = 0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions