Commit 0d1dca22 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

ART - EigenrayEngineTest

- added function to only test cpp rays (without matlab)
- moved matlab subfunctions to private folder
parent 2e5011fe
......@@ -120,7 +120,7 @@ int main(int iNumInArgs, char* pcInArgs[])
CStratifiedAtmosphere homAtmosphere = GetHomogeneousAtmosphere();
CStratifiedAtmosphere inhomAtmosphere = GetInhomogeneousAtmosphere();
//TestReceiverNearGround(homAtmosphere, "Homogeneous");
TestReceiverNearGround(homAtmosphere, "Homogeneous");
TestReceiverNearGround(inhomAtmosphere, "Inhomogeneous");
}
......@@ -56,13 +56,16 @@ art.angleForGeomSpreading = 0.01; %Angle between rays used to calculat
art.maxReflOrder = 1;
%% Run Tests
art.atmosphere = homAtmos;
%% Test Matlab vs Cpp
% art.atmosphere = homAtmos;
% runTestReceiverNearGround(art, 'Homogeneous');
art.atmosphere = inhomAtmos;
runTestReceiverNearGround(art, 'Inhomogeneous');
% art.atmosphere = inhomAtmos;
% runTestReceiverNearGround(art, 'Inhomogeneous');
%% Check C++ data only
checkResultsReceiverNearGround('Homogeneous');
checkResultsReceiverNearGround('Inhomogeneous');
function runTestReceiverNearGround(art, atmosphereSuffix)
sourceReceiverDistance = 2000;
......@@ -73,3 +76,9 @@ for sourceRecAngle = -90:45:90
cppFilename = ['ReceiverNearGround_' atmosphereSuffix '_SourceAngle' num2str(sourceRecAngle) '.json'];
runMatlabVsCppEigenrayTest(art, cppFilename, fileparts(cppFilename), true);
end
function checkResultsReceiverNearGround(atmosphereSuffix)
for sourceRecAngle = -90:45:90
cppFilename = ['ReceiverNearGround_' atmosphereSuffix '_SourceAngle' num2str(sourceRecAngle) '.json'];
checkCppEigenrays(cppFilename, fileparts(cppFilename));
end
function checkCppEigenrays(cppFile, plotTitle)
%% Load C++ Results
cppRays = itaAtmosRay.load(cppFile);
%% Plot rays
receiverPos = [0 0 1.8];
nRays = numel(cppRays);
f = figure;
ax = axes(f);
hold(ax, 'on');
legendEntries = cell(size(cppRays));
for idx=1:nRays
receiverDistance = norm(cppRays(idx).r.cart(end,:) - receiverPos);
reflOrder = cppRays(idx).numReflections;
legendEntries{idx} = ['order: ' num2str(reflOrder) ', dist: ' num2str(receiverDistance) 'm'];
cppRays(idx).pr(f, {'linestyle', 'linewidth'}, {'--', 2.25});
end
plot3(cppRays(1).r0.x, cppRays(1).r0.y, cppRays(1).r0.z, ' ok', 'markerfacecolor', 'b')
plot3(receiverPos(1), receiverPos(2), receiverPos(3), ' ok', 'markerfacecolor', [0 0.6 0])
legend(legendEntries, 'location', 'northwest');
grid on
view(0,0)
title(plotTitle)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment