We have recently made some updates to our set of wind turbine controller examples, which is now available to download from the new Orcina GitHub page.
The main change is the addition of a native controller wrapper example. This takes the form of a C++ DLL, having the same functionality as the existing Python wrapper. The reason for creating this example is to avoid restrictions imposed by the Global Interpreter Lock (GIL). The GIL is an inherent part of the Python process, and it can be restrictive if using Python (e.g. external functions) whilst using multi-threading to run simulations in parallel.
For example, the OrcaFlex batch processing tool uses multi-threading to run a batch of simulations, but there is only one GIL which acts as a gatekeeper for that process. For any models using Python, this can cause performance bottlenecks when running many simulations in parallel.
As the GIL is inherent to Python, running the simulations using the native (C++) wrapper avoids this restriction altogether. In turn, this has the potential to lead to improved efficiency when running large multi-threaded batches of simulations.
Although the native variant has the benefit of avoiding the GIL, the Python variant still has value. It’s easy to modify if adjustments need to be made, for example if you need to adjust what is passed to and from the swap array. This can still be done for the native variant, but the process is more difficult because it requires modification of the C++ source code and then recompilation of the DLL.
For this reason the C++ source code – used as a basis for the native DLL – can be downloaded from the same GitHub page mentioned above: see the folder Bladed controller wrapper\Native controller\src. The build folder contains both a Microsoft Visual Studio project and a MSYS2 makefile, either of which can be used to compile the DLL. This caters for two common C++ toolchains.
We have also made a couple of other minor adjustments to make the Python and native variants have feature parity. The notable changes are:
- Minor changes to how the Python controller wrapper models are set up. Instead of having separate classes named PitchController and TorqueController, there is now a single class named BladedController.
- The yaw controller example – offered in earlier revisions of this resource – has been removed for now. We hope to replace this with a new example in the future. In the meantime, the old example can be supplied upon request. Please contact us for further details.
For further details about the latest updates, please see the Bladed controller wrapper section of the accompanying PDF document. Note, the Code drop-down box, at the top of the GitHub page, provides the option to download this entire resource as a zip file.
Wind turbine examples
Lastly, to reflect the latest set of controller examples, the K02 and K03 examples now demonstrate the implementation of the Python wrapper and native wrapper respectively. A summary of the model setup is provided in the Controller modelling section of the PDF description included with each example.
We hope that you will find the latest updates helpful. We always welcome any questions or feedback, so please do contact us for any further enquiries.