NoiseModelling
NoiseModelling copied to clipboard
Dynamic_map block - many timesteps + multithreading
I use the Dynamic_map experimental WPS block on NoiseModelling 3.2.0. It works well for my usage, but I think that it could be improved in a few ways.
-
By default, Dynamic_map calculates 100 time steps, no matter whether there are more or fewer time steps in the input SOURCES file. Is there a way to automatically detect the number of time steps and change the number of calculations accordingly? And to stop the calculation once there is no time step left to calculate?
-
From what I observed, the calculation of the rays between sources and receivers seems to be multi-threaded (if ThreadNumber>1 in the input variables), but the calculation of sound levels for each time step isn't. Is it possible to add multi-threading for this part of the processing, given that those time steps are independent?
Dear Sacha,
- Is there a way to automatically detect the number of time steps and change the number of calculations accordingly? And to stop the calculation once there is no time step left to calculate?
Yes, it is possible. You can count the unique value of the column T for example. We let it in future enhancement.
- This is a more difficult development to perform, I'm not sure it's possible (multithreaded manipulation of an H2 database). I'm less optimistic about this possibility of development.
Thank you Pierre. I implemented the solution that you suggested using the following code:
import org.h2gis.utilities.JDBCUtilities
ArrayList<String> timeSteps = JDBCUtilities.getUniqueFieldValues(connection, sources_table_name, "T");
int numberTimeSteps = timeSteps.size();
That seems to work.
Thank you for sharing ! If you think you will continue to develop NoiseModelling, I suggest you use github to push modification.
First step : Fork the principal branch Second step : do your modification on your personal github webpage Third step : do a "pull request"
In this way, you will be count as a "contributor" to the NoiseModelling code.
Thanks, I will do it if I add more changes to the code in the future.
Don't hesitate to keep me updated if you manage to make progress on multithreading the sound level calculation. According to H2's documentation, it seems that read/write locks shouldn't be a problem, but I don't know enough about the current implementation to determine whether it's possible to implement such a feature.
related to #238