Skip to content

Commit

Permalink
Merge pull request #696 from pierromond/5.X_Dynamic_Tools_Fix
Browse files Browse the repository at this point in the history
5.x dynamic tools fix
  • Loading branch information
nicolas-f authored Nov 4, 2024
2 parents 329c689 + fa14874 commit e6aa4cf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class RoadCnossosParameters {
private double qStudRatio; // Average ratio of the total volume of light vehicles per hour equipped with studded tyres during the period Ts_stud (in months)


private double Junc_dist; // Distance to junction
private double Junc_dist = 250; // Distance to junction
private int Junc_type; // Junction type (k=1 traffic lights, k=2 roundabout)

private double slopePercentage = 0; // slope s (in %), In the case of a bi-directional traffic flow, it is necessary to split the flow into two components and correct half for uphill and half for downhill.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ public static double evaluate(RoadVehicleCnossosvarParameters parameters) throws
double RoadLvl; // Lw/m (1 veh/h)

// Noise level
// Noise level
RoadLvl = getNoiseLvl(getCoeff("ap", freqParam, veh_type, coeffVer), getCoeff("bp", freqParam, veh_type, coeffVer), speed, 70.);
RoadLvl = getNoiseLvl(getCoeff("ar", freqParam, veh_type, coeffVer), getCoeff("br", freqParam, veh_type, coeffVer), speed, 70.);

// Correction by temperature p. 36
switch (veh_type) {
case "1":
RoadLvl = RoadLvl + 0.08 * (20 - Temperature); // K = 0.08 p. 36
break;
case "2":
RoadLvl = RoadLvl + 0.04 * (20 - Temperature); // K = 0.04 p. 36
break;
case "3":
RoadLvl = RoadLvl + 0.04 * (20 - Temperature); // K = 0.04 p. 36
break;
Expand Down Expand Up @@ -102,7 +103,7 @@ public static double evaluate(RoadVehicleCnossosvarParameters parameters) throws
switch (acc_type) {
case 1:
if (veh_type.equals("1") || veh_type.equals("2") || veh_type.equals("3")) {
MotorLvl = MotorLvl + getCp(veh_type, Junc_type, coeffVer) * coefficientJunctionDistance;
MotorLvl = MotorLvl + getCp(veh_type, Junc_type, coeffVer) * coefficientJunctionDistance;
}
break;
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
package org.noise_planet.noisemodelling.emission.road;

import org.junit.Test;
import org.noise_planet.noisemodelling.emission.road.cnossos.RoadCnossos;
import org.noise_planet.noisemodelling.emission.road.cnossos.RoadCnossosParameters;
import org.noise_planet.noisemodelling.emission.road.cnossosvar.RoadVehicleCnossosvar;
import org.noise_planet.noisemodelling.emission.road.cnossosvar.RoadVehicleCnossosvarParameters;

Expand All @@ -26,6 +28,57 @@
public class RoadVehicleCnossosvarTest {
private static final double EPSILON_TEST1 = 0.1;

/**
* Test if static LW computation = dynamic LW computation
* @throws IOException
*/
@Test
public void T02_OneVeh() throws IOException {
double lv_speed = 50;
int lv_per_hour = 50000;
double mv_speed = 10;
int mv_per_hour = 0;
double hgv_speed = 10;
int hgv_per_hour = 0;
double wav_speed = 10;
int wav_per_hour = 0;
double wbv_speed = 10;
int wbv_per_hour = 0;
int FreqParam = 500;
double Temperature = 15;
String RoadSurface = "DEF";
double Pm_stud = 0.;
double Ts_stud = 0.;
double Junc_dist = 200;
int Junc_type = 1;
RoadCnossosParameters rsParameters_stat = new RoadCnossosParameters(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_stat.setSlopePercentage(0);
rsParameters_stat.setFileVersion(2);
rsParameters_stat.setTemperature(Temperature);
rsParameters_stat.setRoadSurface(RoadSurface);

double speed = 50;
int acc = 1;
boolean Stud = false;
String veh_type = "1";
int acc_type = 1;
double LwStd = 0;
int VehId = 10;
RoadVehicleCnossosvarParameters rsParameters_dyn = new RoadVehicleCnossosvarParameters(speed, acc, veh_type, acc_type, Stud, LwStd, VehId);
rsParameters_dyn.setSlopePercentage(0);
rsParameters_dyn.setFileVersion(2);
rsParameters_dyn.setFrequency(FreqParam);
rsParameters_dyn.setTemperature(Temperature);
rsParameters_dyn.setRoadSurface(RoadSurface);
rsParameters_dyn.setJunc_dist(250);
double res = RoadVehicleCnossosvar.evaluate(rsParameters_dyn);
double res2 = RoadCnossos.evaluate(rsParameters_stat);
assertEquals(res2, res, EPSILON_TEST1);


}


@Test
public void testRoadNoise1() throws IOException {
double speed = 50;
Expand All @@ -49,7 +102,7 @@ public void testRoadNoise1() throws IOException {
rsParameters.setRoadSurface(RoadSurface);
rsParameters.setJunc_dist(Junc_dist);
rsParameters.setJunc_type(Junc_type);
assertEquals(91.66, RoadVehicleCnossosvar.evaluate(rsParameters), EPSILON_TEST1);
assertEquals(94.35, RoadVehicleCnossosvar.evaluate(rsParameters), EPSILON_TEST1);
}

@Test
Expand All @@ -76,30 +129,4 @@ public void testRoadNoise2_speed0() throws IOException {
rsParameters.setSlopePercentage(0);
assertEquals(100.08, RoadVehicleCnossosvar.evaluate(rsParameters), EPSILON_TEST1);
}


@Test
public void testRoadNoise3_speed60() throws IOException {
int FreqParam = 8000;
double speed = 60;
int acc = 0;

double Temperature = 15;
String RoadSurface = "NL08";
boolean Stud = false;
double Junc_dist = 200;
int Junc_type = 1;
String veh_type = "1";
int acc_type = 1;
double LwStd = 0;
int VehId = 1;
RoadVehicleCnossosvarParameters rsParameters = new RoadVehicleCnossosvarParameters(speed, acc, veh_type, acc_type, Stud, LwStd, VehId);
rsParameters.setSlopePercentage(0);
rsParameters.setFrequency(FreqParam);
rsParameters.setTemperature(Temperature);
rsParameters.setRoadSurface(RoadSurface);
rsParameters.setJunc_dist(Junc_dist);
rsParameters.setJunc_type(Junc_type);
assertEquals(78.62, RoadVehicleCnossosvar.evaluate(rsParameters), EPSILON_TEST1);
}
}

0 comments on commit e6aa4cf

Please sign in to comment.