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

IllegalArgumentException in ComputeCnossosRays during diffraction calculation (2 > 0) – NoiseModelling 4.0.5 #718

Open
IsotoCedex opened this issue Jan 4, 2025 · 3 comments
Labels

Comments

@IsotoCedex
Copy link

IsotoCedex commented Jan 4, 2025

NoiseModelling version
4.0.5

Describe the bug
Hello friends of NoiseModelling,
I am computing road maps of some areas of Spain, using NoiseModelling with Scripts.
I have divided the calculation domains by official cartographic sheets.
In some sheets it gives errors, although most are computed normally.

Please, could you help me to find the cause of the error?
Thanks very much!

To Reproduce
Below I leave the files of one of the sheets that gives an error:

log

[pool-57-thread-7] INFO org.noise_planet.noisemodelling.pathfinder.RootProgressVisitor - 88,24 %
[pool-57-thread-4] ERROR org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays - 2 > 0
java.lang.IllegalArgumentException: 2 > 0
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3990)
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3950)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.computeHEdgeDiffraction(ComputeCnossosRays.java:795)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.directPath(ComputeCnossosRays.java:320)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.directPath(ComputeCnossosRays.java:298)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.rcvSrcPropagation(ComputeCnossosRays.java:273)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.computeRaysAtPosition(ComputeCnossosRays.java:232)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays$RangeReceiversComputation.run(ComputeCnossosRays.java:1718)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "pool-57-thread-4" java.lang.IllegalArgumentException: 2 > 0
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3990)
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3950)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.computeHEdgeDiffraction(ComputeCnossosRays.java:795)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.directPath(ComputeCnossosRays.java:320)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.directPath(ComputeCnossosRays.java:298)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.rcvSrcPropagation(ComputeCnossosRays.java:273)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.computeRaysAtPosition(ComputeCnossosRays.java:232)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays$RangeReceiversComputation.run(ComputeCnossosRays.java:1718)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

Expected behavior

java.lang.IllegalArgumentException: 2 > 0
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3990)
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3950)
        at org.noise_planet.noisemodelling.pathfinder.ComputeCnossosRays.computeHEdgeDiffraction(ComputeCnossosRays.java:795)

It seems to indicate that, in the routine that calculates the diffraction or the ray tracing (ComputeCnossosRays), it is trying to copy a portion of an array where the start index is greater than the end index, or the expected length is negative (for example, copyOfRange(array, from, to) with from > to).
I thought that the cause was some wrong geometry, but I used QGIS tools to check and correct the geometries, and recalculated, and it still happens the same.
I also modified the density of receptors in Delaunay, to see if some error could be produced by the triangulation, but I have not been able to avoid the error either.

Calculation setup:

// Step 3: Run Calculation
    runScript(connection, "C:/NM_Delaunay_SUPRA01/NoiseModelling_without_gui/scriptrunner/noisemodelling/wps/NoiseModelling/Noise_level_from_source.groovy",
            ["tableBuilding":"Buildings",
             "tableSources":"LW_roads",
             "tableReceivers":"Receivers",
             "tableDEM":"DEM",
             "paramWallAlpha":"0.1",
             "confReflOrder":"1",
             "confMaxReflDist":"50",
             "confMaxSrcDist":"1500",
             "confDiffVertical":"False",
             "confDiffHorizontal":"True",
             "confHumidity":"63",
             "confTemperature":"18",
             "confFavorableOccurrencesDay":"0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5",
             "confFavorableOccurrencesEvening":"0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75",
             "confFavorableOccurrencesNight":"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0",
             ])

Screenshots
Here is the results file for Lday. It can be observed that there comes a point, after the error, in which the calculations fail or simply do not continue.

0001_LDAYIsoContour.zip

And a screenshot:
image

@IsotoCedex IsotoCedex added the bug label Jan 4, 2025
@nicolas-f
Copy link
Member

Hi,

Thanks for the feedback.

We are almost done with the v 5.0 release that contain a almost complete rewrite of the propagation algorithm with extensive cnossos and general tests cases.

I don't know if we will release the fix done on the 4.X branch @pierromond ?

@pierromond
Copy link
Collaborator

Thank you @IsotoCedex for this complete feedback of an issue we never saw before (no fast answer...).

I also would like to propose @IsotoCedex to wait the version 5.0 which will bring a lot of new features (and I hope not so much issues :) ) and the rewrite of the propagation algo ... so it should probably resolve this issue. @IsotoCedex can you wait the end of January ?

Kind regards.

@IsotoCedex
Copy link
Author

IsotoCedex commented Jan 6, 2025

Dear @nicolas-f and @pierromond,
Of course I can wait. For now I have solved it by removing the diffraction calculation in those models.
I think the error has to do with some kind of complex geometry of the buildings, which possibly interacts badly with the digital terrain model. But I have not been able to identify it.
I am looking forward to trying the new version of Noise Modelling.
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants