NoiseModelling icon indicating copy to clipboard operation
NoiseModelling copied to clipboard

Dynamic_map block - many timesteps + multithreading

Open sachabaclet opened this issue 4 years ago • 5 comments

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.

  1. 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?

  2. 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?

sachabaclet avatar Jun 02 '20 15:06 sachabaclet

Dear Sacha,

  1. 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.

  1. 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.

pierromond avatar Jun 03 '20 07:06 pierromond

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.

sachabaclet avatar Jun 03 '20 13:06 sachabaclet

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.

pierromond avatar Jun 04 '20 07:06 pierromond

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.

sachabaclet avatar Jun 04 '20 14:06 sachabaclet

related to #238

pierromond avatar Apr 21 '22 13:04 pierromond