Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error running ROSCO in Simulink for IEA-15-240-RWT-UMaineSemi Model with Version 2.6.0 #398

Closed
dorsamgh opened this issue Nov 26, 2024 · 3 comments

Comments

@dorsamgh
Copy link

dorsamgh commented Nov 26, 2024

Hello, hope you all doing well.
I want to run ROSCO in Simulink for the IEA-15-240-RWT-UMaineSemi wind turbine model. However, I have encountered the same issue as mentioned in this link(#172). None of the suggested solutions have worked for me. If possible, please guide me.
I am using ROSCO version 2.6.0.

runFAST.m code:

`%% runFAST.m
% This script will run a single FAST simulation with the ROSCO Simulink
% controller. A more in depth version can be found at https://github.com/dzalkind/matlab-toolbox/tree/master/Simulations

clear;
clc;

[this_dir,,] = fileparts(mfilename('fullpath'));

% Compile FAST for use with simulink & mex using openfast docs
fast.FAST_SFuncDir = 'C:\Users\dmahd\Desktop\test5\IEA-15-240-RWT-UMaineSemi'; %%%% NEED FOR SIMULINK
fast.FAST_InputFile = 'IEA-15-240-RWT-UMaineSemi.fst'; % FAST input file (ext=.fst)
fast.FAST_directory = 'C:\Users\dmahd\Desktop\test5\IEA-15-240-RWT-UMaineSemi'; % Path to fst directory files

% Simulink Parameters
% Model
simu.SimModel = fullfile(this_dir,'Simulink','ROSCO');

% Script for loading parameters
simu.ParamScript = fullfile(this_dir,'Utilities','load_ROSCO_params');

%% Simulink Setup

[ControlScriptPath,ControScript] = fileparts(simu.ParamScript);
addpath(ControlScriptPath);
addpath(fast.FAST_SFuncDir);
addpath('Utilities')
%% Read FAST Files & Load ROSCO Params from DISCON.IN

[Param,Cx] = ReadWrite_FAST(fast);

% Simulation Parameters
simu.TMax = Param.FP.Val{contains(Param.FP.Label,'TMax')};
simu.dt = Param.FP.Val{contains(Param.FP.Label,'DT')};
[R,F] = feval(ControScript,Param,simu);

%% Premake OutList for Simulink

OutList = {'Time'};
OutList = [OutList;
Param.IWP.OutList;
Param.EDP.OutList;
Param.ADP.OutList;
Param.SvDP.OutList;
];

for iOut = 2:length(OutList)
OutList{iOut} = OutList{iOut}(2:end-1); %strip "s
end

%% Exectute FAST

% Using Simulink/S_Func
FAST_InputFileName = [fast.FAST_directory,filesep,fast.FAST_InputFile];
TMax = simu.TMax;

SimulinkModel = simu.SimModel;

Out = sim(SimulinkModel, 'StopTime', num2str(simu.TMax));
sigsOut = get(Out,'sigsOut'); %internal control signals

%% Get OutData

SFuncOutStr = '.SFunc';

% Try text first, then binary
[OutData,OutList] = ReadFASTtext([fast.FAST_directory,filesep,fast.FAST_InputFile(1:end-4),SFuncOutStr,'.out']);
if isempty(OutData)
[OutData,OutList] = ReadFASTbinary([fast.FAST_directory,filesep,fast.FAST_InputFile(1:end-4),SFuncOutStr,'.outb']);
end

% Dump data to structure
for i = 1:length(OutList)
simout.(OutList{i}) = OutData(:,i);
end

%% Plot
Pl_FastPlots(simout)`

outlist:

'Time'
'Wind1VelX'
'Azimuth'
'BldPitch1'
'GenSpeed'
'IPDefl1'
'LSSGagMya'
'LSSGagMza'
'OoPDefl1'
'PtfmSurge'
'PtfmSway'
'PtfmHeave'
'PtfmRoll'
'PtfmPitch'
'PtfmYaw'
'RootFxb1'
'RootFyb1'
'RootFzb1'
'RootMxb1'
'RootMyb1'
'RootMzb1'
'RootFxb2'
'RootFyb2'
'RootFzb2'
'RootMxb2'
'RootMyb2'
'RootMzb2'
'RootFxb3'
'RootFyb3'
'RootFzb3'
'RootMxb3'
'RootMyb3'
'RootMzb3'
'TipDxb1'
'TipDyb1'
'TipDxb2'
'TipDyb2'
'TipDxb3'
'TipDyb3'
'NcIMUTAxs'
'NcIMUTAys'
'NcIMUTAzs'
'YawBrTDxt'
'YawBrTDyt'
'RotSpeed'
'RotTorq'
'RotThrust'
'Spn2MLxb1'
'Spn2MLyb1'
'TwrBsFxt'
'TwrBsFyt'
'TwrBsFzt'
'TwrBsMxt'
'TwrBsMyt'
'TwrBsMzt'
'TTDspTwst'
'TwHt1TPxi'
'TwHt1TPyi'
'TwstDefl1'
'YawBrFxp'
'YawBrFyp'
'YawBrFzp'
'YawBrMxp'
'YawBrMyp'
'YawBrMzp'
'TwrBsFzt'
'NacYaw'
'NcIMURAYs'
'RootMyc1'
'RootMyc2'
'RootMyc3'
'RtAeroFxh'
'RtAeroFyh'
'RtAeroFzh'
'RtAeroMxh'
'RtAeroMyh'
'RtAeroMzh'
'RtVAvgxh'
'RtAeroCp'
'RtAeroCt'
'RtArea'
'RtSpeed'
'RtTSR'
'GenPwr'
'GenTq'
'Wave1Elev'
'FAIRTEN1'
'FAIRTEN2'
'FAIRTEN3'
'ANCHTEN1'
'ANCHTEN2'
'ANCHTEN3'
image
image

@dzalkind
Copy link
Collaborator

Hi,

We cannot at this time actively test and support the Matlab_Toolbox. The Simulink ROSCO controller is not up-to-date with the Fortran dynamic library.

Since Matlab/Simulink is widely used at universities and by control practitioners, we will leave the tools posted as a learning tool, but cannot help fix specific issues with the code. We will need to rely on the community for supporting this at this time.

Best, Dan

@dorsamgh
Copy link
Author

dorsamgh commented Nov 27, 2024

dear @dzalkind
I just want to run ROSCO in the Simulink environment with the tested 15 MW model. However, I encountered this error, which has also been discussed (link). I was hoping you could assist me in resolving these errors to achieve a successful run and obtain the output.

Additionally, I have a question: apart from the test case-related files that I have fully included from the downloaded folder, what other files need to be in the MATLAB path(sFunc for example)? I have included runFAST.m and the ROSCO model in MDL format. Is there any other file that I need to include?

@dzalkind
Copy link
Collaborator

I'm sorry, I can't assist you with MATLAB/Simulink issues at this time. I'd include the sFunc on the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants