MCrunch findings and feature request

Dear Marshall,
I’m using MCrunch for some post-processing; I found something that could be errata and would like to point it out to help the development…

  • use of variable for me is recognized correctly only using the syntax $VarName$ instead of $VarName the one suggested in the manual
  • line 65 in GenBins.m should be if ( WrBinsXLS) instead of if ( WrBinsTxt )

I would like to save an “augmented” FAST.out file containing original+calculated channels.
Does this feature already exist and I’m not aware of? or otherwise I’ll write a couple of line of code :smiley:

As usual …thank you so much for the effort you guys put in the development of the software.

Cheers,
Stefano

Hi,
here some basic code I use to export a FAST.out file with addition of post-processing calculated channel

in MCrunch.m : add the following lines after the call to ReadManyFiles

DoExportCC = 1;
if ( DoExportCC )
    WriteManyFiles( FileList, TitleLine, NamesLine, UnitsLine, FirstDataLine);
end 

create the function WriteManyFiles.m with the following code (this by default save the data in an output file with extension .outp )

function WriteManyFiles( FileList, TitleLine, NamesLine, UnitsLine, FirstDataLine )
%WRITEMANYFILES Summary of this function goes here
%   Detailed explanation goes here
    
    global FileInfo

    % Estimate the number of lines in all the files.

    NumFiles = int16( size( FileList, 1 ) );
   
    for File=1:NumFiles
        
        FileNameOut = strrep(FileList{File},'.out','.outp');
        
        Data = FileInfo.Time(FileInfo.StartLine(File):FileInfo.StartLine(File)+FileInfo.NumLines(File)-1,:);
        
        
        fid = fopen(FileNameOut,'w');
        fprintf(fid,'%s',FileInfo.Title{File});
        
        for Wi=1:NamesLine
            fprintf(fid,'\n');
        end
            % Print Names    
            
        for Ni=1:size( FileInfo.Names,2)
            fprintf(fid,'%8s\t',FileInfo.Names{Ni});
        end
        fprintf(fid,'\n');
        
            % Print Units
            
        for Ui=1:size( FileInfo.Units,2)
            fprintf(fid,'%8s\t',FileInfo.Units{Ui});
        end
        fprintf(fid,'\n');
       
        fclose(fid);
       
        dlmwrite(FileNameOut, Data, '-append', 'delimiter', '\t', 'precision', '%1.3e');
        
    end
 
end

for sure could be optimized, but yet is something :slight_smile:

cheers
Stefano

Ops,
I forgot to mention, DoExportCC is a place holder for flag eventually implemented by NREL in the future

also, if you post process a large number of file and want to export calculated channels, keep in mind that dlmwrite is really time consuming…

happy coding
stefano

Stefano,

Thanks for the great feedback.

The user’s guide is out of date. We found that the $Var caused problems and had to change it to $Var$. We will update the documentation when we get back to working on MCrunch. We are almost done with the first release of MLife and may be able to address your issues then.

Writing out the modified input is still on the list of things to do. You can use Crunch or GenStats to do that now.

Marshall