forked from OpenFAST/openfast
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenFAST#1703 from Reoptimize-Systems/dev
Add tests for FAST_SFunc using Matlab action to integrate with CI
- Loading branch information
Showing
3 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,8 @@ jobs: | |
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
- name: Set up MATLAB | ||
uses: matlab-actions/setup-matlab@v1 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
@@ -67,6 +69,7 @@ jobs: | |
-DVARIABLE_TRACKING=OFF \ | ||
-DBUILD_TESTING:BOOL=ON \ | ||
-DCTEST_PLOT_ERRORS:BOOL=ON \ | ||
-DBUILD_OPENFAST_SIMULINK_API=ON \ | ||
${GITHUB_WORKSPACE} | ||
# -DDOUBLE_PRECISION=OFF \ | ||
- name: Build all | ||
|
@@ -175,6 +178,8 @@ jobs: | |
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
- name: Set up MATLAB | ||
uses: matlab-actions/setup-matlab@v1 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
@@ -203,6 +208,7 @@ jobs: | |
-DBUILD_SHARED_LIBS:BOOL=OFF \ | ||
-DBUILD_TESTING:BOOL=ON \ | ||
-DCTEST_PLOT_ERRORS:BOOL=ON \ | ||
-DBUILD_OPENFAST_SIMULINK_API=ON \ | ||
${GITHUB_WORKSPACE} | ||
- name: Build openfast-postlib | ||
working-directory: ${{runner.workspace}}/openfast/build | ||
|
@@ -612,6 +618,36 @@ jobs: | |
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/WP_Baseline | ||
rtest-OF-simulink: | ||
runs-on: ubuntu-22.04 | ||
needs: build-openfast-release | ||
steps: | ||
- name: Cache the workspace | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{runner.workspace}} | ||
key: build-openfast-release-${{ github.sha }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libhdf5-dev libopenmpi-dev libyaml-cpp-dev libopenblas-dev libopenblas-openmp-dev | ||
- name: Set up MATLAB | ||
uses: matlab-actions/setup-matlab@v1 | ||
- name: Build FAST_SFunc | ||
working-directory: ${{runner.workspace}}/openfast/build | ||
run: | | ||
cmake \ | ||
-DUSE_LOCAL_STATIC_LAPACK:BOOL=ON \ | ||
${GITHUB_WORKSPACE} | ||
cmake --build . --target FAST_SFunc | ||
- name: Run MATLAB tests and generate artifacts | ||
uses: matlab-actions/run-tests@v1 | ||
with: | ||
source-folder: ${{runner.workspace}}/openfast/build/glue-codes/simulink; ${{runner.workspace}}/openfast/glue-codes/simulink/examples | ||
test-results-junit: test-results/results.xml | ||
code-coverage-cobertura: code-coverage/coverage.xml | ||
|
||
|
||
rtest-OF-5MW_OC4Semi_WSt_WavesWN: | ||
runs-on: ubuntu-22.04 | ||
needs: build-openfast-release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
%% Test OpenFAST Simulink Interface | ||
classdef test_openfast_simulink < matlab.unittest.TestCase | ||
|
||
%% Test Method Block | ||
methods (Test) | ||
|
||
function testOpenLoopRuns(testCase) | ||
|
||
workspace_root = getenv("GITHUB_WORKSPACE"); | ||
|
||
this_file_path = fileparts(which(mfilename())); | ||
|
||
cd(this_file_path); | ||
|
||
% these variables are defined in the OpenLoop model's FAST_SFunc block: | ||
FAST_InputFileName = fullfile(workspace_root, 'reg_tests', 'r-test', 'glue-codes', 'openfast', 'AOC_WSt', 'AOC_WSt.fst'); | ||
TMax = 5; % seconds | ||
|
||
mdl = "OpenLoop"; | ||
|
||
%simIn = Simulink.SimulationInput(mdl); | ||
%simIn = setBlockParameter(simIn, "sldemo_househeat/Set Point", "Value", FAST_InputFileName); | ||
|
||
assignin("base", "FAST_InputFileName", FAST_InputFileName); | ||
assignin("base", "TMax", TMax); | ||
|
||
sim(mdl, [0,TMax]); | ||
|
||
end | ||
end | ||
end |