Skip to content

Commit

Permalink
tilt angle set to be inclusive of 0 and 90 degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrunik committed Nov 13, 2024
1 parent 20a219b commit c413da1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hopp/simulation/technologies/pv/pv_plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def __attrs_post_init__(self):
raise Exception("The str can be set to 'lat' or 'lat-func'.")

elif isinstance(self.config.panel_tilt_angle,float):
if self.config.panel_tilt_angle > 0 and self.config.panel_tilt_angle<90:
if self.config.panel_tilt_angle >= 0 and self.config.panel_tilt_angle <= 90:
tilt = self.config.panel_tilt_angle
else:
tilt = 0
raise ValueError("panel_tilt_angle can be set to any float between 0 and 90 degrees.")
else:
raise TypeError("panel_tilt_angle must be a float or a str.")
system_model.SystemDesign.assign({"tilt":tilt})
Expand Down
7 changes: 7 additions & 0 deletions tests/hopp/test_pv_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,10 @@ def test_pv_panel_tilt(site,subtests):
'panel_tilt_angle': 1} #cant be an int
config = PVConfig.from_dict(config_data)
pv_plant = PVPlant(site=site, config=config)

with subtests.test("with invalid value"):
with pytest.raises(ValueError):
config_data = {'system_capacity_kw': system_capacity_kw,
'panel_tilt_angle': 95.0} #can't be greater than 90
config = PVConfig.from_dict(config_data)
pv_plant = PVPlant(site=site, config=config)

0 comments on commit c413da1

Please sign in to comment.