Processing OpenFast linearization output

Dear Dhaneesh,

How are you calling fx_mb3.m? I would expect it to look something like:

[code]>> [MBC] = fx_mbc3( ‘5MW_Land_BD_Linear.1.lin’ )

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

Rotating channel “ED BldPitch1, (deg)” does not form a unique blade triplet. Blade(s) not found: 2 3

Multi-Blade Coordinate transformation completed

MBC =

struct with fields:

             DescStates: {194×1 cell}
                  ndof2: 97
                  ndof1: 0
           RotSpeed_rpm: 12.0991
performedTransformation: 1
                      A: [194×194 double]
                      B: [194×6 double]
                      C: [60×194 double]
                      D: [60×6 double]
                   AvgA: [194×194 double]
                 eigSol: [1×1 struct]
                   AvgB: [194×6 double]
                   AvgC: [60×194 double]
                   AvgD: [60×6 double][/code]

Best regards,

Sir,

It worked. I think the problem was in issuing the command in Matlab window. Because I was following an outdated procedure for executing MBC3 mentioned in (github.com/OpenFAST/matlab-tool … s/MBC3.pdf).

 1.  In MBC generated output the MBC transformed mass and stiffness matrices are not generated. Can I Know how to get them in MBC output ?

 2.  I am interested in cce generated eigen-results. So when I tried to run eiganalysis script I got the error

[MBC] = eiganalysis(‘5MW_Land_DLL_WTurb.1.lin’,‘5MW_Land_DLL_WTurb.2.lin’)
Error using eiganalysis (line 26)
**ERROR: the state-space matrix is not a square matrix.

But the state-space matrix I got in output file was a square matrix.
I think I was issuing the command in wrong way. Can I know the correct procedure ?

Thank you.

Dear Dhaneesh,

The linearization functionality of OpenFAST does not export the mass and stiffness matrices directly. The presence of mass and stiffness matrices would require that all states be second order, but the OpenFAST linearization functionality supports states in both first and second order. So instead of mass and stiffness, the OpenFAST linearization generates the first-order state matrix, A. If all states were second order, the state matrix would likely look something like the following, and so, contain the same information:

A = [ [ 0, I ]; [ -M^-1K, -M^-1C ] ]

where:
0 = Zero matrix
I = Identity matrix
M = Mass matrix
K = Stiffness matrix
C = Damping matrix
M^-1 = The inverse of the mass matrix

If you look at the Eigenalysis.m script, you’ll see that it expects the first argument to be the state matrix, A, not a filename.

The CCE script is no longer supported. I would not recommend that you use it anyway, because performing an eigenanalysis on state matrices that are averaged without first applying the MBC transform, will not result in a meaningful eigensolution.

Best regards,

Sir,

Whether the natural frequencies obtained in eigsol of MBC output are the complete frequencies obtained in eigenanalysis of wind turbine ? or are there any AvgNaturalFrequencies like cce generated eigvalues as old version. Because when I tried with syntax command [mbc] = eiganalysis(A, ndof2, ndof1) It was showing an error printing ( undefined function or variable A ). If MBC output frequencies are not the complete natural frequencies then how can I get complete system frequencies.

Thank you.

Dear Dhaneesh,

fx_mbc3.m already calls eigenanalysis.m; there is no need to call eigenanalysis.m separately. All you need to do is run fx_mbc3.m.

Assuming you’ve called fx_mbc3.m as follows:

[MBC] = fx_mbc3( '5MW_Land_BD_Linear.1.lin' )

the eigensolution is stored in the MATLAB structure, MBC.eigSol, e.g., the full-system natural frequencies in Hz are contained in MBC.eigSol.NaturalFreqs_Hz.

Best regards,

Hi Jason,

the fix solved my problem. Thank you.

Best regards,
Simon

Sir,

Was the pull request 350 (for linearization of offshore wind turbine ) included in dev branch of openfast? If it is included where I can download reg-test and openfast binaries for modified source code.

Thank you.

Dear Dhaneesh,

Not yet, and I’m not sure why it is taking so long (likely key staff are just busy). Regardless, you can access the branch of OpenFAST that includes the new offshore linearization capability through the links found here: github.com/OpenFAST/openfast/pull/350.

Best regards,

Dear Jason,

I am interested in using the runCampbell matlab script you mentioned on this forum to run OpenFAST with linearization. I pulled the source code for the matlab-toolbox from github. I found that the runCampbell script requires InflowWind.dat, ServoDyn.dat, and ElastoDyn.dat files template files but they are missing on the github. I have reported this on the github but there is still no reply. I would like to know if I can generate those template files using one of the examples available in the r-tests. Can you please let me know how to generate these template files?

Thank you,
Srinivasa

Dear Srinivasa,

Yes, the runCampbell.m script runs OpenFAST multiple times, and so, it expects standard InflowWind, ServoDyn, ElastoDyn, etc. input files to exist. Templates for these files can be obtained from the OpenFAST regression tests (r-test) suite: github.com/OpenFAST/r-test. The InflowWind file is assumed to use WindType = 1 and the ServoDyn file is assumed to use PCMode = 0, VSContrl = 1, HSSBrMode = 0, and YCMode = 0.

Best regards,

Dear Jason,

Thanks for your reply. Based on your suggestion, I used the InflowWind, ServoDyn and ElastDyn dat files from the 5MW_OC4Semi_Linear case available on github. I had run this case previously with VSContrl=1 which is the default and it runs fine. But when I run openfast with the 5MW_OC4Semi_Linear inputs by changing VSContrl = 0 from VSContrl = 1 as you suggested the simulation fails with the following output. I believe some other inputs also needed to be changed when I use VSContrl. Can you please let me know how to resolve this issue?

FAST_InitializeAll:SrvD_Init:ValidatePrimaryData:VS_Rgn2K*VS_RtGnSp^2 must not be greater than
VS_RtTq.

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

Regards,
Srinivasa

Dear Srinivasa,

This error results from using VSContrl = 1, but not setting appropriate values for VS_RtGnSp, VS_RtTq, VS_Rgn2K, and VS_SlPc.

Normally it is recommend to use a constant generator torque during the linearization process, as described in the “Linearization” section of the old FAST User’s Guide: nwtc.nrel.gov/system/files/FAST.pdf. To summarize, to set constant torque in ServoDyn, it is easiest to set VSContrl = 1, VS_RtTq = the constant torque you want in Nm (e.g., 43093.55 Nm is the rated generator torque of the NREL 5-MW turbine) and VS_RtGnSp = VS_Rgn2K = VS_SlPc = some small number greater than zero, e.g., 0.001.

I hope that helps.

Best regards,

Dear Jason,

Indeed your suggestion helped me in resolving the problem with VSContrl=1. This is a slightly different question. I see there is no difference in the .lin output file generated while using VSContrl=1 or VSContrl=0. Do you expect any difference in results?

Going back to my original question of using the runCampbell script. I am still unable to make the script run even after using the *.dat files from 5MW_OC4Semi_Linear case. I get several errors about missing parameters (see below) in Matlab. I guess the template files should be containing these parameters which the script wants to replace with some actual values. Is there anything you could suggest to resolve these multiple problems with the runCampbell script?

Parameter CalcSteady not found; adding it to data structure.
Parameter TrimCase not found; adding it to data structure.
Parameter TrimGain not found; adding it to data structure.
Parameter TrimTol not found; adding it to data structure.
Parameter Twr_Kdmp not found; adding it to data structure.
Parameter Bld_Kdmp not found; adding it to data structure.

Best Regards,
Srinivasa

Dear Srinivasa,

With VSContrl = 0, a generator model (GenModel) is used instead of a variable-speed torque controller. Perhaps the generator model settings you are using are giving similar results to the variable-speed torque controller model settings you are using.

The updated version of OpenFAST in with the linearization and mode shape visualization capability (github.com/OpenFAST/openfast/pull/373) includes a change to the input files. In particular, the OpenFAST primary (*.fst) file has changed. The OpenFAST r-test will be updated once the OpenFAST pull-request has been merged in.

Included in the pull request, is a link to updated input files. In particular, an example updated OpenFAST primary input file is available here: github.com/bjonkman/r-test/blob … Shapes.fst.

Best regards,

Dear Jason,

I am confused with the different github branches of OpenFAST and r-tests. It is not very clear which OpeFAST branch and which r-test can be used with runCampbell script available in the matlab-toolbox. I have tried your suggestions to use runCampbell script and run linearization for the 5MW_OC4Semi_Linear case. But I am still unable (error while trying to read NLinTimes.) to run it as I found that OpenFAST code, which you suggested, from github.com/OpenFAST/openfast/pull/350 but this does not include the mode shape visualization features and the parameters (CalcSteady, TrimCase, TrimGain, TrimTol, Twr_Kdmp, and Bld_Kdmp) used in runCampbell script. To my understanding it is not possible to use runCampbell script without merging the two branches (350 and 373) to run the 5MW_OC4Semi_Linear case. I think it could be really helpful if these two branches can be merged into the dev branch. Please correct me if I am wrong.

Also I tried running the case 5MW_Land_ModeShapes using the code from github.com/OpenFAST/openfast/pull/373 but the simulation fails (see below for the errors).

FAST_InitializeAll:FAST_Init:FAST_ReadPrimaryFile:Invalid numerical input for file
“5MW_Land_ModeShapes/5MW_Land_ModeShapes.fst” occurred while trying to read NLinTimes.

Best Regards,
Srinivasa

Dear Srinivasa,

Yes, I agree. These linearization capabilities of floating offshore functionality and for trim/mode shape visualization were developed in separately funded projects, which is why they are in separate branches, but I agree that these branches need to be reviewed and merged. I’m not sure what the hold up is to review and merge these branches, but it is likely related to the fact that it is a lot of work to do so.

Please note that using unmerged forks and branches of OpenFAST will in general be more difficult than using the more robust and stable master branch, or even the dev branch, of OpenFAST.

You are using the input file 5MW_Land_ModeShapes.fst from here: github.com/bjonkman/r-test/blob … Shapes.fst? I would expect this to run using the runCampbell.m script together with the compiled source code from pull request 373. Did you change the files in some way? You can always enable the “Echo” option from the primary input file to debug problems in the input-file processing.

Best regards,

Dear Jason,

Yes I have used the same input file as you suggested. I have made no changed to any input files. Also, the “Echo” option is true.

I think previously there was some problem switching between the dev and the pr373 branches. So I tried again compiling the openfast sources from pull request 373 (the compilation took more time, almost 3 hours, compared to the openfast dev branch. gfortran version above 5 is required to compile the code unlike the code in the dev branch). This time I am able to run the 5MW_Land_ModeShapes case with the runCampbell script but I got errors (see below) related to the postprocessing data in the campbell_diagram_data function. Can you please confirm if you have run this case with the matlab script without any problems? If so could you be able share your matlab-toolbox code?

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

Rotating channel “ED OoPDefl1, (m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED IPDefl1, (m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED TwstDefl1, (deg)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED BldPitch1, (deg)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED Spn2MLxb1, (kN-m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED Spn2MLyb1, (kN-m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootFxb1, (kN)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootFyb1, (kN)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootFzb1, (kN)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootMxb1, (kN-m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootMyb1, (kN-m)” does not form a unique blade triplet. Blade(s) not found: 2 3
Rotating channel “ED RootMzb1, (kN-m)” does not form a unique blade triplet. Blade(s) not found: 2 3

Multi-Blade Coordinate transformation completed
Error: File: campbell_diagram_data.m Line: 131 Column: 16
Creating a string using double quotes is not supported. Use the string function.

Error in runCampbell (line 206)
[CampbellData{i_case}] = campbell_diagram_data(MBC_data{i_case}, BladeLen, TowerLen, ,
strrep(newFSTName,‘.fst’,‘.MBD.sum’));

-------------End----------------

Thank you,
Srinivasa

Dear Srinivasa,

Yes, the runCampbell.m script runs on our end. Are you using the master branch of the MATLAB-Toolbox? Did you change the source code in some way? According to your error message, the following line of code:

[CampbellData{i_case}] = campbell_diagram_data(MBC_data{i_case}, BladeLen, TowerLen, [], strrep(newFSTName,'.fst','.MBD.sum'));

is on line 206, but in the master branch of the MATLAB-Toolbox, this is line 184. So, I’m confused.

Best regards,

Dear Jason,

Yes I am using the master branch of the MATLAB-Toolbox and yes I had to make few changes to the runCampbell script to make it use the dat files for the 5MW_Land_ModeShapes case as the master branch does not have the template dat files which I already mentioned here in the forum. There are a few other changes like reducing the size of arrays like WindSpeedAry =[3, 4, 5]; %(m/sec). Please see below the runCampbell code for your reference (I am sorry for the spamming this post with the matlab code as I had a problem attaching the txt file). I guess the script that you have on your end may be different from the script on the master branch because if you look at line number 184 in runCampbell script the number of arguments is 5 while the function campbell_diagram_data accepts only 4 arguments. I tried to change this in the script but I get new errors with xlswrite function.

I noticed the code to the function CampbellMatchModeNames used in runCampbell is missing. There are also parts of the code (like the copy command at line 180 and xlswrite, which does not work on Mac OS) that are OS-dependent. I think this script has not been carefully tested before committing to the github repository. Please correct me if I am wrong.

Thank you,
Srinivasa

------runCampbell.m------

%
% by Bonnie Jonkman
% (c) 2016 National Renewable Energy Laboratory
% (c) 2018 Envision Energy, USA
%--------------------------------------------------------------------------

%% let's get the directory that contains the template files
templateDir = [ '..\..\ConvertFASTversions\TemplateFiles'];

% IfWtemplate  = [templateDir filesep 'InflowWind.dat'];
% SrvDtemplate = [templateDir filesep 'ServoDyn.dat'];
% EDtemplate   = [templateDir filesep 'ElastoDyn.dat']; 
% FASTtemplate = [templateDir filesep 'OpenFAST.dat']; 
% 
% VizTemplate = [templateDir filesep 'OpenFAST-Modes.viz'];
% WriteVTKmodes = true;
% WriteFASTfiles = true;

IfWtemplate  = ['MYPATH/TemplateFiles/NRELOffshrBsline5MW_InflowWind_Steady13mps.dat'];
SrvDtemplate = ['MYPATH/TemplateFiles/NRELOffshrBsline5MW_Onshore_ServoDyn.dat'];
EDtemplate   = ['MYPATH/TemplateFiles/NRELOffshrBsline5MW_Onshore_ElastoDyn.dat']; 

FASTtemplate = 'MYPATH/TemplateFiles/OpenFAST.dat';
Viztemplate = 'MYPATH/TemplateFiles/OpenFAST-Modes.viz';
%VizTemplate = [templateDir filesep 'OpenFAST-Modes.viz'];
WriteVTKmodes = true;
WriteFASTfiles = true;

WriteVTKmodes = false;
WriteFASTfiles = true;

%% Executable and base file:       
% FASTexe = '..\..\bin\openFAST_Win32.exe';
% FSTName = 'OpenFAST.fst';
% 
% VizFile = 'OpenFAST-Modes.viz';

FASTexe = 'MYPATHTPOF/OpenFAST/OpenFAST-373/build/bin/openfast';
%FSTName = 'OpenFAST.fst';
FSTName = 'MYPATHTOINPUT/OpenFAST/5MW_Land_ModeShapes/5MW_Land_ModeShapes.fst';
VizFile = 'OpenFAST-Modes.viz';

%----------------------------------------------------------------------
%% Read data from original files (for modification):
[oldDir, baseName, ext ] = fileparts(FSTName);
if strcmp(oldDir,filesep)
    oldDir = ['.' filesep];
end

XLSname = [baseName '-CampbellData.xlsx']; % name for spreadsheet to write

FP = FAST2Matlab(FSTName,2); %FP are Fast Parameters, specify 2 lines of header (FAST 8)

[IfWP, InflowFile] = GetFASTPar_Subfile(FP, 'InflowFile', oldDir, oldDir);
[SrvP, ServoFile]  = GetFASTPar_Subfile(FP, 'ServoFile',  oldDir, oldDir);
[EP, EDFile] = GetFASTPar_Subfile(FP, 'EDFile', oldDir, oldDir);

CompElast = GetFASTPar(FP, 'CompElast');
CompInflow = GetFASTPar(FP, 'CompInflow');
CompServo = GetFASTPar(FP, 'CompServo');
CompAero = GetFASTPar(FP, 'CompAero');

TipRad = GetFASTPar(EP, 'TipRad');
HubRad = GetFASTPar(EP, 'HubRad');
BladeLen  = TipRad - HubRad;
TowerLen = GetFASTPar(EP, 'TowerHt');


if WriteVTKmodes
    VizP = FAST2Matlab(VizFile,2);
    WrVTK = 3;
else
    WrVTK = 0;
end

%----------------------------------------------------------------------
%% modify data, write new files (if necessary), and run

% RotSpeedAry = 0:2:14; %10; %0:2:14; %rpm
% 
% 
% WindSpeedAry = [];
% CompInflow = 0;
% CompAero = 0;


%% ED 5MW values:
%WindSpeedAry =[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]; %(m/sec)
%RotSpeedAry = [6.972, 7.183, 7.506, 7.942, 8.469, 9.156, 10.296, 11.431, 11.89, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1, 12.1]; %(rpm)
%BldPitch1   = [0, 0, 0, 0, 0, 0, 0, 0, 0, 3.823, 6.602, 8.668, 10.45, 12.055, 13.536, 14.92, 16.226, 17.473, 18.699, 19.941, 21.177, 22.347, 23.469]; % (deg)
%GenTqAry    = [0.606, 2.58, 5.611, 9.686, 14.62, 20.174, 25.51, 31.455, 40.014, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094, 43.094]*1000; %(N-m)

WindSpeedAry =[3, 4, 5]; %(m/sec)
RotSpeedAry = [6.972, 7.183, 7.506]; %(rpm)
BldPitch1   = [0, 0, 0]; % (deg)
GenTqAry    = [0.606, 2.58, 5.611]*1000; %(N-m)

SimTime   = 5600; % time in seconds that the first linearization output will happen (maximum time to converge to steady-state solution)
RatedWindSpeed = 11.4;

%%
nPoints = max( length(RotSpeedAry), length(WindSpeedAry) );

FAST_linData = cell(nPoints,1); % raw data read from FAST's .lin files
getMatData   = cell(nPoints,1); % FAST .lin data converted to format that MBC can process
MBC_data     = cell(nPoints,1); % processed MBC3 data
CampbellData = cell(nPoints,1);

%%
for i_case = nPoints:-1:1

    if (CompAero > 0)
        wkSheetName = [ num2str(WindSpeedAry(i_case)), ' mps' ];        
    else
        wkSheetName = [ num2str(RotSpeedAry(i_case)), ' RPM' ];
    end
    if ( RotSpeedAry(i_case) == 0 )
        NLinTimes = 1;
    else
        NLinTimes = 36;
    end        
    
    %newFASTbase = [ baseName, '-', strrep(wkSheetName,' ','') ];
    newFASTbase = [ oldDir, '/', baseName, '-', strrep(wkSheetName,' ','') ];
    newFSTName = [ newFASTbase ext ];
    FileNames = strcat( strrep(newFSTName, '.fst','.'), strrep( cellstr(num2str( (1:NLinTimes)' )), ' ', ''), '.lin' );
        
        
    if WriteFASTfiles
        if (WindSpeedAry(i_case) > RatedWindSpeed && CompAero > 0)
            GenTq    = 43094;
            TrimCase = 3;
%             TrimGain = .1 / (RotSpeedAry(i_case) * pi/30); %-> convert RotSpeed to rad/s
%             TrimGain = TrimGain*0.1
            TrimGain = 0.001;
        else
            GenTq = GenTqAry(i_case);        
            TrimCase = 2;
%             TrimGain = 3340 / (RotSpeedAry(i_case) * pi/30); %-> convert RotSpeed to rad/s
            TrimGain = 300;
        end

        
        % InflowWind
        if CompInflow > 0
            IfWP_mod = SetFASTPar(IfWP,'HWindSpeed',WindSpeedAry(i_case));      
            Matlab2FAST(IfWP_mod,IfWtemplate,  InflowFile, 2); %contains 2 header lines
        end

        
        % ServoDyn
        if CompServo > 0 
            SrvP_mod = SetFASTPar(SrvP,'VS_RtTq',GenTq);
            Matlab2FAST(SrvP_mod,SrvDtemplate, ServoFile,  2); %contains 2 header lines
        end
        
        
        % ElastoDyn
        EP_mod   = SetFASTPar(EP, 'RotSpeed',RotSpeedAry(i_case));

        if CompInflow > 0
            EP_mod   = SetFASTPar(EP_mod,'BlPitch(1)',BldPitch1(i_case));       
            EP_mod   = SetFASTPar(EP_mod,'BlPitch(2)',BldPitch1(i_case));       
            EP_mod   = SetFASTPar(EP_mod,'BlPitch(3)',BldPitch1(i_case));
        end

        Matlab2FAST(EP_mod, EDtemplate, EDFile,    2); %contains 2 header lines
        
        FP_mod = SetFASTPar(FP,'TMax',SimTime);
        FP_mod = SetFASTPar(FP_mod,'Linearize','true');
        FP_mod = SetFASTPar(FP_mod,'CalcSteady','true');
        FP_mod = SetFASTPar(FP_mod,'NLinTimes',NLinTimes);
        FP_mod = SetFASTPar(FP_mod,'TrimCase', TrimCase);
        FP_mod = SetFASTPar(FP_mod,'TrimGain', TrimGain); 
        FP_mod = SetFASTPar(FP_mod,'TrimTol', 1e-3);
        FP_mod = SetFASTPar(FP_mod,'Twr_Kdmp', 0);
        FP_mod = SetFASTPar(FP_mod,'Bld_Kdmp', 0);
        FP_mod = SetFASTPar(FP_mod,'OutFmt','"ES20.12E3"'); % make sure we get enough digits of precision
        FP_mod = SetFASTPar(FP_mod,'WrVTK',WrVTK);
        Matlab2FAST(FP_mod,FASTtemplate, newFSTName, 2); %contains 2 header lines

            %% Run FAST with new input files
        status = system([FASTexe ' ' newFSTName]);
    
        if status ~= 0 % check that we have some output here
            break
        end
        
    end
    
    %% Analyze results from .lin files (azimuth average)

    if WriteVTKmodes
        ModesVizName = [newFASTbase '.ModeShapeVTK' ];
        [MBC_data{i_case}, getMatData{i_case}, FAST_linData{i_case}] = fx_mbc3( FileNames, ModesVizName ); 

        VizP = SetFASTPar(VizP,'CheckpointRoot',strrep(newFSTName,'.fst', '.ModeShapeVTK'));
        VizP = SetFASTPar(VizP,'MatlabFileName',ModesVizName);
        Matlab2FAST(VizP,VizTemplate, VizFile, 2); %contains 2 header lines
        
        system( [FASTexe ' -VTKLin ' VizFile]);
        system(['copy fort.51 ' strrep( newFSTName, '.fst','.viz.51' )]);
    else
        [MBC_data{i_case}, getMatData{i_case}, FAST_linData{i_case}] = fx_mbc3( FileNames ); 
    end
    [CampbellData{i_case}] = campbell_diagram_data(MBC_data{i_case}, BladeLen, TowerLen, [], strrep(newFSTName,'.fst','.MBD.sum'));       
    
    % write results at this RPM/WindSpeed to Excel worksheet
    try
        xlswrite(XLSname, CampbellData{i_case}.ModesTable, wkSheetName); % create a worksheet with these modes
    catch
        disp(['warning::could not write Campbell data in Excel worksheet for ' wkSheetName]);
    end
    

end


%%
% [modeID_table, modesDesc] = IdentifyModes(CampbellData);
[modeID_table, modesDesc] = CampbellMatchModeNames(CampbellData);

%%
opTable = cell(3,nPoints+1);
opTable{1,1} = 'Operating Points';
opTable{2,1} = 'Wind Speed (mps)';
opTable{3,1} = 'Rotor Speed (rpm)';
for i=1:nPoints
    opTable{2,i+1} = CampbellData{i}.WindSpeed;
    opTable{3,i+1} = CampbellData{i}.RotSpeed_rpm;
end

%%
thisTable = cell(length(modesDesc)+2,nPoints+1);
thisTable{1,1} = 'Mode Number Table';
if (CompAero > 0)
    thisTable{2,1} = 'Wind Speed (mps)';
    thisTable(2,2:end) = num2cell(WindSpeedAry);
    wkSheetName = 'WS_ModesID';
else
    thisTable{2,1} = 'Rotor Speed (rpm)';
    thisTable(2,2:end) = num2cell(RotSpeedAry);
    wkSheetName = 'ModesID';
end
%%
for i = 1:length(modesDesc)
    thisTable(i+2,1) = modesDesc(i);
end
thisTable(3:end,2:end) = num2cell(modeID_table);

try
    xlswrite(XLSname, thisTable, wkSheetName); % create a worksheet with these modes
    xlswrite(XLSname, opTable, 'OP'); % create a worksheet with these operating points
catch
    disp(['warning::could not write modes identification data in Excel worksheet for ' wkSheetName]);
end


%%
[num,txt,CampbellPlotData] = Plot_CampbellData(XLSname,wkSheetName);

Hi Srinivasa,

Feel free to edit your issue on github ([url]https://github.com/OpenFAST/matlab-toolbox/issues/18[/url]) and add some of the additional problem you encounter (such like the copy function which is OS dependent). I think the function campbell_diagram_data can be called without the 4th argument, which is optional, in which case the xls file is not written.

As you noticed, the script runCampbell is not a fully operational example, and most of the matlab functions were mostly used on windows. I have personally adapted and used a variation of this script (to avoid the xlswrite calls for instance) . As I mentioned in your github issue, we are working on streamlining the toolset to perform linearization. I’ll likely post a pull request in the coming week. If you can wait, you might find the updated version easier to use, and your feedback/testing will be great.

Otherwise, it seems you are really close to get everything running with the current version.

I hope that helps,

Emmanuel