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

FlorisModel set method is slow to call if we don't need to update flow field parameters #865

Closed
achenry opened this issue Apr 4, 2024 · 3 comments

Comments

@achenry
Copy link

achenry commented Apr 4, 2024

I'm using FLORIS in a MPC context, where at each time-step I need to set the wind speeds and directions once, and then iterate for many values of the yaw offsets. My optimization procedure slowed significantly with the update from reinitialize to. set, and on profiling the code I found that virtually all of the time was spent in the _reinitialize method. My workaround has been to call set once for each time step, and then during the optimizer iterations to call:

self.fi.env.core.farm.set_yaw_angles(self.fi.env.core.farm.yaw_angles)
self.fi.env._set_operation(
    yaw_angles=yaw_offsets,
    disable_turbines=self.offline_status,
)
self.run()

to update the turbine powers for new yaw angles. It may be that the run method could also be optimized for yaw only changes, I haven't investigated.

@misi9170
Copy link
Collaborator

misi9170 commented Apr 5, 2024

Hi @achenry , thanks for this! I've now created a pull request to address this on #869. I'd like to confirm with you---do you need the line self.fi.env.core.farm.set_yaw_angles(self.fi.env.core.farm.yaw_angles) in your example above? What would happen if you removed that line from your code?

@achenry
Copy link
Author

achenry commented Apr 5, 2024 via email

@misi9170
Copy link
Collaborator

misi9170 commented Apr 5, 2024

I’m not sure if that line is necessary, I just included it because it was in the set method.

On 4 Apr 2024, at 21:21, misi9170 @.***> wrote: [External email - use caution] Hi @achenry https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fachenry&data=05%7C02%7Caoife.henry%40colorado.edu%7C836730fac7514a21e81408dc551f798c%7C3ded8b1b070d462982e4c0b019f46057%7C1%7C0%7C638478840866242499%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=m7ROIh%2BfBEiNBt%2BwOodDyur55HF2oCsvfBZrZu3MAFI%3D&reserved=0 , thanks for this! I've now created a pull request to address this on #869 https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNREL%2Ffloris%2Fpull%2F869&data=05%7C02%7Caoife.henry%40colorado.edu%7C836730fac7514a21e81408dc551f798c%7C3ded8b1b070d462982e4c0b019f46057%7C1%7C0%7C638478840866398738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=s9Hx0mfHG4c6%2BqV5jY4NSNvqOP%2FQut4lLi4FK7WGDbM%3D&reserved=0. I'd like to confirm with you---do you need the line self.fi.env.core.farm.set_yaw_angles(self.fi.env.core.farm.yaw_angles) in your example above? What would happen if you removed that line from your code? — Reply to this email directly, view it on GitHub https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNREL%2Ffloris%2Fissues%2F865%23issuecomment-2038767330&data=05%7C02%7Caoife.henry%40colorado.edu%7C836730fac7514a21e81408dc551f798c%7C3ded8b1b070d462982e4c0b019f46057%7C1%7C0%7C638478840866398738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=y0%2BN0ZiCQhmUw%2FYpY4%2BiJm7FgFTjp1JZSMzkhZ%2FHlFU%3D&reserved=0, or unsubscribe https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGBIVPC3YKHDNLFIXKSCELTY3YKDJAVCNFSM6AAAAABFXWVZ56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYG43DOMZTGA&data=05%7C02%7Caoife.henry%40colorado.edu%7C836730fac7514a21e81408dc551f798c%7C3ded8b1b070d462982e4c0b019f46057%7C1%7C0%7C638478840866398738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=BLikfLoDccK8zqAKcHeEPDAsFQJbK3Ykp%2F1OzpEHC2Q%3D&reserved=0. You are receiving this because you were mentioned.

Ok great, thank you! I think #869 should cover this then, I'm going to go ahead and merge.

@misi9170 misi9170 closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants