Interface of the GH Bladed DLLs

Hello,

I am trying to program my own controller as a C DLL to run simulations with FAST. So far, I have rewritten the Fortran controller provided with FASTv8 and managed to compile it with VStudio C/C++. Something is not working properly (GenPwr is a constant 0.0) and I am trying to understand how the GH Bladed is meant to be used. I think I have understood most of it thanks to the comments in the Fortran controller and the Fill_avrSWAP/Retrieve_avrSWAP functions, but some things are still not clear to me.

Apparently, the programmers working on GH Bladed have changed the DLL interface recently (so the user manual does not apply anymore) and I cannot find a copy of the old user manual anywhere on the internet. Would someone please mind sharing the appendices regarding the DLL interface actually used in FAST?

Thank you very much,

Borja Fernandez-Gauna

Hi, Borja.

I’ll e-mail you some information from the Bladed User’s Manual about writing the DLL in C. You may just have something simple wrong in the DLL’s argument specs.

Bonnie

Thanks to the documentation I have been able to correct some things I had missunderstood from the Fortran code.

But still, the pitch controller doesn’t seem to work (I debug it and the controller sets non-null demanded pitch positions, but the values logged by the system are null) when I try to use it with a modified version of the first certification test. The variables I changed are:

PCMode= 5
VSControl= 1
DLL_FileName=

I get the same results when I use DISCON.DLL instead of my reimplemented version of it. But if I use the built-in controller, everything seems to work properly. I thought they would be the same controller, but apparently not.

Sorry to bother you with this basic stuff. Could anyone tell me what I am missing? (or point to the documentation I should check, I’d be equally thankful)

Nevermind, I think I sorted it out. Apparently, the controller is intended to work with the baseline 5MW model… using it, everything works fine now!

Dear Bonnie,

I am in the same situation of Borja Fernandez.

I’ll be very pleased if you could send me the Bladed User Manual that you suggest to refer to in the file BladedInterface.F90:

!> This routine fills the avrSWAP array with its inputs, as described in Appendices A and B of the Bladed User Manual of Bladed !! version 3.81.

Thank you in advance

Best regards

Hello,

  I also have been trying to run FAST simulations using a compiled .dll controller.  I have successfully run simulations using the provided .dll controller for the NREL5MW turbine.   I have tried the simulations using the optimal gain option in servodyn, as well as, writing a TLUT in the input file.  However, the controller does not seem to track the desired trajectory, and the PI pitch controller does not track the rated generator speed.  I believe understanding the requirements for the GH Bladed interface would help immensely, and would also be interested in the users manual.

Regards,
Dana Martin

Dear Dana,

The input parameters in the ServoDyn input file relating to the optimal mode and the turque-speed look-up table are inputs that mimic equivalent inputs in GH Bladed, so that FAST can be set up to mimic corresponding GH Bladed simulations. These inputs are not used by FAST, but are simply passed to the GH Bladed-style DLL for use by the DLL. However, you must be using a DLL that makes use of these inputs if you want to use them. I’m not sure what controller you are using, but the baseline controller for the NREL 5-MW turbine that NREL has provided does not make use of these inputs.

The GH Bladed User’s Manual is your best source for documentation of the interface requirements for GH Bladed DLL controllers.

Best regards,

Hello,

I would like to make one suggestion about the DLL interface. As far as I know, the current interface only allows the controller to receive some measured data, but no specific data about the turbine in which is being used. May you consider adding some callable functions to retrieve data such as the nominal rated power, rated generator speed and so on? That way, the same controller could be extendend to be used with any of the turbines instead of hard-coding the specific parameters.

Just a suggestion :slight_smile:

Happy new year!

Borja

Dear Borja,

Good suggestions, but the FAST interface to GH Bladed-style DLL controllers is simply that–an interface that allows controllers written in GH Bladed format to be used by FAST. Therefore, we cannot change the interface in any way without disrupting the requirement that the interface be compatible with what is available in GH Bladed.

You can always write your controller so that the parameters of the controller are read in from a file instead of hardcoded in the source code.

Best regards,

hello Bonnie,

                    I am also trying to program my own controller as a C "DLL" to run simulations with FAST.

Can you also provide me this documentation. That will be a great help.

Thank you

Best regards
Muddassir Nawaz

Dear Muddassir,

I’m not sure what documentation Bonnie had forwarded to Borja, and Bonnie is no longer employed at NREL, but you can find documentation on the FAST/ServoDyn interface to GH Bladed controller-style DLLs via the online ServoDyn documentation: wind.nrel.gov/nwtc/doxygen/Servo … rface.html.

Best regards,

Hello Jason,

                Thank you for your response. Actually I am programing my own Controller on C++, then execute it as dll. i didn't want to recompile FAST. 

But controller in FAST is written in Fortran (F90) type. There is no interface given for controller (“FAST_library.h” cannot be used for controller to create dll)

Can you help me with any example/document (writing controller in c++ enivernment/ interfacing with FAST).

Thank you

Best regards
Muddassir Nawaz

Dear Maddassir,

I just sent you an e-mail with some pertinent information.

Best regards,

Hello Jason,

Thank you so much for pdf. it was great help. I have a question regarding that file

I used “build soultion” for Appendix B.1 controller dll C code and execute file in VS2015 “configuration type as Dynamic Library(.dll)” called FAST.dll. After that i place this FAST.dll file inside

d:/fast/bin/5MW Baseline/ServoData

and in ServoData input file, i replaced Bladed interface (ServoData/FAST.dll as DLL_FileName and “FAST” as DLL_ProcName) and execute Test18.fst but this error came up

FAST_InitializeAll:SrvD_Init:BladedInterface_Init:The dynamic library
.\5MW_Baseline/ServoData/FASTdll.dll could not be loaded. Check that the file exists in the
specified location and that it is compiled for 32-bit applications.

Even though “Configuration manager” in VS is Debug-Win32, FAST.dll is already in ServoData folder, but still this error. Which interface i am missing? i don’t know.

Thank you

Best regards
Muddassir Nawaz

Dear Muddassir,

Regarding your approach, DLL_ProcName must be the name of the SUBROUTINE called by FAST, which in this case is “DISCON”, so, change “FAST” to “DISCON”.

Regarding an error that the DLL could not be loaded, see the following topic on our forum: "DISCON.dll could not be loaded" - #2 by Bonnie.Jonkman.

Best regards,

Dear Jason,
I am trying to operate the 5MW NREL wind turbine using the already-implemented controllers defined in the DLL library of DISCON.DLL. However, the response is without control where the pitch angle increases beyond the maximum pitch and the rotor speed increases beyond the rated value. This is even though I have set the PCmode to 5, TPCon to 0 and the VScontrol to 5. So, I have 2 questions:

  1. Does Fast v8 require any recompile to work with the DLL GH Bladed controllers? If so, can you specify it?
  2. If it does not require a recompile, how does FAST send the DLL inputs to the subroutines in it? Does this require any extra codes to define them?

Also, I would be grateful if you can send me a copy of the Bladed user manual v3.81 which was referenced in the code of BladedInterface.f90

Thank you in advance!

Dear Shaimaa,

The FAST v8 Windows executable(s) NREL has provided should be able to call the controller DLL directly, without modification or recompiling of the source code.

It sounds like you’ve defined the proper settings in the ServoDyn input file to interface with the controller DLL. Are you enabling the ServoDyn module in your FAST v8 solution? What messages are written to the screen when you run the simulation?

I just sent you an e-mail with some pertinent information.

Best regards,

Hi Jason,

I am using ServoDyn source code to simulate control systems in my own FOWT software. Specifically, I require an input of wind direction but I notice that FAST only passes the wind speed -

dll_data%avrSWAP(27) = u%HorWindV                        !> * Record 27: Hub wind speed (m/s) [SrvD input]

I’d like to keep the same Bladed style interface so I was wondering if there is a slot in the avrSWAP array that should contain wind direction.

Maybe if you sent me the old Bladed user manual I can find out for myself!!

Many thanks for all your helpful responses.

Aonghus

Actually, the wind direction can be computed from the yaw error and yaw angle -

u_SrvD%YawErr   = u_SrvD%WindDir - y_ED%YawAngle

and the yaw error and yaw angle are in the swap array -

dll_data%avrSWAP(24) = u%YawErr !> * Record 24: Measured yaw error (rad) dll_data%avrSWAP(37) = u%YawAngle - p%NacYaw_North !> * Record 37: Nacelle yaw angle from North (rad)
(the nacelle yaw north is known to the user so that’s Ok)

So I should manage now. Thanks anyway!

Dear Dr. Jonkman,

Can you please help me with the Bladed user manual, for writing the DLL in Fortron and C?

Kind regards
Shiv