-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
70 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
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
6 changes: 6 additions & 0 deletions
6
resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/ZNAek-vvWzwP-qVKk-hiucnow_od.xml
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,6 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info> | ||
<Category UUID="FileClassCategory"> | ||
<Label UUID="test"/> | ||
</Category> | ||
</Info> |
2 changes: 2 additions & 0 deletions
2
resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/ZNAek-vvWzwP-qVKk-hiucnow_op.xml
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,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info location="untitled.m" type="File"/> |
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,51 @@ | ||
classdef untitled < matlabtest.compiler.TestCase | ||
properties(TestParameter) | ||
% Can define different runtime inputs for the equivalence test | ||
damping = struct(... | ||
"OverDamped", 5e5, ... | ||
"UnderDamped", 1e4, ... | ||
"CriticallyDamped", 5.477225575051661e4) | ||
end | ||
|
||
properties(ClassSetupParameter) | ||
buildDataFile = {}; | ||
end | ||
properties | ||
BuildResults | ||
end | ||
|
||
methods(TestClassSetup) | ||
function filterOnMac(testCase) | ||
testCase.assumeReturnsTrue(@() ~ismac, ... | ||
"MPS equivalence tests not supported on the mac"); | ||
end | ||
function loadBuildResults(testCase,buildDataFile) | ||
loadedData = load(buildDataFile); | ||
testCase.BuildResults = loadedData.buildResults; | ||
end | ||
end | ||
|
||
methods (Test) | ||
function mpsShouldBeEquivalentForDamping(testCase, damping) | ||
% Validate that MPS execution is equivalent to MATLAB for | ||
% various damping coefficient designs | ||
|
||
% Execute the runtime inputs (damping) on the server | ||
disp("Executing design on a local Production Server") | ||
design.k = 5e5; | ||
design.c = damping; | ||
executionResults = testCase.execute(testCase.BuildResults,{design},"simulateSystem"); | ||
|
||
% Verify server execution is equivalent to the local results | ||
disp("Verifying results match MATLAB results") | ||
% Note: Fails due to a bug which is fixed in the R2024a GR | ||
% testCase.verifyExecutionMatchesMATLAB(executionResults); | ||
|
||
% Verification workaround - not needed in GR. Note this | ||
% solution is not only less convenient, but also does not | ||
% produce diagnostics as valuable as the above method | ||
[x, t] = simulateSystem(design); | ||
testCase.verifyEqual(executionResults.ExecutableOutput, {x, t}); | ||
end | ||
end | ||
end |