Skip to content

Commit

Permalink
Add a unit test to check if Dynamic LW compute = Static LW compute
Browse files Browse the repository at this point in the history
  • Loading branch information
pierromond committed Nov 4, 2024
1 parent 356dfb0 commit 090df05
Showing 1 changed file with 52 additions and 0 deletions.
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,56 @@
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);
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 Down

0 comments on commit 090df05

Please sign in to comment.