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

Customize vehicle category #622

Open
zjc9988 opened this issue Oct 31, 2023 · 12 comments
Open

Customize vehicle category #622

zjc9988 opened this issue Oct 31, 2023 · 12 comments

Comments

@zjc9988
Copy link

zjc9988 commented Oct 31, 2023

Hello,
Recently I'm curious about the noise emission from electronic vehicles(EVs) and I have found some papers providing the CNOSSUS-EU coefficients for EVs.
So I wonder if it is possible to calculate noise emission from EVs by customizing a new vehicle category with NoiseModelling. If possible, where can I find the codes and how should I modify them?
Thanks for your help.

@pierromond
Copy link
Contributor

Yes, you can do it. The first job is to add your new category in this file : https://github.com/Universite-Gustave-Eiffel/NoiseModelling/blob/master/noisemodelling-emission/src/main/resources/org/noise_planet/noisemodelling/emission/road/cnossos/RoadCnossos_2020.json

"4a": {
"description": "powered_two_wheelers_inf_50cc",

You can do a fifth category...

Then, you will need to modify a bit this file adding a new code name for the fifth category, for the moment LV = cat 1 MV = cat2, etc. :

And compile again.

I think this is the two only files to modify. Please tell us if you succeed to do so or if you need more info !

@zjc9988
Copy link
Author

zjc9988 commented Nov 7, 2023

@pierromond Thanks for the reply. In previous use, I downloaded the NoiseModelling ver 4.0.0 without GUI, but when I try to look for the code to modify, I can't find them in the directory. So I just downloaded the source code from Github. However, since I'm not familiar with java, can you please give me some instructions about how to compile the codes and put them into use?

@pierromond
Copy link
Contributor

You should use the last version of NM -> 4.0.5

@zjc9988
Copy link
Author

zjc9988 commented Nov 8, 2023

Well, thanks for your reply. I have downloaded two files of the ver 4.0.5 (NoiseModelling_without_gui.zip and NoiseModelling-4.0.5.zip) and unzipped them. The problem here is: I prefer to use the without_gui version because I have written a script for running the model automatically; however, I cannot find the source code file to modify in the NoiseModelling_without_gui directory.
NoiseModelling_without_gui directory
The only place I can find the source code file is in the NoiseModelling-4.0.5 directory but I do not know how to run the model with the source code files.
NoiseModelling-4 0 5 directory (source code)

So here's the help I'm looking for: how can I compile the source codes and make them look like the files in the NoiseModelling_without_gui directory for the model to run? Or is it possible to directly run the model with the source code?

Thanks for your reply.

@pierromond
Copy link
Contributor

You will need to use a IDE as IntelliJ and open NoiseModelling as a github project. Did you already see the video of NM 2022? I think it explains how to run and compile NoiseModelling in your favorite IDE.

@zjc9988
Copy link
Author

zjc9988 commented Nov 9, 2023

No, I can't find the video of NM 2022 on the website of NoiseModelling. Much appreciate if you can provide the link.
Anyway, I'll try with my IDE first. Thanks for your help. I'll keep you informed of the progress.

@pierromond
Copy link
Contributor

You can access here : https://cloud.univ-eiffel.fr/s/tnqybGmj4EE8M8k
pwd : NMDays2022!NMDays2022! free access during 3 days !

Keep in touch

@zjc9988
Copy link
Author

zjc9988 commented Nov 16, 2023

Hello, @pierromond, I've come back to report my progress.
In the past few days, I modified some of the codes and compiled them (Some errors occur at maven test part, but if I toggle 'skip tests' mode, maven build goes fine, so I suppose it doesn't matter?). Then I use the generated .jar files to replace the existing ones in the scriptrunner/lib folder. After that, I modified the input file roads.shp to add some info about the electric vehicles (named 'ev' in the codes and input files).
However, when I start to test running NoiseModelling, I get some errors at the first step of the calculation. Would you mind having a look at the errors and give some advice?
The modified codes, input files, running scripts and running results are attached in the zip files.
bug_report_NM_1116.zip
input1.zip
input2.zip
Thank you for the help.

@pierromond
Copy link
Contributor

Nice work, congratulations !

(Some errors occur at maven test part, but if I toggle 'skip tests' mode, maven build goes fine, so I suppose it doesn't matter?).
It depends the errors, but most of the test are regression tests. They help to be sure that your modifications will not change another part of the code.

However, when I start to test running NoiseModelling, I get some errors at the first step of the calculation. Would you mind having a look at the errors and give some advice? The modified codes, input files, running scripts and running results are attached in the zip files.

Thank you very much for your codes, I will try to find a moment in the next days/week to look at it. The best to test your code, is to do a unit test. You can inspire you from https://github.com/Universite-Gustave-Eiffel/NoiseModelling/blob/master/noisemodelling-emission/src/test/java/org/noise_planet/noisemodelling/emission/road/RoadCnossosTest.java and here :

public void testTableGenerationFromTraffic() throws SQLException, IOException {
and add two TEV tests for example. Then you can publish your code on your github. In this way, it will be much more easy and fast for me to look at your work. Also, because of the test, we can include your work in the main branch quite easily and with a lot of confidence. Finally, using github will guaranty that you will keep the author rights of your code lines ! just a last advice, the road.shp that you will add to the test directory : https://github.com/Universite-Gustave-Eiffel/NoiseModelling/tree/master/noisemodelling-jdbc/src/test/resources/org/noise_planet/noisemodelling/jdbc should be as light as possible !

By the way, I find a moment to look at your code and come back to you. If you want to follow my advices just tell me !

Kind regards.

@zjc9988
Copy link
Author

zjc9988 commented Nov 30, 2023

Hi, @pierromond , I am coming back to share some of my recent progresses.

Last week I was heavily engaged in some other stuffs, so I didn't look into the problem very much. This week I made some test about the input files and I have found some really confusing things.

At first I suppose the problem was due to some differences in the input file formats between previous version ( I was using v4.0.0 previously) and the latest version, so I prepared the input files from osm files again with the latest version. After that the model runs perfectly.

Then, since I need to add electric vehicles' info into the input roads file, I applied a python script to modify the roads file (using geopandas). The modifications are mainly adding electric vehicles info and modify the numbers for light vehicles (as I try to replace some of the light vehicles with electric vehicles). After that I encountered the problem: the model throws an error message that reads"java.lang.IllegalArgumentException: Invalid ordinate index: 2" and some other errors. The most confusing thing is, when I compare the modified file with the original file in QGIS, I find nothing different except the numbers.

What do you think could be the reason of this bug? I'm looking forward to your opinion.

Thank you very much.

@pierromond
Copy link
Contributor

Generaly, this error is because the z-value is now missing. Sometimes it happens exporting and importing shp. Geojson files are safer for that. Tell me if it was that ! (you can use add_height wps block is you want !)

@zjc9988
Copy link
Author

zjc9988 commented Nov 30, 2023

Yes, you are right. It worked!
Though using geojson format did not help solve the problem, after applying a set_height step before calculating, the model worked well. I'll check the results of the eletric vehicle part for the next few days and see if it meets my expectation. Then I'll publish the codes as you suggested. (may take some time as I have never published codes on Github before).
Thanks a lot for the help these days!

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

No branches or pull requests

2 participants