EvaluateRoadSourceCnossos { public static double evaluate(RSParametersCnossos parameters) { final int freqParam = parameters.getFreqParam(); final double Temperature = parameters.getTemperature(); final double Ts_stud = parameters.getTs_stud(); final double Pm_stud = parameters.getPm_stud(); final double Junc_dist = parameters.getJunc_dist(); final int Junc_type = parameters.getJunc_type(); final String roadSurface = parameters.getRoadSurface(); final int coeffVer = parameters.getCoeffVer(); double lvRoadLvl; double medRoadLvl; double hgvRoadLvl; double wheelaRoadLvl; double wheelbRoadLvl; lvRoadLvl = getNoiseLvl(getCoeff("ar", freqParam , "1" ,coeffVer), getCoeff("br", freqParam , "1" ,coeffVer), parameters.getSpeedLv(), 70.); medRoadLvl = getNoiseLvl(getCoeff("ar", freqParam , "2" ,coeffVer ), getCoeff("br", freqParam , "2" ,coeffVer ), parameters.getSpeedMv(), 70.); hgvRoadLvl = getNoiseLvl(getCoeff("ar", freqParam , "3" ,coeffVer), getCoeff("br", freqParam , "3" ,coeffVer ), parameters.getSpeedHgv(), 70.); wheelaRoadLvl = getNoiseLvl(getCoeff("ar", freqParam , "4a" ,coeffVer ), getCoeff("br", freqParam , "4a" ,coeffVer ), parameters.getSpeedWav(), 70.); wheelbRoadLvl = getNoiseLvl(getCoeff("ar", freqParam , "4b" ,coeffVer), getCoeff("br", freqParam , "4b" ,coeffVer ), parameters.getSpeedWbv(), 70.); lvRoadLvl = lvRoadLvl+ 0.08*(20-Temperature); medRoadLvl = medRoadLvl + 0.04*(20-Temperature); hgvRoadLvl = hgvRoadLvl + 0.04*(20-Temperature); double coefficientJunctionDistance = Math.max(1 - Math.abs(Junc_dist) / 100, 0); lvRoadLvl = lvRoadLvl + getCr("1", Junc_type,coeffVer) * coefficientJunctionDistance; medRoadLvl = medRoadLvl + getCr("2", Junc_type,coeffVer) * coefficientJunctionDistance; hgvRoadLvl = hgvRoadLvl + getCr("3", Junc_type,coeffVer) * coefficientJunctionDistance; if (Pm_stud >0 && Ts_stud > 0) { double deltastud = 0; double speed = parameters.getSpeedLv(); double ps = Pm_stud * Ts_stud / 12; speed = (speed >= 90) ? 90 : speed; speed = (speed <= 50) ? 50 : speed; deltastud = getNoiseLvl(getCoeff("a", freqParam, "1",coeffVer), getCoeff("b", freqParam, "1",coeffVer), speed, 70.); lvRoadLvl = lvRoadLvl + 10 * Math.log10((1 - ps) + ps * Math.pow(10, deltastud / 10)); } lvRoadLvl = lvRoadLvl+ getNoiseLvl(getA_Roadcoeff(freqParam,"1", parameters.getRoadSurface(),coeffVer), getB_Roadcoeff("1",roadSurface,coeffVer), parameters.getSpeedLv(), 70.); medRoadLvl = medRoadLvl + getNoiseLvl(getA_Roadcoeff(freqParam,"2", parameters.getRoadSurface(),coeffVer), getB_Roadcoeff("2",roadSurface,coeffVer), parameters.getSpeedMv(), 70.); hgvRoadLvl = hgvRoadLvl + getNoiseLvl(getA_Roadcoeff(freqParam,"3", parameters.getRoadSurface(),coeffVer), getB_Roadcoeff("3",roadSurface,coeffVer), parameters.getSpeedHgv(), 70.); wheelaRoadLvl = wheelaRoadLvl + getNoiseLvl(getA_Roadcoeff(freqParam,"4a", parameters.getRoadSurface(),coeffVer), getB_Roadcoeff("4a",roadSurface,coeffVer), parameters.getSpeedWav(), 70.); wheelbRoadLvl = wheelbRoadLvl + getNoiseLvl(getA_Roadcoeff(freqParam,"4b", parameters.getRoadSurface(),coeffVer), getB_Roadcoeff("4b",roadSurface,coeffVer), parameters.getSpeedWbv(), 70.); double lvMotorLvl = getCoeff("ap", freqParam , "1" ,coeffVer ) + getCoeff("bp", freqParam , "1" ,coeffVer ) * (parameters.getSpeedLv()-70)/70 ; double medMotorLvl = getCoeff("ap", freqParam , "2" ,coeffVer ) + getCoeff("bp", freqParam , "2" ,coeffVer ) * (parameters.getSpeedMv()-70)/70 ; double hgvMotorLvl = getCoeff("ap", freqParam , "3" ,coeffVer ) + getCoeff("bp", freqParam , "3" ,coeffVer ) * (parameters.getSpeedHgv()-70)/70 ; double wheelaMotorLvl = getCoeff("ap", freqParam , "4a" ,coeffVer ) + getCoeff("bp", freqParam , "4a" ,coeffVer ) * (parameters.getSpeedWav()-70)/70 ; double wheelbMotorLvl = getCoeff("ap", freqParam , "4b" ,coeffVer ) + getCoeff("bp", freqParam , "4b" ,coeffVer ) * (parameters.getSpeedWbv()-70)/70 ; lvMotorLvl = lvMotorLvl + getCp("1", Junc_type,coeffVer) * coefficientJunctionDistance; medMotorLvl = medMotorLvl + getCp("2", Junc_type,coeffVer) * coefficientJunctionDistance; hgvMotorLvl = hgvMotorLvl + getCp("3", Junc_type,coeffVer) * coefficientJunctionDistance; if (parameters.getSlopePercentage() < -6) { lvMotorLvl = lvMotorLvl + (Math.min(12,-parameters.getSlopePercentage())-6)/1; } else if (parameters.getSlopePercentage() <= 2) { lvMotorLvl = lvMotorLvl + 0.; } else { lvMotorLvl = lvMotorLvl + ((parameters.getSpeedLv()/100) * ((Math.min(12,parameters.getSlopePercentage())-2)/1.5)); } if (parameters.getSlopePercentage() < -4) { medMotorLvl = medMotorLvl + ((parameters.getSpeedMv()-20)/100) * (Math.min(12,-1*parameters.getSlopePercentage())-4)/0.7; hgvMotorLvl = hgvMotorLvl + ((parameters.getSpeedHgv()-10)/100) * (Math.min(12,-1*parameters.getSlopePercentage())-4)/0.5; } else if (parameters.getSlopePercentage() <= 0) { medMotorLvl = medMotorLvl + 0.; hgvMotorLvl = hgvMotorLvl + 0.; } else { medMotorLvl = medMotorLvl + (parameters.getSpeedMv()/100) * (Math.min(12,parameters.getSlopePercentage()))/1; hgvMotorLvl = hgvMotorLvl + (parameters.getSpeedHgv()/100) * (Math.min(12,parameters.getSlopePercentage()))/0.8; } lvMotorLvl = lvMotorLvl+ Math.min(getA_Roadcoeff(freqParam ,"1",roadSurface,coeffVer), 0.); medMotorLvl = medMotorLvl + Math.min(getA_Roadcoeff(freqParam ,"2",roadSurface,coeffVer), 0.); hgvMotorLvl = hgvMotorLvl + Math.min(getA_Roadcoeff(freqParam ,"3",roadSurface,coeffVer), 0.); wheelaMotorLvl = wheelaMotorLvl + Math.min(getA_Roadcoeff(freqParam ,"4a",roadSurface,coeffVer), 0.); wheelbMotorLvl = wheelbMotorLvl + Math.min(getA_Roadcoeff(freqParam ,"4b",roadSurface,coeffVer), 0.); final double lvCompound = sumDba(lvRoadLvl, lvMotorLvl); final double medCompound = sumDba(medRoadLvl, medMotorLvl); final double hgvCompound = sumDba(hgvRoadLvl, hgvMotorLvl); final double wheelaCompound = sumDba(wheelaRoadLvl, wheelaMotorLvl); final double wheelbCompound = sumDba(wheelbRoadLvl, wheelbMotorLvl); double lvLvl = Vperhour2NoiseLevel(lvCompound , parameters.getLvPerHour(), parameters.getSpeedLv()); double medLvl =Vperhour2NoiseLevel(medCompound , parameters.getMvPerHour(), parameters.getSpeedMv()); double hgvLvl =Vperhour2NoiseLevel(hgvCompound , parameters.getHgvPerHour(), parameters.getSpeedHgv()); double wheelaLvl =Vperhour2NoiseLevel(wheelaCompound , parameters.getWavPerHour(), parameters.getSpeedWav()); double wheelbLvl =Vperhour2NoiseLevel(wheelbCompound , parameters.getWbvPerHour(), parameters.getSpeedWbv()); return sumDba_5(lvLvl, medLvl, hgvLvl, wheelaLvl, wheelbLvl); }  static JsonNode getCnossosData(int coeffVer); static Double getA_Roadcoeff(int Freq, String vehCat, String RoadSurface, int coeffVer); static Double getB_Roadcoeff(String vehCat, String roadSurface, int coeffVer); static double getCr(String vehCat, int k, int coeffVer); static double getCp(String vehCat, int k, int coeffVer); static Double getCoeff(String coeff, int freq, String vehicleCategory, int coeffVer); static double evaluate(RSParametersCnossos parameters);  }
@Test public void T02() { double lv_speed = 70; int lv_per_hour = 1000; double mv_speed = 70; int mv_per_hour = 1000; double hgv_speed = 70; int hgv_per_hour = 1000; double wav_speed = 70; int wav_per_hour = 1000; double wbv_speed = 70; int wbv_per_hour = 1000; int FreqParam = 8000; double Temperature = 15; String RoadSurface = "NL01"; double Pm_stud = 0.5; double Ts_stud = 4; double Junc_dist = 200; int Junc_type = 1; RSParametersCnossos rsParameters = new RSParametersCnossos(lv_speed, mv_speed, hgv_speed, wav_speed, wbv_speed, lv_per_hour, mv_per_hour, hgv_per_hour, wav_per_hour, wbv_per_hour, FreqParam, Temperature, RoadSurface,Ts_stud, Pm_stud , Junc_dist, Junc_type); rsParameters.setSlopePercentage_without_limit(10); rsParameters.setCoeffVer(1); assertEquals(77.6711 , EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); }
@Test public void T03() { double lv_speed = 40; int lv_per_hour = 582; double mv_speed = 43; int mv_per_hour = 500; double hgv_speed = 45; int hgv_per_hour = 400; double wav_speed = 35; int wav_per_hour = 1000; double wbv_speed = 32; int wbv_per_hour = 1100; int FreqParam = 1000; double Temperature = 5; String RoadSurface = "NL02"; double Pm_stud = 0.5; double Ts_stud = 4; double Junc_dist = 200; int Junc_type = 1; RSParametersCnossos rsParameters = new RSParametersCnossos(lv_speed, mv_speed, hgv_speed, wav_speed, wbv_speed, lv_per_hour, mv_per_hour, hgv_per_hour, wav_per_hour, wbv_per_hour, FreqParam, Temperature, RoadSurface,Ts_stud, Pm_stud , Junc_dist, Junc_type); rsParameters.setSlopePercentage_without_limit(-5); rsParameters.setCoeffVer(1); assertEquals(79.6814 , EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); }
@Test public void T04() { double lv_speed = 40; int lv_per_hour = 58; double mv_speed = 43; int mv_per_hour = 50; double hgv_speed = 45; int hgv_per_hour = 40; double wav_speed = 35; int wav_per_hour = 100; double wbv_speed = 32; int wbv_per_hour = 100; int FreqParam = 8000; double Temperature = -5; String RoadSurface = "NL03"; double Pm_stud = 0.5; double Ts_stud = 4.; double Junc_dist = 200; int Junc_type = 1; RSParametersCnossos rsParameters = new RSParametersCnossos(lv_speed, mv_speed, hgv_speed, wav_speed, wbv_speed, lv_per_hour, mv_per_hour, hgv_per_hour, wav_per_hour, wbv_per_hour, FreqParam, Temperature, RoadSurface,Ts_stud, Pm_stud, Junc_dist, Junc_type ); rsParameters.setSlopePercentage_without_limit(-7); rsParameters.setCoeffVer(1); assertEquals(58.8222 , EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); }
@Test public void T05() { double lv_speed = 40; int lv_per_hour = 58; double mv_speed = 43; int mv_per_hour = 50; double hgv_speed = 45; int hgv_per_hour = 40; double wav_speed = 35; int wav_per_hour = 100; double wbv_speed = 32; int wbv_per_hour = 100; int FreqParam = 63; double Temperature = -5; String RoadSurface = "NL03"; double Pm_stud = 0.5; double Ts_stud = 4.; double Junc_dist = 50; int Junc_type = 1; RSParametersCnossos rsParameters = new RSParametersCnossos(lv_speed, mv_speed, hgv_speed, wav_speed, wbv_speed, lv_per_hour, mv_per_hour, hgv_per_hour, wav_per_hour, wbv_per_hour, FreqParam, Temperature, RoadSurface,Ts_stud, Pm_stud, Junc_dist, Junc_type ); rsParameters.setSlopePercentage_without_limit(-7); rsParameters.setCoeffVer(1); assertEquals(82.785 , EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); }
@Test public void T06() { double lv_speed = 70; int lv_per_hour = 1000; double mv_speed = 70; int mv_per_hour = 1000; double hgv_speed = 70; int hgv_per_hour = 1000; double wav_speed = 70; int wav_per_hour = 1000; double wbv_speed = 70; int wbv_per_hour = 1000; int FreqParam = 4000; double Temperature = 15; String RoadSurface = "NL01"; double Pm_stud = 0.5; double Ts_stud = 4.; double Junc_dist = 30; int Junc_type = 2; RSParametersCnossos rsParameters = new RSParametersCnossos(lv_speed, mv_speed, hgv_speed, wav_speed, wbv_speed, lv_per_hour, mv_per_hour, hgv_per_hour, wav_per_hour, wbv_per_hour, FreqParam, Temperature, RoadSurface,Ts_stud, Pm_stud, Junc_dist, Junc_type ); rsParameters.setSlopePercentage_without_limit(10); rsParameters.setCoeffVer(1); assertEquals(85.4991 , EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); }
@Test public void CnossosEmissionTest() { String vehCat="1"; double vehiclePerHour = 1000; double vehicleSpeed = 20; double tsStud = 0.5; String surfRef = "NL01"; double temperature = -5; double pmStud = 1; double slope = -15; double juncDist = 200; int juncType = 1; double[] expectedValues = new double[]{88.421,77.1136,75.5712,75.6919,73.6689,71.3471,68.1195,63.4796}; for(int idFreq = 1; idFreq < FREQUENCIES.length; idFreq++) { RSParametersCnossos rsParameters = new RSParametersCnossos(vehicleSpeed, vehicleSpeed, vehicleSpeed, vehicleSpeed, vehicleSpeed, "1".equals(vehCat) ? vehiclePerHour : 0, "2".equals(vehCat) ? vehiclePerHour : 0, "3".equals(vehCat) ? vehiclePerHour : 0, "4a".equals(vehCat) ? vehiclePerHour : 0, "4b".equals(vehCat) ? vehiclePerHour : 0, FREQUENCIES[idFreq], temperature, surfRef, tsStud, pmStud, juncDist, juncType); rsParameters.setSlopePercentage(slope); rsParameters.setCoeffVer(1); assertEquals(String.format("%d Hz", FREQUENCIES[idFreq]), expectedValues[idFreq], EvaluateRoadSourceCnossos.evaluate(rsParameters), EPSILON_TEST1); } }