Development of external interface for DISCON.dll

Dear Bonnie and Jason,

I am developing an external interface to exchange information with already compiled DISCON.dll controllers from OpenFAST. The goal is to understand how data is exchanged between the compiled dll and OpenFAST in order to implement these type of controller into specific simulation methods developed here at the university.
As a starting point, I am trying to understand how information is exchanged during simulation between the dll-file and OpenFAST.

Currently, I’m using Python 3.8 with the “ctypes” function library to load the DLL and call the functions exported by it. The implementation is not limited to Python though, I’m using it for testing and convenience reasons. My system is a Windows machine with x64 architecture, and I am working on my own compiled DLLs using the Visual Studio solution described in the reg-test repository of OpenFAST (Visual Studio 16 2019 + Intel Fortran Compiler).

Until now I am able to call the DISCON function exported by the DLL, but I am not sure if the avrSWAP-array I am passing from Python has the right data format. The only output I get (besides numerous “access violation errors” from Windows) is an 8-digit integer and I have no clue what that means :unamused:

My question is: Could you provide some light into this information exchange? Does OpenFAST send the data to the DLL with some specific format (like a C-Array or a C-pointer with the memory address of avrSWAP)

I can`t find details of this kind on the BLADED user Manual v3.51 (June 2003) and my Experience with C and Fortran is limited.

Any kind of Information you can provide is greatly appreciated.
Thank you for the time you take moderating and sharing your knowledge on the forum!

Best regards,
Juan Camilo Tejada Escobar

Dear Juan Camilo,

Well, I recommend you review the Fortran source-code that we wrote in the ServoDyn module of FAST / OpenFAST to interface with the Bladed-style DLL controllers. The source file is named BladedDLLInterface.f90. This source file includes detail on how we load the DLL, as well as details on the size and order of the array arguments pass to, and received from the DLL, including the avrSWAP array.

Best regards,