-
Notifications
You must be signed in to change notification settings - Fork 155
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
Consolidate turbine libraries #345
Comments
Sounds good! For now (to prevent confusion), I removed the |
Hello! First, thank you for the amazing work done on the v3. From my understanding, if a user wants to add another turbine type, the new associated YAML file should be placed in the Modifying the content of the source code does not seem appropriate. Wouldn't it be better to allow an additional (external) turbine library? For example, there could be an floris/floris/simulation/farm.py Lines 76 to 77 in 89e071f
|
Thank you for the feedback! This is something we have been discussing internally and agree that there should be a better solution to allow for user-defined turbine types. We will update here with any changes addressing this. |
Even when creating a new turbine in the turbine_library (the iea_15MW turbine) using the iea_10MW.yaml file as a template, I'm getting the following error: Is there a way to bypass this for now until the external library is created? |
Hi @econdon16 . I have had success placing new turbine files in floris/floris/turbine_library and importing them in a similar manner as for the NREL 5MW and IEA 10MW turbine in the input YAML file. Can you share where you placed your files and how you modified your input YAML file? |
@Bartdoekemeijer I duplicated the iea_10MW.yaml file within the same turbine_library folder and edited it to include the following:
(My input file works with the iea_10MW.yaml file so I don't think the issue is there.) |
The code will look for the turbine file based on the file name. As such, do you have the file saved as |
Yes I have named it that exactly @bayc |
In
You could try printing |
I found my error to be in my environment organization. Though I thought I have floris v3.0.1 in it's own location, the turbine_library was being called from an installation of floris v3.0.1 in an anaconda environment i.e. I have floris/floris/turbine_library in two locations and it was favoring the one in a distant file. Adding my iea_15MW.yaml file to that location solved the issue, but any advice on editing that path? |
If you're using conda, I think the Python interpreter will require that you add your new turbine to the floris in the anaconda installation. Like @ElieKadoche mentioned in #345 (comment), modifying the source code of an installed package is bad practice and we will resolve this in a future release. I'm not sure if I correctly understood so does this answer your question? |
@econdon16 alternatively you can supply your turbine definition directly (as in, not in a turbine library directory) using the farm:
layout_x:
- 0.0
- 630.0
- 1260.0
layout_y:
- 0.0
- 0.0
- 0.0
turbine_type:
- !include /your/path/to/raf_20MW.yaml |
Does anyone know how to create a yaml file that has a custom turbine type (!include /your/path/to/raf_20MW.yaml) not manually but directly from a python script? When I am trying to write the yaml file (using pyyalm and yalm.dump) the keyword !include is interpreted as a string and does not work. Thank you very much. |
Good question - I can't think of how to do this. Can you share a small example of what you've tried? Are you automatically generating FLORIS input files? If so, you could also include the turbine definition directly under |
Thanks, @rafmudaf for your suggestion. Indeed this is what I also tried and it worked. All you need is to include the individual wind turbine content (i.e. the content that would normally be in the reference: !include /your/path/to/raf_20MW.yaml) per turbine, in the floris input file. Then you can overwrite the characteristics in the custom floris input file easily from the python script. In that way, you can even assign different Cp/Ct curves per wind turbine in the farm :) Here follows an example with a custom input file: gch_new_input_32_turbines_Cp_Ct_rewritable.yaml Loop to assign different curves to different turbines and write new input filewith open(r'inputs\gch_new_input_32_turbines_Cp_Ct_rewritable.yaml', 'r') as inputSpecsFile:
farmSpecs = yaml.full_load(inputSpecsFile)
u_curves_list = u_curves.tolist()
TSR_2_floris_list = TSR_2_floris.tolist()
for iturbine in range(N_TURBINES):
Cp_2_floris_list = Cp_2_floris[iturbine,:].tolist()
Ct_2_floris_list = Ct_2_floris[iturbine,:].tolist()
farmSpecs['farm']['turbine_type'][iturbine]['power_thrust_table']['power'] = Cp_2_floris_list
farmSpecs['farm']['turbine_type'][iturbine]['power_thrust_table']['thrust'] = Ct_2_floris_list
farmSpecs['farm']['turbine_type'][iturbine]['power_thrust_table']['wind_speed'] = u_curves_list
farmSpecs['farm']['turbine_type'][iturbine]['TSR'] = TSR_2_floris_list[iturbine]
newFarmSpec = farmSpecs
with open(r'inputs\gch_new_input_32_turbines_Cp_Ct_rewritable.yaml', 'w') as file:
documents = yaml.dump(newFarmSpec,file) |
This should be added to the user documentation |
@RHammond2 mostly addressed this issue in #568, but I'm leaving this open since it is not yet in the documentation. |
The error always show that nrel_5MW_custom.yaml is not defined when I am using external library, how can I solve it? |
@pengyulu1112 could you share a simple script demonstrating the error? Also, please share the version of floris that you're using. |
The version is 3.4. I just modified the hub height of nrel_5MW, and I saved it as nrel_5MW100.yaml, I changed the hug height to 100m. But when I always meet the error shows that nrel_5MW100 does not exist in either the internal or external turbine library. So I wondering how to define an external turbine to my code. Thank you very much. Have a nice day! This is the wind turbine I changed. Just vary the hub height of nrel_5MW. I renamed it as nrel_5MW100.yaml
And this is the wind farm I set.
And this is the code I use.
Here is the error.
|
@pengyulu1112 Take a look at the description in #568. An additional field is required in your input file: |
Thank you! I creat a new file which named nrel_5MW100.yaml in E:/ then it works!! Thank you very much! |
For simplicity in the setuptools configuration, I created a new turbine library in
floris/turbine_library
so there is now two instances with the other one inexamples/inputs/turbine_definitions
. @bayc Let's think about how to resolve this viasetup.py
and thepackage_data
keyword.See #325
The text was updated successfully, but these errors were encountered: