Problem reading binary output file

Dear all,

After running a simulation with OpenFAST, I tried to read the binary output file I had requested. To do that, I used the function readFASTbinary provided in the Matlab toolbox. However, I got an error. To check if it was the file I had obtained, I checked the function with one of the .outb files provided: ‘5MW_Land_BD_DLL_WTurb.outb’. The problem appeared again: “Could not read entire 5MW_Land_BD_DLL_WTurb.outb file: read 0 of 1260063 values”.

I checked the code on the function line by line and at first it appeared to run correctly, since I obtained the FIleID, number of channels and of time steps, and the first time and time increment. However, after getting the channel slopes and offsets, I couldn’t get the description, units nor names of the channels. I checked with Python and noticed that ‘LenDesc’ should be read right after ‘TimeIncr’ since the description starts a few positions after. I tried on Matlab skipping ‘ColScl’ and ‘ColOff’ and I managed to get the description, units and channel names. The rest of the function didn’t work.

In summary, with this code the function didn’t work:

[code]
FileID = fread( fid, 1, ‘int16’,machinefmt); % FAST output file format, INT(2)

NumOutChans  = fread( fid, 1, 'int32',machinefmt);             % The number of output channels, INT(4)
NT           = fread( fid, 1, 'int32',machinefmt);             % The number of time steps, INT(4)

if FileID == FileFmtID.WithTime
    TimeScl  = fread( fid, 1, 'float64',machinefmt);           % The time slopes for scaling, REAL(8)
    TimeOff  = fread( fid, 1, 'float64',machinefmt);           % The time offsets for scaling, REAL(8)
else
    TimeOut1 = fread( fid, 1, 'float64',machinefmt);           % The first time in the time series, REAL(8)
    TimeIncr = fread( fid, 1, 'float64',machinefmt);           % The time increment, REAL(8)
end

ColScl       = fread( fid, NumOutChans, 'float32',machinefmt); % The channel slopes for scaling, REAL(4)
ColOff       = fread( fid, NumOutChans, 'float32',machinefmt); % The channel offsets for scaling, REAL(4)

LenDesc      = fread( fid, 1,           'int32',machinefmt );  % The number of characters in the description string, INT(4)
DescStrASCII = fread( fid, LenDesc,     'uint8',machinefmt );  % DescStr converted to ASCII
DescStr      = char( DescStrASCII' );                     

if FileID == FileFmtID.ChanLen
    LenName = 15;
    LenUnit = LenName;
end

ChanName = cell(NumOutChans+1,1);                   % initialize the ChanName cell array
for iChan = 1:NumOutChans+1 
    ChanNameASCII = fread( fid, LenName, 'uint8',machinefmt ); % ChanName converted to numeric ASCII
    ChanName{iChan}= strtrim( char(ChanNameASCII') );
end

ChanUnit = cell(NumOutChans+1,1);                   % initialize the ChanUnit cell array
for iChan = 1:NumOutChans+1
    ChanUnitASCII = fread( fid, LenUnit, 'uint8',machinefmt ); % ChanUnit converted to numeric ASCII
    ChanUnit{iChan}= strtrim( char(ChanUnitASCII') );
end
[/code]

I couldn’t even get the description of the file. Just by skipping reading ‘ColScl’ and ‘ColOff’, I got the description, units and channels.

Has something changed in the structure of the binary output files? Is the function wrong? Or am I doing something wrong?

Thank you,

Rubén González

Dear Ruben,

Are you outputting the binary file with OutFileFmt=2? The readFASTbinary script provided in the MATLAB Toolbox should be able to read this file type without problem.

In OpenFAST, a different binary file type is available by specifying OutFileFmt=0. This is really an undocumented feature for use in the regression tests (r-tests). I can see the readFASTbinary script having trouble reading this type of binary output file.

Best regards,

Dear Jason,

That was exactly the problem, I didn’t check properly the ‘.fst’ file. It works completely fine now. I will be much cautious the next time.

Thank you very much for your attention and the prompt answer.

Best regards,

Rubén González

Dear Rubén,

I’m glad that solved the problem. I’ve now raised this issue on OpenFAST: github.com/OpenFAST/openfast/issues/331.

Best regards,