NREL / TITANIC

Turbine Inflow Turbulence ANalysIs Code
5 stars 4 forks source link

Error running TowerRunAnalysis.m #6

Open jonathansergio opened 5 years ago

jonathansergio commented 5 years ago

Dear all,

I was trying to run TowerRunAnalysis.m but I faced the following error:

Warning: Problem running TowerRunAnalysis.m generated by TowerRunAnalysis:Run. Error: Error using TowerRunAnalysis (line 145) Problem running FirstLook.m generated by tower_main:Run.

Please, can anyone help me in this issue?

Best regards, Jonathan

AndyClifton commented 5 years ago

This means that something in firstlook.m crashed - that's the code that actually analyses the 10-mintue data files.

At the moment without data samples or more information about what's going on here it's hard to help. First question: are you running the Matlab version or the .exe?

If you are running Matlab, you should start standard debugging processes in firstlook.m to see where it's crashing. 

jonathansergio commented 5 years ago

Thanks for the fast reply.

I'm running Matlab version, just downloaded the project and changed the directory path. Where can I debug to send more information?

Thanks, Jonathan

AndyClifton commented 5 years ago

Ooooh my. You've got a lot of work! Did you look at the wiki pages to see what needs to be done?

jonathansergio commented 5 years ago

Yes, I was following this page. But I got the error at the 2nd step of Try out TITANIC with sample data.

Best wishes, Jonathan

AndyClifton commented 5 years ago

Ok. Questions:

  1. What version of Matlab are you using?
  2. What toolboxes do you have installed?
  3. Are you on mac or windows?
  4. Does your path name have any spaces in it?
  5. Did you add the path to Titanic to matlab?
  6. Have you tried to add breakpoints in firstlook.m to see how far you are getting?

BTW, no need for the "Thanks" and "Best wishes ... " any more.

jonathansergio commented 5 years ago
  1. MATLAB 2015 x64
  2. I didn't install any toolbox
  3. Windows 10 x64
  4. No, it doesn't have any spaces, they were replaced for underscores
  5. Yes, I added
  6. I didn't add breakpoints, although I found the line it's causing the error, it's the line that throws this error:

Problem running FirstLook.m generated by tower_main:Run.

AndyClifton commented 5 years ago

TowerRunAnalysis handles the whole analysis process. It creates a list of data files and then calls FirstLook.m to analyse those data files one at a time. It also calls a few other functions in the process.

It would really help me to help you if you could run TowerRunAnalysis line-by-line or use breakpoints to find out exactly which line causes trouble. If you don't know how to do this, see e.g. https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html.

You will probably find that the error happens somewhere in the if-then block in TowerRunAnalysis between lines 132 and 147. This is where FirstLook() is called, and the error message is generated if something happened in that block. Put a breakpoint on lines 134 and 145, step through, and I bet when its executed it jumps from 134 to 145 - which means an error has occurred in the FirstLook function. N.B.: line numbers correspond to the lines on https://github.com/NREL/TITANIC/blob/master/MATLAB%20source%20code/firstlook/TowerRunAnalysis.m, not the matlab editor.

Please confirm this is where the error happens, and we'll try to keep going after that.

jonathansergio commented 5 years ago

Yes, it's exatcly there where error happens. It jumps from line 134 to 145. Could I extract any other error information?

AndyClifton commented 5 years ago

I can now reproduce this error on Matlab running with an academic license. This version has all toolboxes enabled. One of those toolboxes is the Datafeed toolbox. That defines a function called datastream(), which is also the name of the data object that contains the data in the met tower files. This is not a good thing as it causes FirstLook() to fail.

@jonathansergio are you running an academic license, perhaps? Please check which toolboxes are listed when you use ver()

AndyClifton commented 5 years ago

The first part of the solution is to disable all toolboxes using e.g. this submission on matlab central: https://nl.mathworks.com/matlabcentral/fileexchange/60347-toggletoolbox.

toggleToolbox('all','off')

then, you need to re-enable the statistics and Signal Processing toolboxes:

toggleToolbox('stats','on') toggleToolbox('signal','on')

The TowerRunAnalysis code works afterwards. Edit 6 Dec: It still has problems.

Please note that I cannot guarantee that the toggletoolbox()command won't utterly trash your Matlab install.

AndyClifton commented 5 years ago

There were also some small errors in the configuration file and in the data file import routines. I have submitted pull request #7 that fixes the issue reported here.

@jonathansergio : you can pick up the relevant files from #7 or wait for NREL to accept the pull request. You still need to be careful with the toolboxes, though.

jonathansergio commented 5 years ago

Thanks for all the updates. I'll get the files to run before NREL accept th request. Just 2 files were modified, right?

AndyClifton commented 5 years ago

Actually three files. See https://github.com/NREL/TITANIC/pull/7/commits for details, but they are...

  1. ...code/helper_files/TDMSreader/Version_2p4_Final/tdmsSubfunctions/TDMS_preprocessFile.m
  2. local/MetData/M5Twr/M5_config_TDMS.m
  3. local/MetData/M5Twr/M5_config_TDMS.mat

M5_config_TDMS.mat file can be created by running M5_config_TDMS.m and saving the output variables (tower and datastream) as the .mat file. Make sure if you do this that you clear any existing variables first.

jonathansergio commented 5 years ago

I really appreciate your help Andy!!

The program is running and showing graphs of many measures. I still got a lot of warnings, but that's ok.

Does the program perform some type of wind turbine control?

AndyClifton commented 5 years ago

Glad it's working.

There's no link to wind turbines in this at all. It's purely for converting high frequency met tower data into 10-minute averages. You can see examples of the output at https://nwtc.nrel.gov/MetData; follow the links to the M5 data (https://nwtc.nrel.gov/M5).

If you're interested in wind turbine controls, you could look into NREL's FAST codes. See https://nwtc.nrel.gov/FAST for details.