Wind turbine simulation

  • martinho
  • Topic Author
05 Jul 2023 09:07 #12276 by martinho
Wind turbine simulation was created by martinho
Hello everyone, 
I'm trying to create a code to simulate wind turbine but it doesn't working, maybe this is the wind resource file format but i don't know. I have tried several solution but it still doesn't working.

Here is the code that i created : 

import PySAM.Windpower as wp

# Create a Windpower object
wind_turbine = wp.default("WindPowerSingleOwner")

# Set the turbine parameters
wind_turbine.system_capacity = 200  # Turbine capacity in kW
wind_turbine.max_cp = 0.45  # Maximum power coefficient
wind_turbine.max_tip_speed = 80  # Maximum tip speed in m/s
wind_turbine.cut_in_speed = 3  # Cut-in wind speed in m/s
wind_turbine.cut_out_speed = 25  # Cut-out wind speed in m/s

# Set the wind resource file path
wind_resource_file = "C:/Users/arthu/OneDrive/Documents/INTERNSHIP/SAM/05-07-2023/"
wind_turbine.Resource.wind_resource_data = [wind_resource_file]

# Run the simulation

# Access the wind turbine outputs
annual_energy = wind_turbine.Outputs.annual_energy

# Print the annual energy production
print("Annual Energy Production:", annual_energy, "kWh")

When i execute this code, it display me this message error :Cell In[58], line 15
13 # Set the wind resource file path
14 wind_resource_file = "C:/Users/arthu/OneDrive/Documents/INTERNSHIP/SAM/05-07-2023/"
---> 15 wind_turbine.Resource.wind_resource_data = [wind_resource_file]
17 # Run the simulation
18 wind_turbine.execute()

Exception: Table must be set from dict.

I don't know how to resolve this problem. I will be very glad if someone car help me.

Please Log in or Create an account to join the conversation.

  • pgilman
08 Jul 2023 00:00 #12294 by pgilman
Replied by pgilman on topic Wind turbine simulation

I'm not sure if this is a different question from the other one you posted here

In this script, you are modifying inputs like wind_turbine.max_cp, wind_turbine.max_tip_speed, etc. that require that the "Define turbine design characteristics" option be selected on the Wind Turbine page in SAM. Because you created the Windpower object from the default "WindPowerSingleOwner" case, the option is set to "Select a turbine from the library". If you want to be able to modify the turbine design characteristics in Python, I would recommend setting up a SAM file with the inputs for the "Define turbine design characteristics" and then using the technique described in to import the inputs into PySAM.

Best regards,

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum