Processing OpenFast linearization output

Are any tools available for processing the linearization output files of OpenFast? It has been a while since I worked with the linearization output, and it looks like the file format has changed.

Thanks,
Ian Prowell

Hi Ian,

The MATLAB-based MBC3 post-processor has been updated to reflect the updated file format of the inearization output–MBC3 is now available in the MATLAB toolbox: github.com/OpenFAST/matlab-toolbox.

We have also been working closely with Envision Energy recently to improve the OpenFAST linearization process and post-processing, including automating the calculation of steady-state conditions (including controller trim) and introducing a mode shape visualization. This capability has been submitted as a pull request into OpenFAST, but is in NREL review before being merged into the OpenFAST dev branch: github.com/OpenFAST/openfast/pull/373.

Best regards,

Hi,
I am trying to test the matlab-toolbox (github.com/OpenFAST/matlab-toolbox) for the 1st time on a linux cluster. I am working on MBC/Source/runCampbell.m example. I have built openfast with Fortran modules. A top view of the folders:
matlab-toolbox openfast r-test

1-Is this the easiest example to run?
2-It seems FSTName = ‘OpenFAST.fst’ is missing. It will need other input files later on e.g. *.lin extension as well. Where do I get these?

Thanks,
Reza Yaghmaie

Dear Reza,

I’m not sure what you mean when you ask “is this the easiest example to run?”

Regarding your second question, “OpenFAST.fst” is the name of the OpenFAST primary input file; you must have a complete OpenFAST model (the primary input file, plus the input files of each module) before running the script. The runCampbell.m script will run OpenFAST a number of times (for different rotor speeds, etc.), which will generate the associated linearization output (*.lin) files to be post-processed by the script to generate the Campbell diagram.

Best regards,

Sir,

How to Conduct eigenvalue analysis to get natural frequencies for my test case(monopile supported 5MW NREL wind turbine), Hoping that I already conducted linearization analysis and I have linearization output files (for different rotor speeds and azimuth). Is the matlab-toolbox-master is same for all versions of openfast. I downloaded it from (github.com/OpenFAST/matlab-toolbox.) and presently I was using openfast v2.3

Thank you.

Dear Dhaneesh,

By “monopile”, do you mean a tubular land-based tower. Normally the SubDyn module is used to model the structural flexibility of offshore fixed-bottom monopiles, but the linearization functionality of OpenFAST does not yet support linearization with SubDyn enabled. (That said, we are currently working an update to OpenFAST that does support linearization with the SubDyn module enabled.)

Yes, the MBC3 post-processor provided with the MATLAB toolbox should be applicable to all linearization (*.lin) output files generated by OpenFAST v2.3.

Best regards,

Sir,

By monopile, I mean 5MW offshore wind turbine(5MW_OC3Mnpl_DLL_WTurb_WavesIrr). But as linearization does not support with hydrodyn and subdyn enabled. So I did Linearization analysis for test case 5MW_Land_BD_Linear and got linearization output files. Now how should I add the Linearization output file to the eiganalysis (M File) in matlab-toolbox-master to get natural frequencies of 5MW land-based tower.

Thank you.

Dear Dhaneesh,

Unfortunately, there is not much documentation on MBC3 (but there is a bit outdated documentation available here: github.com/OpenFAST/matlab-tool … s/MBC3.pdf). Hopefully, you can following the MBC3 scripts by reviewing their source code. fx_mbc3.m is the script that does the main MBC3 calculations. runCampbell will run OpenFAST for you, call fx_mbc3.m, and help you interpret the mode shapes through visualization, but this relies on an OpenFAST pull request that has not yet been reviewed and merged into OpenFAST-dev or -master.

Best regards,

Sir,

I have followed the instructions given in github.com/OpenFAST/matlab-tool … s/MBC3.pdf for execution of MBC. when I tried post processing of linearized output files of test case 5MW_Land_BD_Linear, this error has occured in matlab.

fx_getMats
Undefined function or variable ‘ReadFASTLinear’.

Error in fx_getMats (line 46)
data(matData.NAzimStep) = ReadFASTLinear(FileNames{matData.NAzimStep}); %we’ll read this twice so we can allocate space first; putting it at matData.NAzimStep saves some reallocation later

can I get some help.

Dear Dhaneesh,

The MATLAB script ReadFASTLinear.m is distributed in the MATLAB toolbox in the Utilities directory.

Best regards,

Sir

After adding couple of matlab scripts in utility folder to my working directory this error was called in matlab. Does it mean is there something wrong with my test case .lin output files( i.e, Is it saying about size of linearized state space matrix). I tried checking the error it but I didn’t get it.

fx_getMats
Index exceeds matrix dimensions.

Error in fx_getMats>getStateOrderingIndx (line 287)
lastModOrd = matData.StateDerivOrder(i);

Error in fx_getMats (line 98)
[matData.StateOrderingIndx, checkEDstates] = getStateOrderingIndx(matData);

Thank you.

Hi Jason,

can you lead my to the correct scripts for eigenvalue analysis for OpenFAST 2.2.0 with BeamDyn?

Running matlab-toolbox-master\MBC\Source\fx_mbc3.m throws a error at i=13 (modName = ‘BD_1’):

[code]Index exceeds the number of array elements (1).

Error in fx_getMats>getStateOrderingIndx (line 287)
lastModOrd = matData.StateDerivOrder(i);

Error in fx_getMats (line 98)
[matData.StateOrderingIndx, checkEDstates] = getStateOrderingIndx(matData);

Error in fx_mbc3 (line 41)
[matData, FAST_linData] = fx_getMats(FileNames);[/code]

Attached the matData.DescStates at time of Error.

Running fx_mbc3.m with *.lin files with ElastoDyn everything works fine.

And do you knwo when functionalities need for runCampbell.m to work merged into the master branch of OpenFAST?

Best wishes,
Simon
DescStates.txt (21.2 KB)

Dear Dahneesh and Simon,

It is hard for me to understand the problem without reproducing the error myself. Can you attach the OpenFAST linearization output (.lin) files you are using that generate these errors?

I’m not sure when the OpenFAST pull request will be reviewed and merged into OpenFAST-dev or -master, but I hope that is soon as well!

Best regards,

Sir,

I also tried Post-processing of linearization output files of test case (5MW_Land_DLL_WTurb) with elastodyn instead of beamdyn. After running fx_getMats, I got these errors in mbc3.

fx_mbc3

Running mbc3 (v2.0, 29-Jan-2018)

Not enough input arguments.

Error in fx_mbc3 (line 41)
[matData, FAST_linData] = fx_getMats(FileNames);

And I am attaching the linearization output files I got for test case 5MW_Land_BD_Linear that you asked in earlier reply.
5MW_Land_BD_Linear.2.txt (630 KB)
5MW_Land_BD_Linear.1.txt (630 KB)

Dear Dhaneesh,

OK, I was able to reproduce the error. I realized that there is a small bug in ReadFASTLinear.m. Line 66 should be:

            data.x_DerivOrder(:) = 2; % (these are second-order states)

instead of:

            data.x_DerivOrder = 2; % (these are second-order states)

(i.e., the “(:)” should be added in.) This is actually fixed in a pull request waiting to be reviewed and merged into the MATLAB toolbox (github.com/OpenFAST/matlab-toolbox/pull/12).

Best regards,

Sir,

Thank you for spending your time on clearing my doubts. I made changes to copy of my Matlab scripts as in github.com/OpenFAST/matlab-toolbox/pull/12. For running Matlab scripts I followed the procedure given in MBC3.pdf. After I issued the command fx_getMATS in matlab command window the code started executing and when I typed Fast output file without .lin extention I got error then I tried executing fx_mbc3 then I got another error.

5MW_Land_BD_Linear.1
5MW_Land_BD_Linear.1

Error: Unexpected MATLAB expression.

5MW_Land_BD_Linear.1 5MW_Land_BD_Linear.2
5MW_Land_BD_Linear.1 5MW_Land_BD_Linear.2

Error: Unexpected MATLAB expression.

who

Your variables are:

ans

fx_mbc3

Running mbc3 (v2.0, 29-Jan-2018)

Not enough input arguments.

Error in fx_mbc3 (line 41)
[matData, FAST_linData] = fx_getMats(FileNames);

And I tried to run fx_mbc3 by replacing FileNames by (‘5MW_Land_BD_Linear.1.lin’,‘5MW_Land_BD_Linear.2.lin’) in line 41 of fxmbc3 M file. Then I got this error.

Error using fx_getMats
Too many input arguments.

Error in fx_mbc3 (line 41)
[matData, FAST_linData] = fx_getMats(‘5MW_Land_BD_Linear.1.lin’,‘5MW_Land_BD_Linear.2.lin’);

Can I get some help.

Dear Dhaneesh,

FileNames is a required argument to fx_getMats. Specify a single file in quotes, e.g., FileNames = ‘5MW_Land_BD_Linear.1.lin’. If you want to specify multiple files, use a cell array, e.g., FileNames = { ‘5MW_Land_BD_Linear.1.lin’, ‘5MW_Land_BD_Linear.2.lin’ }

Best regards,

Sir,

From beginning I was using cell array to define FileNames in fx_getMats. Eventhough I was getting the same error. I am attaching the matlab scripts fx_getMats and fx_mbc3. Can I know where I was wrong.
fx_mbc3.docx (16.2 KB)
fx_getMats.docx (16.2 KB)

Dear Dhaneesh,

I haven’t looked at your MATLAB scripts, but after downloading the master branch of the MATLAB toolbox, the only thing that you should need to change is the one line in ReadFASTLinear.m that I indicated in my Apr 22. 2020 post above. I was able to run fx_mbc3.m using the OpenFAST linearization output files you attached in your Apr 22, 2020 post above with this one line change to ReadFASTLinear.m.

Best regards,

Sir,

Thank you for your quick reply and sorry to bother you this many times on same topic. Earlier I made all changes showed in pull request to my matlab scripts and tried to run mbc then I got error(Not enough input arguments) and error in line 41 of mbc. After seeing your last reply I only changed that 66 line in ReadFASTlinear.m and tried running mbc. Eventhough I was getting same error. And I haven’t made any changes in matlab scripts.

Thank you.
ReadFASTLinear.docx (12.5 KB)
fx_mbc3.docx (16.2 KB)
fx_getMats.docx (14.8 KB)