Skip to content

Commit

Permalink
Merge pull request #20 from EdFage/add-tilt-and-orientation
Browse files Browse the repository at this point in the history
Add tilt and orientation
  • Loading branch information
peterdudfield authored Dec 8, 2023
2 parents f080424 + e10643b commit 3dee386
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def main():
site = PVSite(latitude=51.75, longitude=-1.25, capacity_kwp=1.25)

# run model
predications_df = run_forecast(site=site, ts='2023-10-30')
predictions_df = run_forecast(site=site, ts="2023-10-30")

print(predications_df)
print(f"Max: {predications_df['power_wh'].max()}")
print(predictions_df)
print(f"Max: {predictions_df['power_wh'].max()}")


if __name__ == "__main__":
Expand Down
5 changes: 2 additions & 3 deletions quartz_solar_forecast/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def make_pv_data(site: PVSite, ts) -> xr.Dataset:
timestamp = [ts]
pv_id = [1]

# would be nice to not use ss_id, should be pv_id
da = xr.DataArray(
data=generation_wh,
dims=["pv_id", "timestamp"],
Expand All @@ -135,8 +134,8 @@ def make_pv_data(site: PVSite, ts) -> xr.Dataset:
timestamp=timestamp,
pv_id=pv_id,
kwp=(["pv_id"], [site.capacity_kwp]),
tilt=(["pv_id"], [0]),
orientation=(["pv_id"], [0]),
tilt=(["pv_id"], [site.tilt]),
orientation=(["pv_id"], [site.orientation]),
),
)
da = da.to_dataset(name="generation_wh")
Expand Down
13 changes: 12 additions & 1 deletion quartz_solar_forecast/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@


class PVSite(BaseModel):

latitude: float = Field(..., description="the latitude of the site", ge=-90, le=90)
longitude: float = Field(..., description="the longitude of the site", ge=-180, le=180)
capacity_kwp: float = Field(..., description="the capacity [kwp] of the site", ge=0)
tilt: float = Field(
default=35,
description="the tilt of the site [degrees], the panels' angle relative to horizontal ground",
ge=0,
le=90,
)
orientation: float = Field(
default=180,
description="the orientation of the site [degrees], the angle between north and the direction the panels face, measured on the horizontal plane.",
ge=0,
le=360,
)

0 comments on commit 3dee386

Please sign in to comment.