I have a complete wind turbine FAST model that has a BLADED controller .dll (DISCON.dll) and associated parameter and source code files. I received the following error when I tried to run the model:
“SrvD_Init:BladedInterface_Init:The dynamic library DISCON.dll could not be loaded.
Check that the file exists in the specified location and that it is compiled for 64-bit
I tried running the model with another 64-bit .dll and it worked, so I’m assuming that the error above is resulting from DISCON.dll being compiled for 32-bit apps instead of 64-bit (I currently run 64-bit).
Do I need to recompile the source code to get a 64-bit .dll for use in my FAST model? If so, what is the procedure for compiling a new 64-bit .dll?
If you are using a 64-bit version of FAST, you will need a DLL that was compiled for 64-bit applications.
The procedure for compiling at 64-bit dll is the same as the 32-bit dll, with the exception that you tell the compiler to generate code for 64-bit applications. If you’re using Intel, you use the x64 platform and the compiler will do the rest.
The compiling folder in the FAST v8 archive has some scripts that you can use to compile the DISCON dlls distributed with the CertTest folder. Compiling\Compile_DISCON_DLL.bat uses the Intel compiler, and you can see that it just uses “intel64” instead of “ia32” when you invoke the compiler (alternatively, you can open the 64-bit version of the intel compiler command window). The Compiling\makefile_DISCON_DLL file is set up for compiling the dlls with gfortran. To generate a 64-bit dll, you’d change BITS=32 to BITS=64 on line 13/14, (assuming your gfortran compiler is set up to generate 64-bit code).
Thank you very much for your reply. I realized that I left our a few details from my original post:
- I am actually using MATLAB to run FAST, since I plan to start with the BLADED .DLL but perform some controller optimization later using Simulink.
- I am running a 64-bit version of MATLAB, so I downloaded the 64-bit version of the FAST code. I was assuming that this was necessary, but is it possible to use the 32-bit FAST with 64-bit MATLAB? I wasn’t sure if the MATLAB interface would work in that case.
- If the above is not possible and I do need to compile a 64-bit version of the BLADED .DLL, is the procedure similar to your original response (even though I am using MATLAB to run FAST)?
If you are using a 64-bit version of MATLAB, it will call the 64-bit version of FAST (which is actually a dll in this case), and FAST will need a 64-bit version of the Bladed DLL. You can’t mix 32-bit applications with 64-bit dlls or 64-bit applications with 32-bit dlls.
So, yes, you do need to compile a 64-bit version of the Bladed DLL. The procedure for compiling the Bladed DLL is the same whether you are using it in MATLAB or from the standalone-FAST executable (because you use the same Bladed DLL whether you are calling it from FAST in Simulink or from the standalone FAST executable).
Bonnie, thanks so much for clarification, and for taking the time to answer my questions.
I have an additional question for you related to my posts above. I now have a 64-bit DLL (recompiled by a colleague) but I am currently getting a different error when I try to run the model (screenshot attached). We are trying to troubleshoot this error, but there isn’t much insight provided.
Are there any major differences with how BLADED DLLs are run (or the DLL format) between FAST v8 and v7 or v6? For instance, it appears that DISCON.IN is no longer required. Is this the case? Any further insight that you can give on these version differences and the attached error would be very helpful.
Theoretically, there is no difference in how the Bladed DLL is called between FAST v7 and v6. You may see some differences with messages returned from the DLL because FAST v8 is a little more rigorous in dealing with null characters that are at the end of C strings, but if you’ve written the DLL in Fortran, you shouldn’t see any difference in FAST v8. The name “DISCON.IN” was hard-coded in FAST v7; in FAST v8 you specify that name in the ServoDyn input file. What the DLL does with that name (either reads a file with that name or skips it), is outside the realm of FAST.
In your screen shot below, the “**** FAST START ****” appears to be written in the DLL, unless you’ve modified the FAST source code. The message with all the “\DISCON.IN” stuff is in the error message returned from the DLL. The aviFAIL argument from your subroutine must be less than 0, which tells FAST it encountered a fatal error. So, whatever error has been encountered originated inside the DLL.
The first thing I would check is that the arguments in your DLL are specified correctly. (e.g., avrSWAP should still be 4-byte reals even though the address to that array is 64-bits instead of 32-bits). The fact that the message returned from the DLL is so strange makes me think there may be a problem with the DLL arguments.