Skip to content

Commit

Permalink
was wrong order of ray and data in unit test (was disabled too) TC18
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Nov 22, 2024
1 parent dee8255 commit 77e9dce
Showing 1 changed file with 144 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5023,14 +5023,19 @@ public void TC18() throws IOException {
//Run computation
computeRays.run(propDataOut);

exportRays("target/tc18.json", propDataOut);
assertEquals(2, propDataOut.getPropagationPaths().size());

double[] L = addArray(propDataOut.getVerticesSoundLevel().get(0).value, new double[]{93-26.2,93-16.1,93-8.6,93-3.2,93,93+1.2,93+1.0,93-1.1});

// Table 195
double[] expectedWH = new double[]{0.00, 0.00, 0.00, 0.02, 0.11, 0.58, 2.94, 13.68};
double[] expectedCfH = new double[]{201.47,218.76,217.74,102.89,14.04,1.71,0.34,0.07};
double[] expectedAGroundH = new double[]{-1.26,-1.26,-1.26,2.12,-1.26,-1.26,-1.26,-1.26};
double[] expectedWF = new double[]{0.00, 0.00, 0.00, 0.01, 0.08, 0.42, 2.16, 10.35};
double[] expectedCfF = new double[]{199.62,214.14,225.42,131.91,22.89,2.42,0.46,0.10};
double[] expectedAGroundF = new double[]{-1.26,-1.26,-1.26,-1.26,-1.26,-1.26,-1.26,-1.26};

// Table 196
double[] expectedAlphaAtm = new double[]{0.12, 0.41, 1.04, 1.93, 3.66, 9.66, 32.77, 116.88};
double[] expectedAAtm = new double[]{0.02, 0.08,0.20,0.37,0.71,1.88,6.37,22.73};
double[] expectedADiv = new double[]{56.78,56.78,56.78,56.78,56.78,56.78,56.78,56.78};
Expand All @@ -5042,7 +5047,6 @@ public void TC18() throws IOException {
double[] expectedLA = new double[]{11.26,21.30,28.68,32.54,36.77,36.80,32.11,13.65};

//Actual values
//Actual values - right lateral
CnossosPath proPath = propDataOut.getPropagationPaths().get(0);

double[] actualWH = proPath.groundAttenuation.wH;
Expand All @@ -5061,29 +5065,39 @@ public void TC18() throws IOException {
double[] actualLF = addArray(proPath.aGlobalF, SOUND_POWER_LEVELS);
double[] actualL = addArray(proPath.aGlobal, SOUND_POWER_LEVELS);
double[] actualLA = addArray(actualL, A_WEIGHTING);
double[] directLA = actualLA;

assertDoubleArrayEquals("WH - vertical plane", expectedWH, actualWH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("CfH - vertical plane", expectedCfH, actualCfH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("WF - vertical plane", expectedWF, actualWF, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("CfF - vertical plane", expectedCfF, actualCfF, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AGroundH - vertical plane", expectedAGroundH, actualAGroundH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("AGroundF - vertical plane", expectedAGroundF, actualAGroundF, ERROR_EPSILON_VERY_LOW);

assertEquals(194.48, proPath.getSRSegment().dp, ERROR_EPSILON_LOWEST);
assertEquals(0.51, proPath.getSRSegment().gPath, ERROR_EPSILON_LOWEST);
assertEquals(0.58, proPath.getSRSegment().gPathPrime, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("WH - reflexion", expectedWH, actualWH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("CfH - reflexion", expectedCfH, actualCfH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("WF - reflexion", expectedWF, actualWF, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("CfF - reflexion", expectedCfF, actualCfF, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AGroundH - reflexion", expectedAGroundH, actualAGroundH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("AGroundF - reflexion", expectedAGroundF, actualAGroundF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("AlphaAtm - vertical plane", expectedAlphaAtm, actualAlphaAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AAtm - vertical plane", expectedAAtm, actualAAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ADiv - vertical plane", expectedADiv, actualADiv, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ABoundaryH - vertical plane", expectedABoundaryH, actualABoundaryH, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("ABoundaryF - vertical plane", expectedABoundaryF, actualABoundaryF, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("LH - vertical plane", expectedLH, actualLH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LF - vertical plane", expectedLF, actualLF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("L - vertical plane", expectedL, actualL, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LA - vertical plane", expectedLA, actualLA, ERROR_EPSILON_VERY_LOW);

assertDoubleArrayEquals("AlphaAtm - reflexion", expectedAlphaAtm, actualAlphaAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AAtm - reflexion", expectedAAtm, actualAAtm, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("ADiv - reflexion", expectedADiv, actualADiv, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ABoundaryH - reflexion", expectedABoundaryH, actualABoundaryH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("ABoundaryF - reflexion", expectedABoundaryF, actualABoundaryF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LH - reflexion", expectedLH, actualLH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LF - reflexion", expectedLF, actualLF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("L - reflexion", expectedL, actualL, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LA - reflexion", expectedLA, actualLA, ERROR_EPSILON_VERY_LOW);

//Actual values - Reflexion left lateral
proPath = propDataOut.getPropagationPaths().get(1);


SegmentPath ReflectionSO = proPath.getSegmentList().get(0);
SegmentPath ReflectionOnR = proPath.getSegmentList().get(1);

assertEquals(0.7, ReflectionSO.gPath, ERROR_EPSILON_LOWEST);
assertEquals(0.86, ReflectionSO.gPathPrime, ERROR_EPSILON_LOWEST);
assertEquals(85.16, ReflectionSO.dp, ERROR_EPSILON_LOWEST);
assertEquals(0.37, ReflectionOnR.gPath, ERROR_EPSILON_LOWEST);
assertEquals(112.14, ReflectionOnR.dp, ERROR_EPSILON_LOWEST);

// Table 198
double[] expectedDeltaDiffSRH = new double[]{7.77,9.5,11.71,14.26,17.02,19.90,22.84,25.82};
double[] expectedAGroundSOH = new double[]{-0.43,-0.43, -0.43, -0.43, -0.43, -0.43, -0.43, -0.43};
double[] expectedAGroundORH = new double[]{-1.90,-1.90, -1.90, -1.90, -1.90, -1.90,-1.90,-1.90};
Expand All @@ -5093,28 +5107,41 @@ public void TC18() throws IOException {
double[] expectedDeltaGroundORH = new double[]{-1.75,-1.71,-1.68,-1.66,-1.65,-1.65,-1.64,-1.64};
double[] expectedADiffH = new double[]{5.62,7.40,9.65,12.22,15.00,17.88,20.83,22.99};

double[] expectedDeltaDiffSRF = new double[]{7.22,8.76,10.80,13.24,15.93,18.77,21.69,24.65};
double[] expectedAGroundSOF = new double[]{-0.43,-0.43, -0.43, -0.43, -0.43, -0.43, -0.43, -0.43};
double[] expectedAGroundORF = new double[]{-1.90,-1.90, -1.90, -1.90, -1.90, -1.90,-1.90,-1.90};
double[] expectedDeltaDiffSPrimeRF = new double[]{8.9,9.93,12.22,14.82,17.61,20.51,23.46,26.44};
double[] expectedDeltaDiffSRPrimeF = new double[]{8.08,9.91,12.20,14.80,17.59,20.48,23.43,26.41};
double[] expectedDeltaGroundSOF = new double[]{-0.39,-0.38,-0.37,-0.36,-0.36,-0.35,-0.35,-0.35};
double[] expectedDeltaGroundORF = new double[]{-1.74,-1.69,-1.64,-1.61,-1.60,-1.59,-1.58,-1.58};
double[] expectedADiffF = new double[]{5.09,6.70,8.79,11.26,13.97,16.82,19.75,22.72};
double[] actualDeltaDiffSRH = proPath.aBoundaryH.deltaDiffSR;
double[] actualAGroundSOH = proPath.aBoundaryH.aGroundSO;
double[] actualAGroundORH = proPath.aBoundaryH.aGroundOR;
double[] actualDeltaDiffSPrimeRH = proPath.aBoundaryH.deltaDiffSPrimeR;
double[] actualDeltaDiffSRPrimeH = proPath.aBoundaryH.deltaDiffSRPrime;
double[] actualDeltaGroundSOH = proPath.aBoundaryH.deltaGroundSO;
double[] actualDeltaGroundORH = proPath.aBoundaryH.deltaGroundOR;
double[] actualADiffH = proPath.aBoundaryH.aDiff;

expectedAlphaAtm = new double[]{0.1,0.4,1.0,1.9,3.7,9.7,32.8,116.9};
expectedAAtm = new double[]{0.02,0.08,0.21,0.38,0.73,1.92,6.5,23.18};
expectedADiv = new double[]{56.95,56.95,56.95,56.95,56.95,56.95,56.95,56.95};
expectedABoundaryH = new double[]{5.62,7.40,9.65,12.22,15.00,17.88,20.83,22.99};
expectedABoundaryF = new double[]{5.09,6.70,8.79,11.26,13.97,16.82,19.75,22.72};
expectedLH = new double[]{27.49,27.6,24.64,21.23,17.32,12.27,3.49,-13.13};
expectedLF = new double[]{27.71,28.30,25.5,22.19,18.34,13.33,4.57,-12.86};
expectedL = new double[]{27.6,27.97,25.09,21.74,17.86,12.83,4.07,-13.00};
expectedLA = new double[]{1.40,11.87,16.49,18.54,17.86,14.03,5.07,-14.10};
assertDoubleArrayEquals("DeltaDiffSRH - Reflection left lateral", expectedDeltaDiffSRH, actualDeltaDiffSRH, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("AGroundSOH - Reflection left lateral", expectedAGroundSOH, actualAGroundSOH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AGroundORH - Reflection left lateral", expectedAGroundORH, actualAGroundORH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("DeltaDiffSPrimeRH - Reflection left lateral", expectedDeltaDiffSPrimeRH, actualDeltaDiffSPrimeRH, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("DeltaDiffSRPrimeH - Reflection left lateral", expectedDeltaDiffSRPrimeH, actualDeltaDiffSRPrimeH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("DeltaGroundSOH - Reflection left lateral", expectedDeltaGroundSOH, actualDeltaGroundSOH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("DeltaGroundORH - Reflection left lateral", expectedDeltaGroundORH, actualDeltaGroundORH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("actualADiffH - Reflection left lateral", expectedADiffH, actualADiffH, ERROR_EPSILON_LOW);








/*
actualAlphaAtm = propDataOut.genericMeteoData.getAlpha_atmo();
actualAAtm = proPath.aAtm;
actualADiv = proPath.aDiv;
actualABoundaryH = proPath.double_aBoundaryH;
actualABoundaryF = proPath.double_aBoundaryF;

double[] actualLA = addArray(actualL, A_WEIGHTING);


//Actual values
proPath = propDataOut.getPropagationPaths().get(1);
double[] actualDeltaDiffSRH = proPath.aBoundaryH.deltaDiffSR;
double[] actualAGroundSOH = proPath.aBoundaryH.aGroundSO;
double[] actualAGroundORH = proPath.aBoundaryH.aGroundOR;
Expand All @@ -5133,27 +5160,9 @@ public void TC18() throws IOException {
double[] actualDeltaGroundORF = proPath.aBoundaryF.deltaGroundOR;
double[] actualADiffF = proPath.aBoundaryF.aDiff;

actualAlphaAtm = propDataOut.genericMeteoData.getAlpha_atmo();
actualAAtm = proPath.aAtm;
actualADiv = proPath.aDiv;
actualABoundaryH = proPath.double_aBoundaryH;
actualABoundaryF = proPath.double_aBoundaryF;
actualLH = addArray(proPath.aGlobalH, SOUND_POWER_LEVELS);
actualLF = addArray(proPath.aGlobalF, SOUND_POWER_LEVELS);
actualL = addArray(proPath.aGlobal, SOUND_POWER_LEVELS);
actualLA = addArray(actualL, A_WEIGHTING);
double[] reflexionLA = actualLA;

double[] L = addArray(propDataOut.getVerticesSoundLevel().get(0).value, new double[]{93-26.2,93-16.1,93-8.6,93-3.2,93,93+1.2,93+1.0,93-1.1});

SegmentPath ReflectionSO = proPath.getSegmentList().get(0);
SegmentPath ReflectionOnR = proPath.getSegmentList().get(1);

assertEquals(0.7, ReflectionSO.gPath, ERROR_EPSILON_LOWEST);
assertEquals(0.86, ReflectionSO.gPathPrime, ERROR_EPSILON_LOWEST);
assertEquals(85.16, ReflectionSO.dp, ERROR_EPSILON_LOWEST);
assertEquals(0.37, ReflectionOnR.gPath, ERROR_EPSILON_LOWEST);
assertEquals(112.14, ReflectionOnR.dp, ERROR_EPSILON_LOWEST);
assertEquals(194.48, proPath.getSRSegment().dp, ERROR_EPSILON_LOWEST);
assertEquals(0.51, proPath.getSRSegment().gPath, ERROR_EPSILON_LOWEST);
assertEquals(0.58, proPath.getSRSegment().gPathPrime, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("DeltaDiffSRH - vertical plane", expectedDeltaDiffSRH, actualDeltaDiffSRH, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("AGroundSOH - vertical plane", expectedAGroundSOH, actualAGroundSOH, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AGroundORH - vertical plane", expectedAGroundORH, actualAGroundORH, ERROR_EPSILON_LOWEST);
Expand All @@ -5172,13 +5181,80 @@ public void TC18() throws IOException {
assertDoubleArrayEquals("DeltaGroundORF - vertical plane", expectedDeltaGroundORF, actualDeltaGroundORF, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("actualADiffF - vertical plane", expectedADiffF, actualADiffF, ERROR_EPSILON_LOW);

assertDoubleArrayEquals("AlphaAtm - vertical plane", expectedAlphaAtm, actualAlphaAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AAtm - vertical plane", expectedAAtm, actualAAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ADiv - vertical plane", expectedADiv, actualADiv, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ABoundaryH - vertical plane", expectedABoundaryH, actualABoundaryH, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("ABoundaryF - vertical plane", expectedABoundaryF, actualABoundaryF, ERROR_EPSILON_LOW);
assertDoubleArrayEquals("LH - vertical plane", expectedLH, actualLH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LF - vertical plane", expectedLF, actualLF, ERROR_EPSILON_VERY_LOW);


//Actual values
//Actual values - reflexion left lateral
proPath = propDataOut.getPropagationPaths().get(1);

double[] actualWH = proPath.groundAttenuation.wH;
double[] actualCfH = proPath.groundAttenuation.cfH;
double[] actualAGroundH = proPath.groundAttenuation.aGroundH;
double[] actualWF = proPath.groundAttenuation.wF;
double[] actualCfF = proPath.groundAttenuation.cfF;
double[] actualAGroundF = proPath.groundAttenuation.aGroundF;

double[] actualAlphaAtm = propDataOut.genericMeteoData.getAlpha_atmo();
double[] actualAAtm = proPath.aAtm;
double[] actualADiv = proPath.aDiv;
double[] actualABoundaryH = proPath.double_aBoundaryH;
double[] actualABoundaryF = proPath.double_aBoundaryF;
double[] actualLH = addArray(proPath.aGlobalH, SOUND_POWER_LEVELS);
double[] actualLF = addArray(proPath.aGlobalF, SOUND_POWER_LEVELS);
double[] actualL = addArray(proPath.aGlobal, SOUND_POWER_LEVELS);
double[] actualLA = addArray(actualL, A_WEIGHTING);
double[] directLA = actualLA;


SegmentPath ReflectionSO = proPath.getSegmentList().get(0);
SegmentPath ReflectionOnR = proPath.getSegmentList().get(1);

assertEquals(0.7, ReflectionSO.gPath, ERROR_EPSILON_LOWEST);
assertEquals(0.86, ReflectionSO.gPathPrime, ERROR_EPSILON_LOWEST);
assertEquals(85.16, ReflectionSO.dp, ERROR_EPSILON_LOWEST);
assertEquals(0.37, ReflectionOnR.gPath, ERROR_EPSILON_LOWEST);
assertEquals(112.14, ReflectionOnR.dp, ERROR_EPSILON_LOWEST);


assertDoubleArrayEquals("AlphaAtm - reflexion", expectedAlphaAtm, actualAlphaAtm, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("AAtm - reflexion", expectedAAtm, actualAAtm, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("ADiv - reflexion", expectedADiv, actualADiv, ERROR_EPSILON_LOWEST);
assertDoubleArrayEquals("ABoundaryH - reflexion", expectedABoundaryH, actualABoundaryH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("ABoundaryF - reflexion", expectedABoundaryF, actualABoundaryF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LH - reflexion", expectedLH, actualLH, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LF - reflexion", expectedLF, actualLF, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("L - reflexion", expectedL, actualL, ERROR_EPSILON_VERY_LOW);
assertDoubleArrayEquals("LA - reflexion", expectedLA, actualLA, ERROR_EPSILON_VERY_LOW);

double[] expectedDeltaDiffSRH = new double[]{7.77,9.5,11.71,14.26,17.02,19.90,22.84,25.82};
double[] expectedAGroundSOH = new double[]{-0.43,-0.43, -0.43, -0.43, -0.43, -0.43, -0.43, -0.43};
double[] expectedAGroundORH = new double[]{-1.90,-1.90, -1.90, -1.90, -1.90, -1.90,-1.90,-1.90};
double[] expectedDeltaDiffSPrimeRH = new double[]{8.54,10.51,12.90,15.56,18.38,21.30,24.26,27.25};
double[] expectedDeltaDiffSRPrimeH = new double[]{8.53,10.49,12.88,15.54,18.36,21.27,24.24,27.22};
double[] expectedDeltaGroundSOH = new double[]{-0.39,-0.38,-0.38,-0.37,-0.37,-0.37,-0.37,-0.37};
double[] expectedDeltaGroundORH = new double[]{-1.75,-1.71,-1.68,-1.66,-1.65,-1.65,-1.64,-1.64};
double[] expectedADiffH = new double[]{5.62,7.40,9.65,12.22,15.00,17.88,20.83,22.99};

double[] expectedDeltaDiffSRF = new double[]{7.22,8.76,10.80,13.24,15.93,18.77,21.69,24.65};
double[] expectedAGroundSOF = new double[]{-0.43,-0.43, -0.43, -0.43, -0.43, -0.43, -0.43, -0.43};
double[] expectedAGroundORF = new double[]{-1.90,-1.90, -1.90, -1.90, -1.90, -1.90,-1.90,-1.90};
double[] expectedDeltaDiffSPrimeRF = new double[]{8.9,9.93,12.22,14.82,17.61,20.51,23.46,26.44};
double[] expectedDeltaDiffSRPrimeF = new double[]{8.08,9.91,12.20,14.80,17.59,20.48,23.43,26.41};
double[] expectedDeltaGroundSOF = new double[]{-0.39,-0.38,-0.37,-0.36,-0.36,-0.35,-0.35,-0.35};
double[] expectedDeltaGroundORF = new double[]{-1.74,-1.69,-1.64,-1.61,-1.60,-1.59,-1.58,-1.58};
double[] expectedADiffF = new double[]{5.09,6.70,8.79,11.26,13.97,16.82,19.75,22.72};

expectedAlphaAtm = new double[]{0.1,0.4,1.0,1.9,3.7,9.7,32.8,116.9};
expectedAAtm = new double[]{0.02,0.08,0.21,0.38,0.73,1.92,6.5,23.18};
expectedADiv = new double[]{56.95,56.95,56.95,56.95,56.95,56.95,56.95,56.95};
expectedABoundaryH = new double[]{5.62,7.40,9.65,12.22,15.00,17.88,20.83,22.99};
expectedABoundaryF = new double[]{5.09,6.70,8.79,11.26,13.97,16.82,19.75,22.72};
expectedLH = new double[]{27.49,27.6,24.64,21.23,17.32,12.27,3.49,-13.13};
expectedLF = new double[]{27.71,28.30,25.5,22.19,18.34,13.33,4.57,-12.86};
expectedL = new double[]{27.6,27.97,25.09,21.74,17.86,12.83,4.07,-13.00};
expectedLA = new double[]{1.40,11.87,16.49,18.54,17.86,14.03,5.07,-14.10};
*/


assertArrayEquals( new double[]{11.69,21.77,28.93,32.71,36.83,36.83,32.12,13.66},L, ERROR_EPSILON_VERY_LOW);
}
Expand Down

0 comments on commit 77e9dce

Please sign in to comment.