Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor clean-ups to floris.py #419

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

# Required
version: 2
sphinx:
# Path to your Sphinx configuration file.
configuration: docs/conf.py

# Set the version of Python and other tools you might need
build:
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## Unreleased, TBD
+ minor clean up to floris.py - removed unnecessary data exportation and fixed bug in value()

## Version 3.1.1, Dec. 18, 2024

* Enhanced PV plant functionality: added tilting solar panel support, improved system design handling, and refined tilt angle calculations.
Expand Down
23 changes: 9 additions & 14 deletions hopp/simulation/technologies/wind/floris.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
class Floris(BaseClass):
site: SiteInfo = field()
config: "WindConfig" = field()
verbose: bool = field(default = True)

_operational_losses: float = field(init=False)
_timestep: Tuple[int, int] = field(init=False)
Expand All @@ -44,14 +45,6 @@ def __attrs_post_init__(self):
self.wind_resource_data = self.site.wind_resource.data
self.speeds, self.wind_dirs = self.parse_resource_data()

save_data = np.zeros((len(self.speeds),2))
save_data[:,0] = self.speeds
save_data[:,1] = self.wind_dirs

with open('speed_dir_data.csv', 'w', newline='') as fo:
writer = csv.writer(fo)
writer.writerows(save_data)

self.wind_farm_xCoordinates = self.fi.layout_x
self.wind_farm_yCoordinates = self.fi.layout_y
self.nTurbs = len(self.wind_farm_xCoordinates)
Expand Down Expand Up @@ -90,7 +83,7 @@ def value(self, name: str, set_value=None):
"""
if set_value = None, then retrieve value; otherwise overwrite variable's value
"""
if set_value:
if set_value is not None:
self.__setattr__(name, set_value)
else:
return self.__getattribute__(name)
Expand Down Expand Up @@ -119,8 +112,9 @@ def parse_resource_data(self):
return speeds, wind_dirs

def execute(self, project_life):

print('Simulating wind farm output in FLORIS...')

if self.verbose:
print('Simulating wind farm output in FLORIS...')

# find generation of wind farm
power_turbines = np.zeros((self.nTurbs, 8760))
Expand All @@ -138,14 +132,15 @@ def execute(self, project_life):
power_turbines[:, self.start_idx:self.end_idx] = self.fi.get_turbine_powers().reshape((self.nTurbs, self.end_idx - self.start_idx))
power_farm[self.start_idx:self.end_idx] = self.fi.get_farm_power().reshape((self.end_idx - self.start_idx))

operational_efficiency = ((100 - self._operational_losses)/100)
# Adding losses from PySAM defaults (excluding turbine and wake losses)
self.gen = power_farm * ((100 - self._operational_losses)/100) / 1000 # kW
self.gen = power_farm * operational_efficiency / 1000 # kW

self.annual_energy = np.sum(self.gen) # kWh
self.capacity_factor = np.sum(self.gen) / (8760 * self.system_capacity) * 100
self.turb_powers = power_turbines * (100 - self._operational_losses) / 100 / 1000 # kW
self.turb_powers = power_turbines * operational_efficiency / 1000 # kW
self.turb_velocities = self.fi.turbine_average_velocities
self.annual_energy_pre_curtailment_ac = self.annual_energy
self.annual_energy_pre_curtailment_ac = np.sum(self.gen) # kWh

def export(self):
"""
Expand Down
Loading