Calling Discon/libdiscon.dll from MATLAB functions loadlibrary and calllib

Dear Nikhar/Boni,

I have successfully coupled the Discon.dll with MATLAB using functions loadlibrary and calllib. The procedure to implement this involved writing a header file in FORTRAN, which provides the definition and class of each variable being passed in and out of the DLL. Using this implementation, I have developed an in house aeroelastic code (OxDyn) that closely matches OpenFAST for the NREL 5MW turbine as shown below:

I have now tried to model the NREL 15MW turbine however when I simulate this turbine the Discon.dll controller only outputs zero generator torque and blade pitch even when the wind speed and generator speed that I pass to the controller are within operating conditions. Just to be clear, I have changed the Discon input files to the relevant files for the NREL 15MW.

The controller does output a generator torque when I set the gearbox ratio is set to 97 with the NREL 15MW but this is obviously not the correct setting since the 15MW turbine is direct drive. Therefore my first question is if it is possible to simulate the NREL 15MW turbine with the discon.dll rather than the libdiscon.dll? if so can you provide guidance on how to do this?

I have tried to change the dll from the discon.dll to the libdiscon.dll but in this case MATLAB crashes without giving any warning therefore making it difficult to debug. I think the source of this crash is because the variables that are being passed to the libdiscon.dll are different from the discon.dll but I am hoping you can also clarify this?

Any help with this issue would be greatly appreciated.

Kind regards,
Gerard Ryan

Hi Gerard,

I’m not sure I understand the difference between discon.dll and libdiscon.dll. I have seen the same controller library named both of those things. I would recommend using the latest version of the ROSCO dynamic library: Release Version 2.5.0 · NREL/ROSCO · GitHub. If this is the version that doesn’t work, what is the discon.dll that does work?

Calling a ROSCO library from Matlab sounds like a useful feature for other controls researchers. If you are able to, your contribution to the ROSCO repo would be greatly appreciated! ROSCO/Matlab_Toolbox at main · NREL/ROSCO · GitHub. We would be happy to help with a pull request.

Best, Dan