Strengthen WDM and IM/DD optical tests
This commit is contained in:
@@ -1,10 +1,78 @@
|
||||
classdef DP_Fiber_test < IMDDTestCase
|
||||
% Auto-generated placeholder for DP_Fiber.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/02_optical/DP_Fiber.m
|
||||
methods (Test, TestTags = {'unit', 'fast', 'optical', 'dp_fiber'})
|
||||
function constructorStoresConfigurationAndStartsWithEmptyState(testCase)
|
||||
fiber = makeIdentityFiber();
|
||||
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for DP_Fiber are not implemented yet.");
|
||||
testCase.verifyEqual(fiber.L, 0);
|
||||
testCase.verifyEqual(fiber.dz, 1);
|
||||
testCase.verifyEqual(fiber.lambda, 1550);
|
||||
testCase.verifyEqual(fiber.rng, 7);
|
||||
testCase.verifyEqual(fiber.gamma, 0);
|
||||
testCase.verifyEqual(fiber.fa, 64e9);
|
||||
testCase.verifyEqual(fiber.X_alpha, 0);
|
||||
testCase.verifyEqual(fiber.D, 0);
|
||||
testCase.verifyEqual(fiber.Ds, 0);
|
||||
testCase.verifyEqual(fiber.Dpmd, 0);
|
||||
testCase.verifyEqual(fiber.n_waveplates, 1);
|
||||
testCase.verifyEqual(fiber.useGPU, false);
|
||||
testCase.verifyEqual(fiber.useSingle, false);
|
||||
testCase.verifyTrue(isstruct(fiber.state));
|
||||
testCase.verifyEmpty(fieldnames(fiber.state));
|
||||
end
|
||||
|
||||
function processPreservesAZeroImpairmentDualPolarizationSignal(testCase)
|
||||
fiber = makeIdentityFiber();
|
||||
inputMatrix = [ ...
|
||||
1 + 1i, 2 - 1i; ...
|
||||
0.5, -0.25i; ...
|
||||
-1 + 0.2i, 0.75 - 0.5i; ...
|
||||
0, 0.25 + 0.75i];
|
||||
|
||||
sigIn = Signal(inputMatrix, "fs", fiber.fa);
|
||||
sigOut = fiber.process(sigIn);
|
||||
|
||||
testCase.verifyClass(sigOut, "Signal");
|
||||
testCase.verifyEqual(sigOut.fs, sigIn.fs);
|
||||
testCase.verifyEqual(size(sigOut.signal), size(sigIn.signal));
|
||||
testCase.verifyEqual(sigOut.signal, sigIn.signal, "AbsTol", 1e-12);
|
||||
testCase.verifyEqual(height(sigOut.logbook), 1);
|
||||
end
|
||||
|
||||
function process_ProducesIdentityOutputForRawMatrixInput(testCase)
|
||||
fiber = makeIdentityFiber();
|
||||
inputMatrix = [ ...
|
||||
1 + 1i, 2 - 1i; ...
|
||||
0.5, -0.25i; ...
|
||||
-1 + 0.2i, 0.75 - 0.5i; ...
|
||||
0, 0.25 + 0.75i];
|
||||
|
||||
sigOut = fiber.process_(inputMatrix, fiber.fa);
|
||||
|
||||
testCase.verifyEqual(size(sigOut), size(inputMatrix));
|
||||
testCase.verifyEqual(sigOut, inputMatrix, "AbsTol", 1e-12);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fiber = makeIdentityFiber()
|
||||
fiber = DP_Fiber( ...
|
||||
"L", 0, ...
|
||||
"dz", 1, ...
|
||||
"lambda", 1550, ...
|
||||
"rng", 7, ...
|
||||
"gamma", 0, ...
|
||||
"fa", 64e9, ...
|
||||
"X_alpha", 0, ...
|
||||
"D", 0, ...
|
||||
"Ds", 0, ...
|
||||
"Dpmd", 0, ...
|
||||
"beat_len", 1e9, ...
|
||||
"corr_len", 1e9, ...
|
||||
"manakov", 0, ...
|
||||
"SS_dphimax", 5e-3, ...
|
||||
"SS_dzmax", 1, ...
|
||||
"SS_dzmin", 1, ...
|
||||
"n_waveplates", 1, ...
|
||||
"useGPU", false, ...
|
||||
"useSingle", false);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user