ValentinChb / FASTFarm2Simulink

Apache License 2.0
7 stars 0 forks source link

Unable to run #5

Closed Alessandro5I closed 3 months ago

Alessandro5I commented 4 months ago

I tried to download and run the test from github but I get different errors:

  1. When calling the FastFARM exe in your directory I get the error in the picture attached.

Screenshot 2024-07-10 202030

  1. When running RunTest_MATLAB alone I get this error: Ready to connect Invalid MEX-file 'C:\Users\aless\OneDrive - Politecnico di Milano\Desktop\TESI\FASTFarm2Simulink\SC_MPIServer\MPIServer_Init.mexw64': The specified module could not be found.

Error in SC_MATLAB (line 18) [nT,nc]=MPIServer_Init(MPI_sharedfile);

ERROR: MATLAB error Exit Status: 0x00000001

Thanks for your time, Alessandro

ValentinChb commented 4 months ago

Hi Alessandro, Glad to see you're trying to use this. I'll do my best to make it work. I've never seen the first error but it is purely on the OpenFAST side, this should be fixed by recompiling FastFarm or just using a newer release (that will imply updating the input files). To be clearer, there is no change in FastFarm itself so the official branch from NREL can be used, all mods are in the controller dll. The second error may be due either to some bad path in Matlab, or to some version incompatibility. Try recompiling the mex file. BR Valentin

Alessandro5I commented 4 months ago

Dear BR Valentin, I'm trying to use your interface for my Master's Thesis.

Regading the first error, may I ask you which version of Fast.Farm did you use?

For the second part, I tried to recompile the mex file in matlab but I got the same error for MPIServer_Init.cpp and MPIServer_Stop.cpp:

mex MPIServer_Stop.cpp Building with 'Microsoft Visual C++ 2022'. Error using mex Creating library MPIServer_Stop.lib and object MPIServer_Stop.exp MPIServer_Stop.obj : error LNK2019: unresolved external symbol MPIServer_Stop referenced in function "public: virtual void __cdecl MexFunction::operator()(class matlab::mex::MexIORange<class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class matlab::data::Array> > > >,class matlab::mex::MexIORange<class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class matlab::data::Array> > > >)" (??RMexFunction@@UEAAXV?$MexIORange@V?$_Vector_iterator@V?$_Vector_val@U?$_Simple_types@VArray@data@matlab@@@std@@@std@@@std@@@mex@matlab@@0@Z) MPIServer_Stop.mexw64 : fatal error LNK1120: 1 unresolved externals

Here I attach a picture Screenshot 2024-07-12 142607

Thanks for your help, Alessandro

ValentinChb commented 4 months ago

You need to link the mex file against the MPI server dll, see mex file documentation

Alessandro5I commented 4 months ago

Which version of FF are you using? I would like to run this with the basic version (no OMP) of the program to have easier life. Do you think is it possible?

ValentinChb commented 4 months ago

The version in the GitHub repo is pretty old, 3.0 I guess. As said before, it should be totally fine to update FAST.Farm, as everything is happening in the controller dll. The only thing you need then is to update OpenFAST input files to a newer version. Removing OMP will just call turbines sequantially, that should not change anything beside making it slower. I don't see why that should make your life easier though, unless you want to mess up with the MPI interface.

Alessandro5I commented 3 months ago

Hi, I updated the input and solved something. Still I have some issues, first of all I don't understand the exact sequence to start the program, it seems to work by simply click on the run_MATLAB but this procedure seems different then what is written in the readme. The new issue I found is this:

Farm_Initialize:T1:Farm_InitFAST:FWrap_Init:FAST_InitializeAll:SrvD_Init:BladedInterface_Init:The dynamic library .\OpenFAST\T1\ControlData\SCClient_DTUWEC_64.dll could not be loaded. Check that the file exists in the specified location and that it is compiled for 64-bit applications. T2:Farm_InitFAST:FWrap_Init:FAST_InitializeAll:SrvD_Init:BladedInterface_Init:The dynamic library .\OpenFAST\T2\ControlData\SCClient_DTUWEC_64.dll could not be loaded. Check that the file exists in the specified location and that it is compiled for 64-bit applications.

Thanks for your help. Alessandro

Alessandro5I commented 3 months ago

You need to link the mex file against the MPI server dll, see mex file documentation

I'm having difficulties in understanding which MPI server dll file should I link, in the doc I could only find how to link .lib files but the only one in this folder is not the one needed.

ValentinChb commented 3 months ago

Hi, libSC_MPIServerSubs.a is the (static) library you should link against. The new issue you are encountering is self explanatory, the WT controller dll file cannot be loaded. Beside the given obvious reasons of path and CPU architecture, it may be because the dll is itself unable to load one of its dependencies (typically the MPI server dll given the original problem). You may use DependencyWalker to confirm this.

Alessandro5I commented 3 months ago

Hi, Thanks for the fast reply. I used DependencyWalker but it finds many many missing dlls for what I understand, I attach a screenshot: Screenshot 2024-08-16 130603

Thanks for your help. Alessandro

ValentinChb commented 3 months ago

Hi, yes DependencyWalker gives a lot of false errors. You've got to ignore the system dlls (like kernel32 or msvcrt) and look for any dependency specific to this application. Did you try recompiling the SCClient dll?

Alessandro5I commented 3 months ago

Hi, Today I solved everything, thanks for your time, Alessandro