Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Dynamic Tools #660

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public RoadCnossosParameters() {
* @param wbvPerHour Average heavy vehicle per hour
* @param frequency Studied Frequency (must be octave band)
* @param Temperature Temperature (Celsius)
* @param roadSurface roadSurface empty default, NL01 FR01 .. (look at src/main/resources/org/noise_planet/noisemodelling/emission/RoadCnossos_2020.json)
* @param roadSurface roadSurface empty default, NL01 FR01 .. (look at src/main/resources/org/noise_planet/noisemodelling/emission/RoadCnossos_2020.jsonRoadCnossos_2020.json)
* @param Ts_stud A limited period Ts (in months) over the year where a average proportion pm of light vehicles are equipped with studded tyres and during .
* @param Pm_stud Average proportion of vehicles equipped with studded tyres
* @param Junc_dist Distance to the junction (in m) near an intersection, the road segment should be cut into small parts of 10 m..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ public static double evaluate(RoadVehicleCnossosvarParameters parameters) throws

// 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 All @@ -70,8 +72,8 @@ public static double evaluate(RoadVehicleCnossosvarParameters parameters) throws


// Rolling noise acceleration correction
double coefficientJunctionDistance = Math.max(1 - Math.abs(Junc_dist) / 100, 0);
RoadLvl = RoadLvl + getCr(veh_type, Junc_type, coeffVer) * coefficientJunctionDistance;
// double coefficientJunctionDistance = Math.max(1 - Math.abs(Junc_dist) / 100, 0);
// RoadLvl = RoadLvl + getCr(veh_type, Junc_type, coeffVer) * coefficientJunctionDistance;


//Studied tyres
Expand Down Expand Up @@ -102,7 +104,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 @@ -16,11 +16,9 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import static org.h2gis.utilities.GeometryTableUtilities.getGeometryColumnNames;
Expand All @@ -35,6 +33,8 @@ public abstract class JdbcNoiseMap {
// When computing cell size, try to keep propagation distance away from the cell
// inferior to this ratio (in comparison with cell width)
PropagationProcessPathData propagationProcessPathDataDay = new PropagationProcessPathData();

HashMap<String , PropagationProcessPathData > propagationProcessPathDataT= new HashMap<String,PropagationProcessPathData >();
PropagationProcessPathData propagationProcessPathDataEvening = new PropagationProcessPathData();
PropagationProcessPathData propagationProcessPathDataNight = new PropagationProcessPathData();
Logger logger = LoggerFactory.getLogger(JdbcNoiseMap.class);
Expand All @@ -43,7 +43,7 @@ public abstract class JdbcNoiseMap {
protected static final double MINIMAL_BUFFER_RATIO = 0.3;
private String alphaFieldName = "G";
protected final String buildingsTableName;
protected final String sourcesTableName;
protected String sourcesTableName;
protected String soilTableName = "";
// Digital elevation model table. (Contains points or triangles)
protected String demTable = "";
Expand Down Expand Up @@ -96,6 +96,10 @@ public PropagationProcessPathData getPropagationProcessPathData(LDENConfig.TIME_
}
}

public PropagationProcessPathData getPropagationProcessPathData(String time_period) {
return propagationProcessPathDataT.get(time_period);
}

public void setPropagationProcessPathData(LDENConfig.TIME_PERIOD time_period, PropagationProcessPathData propagationProcessPathData) {
switch (time_period) {
case DAY:
Expand All @@ -106,6 +110,10 @@ public void setPropagationProcessPathData(LDENConfig.TIME_PERIOD time_period, Pr
propagationProcessPathDataNight = propagationProcessPathData;
}
}

public void setPropagationProcessPathData(String time_period, PropagationProcessPathData propagationProcessPathData) {
propagationProcessPathDataT.put(time_period, propagationProcessPathData);
}
public PropagationProcessPathData getPropagationProcessPathDataDay() {
return propagationProcessPathDataDay;
}
Expand Down Expand Up @@ -401,6 +409,76 @@ public void fetchCellSource(Connection connection,Envelope fetchEnvelope, Cnosso
}
}


/**
* Fetch source geometries and power
* @param connection Active connection
* @throws SQLException
*/
public List<Integer> fetchSourceNumber(Connection connection)
throws SQLException, IOException {
TableLocation sourceTableIdentifier = TableLocation.parse(sourcesTableName);
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery("SELECT DISTINCT(PK) PK FROM " + sourcesTableName +";");
// Create a List to store the values
List<Integer> distinctSources = new ArrayList<>();


// Iterate through the ResultSet and add values to the List
while (rs.next()) {
Integer value = rs.getInt("PK"); // Change "IT" to the actual column name
distinctSources.add(value);
}

List<Integer> distinctTimesteps = new ArrayList<>();

rs = st.executeQuery("SELECT DISTINCT(IT) IT FROM " + sourcesTableName +";");

// Iterate through the ResultSet and add values to the List
while (rs.next()) {
Integer value = rs.getInt("IT"); // Change "IT" to the actual column name
distinctTimesteps.add(value);
}

return distinctSources;
}

public void createSourcesTable(Connection connection, List<Integer> frequencyValues)
throws SQLException, IOException {
TableLocation sourceTableIdentifier = TableLocation.parse(sourcesTableName);
Statement st = connection.createStatement();

st.execute("CREATE TABLE LW_SOURCES_130DB AS SELECT DISTINCT PK, THE_GEOM FROM " + sourcesTableName +";");

for (int freq : frequencyValues) {
st.execute("ALTER TABLE LW_SOURCES_130DB ADD HZ"+ freq +" DOUBLE NOT NULL DEFAULT 130.0;");
}

st.execute("ALTER TABLE LW_SOURCES_130DB ALTER COLUMN PK INTEGER NOT NULL;");
st.execute("ALTER TABLE LW_SOURCES_130DB ADD CONSTRAINT PK PRIMARY KEY (PK);");



}

public List<String> fetchTimeSteps(Connection connection)
throws SQLException, IOException {
TableLocation sourceTableIdentifier = TableLocation.parse(sourcesTableName);
Statement st = connection.createStatement();

List<String> distinctTimesteps = new ArrayList<>();

ResultSet rs = st.executeQuery("SELECT DISTINCT(IT) IT FROM " + sourcesTableName +";");

// Iterate through the ResultSet and add values to the List
while (rs.next()) {
String value = rs.getString("IT"); // Change "IT" to the actual column name
distinctTimesteps.add(value);
}

return distinctTimesteps;
}

/**
* true if train propagation is computed (multiple reflection between the train and a screen)
* @param bodyBarrier
Expand Down Expand Up @@ -498,6 +576,10 @@ public String getSourcesTableName() {
return sourcesTableName;
}

public void setSourcesTableName(String sourcesTableName) {
this.sourcesTableName = sourcesTableName;
}

/**
* Extracted from NMPB 2008-2 7.3.2
* Soil areas POLYGON, with a dimensionless coefficient G:
Expand Down
Loading
Loading