diff --git a/.github/workflows/all-tests-reusable.yml b/.github/workflows/all-tests-reusable.yml index e71a33f2..eb544ab9 100644 --- a/.github/workflows/all-tests-reusable.yml +++ b/.github/workflows/all-tests-reusable.yml @@ -20,16 +20,16 @@ jobs: steps: - run: echo "Triggered by WEC-Sim commit ${{ fromJSON(inputs.client_payload).sha }}" - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: lfs: true ref: ${{ fromJSON(inputs.client_payload).branch }} - name: Install MATLAB - uses: matlab-actions/setup-matlab@v2 + uses: matlab-actions/setup-matlab@v3 with: release: R2024b - name: Get test target folder - uses: matlab-actions/run-command@v2 + uses: matlab-actions/run-command@v3 with: command: getTestTargets - name: Save output diff --git a/.github/workflows/changed-tests.yml b/.github/workflows/changed-tests.yml index 90826591..8e46d607 100644 --- a/.github/workflows/changed-tests.yml +++ b/.github/workflows/changed-tests.yml @@ -24,22 +24,22 @@ jobs: if: github.event_name != 'repository_dispatch' steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: lfs: true fetch-depth: 0 - name: Generate git diff - uses: GrantBirki/git-diff-action@v2 + uses: GrantBirki/git-diff-action@v3 id: git-diff-action with: json_diff_file_output: diff.json file_output_only: "true" - name: Install MATLAB - uses: matlab-actions/setup-matlab@v2 + uses: matlab-actions/setup-matlab@v3 with: - release: R2024a + release: R2024b - name: Get test target folder - uses: matlab-actions/run-command@v2 + uses: matlab-actions/run-command@v3 with: command: getTestTargets("diff.json") - name: Save output diff --git a/.github/workflows/run-tests-reusable.yml b/.github/workflows/run-tests-reusable.yml index ce6a373a..0a1b051f 100644 --- a/.github/workflows/run-tests-reusable.yml +++ b/.github/workflows/run-tests-reusable.yml @@ -29,18 +29,11 @@ jobs: os: [ubuntu-latest, windows-latest] release: [R2024b] include: ${{ fromJSON(inputs.include) }} - exclude: - - os: ubuntu-latest - folder: Mooring - - os: ubuntu-latest - folder: OWC - - os: ubuntu-latest - folder: Paraview_Visualization name: "${{ matrix.folder }} - ${{ matrix.os }} - ${{ matrix.release }}" timeout-minutes: 45 steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: lfs: true ref: ${{ inputs.head_ref }} @@ -48,14 +41,14 @@ jobs: - name: Checkout LFS objects run: git lfs checkout - name: Check out WEC-Sim - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: WEC-Sim/WEC-Sim ref: ${{ inputs.base_ref }} path: './WEC-Sim' - name: Check out MoorDyn if: matrix.folder == 'Mooring' || matrix.folder == 'OWC' || matrix.folder == 'Paraview_Visualization' - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: WEC-Sim/MoorDyn path: './MoorDyn' @@ -67,7 +60,7 @@ jobs: shell: bash working-directory: './MoorDyn' - name: Install MATLAB - uses: matlab-actions/setup-matlab@v2 + uses: matlab-actions/setup-matlab@v3 with: products: ${{ matrix.products }} release: ${{ matrix.release }} @@ -78,7 +71,7 @@ jobs: Xvfb :99 & echo "DISPLAY=:99" >> $GITHUB_ENV - name: Install WEC-Sim, run tests and generate artifacts - uses: matlab-actions/run-command@v2 + uses: matlab-actions/run-command@v3 with: command: | addpath(genpath('WEC-Sim/source')); diff --git a/Body-to-Body_Interactions/TestB2B.m b/Body-to-Body_Interactions/TestB2B.m index 4deff748..f6757dce 100644 --- a/Body-to-Body_Interactions/TestB2B.m +++ b/Body-to-Body_Interactions/TestB2B.m @@ -21,6 +21,14 @@ function killPlots (~) end methods(TestClassSetup) + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end diff --git a/Cable/TestCable.m b/Cable/TestCable.m index 13c2704f..37b7cc4d 100644 --- a/Cable/TestCable.m +++ b/Cable/TestCable.m @@ -22,11 +22,17 @@ function killPlots (~) end methods(TestClassSetup) - function captureVisibility(testCase) testCase.OriginalDefault = get(0, 'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -40,18 +46,17 @@ function runBemio(testCase) end methods(TestClassTeardown) - function checkVisibilityRestored(testCase) set(0, 'DefaultFigureVisible', testCase.OriginalDefault); testCase.assertEqual(get(0, 'DefaultFigureVisible'), ... testCase.OriginalDefault); end - end methods(Test) function testCable(testCase) wecSim + close_system('MBARI_cable',0) end end diff --git a/Controls/TestControls.m b/Controls/TestControls.m index 821c7071..d6a6447a 100644 --- a/Controls/TestControls.m +++ b/Controls/TestControls.m @@ -24,6 +24,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -53,26 +61,32 @@ function checkVisibilityRestored(testCase) function testPassive(testCase) cd('Passive (P)') wecSim + close_system('passive',0) end function testReactive(testCase) cd('Reactive (PI)') wecSim + close_system('reactive',0) end function testLatching(testCase) cd('Latching') wecSim + close_system('latchTime',0) end function testDeclutching(testCase) cd('Declutching') wecSim + close_system('declutch',0) end function testMPC(testCase) cd('MPC') wecSim + close_system('sphereMPC',0) end function testReactiveWithPTO(testCase) cd('ReactiveWithPTO') wecSim + close_system('reactiveWithPTO',0) end end end diff --git a/Desalination/OSWEC_RO.slx b/Desalination/OSWEC_RO.slx index 3444b958..6083a0e9 100644 Binary files a/Desalination/OSWEC_RO.slx and b/Desalination/OSWEC_RO.slx differ diff --git a/Desalination/TestDesalination.m b/Desalination/TestDesalination.m index 5ca23fa3..a61ffd39 100644 --- a/Desalination/TestDesalination.m +++ b/Desalination/TestDesalination.m @@ -24,7 +24,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) % Check for Simscape Fluids assumeEqual(testCase, ... @@ -38,7 +46,7 @@ function runBemio(testCase) end cd(testCase.testDir) testCase.hasH5 = true; - end + end end methods(TestClassTeardown) @@ -52,6 +60,7 @@ function checkVisibilityRestored(testCase) methods(Test) function testDesalination(testCase) wecSim + close_system('OSWEC_RO',0) end end end diff --git a/Desalination/wecSimInputFile.m b/Desalination/wecSimInputFile.m index 40a2b0ac..8eae57e3 100644 --- a/Desalination/wecSimInputFile.m +++ b/Desalination/wecSimInputFile.m @@ -6,7 +6,7 @@ simu.solver = 'ode4'; %simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step simu.startTime = 0; % Simulation Start Time [s] simu.rampTime = 50; -simu.endTime=300; +simu.endTime = 300; simu.dt = 0.01; %Simulation time-step [s] for a convolution function in the radiation force calculation simu.cicEndTime = 30; @@ -54,6 +54,8 @@ constraint(4)= constraintClass('Constraint4'); % Initialize ConstraintClass constraint(4).location = [0+0.9 0 -7]; +inertiaBlock = 1e-3; % kg - small mass on follower side of PTO used to resolve degenerate mass errors + pto(1) = ptoClass('PTO1'); % Initialize ptoClass for PTO1 pto(1).stiffness = 0; % PTO Stiffness Coeff [Nm/rad] pto(1).damping = 0; % PTO Damping Coeff [Nsm/rad] diff --git a/End_Stops/TestEndStops.m b/End_Stops/TestEndStops.m index 5b666a18..16e0a253 100644 --- a/End_Stops/TestEndStops.m +++ b/End_Stops/TestEndStops.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -34,7 +42,7 @@ function runBemio(testCase) cd(testCase.testDir) end end - + methods(TestClassTeardown) function checkVisibilityRestored(testCase) set(0,'DefaultFigureVisible',testCase.OriginalDefault); @@ -46,6 +54,7 @@ function checkVisibilityRestored(testCase) methods(Test) function testEnd_Stops(testCase) wecSim + close_system('RM3',0) end end end diff --git a/Free_Decay/TestFreeDecay.m b/Free_Decay/TestFreeDecay.m index 7a26f25b..0f871855 100644 --- a/Free_Decay/TestFreeDecay.m +++ b/Free_Decay/TestFreeDecay.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) diff --git a/Full_Directional_Waves/OSWEC.slx b/Full_Directional_Waves/OSWEC.slx new file mode 100644 index 00000000..42d0e230 Binary files /dev/null and b/Full_Directional_Waves/OSWEC.slx differ diff --git a/Full_Directional_Waves/TestFullDirectionalWaves.m b/Full_Directional_Waves/TestFullDirectionalWaves.m new file mode 100644 index 00000000..1a0673da --- /dev/null +++ b/Full_Directional_Waves/TestFullDirectionalWaves.m @@ -0,0 +1,66 @@ +classdef TestFullDirectionalWaves < matlab.unittest.TestCase + + properties + OriginalDefault + testDir + h5Dir = '../_Common_Input_Files/OSWEC/hydroData/' + h5Name = 'oswec.h5' + outName = 'oswec.out' + end + + methods (Access = 'public') + function obj = TestFullDirectionalWaves + obj.testDir = fileparts(mfilename('fullpath')); + end + end + + methods (TestMethodSetup) + function killPlots (~) + set(0,'DefaultFigureVisible','off'); + end + end + + methods(TestClassSetup) + function captureVisibility(testCase) + testCase.OriginalDefault = get(0,'DefaultFigureVisible'); + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end + function runBemio(testCase) + cd(testCase.h5Dir); + if isfile(testCase.h5Name) + fprintf('runBemio skipped, *.h5 already exists\n') + else + bemio + end + cd(testCase.testDir) + end + end + + methods(TestMethodTeardown) + function returnHome(testCase) + cd(testCase.testDir) + end + end + + methods(TestClassTeardown) + function checkVisibilityRestored(testCase) + set(0,'DefaultFigureVisible',testCase.OriginalDefault); + testCase.assertEqual(get(0,'DefaultFigureVisible'), ... + testCase.OriginalDefault); + end + end + + methods(Test) + function testFullDirectionalWaves(testCase) + wecSim + close_system('OSWEC',0) + end + end +end diff --git a/Full_Directional_Waves/convertOOIToIEC.m b/Full_Directional_Waves/convertOOIToIEC.m new file mode 100644 index 00000000..0f19c4c4 --- /dev/null +++ b/Full_Directional_Waves/convertOOIToIEC.m @@ -0,0 +1,51 @@ +function [frequenciesIEC, spectrumIEC, spreadIEC, directionsIEC] = convertOOIToIEC(spectrumDataOOI, directionBins, plotFlag) + + directionBins = wrapTo180(directionBins); + if any(directionBins == 180) && any(directionBins == -180) + warning('Directions include both -180 and 180. Removing -180 to avoid duplicate directions.') + directionBins(directionBins == -180) = []; + end + if length(unique(mod(directionBins + 180, 360) - 180)) < length(directionBins) + error('Duplicate directions were found.') + end + + frequenciesOOI = spectrumDataOOI(:,1); + spectrumOOI = spectrumDataOOI(:,2); + directionsOOI = spectrumDataOOI(:,3); + spreadOOI = spectrumDataOOI(:,4); + + % convert to IEC: + directionsIEC = directionBins(:); + frequenciesIEC = frequenciesOOI; + spectrumIEC = spectrumOOI; + spreadIEC = zeros(length(frequenciesIEC),length(directionsIEC)); + + % for spread, we need to apply gaussian distribution + for ii = 1:length(frequenciesOOI) + % convert to IEC spread calculation + directions = deg2rad(wrapTo180(directionBins - wrapTo180(directionsOOI(ii)))); + energySpread = (1./(deg2rad(spreadOOI(ii)).*sqrt(2*pi))) .* exp(-(directions.^2) ./ (2.*deg2rad(spreadOOI(ii)).^2)); + checkSum = trapz(deg2rad(directionBins),energySpread); + if checkSum < 0.95 % if this is true, then less than 95% of the initial energy at this frequency is contained over the considered directions. + warning('Number of directional bins inadequate at frequency number %i. Directional approximation weak. \n \r', ii); + end + energySpread = energySpread./checkSum; + spreadIEC(ii,:) = energySpread; + end + + if plotFlag == 1 + spectrumFullDir = spreadIEC.*spectrumIEC; + meanDirection = sum(wrapTo180(directionsOOI).*spectrumOOI)/sum(spectrumOOI); + + [plotDirs,plotFreqs] = meshgrid(directionsIEC,frequenciesIEC); + + figure() + polarscatter(deg2rad(plotDirs(:)),plotFreqs(:),4,spectrumFullDir(:),'filled') + hold on + polarplot(deg2rad([meanDirection meanDirection]), [0 max(plotFreqs(:))], 'k--'); % + c = colorbar; + c.Label.String = 'Spectrum (m^2/Hz/deg)'; + title('Elevation variance spectrum'); + legend('spectrum','approx. mean direction','Location','northwest') + end +end \ No newline at end of file diff --git a/Full_Directional_Waves/dirSpectrumOOI.mat b/Full_Directional_Waves/dirSpectrumOOI.mat new file mode 100644 index 00000000..85f91567 Binary files /dev/null and b/Full_Directional_Waves/dirSpectrumOOI.mat differ diff --git a/Full_Directional_Waves/fullDirSpectrum.mat b/Full_Directional_Waves/fullDirSpectrum.mat new file mode 100644 index 00000000..315cff9d Binary files /dev/null and b/Full_Directional_Waves/fullDirSpectrum.mat differ diff --git a/Full_Directional_Waves/products.txt b/Full_Directional_Waves/products.txt new file mode 100644 index 00000000..82ab62e2 --- /dev/null +++ b/Full_Directional_Waves/products.txt @@ -0,0 +1,3 @@ +Simulink +Simscape +Simscape_Multibody diff --git a/Full_Directional_Waves/userDefinedFunctions.m b/Full_Directional_Waves/userDefinedFunctions.m new file mode 100644 index 00000000..cbaeffcf --- /dev/null +++ b/Full_Directional_Waves/userDefinedFunctions.m @@ -0,0 +1,22 @@ +%Example of user input MATLAB file for post processing + +%Plot waves +waves.plotElevation(simu.rampTime); +try + waves.plotSpectrum(); +catch +end + +% Plot RY forces for body 1 +output.plotForces(1,5) + +%Plot RY response for body 1 +output.plotResponse(1,5); + +% Plot x forces for body 2 +output.plotForces(2,1) + +% Save waves and response as video +% output.saveViz(simu,body,waves,... +% 'timesPerFrame',5,'axisLimits',[-50 50 -50 50 -12 20],... +% 'startEndTime',[100 125]); diff --git a/Full_Directional_Waves/wecSimInputFile.m b/Full_Directional_Waves/wecSimInputFile.m new file mode 100644 index 00000000..c8658216 --- /dev/null +++ b/Full_Directional_Waves/wecSimInputFile.m @@ -0,0 +1,55 @@ +%% Simulation Data +simu = simulationClass(); % Initialize Simulation Class +simu.simMechanicsFile = 'OSWEC.slx'; % Specify Simulink Model File +simu.mode = 'normal'; % Specify Simulation Mode ('normal','accelerator','rapid-accelerator') +simu.explorer = 'on'; % Turn SimMechanics Explorer (on/off) +simu.startTime = 0; % Simulation Start Time [s] +simu.endTime = 400; % Simulation End Time [s] +simu.rampTime = 100; % Wave Ramp Time [s] +simu.solver = 'ode4'; % simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step +simu.dt = 0.05; % Simulation time-step [s] +simu.cicEndTime = 30; + +%% Wave Information + +% Full directional waves base case +waves = waveClass('spectrumImportFullDir'); +waves.spectrumFile = ('fullDirSpectrum.mat'); +waves.phaseSeed = 1; + +% % Uncomment this section to run full directional waves with conversion from OOI +% load dirSpectrumOOI.mat +% spectrumDataOOI = dataWaveSnip; +% directions = -179:2:179; +% +% [frequencies, spectrum, spread, directions] = convertOOIToIEC(spectrumDataOOI, directions, 1); +% +% save 'fullDirSpectrumOOI.mat' spectrum spread frequencies directions +% +% waves = waveClass('spectrumImportFullDir'); +% waves.spectrumFile = ('fullDirSpectrumOOI.mat'); +% waves.phaseSeed = 1; + +%% Body Data +% Flap +body(1) = bodyClass('../_Common_Input_Files/OSWEC/hydroData/oswec.h5'); % Initialize bodyClass for Flap +body(1).geometryFile = '../_Common_Input_Files/OSWEC/geometry/flap.stl'; % Geometry File +body(1).mass = 127000; % User-Defined mass [kg] +body(1).inertia = [1.85e6 1.85e6 1.85e6]; % Moment of Inertia [kg-m^2] + +% Base +body(2) = bodyClass('../_Common_Input_Files/OSWEC/hydroData/oswec.h5'); % Initialize bodyClass for Base +body(2).geometryFile = '../_Common_Input_Files/OSWEC/geometry/base.stl'; % Geometry File +body(2).mass = 999; % Placeholder mass for a fixed body +body(2).inertia = [999 999 999]; % Placeholder inertia for a fixed body + +%% PTO and Constraint Parameters +% Fixed +constraint(1)= constraintClass('Constraint1'); % Initialize ConstraintClass for Constraint1 +constraint(1).location = [0 0 -10]; % Constraint Location [m] + +% Rotational PTO +pto(1) = ptoClass('PTO1'); % Initialize ptoClass for PTO1 +pto(1).stiffness = 0; % PTO Stiffness Coeff [Nm/rad] +pto(1).damping = 12000; % PTO Damping Coeff [Nsm/rad] +pto(1).location = [0 0 -8.9]; % PTO Location [m] diff --git a/Generalized_Body_Modes/TestGeneralizedBodyModes.m b/Generalized_Body_Modes/TestGeneralizedBodyModes.m index 31ae4b9e..d6e93e67 100644 --- a/Generalized_Body_Modes/TestGeneralizedBodyModes.m +++ b/Generalized_Body_Modes/TestGeneralizedBodyModes.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -46,6 +54,7 @@ function checkVisibilityRestored(testCase) methods(Test) function testGeneralized_Body_Modes(testCase) wecSim + close_system('GBM',0) end end end diff --git a/Load_Mitigating_Controls/TestLoadMitigatingControls.m b/Load_Mitigating_Controls/TestLoadMitigatingControls.m index 567b0339..15809191 100644 --- a/Load_Mitigating_Controls/TestLoadMitigatingControls.m +++ b/Load_Mitigating_Controls/TestLoadMitigatingControls.m @@ -22,7 +22,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -52,14 +60,17 @@ function checkVisibilityRestored(testCase) function testLoad_Mitigating_Control_ControlTests(testCase) cd('ControlTests') wecSim + close_system('WaveBot3Dof_Control',0) end function testLoad_Mitigating_Control_CalcImpedance(testCase) cd('CalcImpedance') wecSim + close_system('WaveBot3Dof_ID',0) end function testLoad_Mitigating_Control_CalcImpedance_MCR(testCase) cd('CalcImpedance') wecSimMCR + close_system('WaveBot3Dof_ID',0) end end end diff --git a/MOST/tests/TestMOST.m b/MOST/tests/TestMOST.m index 7d77e802..20ed82c4 100644 --- a/MOST/tests/TestMOST.m +++ b/MOST/tests/TestMOST.m @@ -33,6 +33,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBEMIO(testCase) cd(fullfile(testCase.testDir, testCase.hydroDataDir)); if isfile(testCase.h5Name) @@ -52,6 +60,7 @@ function runMOSTIO(testCase) function runTurbulentTest(testCase) cd(fullfile(testCase.testDir,'turbulent')) runLoadTurbulent; + close_system('SModel_VolturnUS',0) testCase.turbulent = load('turbulent.mat').("turbulent"); cd(testCase.testDir); end diff --git a/Mean_Drift/TestMeanDrift.m b/Mean_Drift/TestMeanDrift.m index bebb06b5..a450fde2 100644 --- a/Mean_Drift/TestMeanDrift.m +++ b/Mean_Drift/TestMeanDrift.m @@ -21,12 +21,18 @@ function killPlots (~) end end - methods(TestClassSetup) - + methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -36,22 +42,20 @@ function runBemio(testCase) end cd(testCase.testDir) end - - end + end methods(TestClassTeardown) - function checkVisibilityRestored(testCase) set(0,'DefaultFigureVisible',testCase.OriginalDefault); testCase.assertEqual(get(0,'DefaultFigureVisible'), ... testCase.OriginalDefault); - end - + end end methods(Test) function testMean_Drift(testCase) wecSim + close_system('sphere',0) end end diff --git a/Mooring/MoorDyn/Mooring/lines.txt b/Mooring/MoorDyn/Mooring/lines.txt index 2927aa08..c4a7384d 100644 --- a/Mooring/MoorDyn/Mooring/lines.txt +++ b/Mooring/MoorDyn/Mooring/lines.txt @@ -2,19 +2,19 @@ Mooring line data file for MoorDyn in libmoordyn.dll ---------------------- LINE TYPES ----------------------------------------------------- LineType Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx (-) (m) (kg/m) (N) (N-s/-) (N-m^2) (-) (-) (-) (-) -Chain 0.144 126.0 583.376E6 -0.8 0 1.6 1.0 0.05 0.0 +Chain 0.144 126.0 583.376E6 -0.8 0 1.6 1.0 0.05 0.0 ---------------------------- BODIES ----------------------------------------------------- ID Attachment X0 Y0 Z0 r0 p0 y0 Mass CG* I* Volume CdA* Ca (#) (-) (m) (m) (m) (deg) (deg) (deg) (kg) (m) (kg-m^2) (m^3) (m^2) (-) -1 Coupled 0 0 -21.5 0 0 0 0.0 0 0 0 0 0 +1 Coupled 0 0 0 0 0 0 0.0 0 0 0 0 0 ---------------------- POINTS ----------------------------------------------------- ID Attachment X Y Z Mass Volume CdA CA (#) (word/ID) (m) (m) (m) (kg) (mˆ3) (m^2) (-) -1 Body1 -3.0 0 11.50 0 0 0 0 +1 Body1 -3.0 0 -10.00 0 0 0 0 2 Fixed -267.0 0 -70.00 0 0 0 0 -3 Body1 1.5 2.598 11.50 0 0 0 0 +3 Body1 1.5 2.598 -10.00 0 0 0 0 4 Fixed 133.5 231.23 -70.00 0 0 0 0 -5 Body1 1.5 -2.598 11.50 0 0 0 0 +5 Body1 1.5 -2.598 -10.00 0 0 0 0 6 Fixed 133.5 -231.23 -70.00 0 0 0 0 7 Free -40.0 0 -10.00 16755 33.510 12.566 1 8 Free 20.0 34.642 -10.00 16755 33.510 12.566 1 diff --git a/Mooring/MoorDyn/wecSimInputFile.m b/Mooring/MoorDyn/wecSimInputFile.m index aa7d76fb..bf32a6cb 100644 --- a/Mooring/MoorDyn/wecSimInputFile.m +++ b/Mooring/MoorDyn/wecSimInputFile.m @@ -46,4 +46,4 @@ mooring(1).moorDynLines = 6; % Specify number of lines mooring(1).moorDynNodes(1:3) = 16; % Specify number of nodes per line mooring(1).moorDynNodes(4:6) = 6; % Specify number of nodes per line -mooring(1).initial.displacement = [0 0 -21.29-.21]; % Initial Displacement (body cg + body initial displacement) +mooring(1).initial.displacement = [0 0 0]; % Initial Displacement diff --git a/Mooring/TestMooring.m b/Mooring/TestMooring.m index 0a4f12cd..537c7f1e 100644 --- a/Mooring/TestMooring.m +++ b/Mooring/TestMooring.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -49,8 +57,10 @@ function checkVisibilityRestored(testCase) end end - methods(Test) + methods(Test) function testMoorDyn(testCase) + isCI = strcmpi(getenv("GITHUB_ACTIONS"), "true"); + testCase.assumeFalse(isCI, "Skipping MoorDyn test on GitHub CI"); assumeEqual(testCase, ... exist("MoorDyn_caller", "file"), 2, ... "MoorDyn is not installed"); diff --git a/Morison_Element/TestMorisonElement.m b/Morison_Element/TestMorisonElement.m index aa709ab2..d9b6ddaf 100644 --- a/Morison_Element/TestMorisonElement.m +++ b/Morison_Element/TestMorisonElement.m @@ -20,10 +20,18 @@ function killPlots (~) end end - methods(TestClassSetup) + methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -38,7 +46,7 @@ function runBemio(testCase) methods(TestMethodTeardown) function returnHome(testCase) cd(testCase.testDir) - end + end end methods(TestClassTeardown) diff --git a/Multiple_Condition_Runs/TestMultipleConditionRuns.m b/Multiple_Condition_Runs/TestMultipleConditionRuns.m index 9f227b12..64443f49 100644 --- a/Multiple_Condition_Runs/TestMultipleConditionRuns.m +++ b/Multiple_Condition_Runs/TestMultipleConditionRuns.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) diff --git a/Multiple_Wave_Spectra/TestMultipleWaveSpectra.m b/Multiple_Wave_Spectra/TestMultipleWaveSpectra.m index 83ffb71c..56f2e4b6 100644 --- a/Multiple_Wave_Spectra/TestMultipleWaveSpectra.m +++ b/Multiple_Wave_Spectra/TestMultipleWaveSpectra.m @@ -22,11 +22,17 @@ function killPlots (~) end methods(TestClassSetup) - function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -44,12 +50,13 @@ function checkVisibilityRestored(testCase) set(0,'DefaultFigureVisible',testCase.OriginalDefault); testCase.assertEqual(get(0,'DefaultFigureVisible'), ... testCase.OriginalDefault); - end + end end methods(Test) function testMultiple_Wave_Headings(testCase) wecSim + close_system('OSWEC',0) end end end diff --git a/Nonhydro_Body/TestNonHydroBody.m b/Nonhydro_Body/TestNonHydroBody.m index 9239d2db..11a1dc5f 100644 --- a/Nonhydro_Body/TestNonHydroBody.m +++ b/Nonhydro_Body/TestNonHydroBody.m @@ -24,7 +24,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -48,6 +55,7 @@ function checkVisibilityRestored(testCase) methods(Test) function testNonhydro_Body(testCase) wecSim + close_system('OSWEC',0) end end diff --git a/Nonlinear_Hydro/TestNonlinearHydro.m b/Nonlinear_Hydro/TestNonlinearHydro.m index e1424eac..4ac88efb 100644 --- a/Nonlinear_Hydro/TestNonlinearHydro.m +++ b/Nonlinear_Hydro/TestNonlinearHydro.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -59,16 +67,16 @@ function testNonlinear_Hydro_ode4_RegularCIC(testCase) cd(fullfile('ode4', 'RegularCIC')) wecSim close_system('ellipsoid',0) - end + end function testNonlinear_Hydro_ode45_Regular(testCase) cd(fullfile('ode45', 'Regular')) wecSim close_system('ellipsoid',0) - end + end function testNonlinear_Hydro_ode45_RegularCIC(testCase) cd(fullfile('ode45', 'RegularCIC')) wecSim close_system('ellipsoid',0) - end + end end end diff --git a/OWC/FloatingOWC/Mooring/lines.txt b/OWC/FloatingOWC/Mooring/lines.txt index 79a0f3c0..571f17af 100644 --- a/OWC/FloatingOWC/Mooring/lines.txt +++ b/OWC/FloatingOWC/Mooring/lines.txt @@ -6,7 +6,7 @@ Chain 0.032 34.82 1.5e6 -0.8 1e4 1.6 1.0 0 ---------------------------- BODIES ----------------------------------------------------- ID Attachment X0 Y0 Z0 r0 p0 y0 Mass CG* I* Volume CdA* Ca (#) (-) (m) (m) (m) (deg) (deg) (deg) (kg) (m) (kg-m^2) (m^3) (m^2) (-) -1 Coupled 0 0 -2.58 0 0 0 2.914e6 -31.96 1.53e9 2.9013e3 0 0 +1 Coupled 0 0 -2.58 0 0 0 2.914e6 -31.96 1.53e9 2.9013e3 0 0 ---------------------- POINTS ----------------------------------------------------- ID Attachment X Y Z Mass Volume CdA CA (#) (word/ID) (m) (m) (m) (kg) (mˆ3) (m^2) (-) diff --git a/OWC/TestOWC.m b/OWC/TestOWC.m index e10f72f6..3307173d 100644 --- a/OWC/TestOWC.m +++ b/OWC/TestOWC.m @@ -22,6 +22,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemioOrifice(testCase) cd(testCase.h5DirOrifice); if isfile(testCase.h5NameOrifice) @@ -58,15 +66,16 @@ function checkVisibilityRestored(testCase) function testOWCOrifice(testCase) cd('OrificeModel') wecSim - close_system('OWC_rigid',0) + close_system('OWC_GBM',0) end - function testOWCFloating(testCase) + isCI = strcmpi(getenv("GITHUB_ACTIONS"), "true"); + testCase.assumeFalse(isCI, "Skipping MoorDyn test on GitHub CI"); assumeEqual(testCase, exist("MoorDyn_caller", "file"), 2, ... "MoorDyn is not installed"); cd('FloatingOWC') wecSim - close_system('OWC_GBM',0) + close_system('OWC_rigid',0) end end end \ No newline at end of file diff --git a/PTO-Sim/OSWEC/TestPTOSimOSWEC.m b/PTO-Sim/OSWEC/TestPTOSimOSWEC.m index 86a48608..55b573b8 100644 --- a/PTO-Sim/OSWEC/TestPTOSimOSWEC.m +++ b/PTO-Sim/OSWEC/TestPTOSimOSWEC.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -58,10 +66,12 @@ function checkVisibilityRestored(testCase) function testOSWEC_Hydraulic_Crank_PTO(testCase) cd('OSWEC_Hydraulic_Crank_PTO') wecSim + close_system('OSWEC_Hydraulic_Crank_PTO',0) end function testOSWEC_Hydraulic_PTO(testCase) cd('OSWEC_Hydraulic_PTO') wecSim + close_system('OSWEC_Hydraulic_PTO',0) end end end diff --git a/PTO-Sim/RM3/TestPTOSimRM3.m b/PTO-Sim/RM3/TestPTOSimRM3.m index 91a19117..ded1f793 100644 --- a/PTO-Sim/RM3/TestPTOSimRM3.m +++ b/PTO-Sim/RM3/TestPTOSimRM3.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -58,10 +66,12 @@ function checkVisibilityRestored(testCase) function testRM3_cHydraulic_PTO(testCase) cd('RM3_cHydraulic_PTO') wecSim + close_system('RM3_cHydraulic_PTO',0) end function testRM3_DD_PTO(testCase) cd('RM3_DD_PTO') wecSim + close_system('RM3_DD_PTO',0) end end end diff --git a/Paraview_Visualization/OSWEC_NonLinear_Viz/TestOSWECNonLinearViz.m b/Paraview_Visualization/OSWEC_NonLinear_Viz/TestOSWECNonLinearViz.m index a1dee4ef..87212314 100644 --- a/Paraview_Visualization/OSWEC_NonLinear_Viz/TestOSWECNonLinearViz.m +++ b/Paraview_Visualization/OSWEC_NonLinear_Viz/TestOSWECNonLinearViz.m @@ -24,6 +24,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -54,6 +62,7 @@ function removeVTK(testCase) methods(Test) function testParaview_Visualization_OSWEC_NonLinear_Viz(testCase) wecSim + close_system('OSWEC',0) end end end diff --git a/Paraview_Visualization/RM3_MoorDyn_Viz/Mooring/lines.txt b/Paraview_Visualization/RM3_MoorDyn_Viz/Mooring/lines.txt index 5da45600..7e4971ee 100644 --- a/Paraview_Visualization/RM3_MoorDyn_Viz/Mooring/lines.txt +++ b/Paraview_Visualization/RM3_MoorDyn_Viz/Mooring/lines.txt @@ -2,19 +2,19 @@ Mooring line data file for MoorDyn in libmoordyn.dll ---------------------- LINE TYPES ----------------------------------------------------- LineType Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx (-) (m) (kg/m) (N) (N-s/-) (N-m^2) (-) (-) (-) (-) -Chain 0.144 126.0 583.376E6 -0.8 0 1.6 1.0 0.05 0.0 +Chain 0.144 126.0 583.376E6 -0.8 0 1.6 1.0 0.05 0.0 ---------------------------- BODIES ----------------------------------------------------- ID Attachment X0 Y0 Z0 r0 p0 y0 Mass CG* I* Volume CdA* Ca (#) (-) (m) (m) (m) (deg) (deg) (deg) (kg) (m) (kg-m^2) (m^3) (m^2) (-) -1 Coupled 0 0 -21.5 0 0 0 0.0 0 0 0 0 0 +1 Coupled 0 0 0 0 0 0 0.0 0 0 0 0 0 ---------------------- POINTS ----------------------------------------------------- Node Type X Y Z M V CdA CA (-) (-) (m) (m) (m) (kg) (m^3) (m^2) (-) -1 Body1 -3.0 0 11.50 0 0 0 0 +1 Body1 -3.0 0 -10.00 0 0 0 0 2 Fixed -267.0 0 -70.00 0 0 0 0 -3 Body1 1.5 2.598 11.50 0 0 0 0 +3 Body1 1.5 2.598 -10.00 0 0 0 0 4 Fixed 133.5 231.23 -70.00 0 0 0 0 -5 Body1 1.5 -2.598 11.50 0 0 0 0 +5 Body1 1.5 -2.598 -10.00 0 0 0 0 6 Fixed 133.5 -231.23 -70.00 0 0 0 0 ---------------------- LINES ----------------------------------------------------- ID LineType AttachA AttachB UnstrLen NumSegs LineOutputs diff --git a/Paraview_Visualization/RM3_MoorDyn_Viz/TestMoorDynViz.m b/Paraview_Visualization/RM3_MoorDyn_Viz/TestMoorDynViz.m index b5f899ed..49f4c212 100644 --- a/Paraview_Visualization/RM3_MoorDyn_Viz/TestMoorDynViz.m +++ b/Paraview_Visualization/RM3_MoorDyn_Viz/TestMoorDynViz.m @@ -25,6 +25,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) % Check for MoorDyn assumeEqual(testCase, ... @@ -62,7 +70,10 @@ function removeVTK(testCase) methods(Test) function testParaview_Visualization_RM3_MoorDyn_Viz(testCase) + isCI = strcmpi(getenv("GITHUB_ACTIONS"), "true"); + testCase.assumeFalse(isCI, "Skipping MoorDyn test on GitHub CI"); wecSim + close_system('RM3MoorDyn',0) end end end diff --git a/Paraview_Visualization/RM3_MoorDyn_Viz/wecSimInputFile.m b/Paraview_Visualization/RM3_MoorDyn_Viz/wecSimInputFile.m index 366e77bb..a697e1a8 100644 --- a/Paraview_Visualization/RM3_MoorDyn_Viz/wecSimInputFile.m +++ b/Paraview_Visualization/RM3_MoorDyn_Viz/wecSimInputFile.m @@ -54,4 +54,4 @@ mooring(1).moorDyn = 1; % Initialize MoorDyn mooring(1).moorDynLines = 3; % Specify number of lines mooring(1).moorDynNodes = [21 21 21]; % Specify number of nodes per line -mooring(1).initial.displacement = [0 0 -21.29-.21]; % Initial Displacement (includes body cg and body initial displacement) +mooring(1).initial.displacement = [0 0 0]; % Initial Displacement (includes body cg and body initial displacement) diff --git a/Passive_Yaw/TestPassiveYaw.m b/Passive_Yaw/TestPassiveYaw.m index c108a74b..e9d63863 100644 --- a/Passive_Yaw/TestPassiveYaw.m +++ b/Passive_Yaw/TestPassiveYaw.m @@ -21,6 +21,14 @@ function killPlots (~) end methods(TestClassSetup) + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end diff --git a/Passive_Yaw/TestPassiveYawRegression.m b/Passive_Yaw/TestPassiveYawRegression.m index 30b00cdb..51d10013 100644 --- a/Passive_Yaw/TestPassiveYawRegression.m +++ b/Passive_Yaw/TestPassiveYawRegression.m @@ -28,6 +28,14 @@ function killPlots (~) end methods(TestClassSetup) + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runYawIrrTest(testCase) cd(fullfile(testCase.testDir, ... 'PassiveYawRegression')) diff --git a/RM3_PTO_Extension/TestRM3PTOExtension.m b/RM3_PTO_Extension/TestRM3PTOExtension.m index 75b8de29..f3d59736 100644 --- a/RM3_PTO_Extension/TestRM3PTOExtension.m +++ b/RM3_PTO_Extension/TestRM3PTOExtension.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) diff --git a/Radiation_Force_Options/TestRadiationForceOptions.m b/Radiation_Force_Options/TestRadiationForceOptions.m index 271b3cde..f3998c4b 100644 --- a/Radiation_Force_Options/TestRadiationForceOptions.m +++ b/Radiation_Force_Options/TestRadiationForceOptions.m @@ -22,11 +22,17 @@ function killPlots (~) end methods(TestClassSetup) - function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -52,6 +58,7 @@ function checkVisibilityRestored(testCase) methods(Test) function TestRadiation_Force_Options(testCase) compare_runs + close_system('RM3',0) end end diff --git a/Radiation_Force_Options/compare_runs.m b/Radiation_Force_Options/compare_runs.m index 537045c9..01012be7 100644 --- a/Radiation_Force_Options/compare_runs.m +++ b/Radiation_Force_Options/compare_runs.m @@ -8,6 +8,7 @@ enable_ss = 0; t_regular = tic; wecSim +close_system('RM3',0) run_time.baseline = toc(t_regular); run_summary.baseline = output; clearvars -except run_summary run_time @@ -19,6 +20,7 @@ enable_ss = 0; tStart_FIR = tic; wecSim +close_system('RM3',0) run_time.FIR = toc(tStart_FIR)/run_time.baseline; run_summary.FIR = output; clearvars -except run_summary run_time @@ -30,6 +32,7 @@ enable_ss = 1; tStart_ss = tic; wecSim +close_system('RM3',0) run_time.state_space = toc(tStart_ss)/run_time.baseline; run_summary.state_space = output; clearvars -except run_summary run_time @@ -40,6 +43,7 @@ enable_ss = 0; t_conv = tic; wecSim +close_system('RM3',0) run_time.convolution = toc(t_conv)/run_time.baseline; run_summary.convolution = output; clearvars -except run_summary run_time diff --git a/Variable_Hydro/TestVariableHydro.m b/Variable_Hydro/TestVariableHydro.m index 8ea87de0..8d50d159 100644 --- a/Variable_Hydro/TestVariableHydro.m +++ b/Variable_Hydro/TestVariableHydro.m @@ -24,11 +24,17 @@ function killPlots (~) end methods(TestClassSetup) - function captureVisibility(testCase) testCase.OriginalDefault = get(0, 'DefaultFigureVisible'); end - + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemioPY(testCase) cd(testCase.h5DirPY); if isfile(testCase.h5NamePY) @@ -74,7 +80,7 @@ function testPY(testCase) function testVM(testCase) cd('Variable_Mass') wecSim - close_system('OSWEC',0) + close_system('sphereVarMass',0) end end diff --git a/WECCCOMP/TestWECCCOMP.m b/WECCCOMP/TestWECCCOMP.m index a2b17925..f37c68ce 100644 --- a/WECCCOMP/TestWECCCOMP.m +++ b/WECCCOMP/TestWECCCOMP.m @@ -23,7 +23,15 @@ function killPlots (~) methods(TestClassSetup) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); - end + end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) diff --git a/Wave_Markers/TestWaveMarkerRM3.m b/Wave_Markers/TestWaveMarkerRM3.m index 0cac83c9..4d0c7f5f 100644 --- a/Wave_Markers/TestWaveMarkerRM3.m +++ b/Wave_Markers/TestWaveMarkerRM3.m @@ -24,6 +24,14 @@ function killPlots (~) function captureVisibility(testCase) testCase.OriginalDefault = get(0,'DefaultFigureVisible'); end + function removeProjectFolder(~) + d = dir('**'); + d = d([d.isdir]); + d = d(string({d.name})=="slprj"); + for i = 1:length(d) + rmdir(fullfile(d(i).folder, d(i).name), 's') + end + end function runBemio(testCase) cd(testCase.h5Dir); if isfile(testCase.h5Name) @@ -47,6 +55,7 @@ function checkVisibilityRestored(testCase) function testRM3_Marker(testCase) cd RM3 wecSim + close_system('RM3',0) end end end