OpenFAST / matlab-toolbox

Collection of Matlab tools developed for use with OpenFAST
Apache License 2.0
50 stars 67 forks source link

multiple problems using runCampbell script #18

Closed ramisetti closed 3 years ago

ramisetti commented 4 years ago
  1. The InflowWind.dat, ServoDyn.dat, and ElastoDyn.dat files required to run runCampbell.m script are missing inside the TemplateFiles directory.
  2. WriteVTKmodes and WriteFASTfiles are assigned twice. It can be understood if WriteVTKmodes is set true then VTK files will be generated. However, I see the purpose of using WriteFASTfiles flag is redundant because without generating the FAST input files and running FAST there will be no *.lin output file, which in turn is required by the fx_mbc3 at lines 173 or 182 inside the runCampbell.m script.
  3. As mentioned in one of my last issue (https://github.com/OpenFAST/matlab-toolbox/issues/17), xlmwrite function at line numbers 188, 230 and 231 does not work on Mac OS. I think an alternative solution to xlmwrite is needed here.
  4. The code from line number 198 does not work without the Campbell data being generated at 184 if WriteFASTfiles flag is set false.
  5. The system commands like copy, used in line 180, are OS-dependent. Also the file fort.51 used in the copy command is missing. I was expecting fort.51 file would be generated by runCampbell script but it does not create this file.
ebranlard commented 4 years ago

I'd like the runCampbell script to be reduced to a minimal amount of lines and simply call a set of reusable functions . So I'll likely update it accordingly, accounting for some of your comments.

ebranlard commented 4 years ago

Hi @ramisetti , if you have time, can you maybe try the Campbell/example/runCampbell.m script located in my fork:

     https://github.com/ebranlard/matlab-toolbox

I can try to incorporate your feedback, before merging this to the official repository.

ramisetti commented 4 years ago

Hi @ebranlard, Sure I will try it and let you know my feedback.

ramisetti commented 4 years ago

I tried using the runCampbell.m script from your fork. I found there are still some errors using the script on Mac OS.

I had to change ‘!’ symbol to '~' at line numbers 124 and 127 in writeLinearizationFiles.m I had to replace the double quotes to single quotes for the line "OCTAVE_VERSION", “builtin” in os_path.m file

After the above changes I could run the script but openfast simulations could not be launched. I got the below error:

dyld: Symbol not found: __gfortran_transfer_character_write Referenced from: /Desktop/OpenFAST/openfast/build/bin/openfast (which was built for Mac OS X 10.15) Expected in: /Applications/MATLAB_R2016b.app/sys/os/maci64/libgfortran.3.dylib

It seems I am unable to use openfast from matlab as I don’t have any problem using the same openfast outside matlab. I did not have this problem with previous runCampbell.m script available in the OpenFast repository.

andrew-platt commented 4 years ago

The dyld: Symbol not found: __gfortran_transfer_character_write error looks to me like it is a path issue. On my system, the /Applications/MATLAB_R2019a.app/sys/os/maci64/libgfortran.3.dylib is for gcc version 4.3.0, but I compile OpenFAST using gfortran version 7.4 and 9.3 which are not compatible with that dylib. This runs fine on my setup Mac (10.14.6) leading me to suspect the path issue.

Try the following:

If these don't match, then there is an issue with your paths in the shell MATLAB spawns

Example output from !otool in matlab (NOTE: /Applications/MATLAB... does not appear in the list):

Otool-output_MATLAB_macos
ebranlard commented 4 years ago

Thanks @andrew-platt. I've push an updated version to fix the syntax issue. Let's see what can be done for this library path. Apart from what Andy mentions, maybe the following thread will have some helpful hints: https://www.mathworks.com/matlabcentral/answers/17437-dyld_library_path-problem

ramisetti commented 4 years ago

Hello @ebranlard,

Thanks to the helpful hints from @andrew-platt. The runCampbell.m script is now able to run openfast simulations but there is a new problem. Only the first simulation finished and all the remaining 4 simulations failed. I get the following error for each failed simulation case.


FAST_InitializeAll:FAST_Init:ValidateInputData:OutFmt produces a column width of 20 instead of 10 characters. FAST_InitializeAll:AD_Init:ReadInputFiles:ReadPrimaryFile:Invalid logical input for file "../../_ExampleData/5MW_Land_Lin/NRELOffshrBsline5MW_Onshore_AeroDyn15.dat" occurred while trying to read UseBlCm.

FAST encountered an error during module initialization. Simulation error level: FATAL ERROR

Aborting OpenFAST.

Could you please help me in resolving this issue?

ebranlard commented 4 years ago

Hi, Thanks for your test. The test case should be up to date with the latest openfast (version 2.3), you might be running into this issue because you are using an older executable. Let me know if you still have issue.

Emmanuel

ramisetti commented 3 years ago

Hi @ebranlard,

Just to let you know I am using the latest openfast version 2.3 from the dev branch cloned in April 2020. I also tried running the script using the latest sources from dev branch (cloned on 21 July 2020) but I get the following errors:

AST_InitializeAll:FAST_Init:FAST_ReadPrimaryFile:Invalid logical input for file "../../_ExampleData/5MW_Land_Lin/ws15.0.fst" occurred while trying to read CalcSteady. FAST_ReadPrimaryFile:Invalid numerical input for file "../../_ExampleData/5MW_Land_Lin/ws15.0.fst" occurred while trying to read Twr_Kdmp. FAST_ReadPrimaryFile:Invalid numerical input for file "../../_ExampleData/5MW_Land_Lin/ws15.0.fst" occurred while trying to read Bld_Kdmp.

Just a few remarks:

  1. I think with your version of matlab-toolbox code, it seems we cannot directly run the MBC analysis using the linearization files produced without using this script. We should rename all the lin files to ws*.lin to be able to use this script. In my opinion, the code on your repository is not really helpful. Please correct me if am wrong.
  2. I noticed while compiling the latest source code (cloned on 21 July 2020) from the dev branch, the r-test and pfunit folders are not available and this is leading to compiling errors. I had to separately clone the r-test and pfunit into the appropriate locations. Was this an intended idea for the latest releases?
  3. Just for the information. As I had multiple issues using this Matlab script since I started using it, I decided to port the code to python to avoid cross-platform issues arising with Matlab. Recently, I finished porting it to Python and the code is now available. I am able to use my code to read the linearization files, perform the MBC analysis, and plot the Campbell diagram. I think I get reasonable results for the NREL 5MW Land-based wind turbine model with the ElastoDyn module. However, I don't get the correct results for the same model when BeamDyn is used. There seems to be some problem in identifying the modes correctly. I think the matlab-toolbox code also has a similar problem.
ebranlard commented 3 years ago

Hi, thanks for trying this again. Unfortunately, changes were added last week to the dev branch of openfast which make it incompatible with version 2.3. There are more input lines in the .fst file, which add more linearization options. On my repo, there is a script runCampbell_Trim.m that is compatible with these options. It uses the following input file _ExampleData/5MW_Land_Lin_Templates/Main_5MW_Land_Lin_Trim.fst, which should be compatible with the latest dev. This input files could also be used with the runCampbell.m.

Regarding your remarks:

  1. Filenames are indeed standardized, but you can specify a column "Filename" in your csv file, with the names of the .fst files to override this.
  2. This might be an openfast issue, I'm not sure what happened. I'm guessing the submodules were not updated. This happens when using the command git pull, which does not pull the submodules, the command git pull --recurse-submodule should do it.
  3. The mode identification indeed requires more work, it is a difficult task and we didn't have the resources to work more on it. It sounds like a good idea to implement this in python. Would you be willing to share your python implementation? We have a python-toolbox repository but it's still work in progress. It would be great to include the mbc in this repository. We have created a directory structure in the dev branch of the python-toolbox, to add linearization in the future (see here). Thanks again for all your testing!
ramisetti commented 3 years ago

Thanks for the information on how to use the script by introducing the Filenames in the csv file. This is indeed helpful if the users are made aware of it.

I am happy to share my python code if this can be helpful to others. At the moment the code is not heavily tested but it can generate the Campbell diagram plot. I will first commit the code to my Github repository and then make it available after some cleanup. Hope this is okay with you.

ebranlard commented 3 years ago

That sounds good, thank you for sharing your repository when you get to it.

ebranlard commented 3 years ago

hi @ramisetti We'd like to start implementing our own version of the linearization scripts (including the MBC). It would be nice to have a look at your version as a starting point. If you don't have a repository ready, could you maybe contact me my email? My email is emmanuel[dot]branlard[at]nrel[dot]gov. Thanks!

ramisetti commented 3 years ago

Hello @ebranlard https://github.com/ebranlard,

I have committed my MBC python code onto a private repo in my GitHub page. It is not yet made public as I could not get time to cleanup some messy parts of the code. I wanted to test some parts of the code for speedup as well but I am afraid I may not get the time to do it anytime soon in this month. To help you I can give you access as a collaborator to my private repo and you can have a look at the code. I hope this is helpful to you. I have also replied to your nrel email so you can directly contact me in future for any help/feedback related to my python implementation of the MBC code.

On 3 Aug 2020, at 23:20, E. Branlard notifications@github.com wrote:

hi @ramisetti https://github.com/ramisetti We'd like to start implementing our own version of the linearization scripts (including the MBC). It would be nice to have a look at your version as a starting point. If you don't have a repository ready, could you maybe contact me my email? My email is emmanuel[dot]branlard[at]nrel[dot]gov. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpenFAST/matlab-toolbox/issues/18#issuecomment-668157053, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFBMHU6XOYC7KPYGZJQABDR632F3ANCNFSM4M43VFSA.

ebranlard commented 3 years ago

Thanks a lot for that!

ramisetti commented 3 years ago

Hi @ebranlard,

I have now enabled access to my private repo on Github. Please let me know if you have any issue accessing the code.

ebranlard commented 3 years ago

I'm closing this thread, since most issues were solved by the latest version (which might come with its own issues).