Skip to content

Commit

Permalink
Resolve bugs (WEC-Sim#66)
Browse files Browse the repository at this point in the history
* fix reference to body.hydroForce in meanDrift

* fix references to h5File in Controls applications

* fix simu.cicEndTime definition in WECCCOMP MPC wecSimInputFile.m

* update test to run mostIO after the regression test

* re-add turbsim to MOST test setup
  • Loading branch information
akeeste authored Sep 11, 2024
1 parent 34e61e7 commit 82e9830
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Controls/Declutching/optimalTimeCalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
waves.period = 3.5;

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

% Define wave conditions
H = waves.height;
Expand Down
2 changes: 1 addition & 1 deletion Controls/Latching/optimalTimeCalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
waves.period = 9.6664;

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

% Define wave conditions
H = waves.height;
Expand Down
2 changes: 1 addition & 1 deletion Controls/MPC/plotFreqDep.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
waves.period = 9.52;

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

% Define the intrinsic mechanical impedance for the device
mass = simu.rho*hydro.properties.volume;
Expand Down
2 changes: 1 addition & 1 deletion Controls/MPC/setupMPC.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% This method sets up the variables to run model predictive control

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

disp('setting up MPC')

Expand Down
2 changes: 1 addition & 1 deletion Controls/Passive (P)/optimalGainCalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
waves.period = 9.6664; % One of periods from BEM

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

% Define wave conditions
H = waves.height;
Expand Down
2 changes: 1 addition & 1 deletion Controls/Reactive (PI)/optimalGainCalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
waves.period = 9.6664;

% Load hydrodynamic data for float from BEM
hydro = readBEMIOH5(body.h5File, 1, body.meanDrift);
hydro = readBEMIOH5(body.h5File{1}, 1, body.meanDrift);

% Define wave conditions
H = waves.height;
Expand Down
20 changes: 13 additions & 7 deletions MOST/tests/TestMOST.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ function runBEMIO(testCase)
end
cd(testCase.testDir)
end
function runMOSTIO(testCase)
cd(testCase.mostDataDir);
if isfile(testCase.turbSimName)
fprintf('runMOSTIO skipped, turbSim/*.mat already exists\n');
else
mostIO
end
function runTurbSim(testCase)
% Only re-run turbSim before testing. The *.mat file is too
% large to commit to the repo.
cd(fullfile(testCase.mostDataDir,'turbSim'));
run_turbsim();
cd(testCase.testDir)
end
function runConstantTest(testCase)
Expand Down Expand Up @@ -201,5 +199,13 @@ function turbulent_windSpeed(testCase)
fprintf(['Wind speed, Diff = ' ...
num2str(max(abs(org-new))) '\n']);
end

function runMOSTIO(testCase)
% Test the pre-processing here so that it does not interfere
% with the precise comparison of results.
cd(testCase.mostDataDir);
mostIO
cd(testCase.testDir)
end
end
end
2 changes: 1 addition & 1 deletion Mean_Drift/WECSim/userDefinedFunctions.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
inds = find(output.wave.time >= simu.rampTime + waves.period*5);
%%
surgeMeanDriftTH = body.hydroForce.fExt.md(1)*waves.amplitude^2;
surgeMeanDriftTH = body.hydroForce.hf1.fExt.md(1)*waves.amplitude^2;
surgeMeanDriftWS = mean(output.bodies.forceExcitation(inds,1));
%%
close all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
case { 2, 5 }; simu.endTime = 150 + simu.rampTime;
case { 3, 6 }; simu.endTime = 200 + simu.rampTime;
end
simu.cicEndTime = []; % Convolution Time [s]
simu.cicEndTime = 2; % Convolution Time [s]
simu.explorer = 'off'; % Explorer on
simu.solver = 'ode8'; % Turn on ode45
simu.domainSize = 5;
Expand Down

0 comments on commit 82e9830

Please sign in to comment.