Skip to content

Commit 82e9830

Browse files
authored
Resolve bugs (#66)
* 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
1 parent 34e61e7 commit 82e9830

9 files changed

Lines changed: 21 additions & 15 deletions

File tree

Controls/Declutching/optimalTimeCalc.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
waves.period = 3.5;
1212

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

1616
% Define wave conditions
1717
H = waves.height;

Controls/Latching/optimalTimeCalc.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
waves.period = 9.6664;
1212

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

1616
% Define wave conditions
1717
H = waves.height;

Controls/MPC/plotFreqDep.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
waves.period = 9.52;
88

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

1212
% Define the intrinsic mechanical impedance for the device
1313
mass = simu.rho*hydro.properties.volume;

Controls/MPC/setupMPC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% This method sets up the variables to run model predictive control
22

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

66
disp('setting up MPC')
77

Controls/Passive (P)/optimalGainCalc.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
waves.period = 9.6664; % One of periods from BEM
1212

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

1616
% Define wave conditions
1717
H = waves.height;

Controls/Reactive (PI)/optimalGainCalc.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
waves.period = 9.6664;
1010

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

1414
% Define wave conditions
1515
H = waves.height;

MOST/tests/TestMOST.m

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ function runBEMIO(testCase)
4242
end
4343
cd(testCase.testDir)
4444
end
45-
function runMOSTIO(testCase)
46-
cd(testCase.mostDataDir);
47-
if isfile(testCase.turbSimName)
48-
fprintf('runMOSTIO skipped, turbSim/*.mat already exists\n');
49-
else
50-
mostIO
51-
end
45+
function runTurbSim(testCase)
46+
% Only re-run turbSim before testing. The *.mat file is too
47+
% large to commit to the repo.
48+
cd(fullfile(testCase.mostDataDir,'turbSim'));
49+
run_turbsim();
5250
cd(testCase.testDir)
5351
end
5452
function runConstantTest(testCase)
@@ -201,5 +199,13 @@ function turbulent_windSpeed(testCase)
201199
fprintf(['Wind speed, Diff = ' ...
202200
num2str(max(abs(org-new))) '\n']);
203201
end
202+
203+
function runMOSTIO(testCase)
204+
% Test the pre-processing here so that it does not interfere
205+
% with the precise comparison of results.
206+
cd(testCase.mostDataDir);
207+
mostIO
208+
cd(testCase.testDir)
209+
end
204210
end
205211
end

Mean_Drift/WECSim/userDefinedFunctions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
inds = find(output.wave.time >= simu.rampTime + waves.period*5);
22
%%
3-
surgeMeanDriftTH = body.hydroForce.fExt.md(1)*waves.amplitude^2;
3+
surgeMeanDriftTH = body.hydroForce.hf1.fExt.md(1)*waves.amplitude^2;
44
surgeMeanDriftWS = mean(output.bodies.forceExcitation(inds,1));
55
%%
66
close all

WECCCOMP/WECCCOMP_Nonlinear_Model_Predictive/wecSimInputFile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
case { 2, 5 }; simu.endTime = 150 + simu.rampTime;
2222
case { 3, 6 }; simu.endTime = 200 + simu.rampTime;
2323
end
24-
simu.cicEndTime = []; % Convolution Time [s]
24+
simu.cicEndTime = 2; % Convolution Time [s]
2525
simu.explorer = 'off'; % Explorer on
2626
simu.solver = 'ode8'; % Turn on ode45
2727
simu.domainSize = 5;

0 commit comments

Comments
 (0)