# Using Known System Capacity Factors to Model Hourly Wind Generation

• colleenmccamy
• Topic Author
07 May 2023 18:33 #12123 by colleenmccamy
Hello,

We are working to get hourly capacity factor for wind at locations of existing wind projects within the contiguous US using the WIND Toolkit wind speed data. We have a SAM code using the PySSC model. We are providing lat and lon values for centroids of each wind project. We are also inputting the project's system capacity as a float within the following code. However, when providing the project's system capacity, the hourly capacity factors that we get for each site do not make sense (values greater than 1). What would be the best way to provide the known system capacity for the wind projects to get estimated hourly capacity factors with the given wind speed data to the SAM model so that it calculates the hourly capacity factors using known system capacity?

We also saw that the system_capacity variable depends on rotor diameter. We input the rotor diameter into the model, the capacity factors do not change.

system_cap_kw = float(system_cap_kw)
def onshoreWind(homePath, lat_in, lon_in, rotor_m, system_cap_kw, data_in):

# importing libraries
import PySAM
from PySAM.PySSC import PySSC
import pandas as pd
import numpy as np
import sys, os

# setting inputs as floats
rotor_m = float(rotor_m)
system_cap_kw = float(system_cap_kw)

# setting model inputs
ssc = PySSC()
ssc.data_set_number( data, b'wind_turbine_rotor_diameter', rotor_m )
ssc.data_set_number( data, b'system_capacity', system_cap_kw )

I have included the entire SAM Assumptions script as an attachment. Please let us know if there is any additional information that we can provide and we appreciate your time and help!

Best,
Colleen
##### Attachments:

• pgilman
08 May 2023 23:47 - 08 May 2023 23:48 #12128 by pgilman
Hi Colleen,

Your Python code imports the PySAM package so you don't need to also import PySSC. You can use the method described in the PySAM documentation to import input data from SAM into your PySAM model:

The benefit of using PySAM is that it has better documentation and provides methods for interacting with variables.

To model different sizes of wind farms, you have to set the value of the following three variables together:

```system_capacity
wind_farm_xCoordinates
wind_farm_yCoordinates```

You can use the diagram on SAM's Wind Farm input page to figure out how those X and Y coordinates work.

Here is a basic code example that shows how to model a wind farm with one turbine and two turbines, assuming you are using the power curve option for specifying the wind turbine. See the attached zip file for the input JSON file, which I generated from the .sam file and then modified to read the wind resource file from the folder containing the Python script.

```import json
import PySAM.Windpower as wp

wind = wp.new()

with open('untitled_windpower.json', 'r') as file:
# loop through each key-value pair
for k, v in data.items():
if k != 'number_inputs':
wind.value(k, v)

# Wind farm with one turbine
wind.value('wind_farm_xCoordinates', [ 0 ])
wind.value('wind_farm_yCoordinates', [ 0 ])
wind.value('system_capacity', 48000)

wind.execute()
print('annual energy (kWh) = ', wind.Outputs.annual_energy)
print('capacity factor = ', wind.Outputs.capacity_factor)
print()

#Wind farm with two turbines
wind.value('wind_farm_xCoordinates', [ 0, 616 ])
wind.value('wind_farm_yCoordinates', [ 0, 0 ])
wind.value('system_capacity', 96000)

wind.execute()
print('annual energy (kWh) = ', wind.Outputs.annual_energy)
print('capacity factor = ', wind.Outputs.capacity_factor)```

Best regards,
Paul.

##### Attachments:
Last edit: 08 May 2023 23:48 by pgilman.