Bladed Knowledge Base

How to exchange data between multiple DLLs coupled to Bladed: User-defined Variables
Category: Control systems

Problem

Bladed allows multiple controller DLLs to be linked to Bladed at the same time, as well as the option of an External Loads DLL. Sometimes it is useful / essential for these multiple DLLs to exchange data between them. How can this be achieved?

Solution

User-defined variables are the mechanism we provide for exchanging data (floating point numbers) between multiple external controller DLLs, and between controller and external loads DLLs. This could be useful in a range of cases where you want to write standalone DLLs that can integrate with custom written DLLs through pre-defined interfaces. For instance, if you want to model a LIDAR system and integrate feed-forward control with a control system: in this case, the wind speed read by the LIDAR unit could be processed in one external controller DLL while the control logic is implemented in a separate external controller and data is communicated between the two DLLs. The controller that processed the LIDAR system data could then be a standalone component that integrates with multiple custom written controllers and the communication of data is controlled via named user variables.

Here is more detail regarding how user defined variables can be used in the DLL interfaces we support in Bladed:

Firstly, we offer the function-based external controller API (available from Bladed 4.4 onwards) where the functions are documented in the chm file that is made available to users in the installation directory - e.g. Bladed C:\DNV\Bladed 4.12\External Controller. In this controller it is possible for users to set “Named” user variables and get the values of those variables across two different external controllers. It is also possible to use this functionality to share variables and their values between the controller DLL and external loads DLL. There are also functions to get and set indexed user variables in the function based controller interface.

The functions to search for in the documentation are called GetNamedUserVariable() and SetNamedUserVariable(), for both the controller and External Loads DLL interfaces. Help files for the External Loads DLL are found in a folder under the installation root, e.g. C:\DNV\Bladed 4.12\External Loads DLL.

Secondly, Bladed also supports a legacy DISCON (DIScrete CONtroller) controller option. This is still supported as it is widely used in the industry and was the default control option for pre 4.4 versions of Bladed. In this case, an array of elements is passed to the DLL and then set by the user and passed back to Bladed simulation to set pitch and torque demands in response to appropriate measurement signals like generator speed. The documentation is available from the Bladed portal under “External controller documentation” GH Bladed (azureedge.net). In this style of controller, the user can set the value of elements 120-129 in the array and these can be accessed by another DISCON style controller. This is analogous to the named user variables in the function based controller.

If running with a combination of function based and DISCON controller DLLs then it is also possible to set an indexed user variable in a DISCON controller and get this value in the function controller using the get indexed user variable function (and vice versa).

Here is an example of how to exchange data between External Loads DLL and External Controller DLL via function-based API. The example External loads DLL script is written with "ExternalLoads_v3" which is avaliable since Bladed 4.13. For Bladed versions before v4.13, the method is the same. Users can refer to Bladed installation folder for different versions of external loads.





Keywords User defined variables; external controller; external loads; DLL; data exchange