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

Problem running matsim's emission contrib #159

Closed
neda-git opened this issue Mar 2, 2023 · 17 comments
Closed

Problem running matsim's emission contrib #159

neda-git opened this issue Mar 2, 2023 · 17 comments
Assignees

Comments

@neda-git
Copy link

neda-git commented Mar 2, 2023

Hi @sebhoerl, I'm trying to run the matsim's emission contrib, after running the full simulation for toulouse to use some classes defined in eqasim-java to analyse and compute emissions based on the MATSim outputs, I got these errors, Do you think the problem is related to hbefa's data? Thank you in advance.

.
.
023-03-02T12:08:27,200 INFO Injector:96
2023-03-02T12:08:27,200 INFO Injector:99 === printInjector end ===
2023-03-02T12:08:27,203 INFO EmissionModule:141 entering createLookupTables
Exception in thread "main" com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Error injecting constructor, java.lang.IllegalArgumentException: Mapping for Component not found, expected one of [Country,Year,Vehicle category,Pollutant,Emission factor,Unit]
    at org.matsim.contrib.emissions.EmissionModule.(EmissionModule.java:65)
    while locating org.matsim.contrib.emissions.EmissionModule

1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
at org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents.main(RunComputeEmissionsEvents.java:72)
Caused by: java.lang.IllegalArgumentException: Mapping for Component not found, expected one of [Country,Year,Vehicle category,Pollutant,Emission factor,Unit]
at org.apache.commons.csv.CSVRecord.get(CSVRecord.java:123)
at org.matsim.contrib.emissions.HbefaTables.setCommonParametersOnKey(HbefaTables.java:88)
at org.matsim.contrib.emissions.HbefaTables.createColdKey(HbefaTables.java:79)
at org.matsim.contrib.emissions.HbefaTables.load(HbefaTables.java:57)
at org.matsim.contrib.emissions.HbefaTables.loadAverageCold(HbefaTables.java:38)
at org.matsim.contrib.emissions.EmissionModule.createLookupTables(EmissionModule.java:144)
at org.matsim.contrib.emissions.EmissionModule.(EmissionModule.java:73)
at org.matsim.contrib.emissions.EmissionModule$$FastClassByGuice$$3f5bb797.newInstance()
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
... 2 more

@sebhoerl
Copy link
Contributor

sebhoerl commented Mar 3, 2023

Hi, I have never used the emissions part. But I'm pretty sure that you'll need Hbefa data for that, I'm not sure if it works without (but maybe you already have it). @Nitnelav should be able to tell you more about the emissions part :)

@neda-git
Copy link
Author

neda-git commented Mar 5, 2023

Hi @sebhoerl @Nitnelav, I've exported the hbefa data by using the online version with [Country,Year,Vehicle category,Pollutant,Emission factor,Unit] and I've converted to csv file, then after running i got the errors.

@Nitnelav
Copy link
Collaborator

Nitnelav commented Mar 6, 2023

Mmmm its odd, it looks like you are not using the proper Matsim version.
Can you give us more details ? what versions of eqasim-java you are using ? What version of MATsim ? What version of HBEFA database ?
Are you using the JAR file ? like java -cp ile_de_france-1.0.6.jar org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents --config-path config.xml --hbefa-cold-avg ./EFA_ColdStart_Vehcat_2015_Cold_Average.csv --hbefa-hot-avg ./EFA_HOT_Vehcat_2015_Hot_Average.csv --hbefa-cold-detailed ./EFA_ColdStart_Subsegm_2015_Cold_Detailed.csv --hbefa-hot-detailed ./EFA_HOT_Subsegm_2015_Hot_Detailed.csv ?

@neda-git
Copy link
Author

neda-git commented Mar 6, 2023

HBEFA 4.2 (online version)
eqasim-java 1.3.1
Matsim 13.0

I used :

java -cp toulouse_run.jar org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents --config-path toulouse_config.xml --hbefa-cold-avg ./EFA_ColdStart_Vehcat_2015_Cold_Average.csv --hbefa-hot-avg ./EFA_HOT_Vehcat_2015_Hot_Average.csv --hbefa-cold-detailed ./EFA_ColdStart_Subsegm_2015_Cold_Detailed.csv --hbefa-hot-detailed ./EFA_HOT_Subsegm_2015_Hot_Detailed.csv

Then I got the error:

ARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2023-03-06T10:16:36,162 INFO CommandLine:505 Received 0 positional command line arguments:
2023-03-06T10:16:36,163 INFO CommandLine:506
2023-03-06T10:16:36,164 INFO CommandLine:528 Received 5 command line options with 0 prefixes:
2023-03-06T10:16:36,164 INFO CommandLine:533 config-path = toulouse_config.xml
2023-03-06T10:16:36,164 INFO CommandLine:533 hbefa-cold-avg = ./EFA_ColdStart_Vehcat_2015_Cold_Average.csv
2023-03-06T10:16:36,164 INFO CommandLine:533 hbefa-cold-detailed = ./EFA_ColdStart_Subsegm_2015_Cold_Detailed.csv
2023-03-06T10:16:36,164 INFO CommandLine:533 hbefa-hot-avg = ./EFA_HOT_Vehcat_2015_Hot_Average.csv
2023-03-06T10:16:36,164 INFO CommandLine:533 hbefa-hot-detailed = ./EFA_HOT_Subsegm_2015_Hot_Detailed.csv
2023-03-06T10:16:36,248 INFO IOUtils:187 Resolved toulouse_config.xml to toulouse_config.xml
2023-03-06T10:16:36,251 INFO Config:572 setting context to [file:/home/nedam/PycharmProjects/ile-de-france2/output/]
2023-03-06T10:16:36,302 INFO Version:21 HV000001: Hibernate Validator null
2023-03-06T10:16:36,395 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_config.xml ...
2023-03-06T10:16:36,426 INFO ConfigReader:102 using config_v2-reader
2023-03-06T10:16:36,426 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/config_v2.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:36,664 INFO GlobalConfigGroup:92 setting number of threads to: 4
2023-03-06T10:16:36,667 WARN PlanCalcScoreConfigGroup$ReflectiveDelegate:1622 Setting pathSizeLogitBeta different from zero is experimental. KN, Sep'08
2023-03-06T10:16:36,682 INFO PlanCalcScoreConfigGroup:554 scoring parameters for subpopulation null were just replaced.
2023-03-06T10:16:36,683 WARN PlansCalcRouteConfigGroup:342 The first mode routing params that are explicitly defined clear the default mode routing params. This functionality was removed for
2023-03-06T10:16:36,683 WARN PlansCalcRouteConfigGroup:343 some weeks in the development head, after release 11.x, and before release 12.x; it is now back. If you want to avoid this
2023-03-06T10:16:36,683 WARN PlansCalcRouteConfigGroup:344 warning, use clearModeRoutingParams(true) in code, and "clearDefaultTeleportedModeParams"=true in xml config.
2023-03-06T10:16:36,690 INFO Config:572 setting context to [file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_config.xml]
2023-03-06T10:16:36,709 INFO ScenarioLoaderImpl:134 loading network from file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_network.xml.gz
2023-03-06T10:16:36,710 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_network.xml.gz ...
2023-03-06T10:16:36,789 INFO MatsimNetworkReader:120 using network_v2-reader.
2023-03-06T10:16:36,789 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/network_v2.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:36,848 INFO NetworkImpl:163 node # 1
2023-03-06T10:16:36,849 INFO NetworkImpl:163 node # 4
2023-03-06T10:16:36,851 INFO NetworkImpl:163 node # 16
2023-03-06T10:16:36,856 INFO NetworkImpl:163 node # 64
2023-03-06T10:16:36,866 INFO NetworkImpl:163 node # 256
2023-03-06T10:16:36,881 INFO NetworkImpl:163 node # 1024
2023-03-06T10:16:36,907 INFO NetworkImpl:163 node # 4096
2023-03-06T10:16:36,976 INFO NetworkImpl:163 node # 16384
2023-03-06T10:16:37,170 INFO NetworkImpl:163 node # 65536
2023-03-06T10:16:37,768 INFO NetworkImpl:163 node # 262144
2023-03-06T10:16:37,848 INFO NetworkImpl:159 link # 1
2023-03-06T10:16:37,849 INFO NetworkImpl:159 link # 4
2023-03-06T10:16:37,851 INFO NetworkImpl:159 link # 16
2023-03-06T10:16:37,859 INFO NetworkImpl:159 link # 64
2023-03-06T10:16:37,889 INFO NetworkImpl:159 link # 256
2023-03-06T10:16:37,913 WARN LinkImpl:125 length=0.0 of link id 100448 may cause problems
2023-03-06T10:16:37,913 WARN LinkImpl:127 Future occurences of this logging statement are suppressed.
2023-03-06T10:16:37,940 INFO NetworkImpl:159 link # 1024
2023-03-06T10:16:38,014 INFO NetworkImpl:159 link # 4096
2023-03-06T10:16:38,215 INFO NetworkImpl:159 link # 16384
2023-03-06T10:16:38,761 INFO NetworkImpl:159 link # 65536
2023-03-06T10:16:40,840 INFO NetworkImpl:159 link # 262144
2023-03-06T10:16:45,055 INFO ScenarioLoaderImpl:159 loading facilities from file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_facilities.xml.gz
2023-03-06T10:16:45,055 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_facilities.xml.gz ...
2023-03-06T10:16:45,058 INFO MatsimFacilitiesReader:137 using facilities_v1-reader.
2023-03-06T10:16:45,058 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/facilities_v1.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:45,666 INFO ScenarioLoaderImpl:168 loaded 111726 facilities from file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_facilities.xml.gz
2023-03-06T10:16:45,666 INFO ScenarioLoaderImpl:187 no facility-attributes file set in config, not loading any facility attributes
2023-03-06T10:16:45,667 INFO ScenarioLoaderImpl:195 loading population from file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_population.xml.gz
2023-03-06T10:16:45,669 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_population.xml.gz ...
2023-03-06T10:16:45,672 INFO PopulationReader:123 using population_v6-reader.
2023-03-06T10:16:45,672 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/population_v6.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:45,725 WARN PopulationReaderMatsimV6:213 coordinate transformation defined both in config and in input file: setting from input file will be used
2023-03-06T10:16:45,742 INFO PopulationImpl:105 person # 1
2023-03-06T10:16:45,744 INFO PopulationImpl:105 person # 4
2023-03-06T10:16:45,830 INFO PopulationImpl:105 person # 16
2023-03-06T10:16:45,865 INFO PopulationImpl:105 person # 64
2023-03-06T10:16:45,961 INFO PopulationImpl:105 person # 256
2023-03-06T10:16:46,229 INFO PopulationImpl:105 person # 1024
2023-03-06T10:16:46,513 INFO PopulationUtils:1087 person # 2616
2023-03-06T10:16:46,514 INFO ScenarioLoaderImpl:243 no person-attributes file set in config, not loading any person attributes
2023-03-06T10:16:46,514 INFO ScenarioLoaderImpl:250 loading households from file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_households.xml.gz
2023-03-06T10:16:46,515 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_households.xml.gz ...
2023-03-06T10:16:46,517 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/households_v1.0.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:46,575 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/matsimCommon.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:46,641 INFO Counter:69 households # 1
2023-03-06T10:16:46,642 INFO Counter:69 households # 2
2023-03-06T10:16:46,643 INFO Counter:69 households # 4
2023-03-06T10:16:46,645 INFO Counter:69 households # 8
2023-03-06T10:16:46,648 INFO Counter:69 households # 16
2023-03-06T10:16:46,655 INFO Counter:69 households # 32
2023-03-06T10:16:46,666 INFO Counter:69 households # 64
2023-03-06T10:16:46,677 INFO Counter:69 households # 128
2023-03-06T10:16:46,686 INFO Counter:69 households # 256
2023-03-06T10:16:46,697 INFO Counter:69 households # 512
2023-03-06T10:16:46,718 INFO Counter:69 households # 1024
2023-03-06T10:16:46,727 INFO Counter:74 households # 1265
2023-03-06T10:16:46,727 INFO ScenarioLoaderImpl:252 households loaded.
2023-03-06T10:16:46,727 INFO ScenarioLoaderImpl:273 no household-attributes file set in config, not loading any household attributes
2023-03-06T10:16:46,729 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_transit_schedule.xml.gz ...
2023-03-06T10:16:46,731 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/transitSchedule_v2.dtd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,601 INFO ScenarioLoaderImpl:324 loading transit vehicles from toulouse_transit_vehicles.xml.gz
2023-03-06T10:16:47,602 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_transit_vehicles.xml.gz ...
2023-03-06T10:16:47,612 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/vehicleDefinitions_v2.0.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,663 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/matsimCommon.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,714 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/vehicleDefinitionsEnumTypes.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,768 INFO MatsimVehicleReader$VehicleReader:75 Found following schemaLocation in vehicle definition file: http://www.matsim.org/files/dtd http://www.matsim.org/files/dtd/vehicleDefinitions_v2.0.xsd
2023-03-06T10:16:47,769 INFO VehicleReaderV2:22 Using org.matsim.vehicles.VehicleReaderV2
2023-03-06T10:16:47,770 INFO Counter:69 [VehiclesImpl] added vehicle # 1
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 2
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 4
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 8
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 16
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 32
2023-03-06T10:16:47,771 INFO Counter:69 [VehiclesImpl] added vehicle # 64
2023-03-06T10:16:47,772 INFO Counter:69 [VehiclesImpl] added vehicle # 128
2023-03-06T10:16:47,773 INFO Counter:69 [VehiclesImpl] added vehicle # 256
2023-03-06T10:16:47,775 INFO Counter:69 [VehiclesImpl] added vehicle # 512
2023-03-06T10:16:47,779 INFO Counter:69 [VehiclesImpl] added vehicle # 1024
2023-03-06T10:16:47,787 INFO Counter:69 [VehiclesImpl] added vehicle # 2048
2023-03-06T10:16:47,799 INFO Counter:69 [VehiclesImpl] added vehicle # 4096
2023-03-06T10:16:47,820 INFO Counter:69 [VehiclesImpl] added vehicle # 8192
2023-03-06T10:16:47,833 INFO ScenarioLoaderImpl:334 loading vehicles from toulouse_vehicles.xml.gz
2023-03-06T10:16:47,833 INFO MatsimXmlParser:160 starting to parse xml from url file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_vehicles.xml.gz ...
2023-03-06T10:16:47,843 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/vehicleDefinitions_v2.0.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,895 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/matsimCommon.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,946 INFO MatsimXmlParser:276 Trying to load http://www.matsim.org/files/dtd/vehicleDefinitionsEnumTypes.xsd. In some cases (e.g. network interface up but no connection), this may take a bit.
2023-03-06T10:16:47,999 INFO MatsimVehicleReader$VehicleReader:75 Found following schemaLocation in vehicle definition file: http://www.matsim.org/files/dtd http://www.matsim.org/files/dtd/vehicleDefinitions_v2.0.xsd
2023-03-06T10:16:48,000 INFO VehicleReaderV2:22 Using org.matsim.vehicles.VehicleReaderV2
2023-03-06T10:16:48,002 INFO Counter:69 [VehiclesImpl] added vehicle # 1
2023-03-06T10:16:48,002 INFO Counter:69 [VehiclesImpl] added vehicle # 2
2023-03-06T10:16:48,002 INFO Counter:69 [VehiclesImpl] added vehicle # 4
2023-03-06T10:16:48,003 INFO Counter:69 [VehiclesImpl] added vehicle # 8
2023-03-06T10:16:48,003 INFO Counter:69 [VehiclesImpl] added vehicle # 16
2023-03-06T10:16:48,004 INFO Counter:69 [VehiclesImpl] added vehicle # 32
2023-03-06T10:16:48,005 INFO Counter:69 [VehiclesImpl] added vehicle # 64
2023-03-06T10:16:48,007 INFO Counter:69 [VehiclesImpl] added vehicle # 128
2023-03-06T10:16:48,012 INFO Counter:69 [VehiclesImpl] added vehicle # 256
2023-03-06T10:16:48,018 INFO Counter:69 [VehiclesImpl] added vehicle # 512
2023-03-06T10:16:48,030 INFO Counter:69 [VehiclesImpl] added vehicle # 1024
2023-03-06T10:16:48,046 INFO Counter:69 [VehiclesImpl] added vehicle # 2048
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_run.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-03-06T10:16:48,582 INFO Injector:81 === printInjector start ===
2023-03-06T10:16:48,583 INFO Injector:85 org.matsim.api.core.v01.Scenario
2023-03-06T10:16:48,583 INFO Injector:86 --> provider: ConstantFactory{value=org.matsim.core.scenario.MutableScenario@289778cd}[Scopes.SINGLETON]
2023-03-06T10:16:48,584 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:65)
2023-03-06T10:16:48,584 INFO Injector:89 --> scope: eager singleton
2023-03-06T10:16:48,584 INFO Injector:94 ==full==> InstanceBinding{key=Key[type=org.matsim.api.core.v01.Scenario, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:65), instance=org.matsim.core.scenario.MutableScenario@289778cd}
2023-03-06T10:16:48,584 INFO Injector:96
2023-03-06T10:16:48,584 INFO Injector:85 org.matsim.core.api.experimental.events.EventsManager
2023-03-06T10:16:48,584 INFO Injector:86 --> provider: ConstantFactory{value=org.matsim.core.events.EventsManagerImpl@7495699f}[Scopes.SINGLETON]
2023-03-06T10:16:48,584 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:66)
2023-03-06T10:16:48,584 INFO Injector:89 --> scope: eager singleton
2023-03-06T10:16:48,585 INFO Injector:94 ==full==> InstanceBinding{key=Key[type=org.matsim.core.api.experimental.events.EventsManager, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:66), instance=org.matsim.core.events.EventsManagerImpl@7495699f}
2023-03-06T10:16:48,585 INFO Injector:96
2023-03-06T10:16:48,585 INFO Injector:85 org.matsim.contrib.emissions.EmissionModule
2023-03-06T10:16:48,585 INFO Injector:86 --> provider: com.google.inject.internal.ConstructorBindingImpl$Factory@7c2312fa
2023-03-06T10:16:48,585 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:67)
2023-03-06T10:16:48,585 INFO Injector:89 --> scope: Scopes.NO_SCOPE
2023-03-06T10:16:48,585 INFO Injector:94 ==full==> ConstructorBinding{key=Key[type=org.matsim.contrib.emissions.EmissionModule, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:67), scope=Scopes.NO_SCOPE}
2023-03-06T10:16:48,585 INFO Injector:96
2023-03-06T10:16:48,585 INFO Injector:99 === printInjector end ===
2023-03-06T10:16:48,587 INFO EmissionModule:141 entering createLookupTables
Exception in thread "main" com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Error injecting constructor, java.lang.IllegalArgumentException: Mapping for Component not found, expected one of [Country, Year, Vehicle category, Pollutant, Emission factor, Unit]
    at org.matsim.contrib.emissions.EmissionModule.(EmissionModule.java:65)
    while locating org.matsim.contrib.emissions.EmissionModule

1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
at org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents.main(RunComputeEmissionsEvents.java:72)
Caused by: java.lang.IllegalArgumentException: Mapping for Component not found, expected one of [Country, Year, Vehicle category, Pollutant, Emission factor, Unit]
at org.apache.commons.csv.CSVRecord.get(CSVRecord.java:123)
at org.matsim.contrib.emissions.HbefaTables.setCommonParametersOnKey(HbefaTables.java:88)
at org.matsim.contrib.emissions.HbefaTables.createColdKey(HbefaTables.java:79)
at org.matsim.contrib.emissions.HbefaTables.load(HbefaTables.java:57)
at org.matsim.contrib.emissions.HbefaTables.loadAverageCold(HbefaTables.java:38)
at org.matsim.contrib.emissions.EmissionModule.createLookupTables(EmissionModule.java:144)
at org.matsim.contrib.emissions.EmissionModule.(EmissionModule.java:73)
at org.matsim.contrib.emissions.EmissionModule$$FastClassByGuice$$3f5bb797.newInstance()
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
... 2 more

@Nitnelav
Copy link
Collaborator

Nitnelav commented Mar 6, 2023

Ok it matches Matsim 13.0 so the issue is probably with the CSV files you exported from HBEFA.
Here are my headers for the hbefa files, can you check you have the same ?

  • EFA_ColdStart_Vehcat_2015_Cold_Average.csv
    Case;VehCat;Year;TrafficScenario;Component;RoadCat;AmbientCondPattern;EFA_weighted;EFA_km_weighted;EFA_WTT_weighted;EFA_WTT_km_weighted;EFA_WTW_weighted;EFA_WTW_km_weighted
  • EFA_HOT_Vehcat_2015_Hot_Average.csv
    Case;VehCat;Year;TrafficScenario;Component;RoadCat;TrafficSit;Gradient;V_weighted;EFA_weighted;AmbientCondPattern;EFA_WTT_weighted;EFA_WTW_weighted
  • EFA_ColdStart_Subsegm_2015_Cold_Detailed.csv
    Case;VehCat;Year;TrafficScenario;Component;RoadCat;AmbientCondPattern;IDSubsegment;Subsegment;Technology;SizeClasse;EmConcept;KM;%OfSubsegment;EFA;EFA_weighted;EFA_km;EFA_km_weighted;EFA_WTT;EFA_WTT_km;EFA_WTW;EFA_WTW_km
  • EFA_HOT_Subsegm_2015_Hot_Detailed.csv
    Case;VehCat;Year;TrafficScenario;Component;RoadCat;TrafficSit;Gradient;IDSubsegment;Subsegment;Technology;SizeClasse;EmConcept;KM;%OfSubsegment;V;V_0%;V_100%;EFA;EFA_0%;EFA_100%;V_weighted;V_weighted_0%;V_weighted_100%;EFA_weighted;EFA_weighted_0%;EFA_weighted_100%;AmbientCondPattern;EFA_WTT;EFA_WTT_0%;EFA_WTT_100%;EFA_WTW;EFA_WTW_0%;EFA_WTW_100%

@neda-git
Copy link
Author

neda-git commented Mar 6, 2023

Ah, no, it's not the same, my headers are: Country, Year, Vehicle category, Pollutant, Emission factor, Unit
your data is exported from the online version? how can i find the data like your data?

@Nitnelav
Copy link
Collaborator

Nitnelav commented Mar 6, 2023

I'm using the following Results "Case" or "Parameter Set" :
image
image
image
image

@Nitnelav
Copy link
Collaborator

Nitnelav commented Mar 6, 2023

Ah I didn't see you were using the online tool. No you need to buy the full HBEFA database and export the data you need to use the provided scripts.
But with some coding you could make it compatible with the online version I guess

@neda-git
Copy link
Author

neda-git commented Mar 6, 2023

Many thanks @Nitnelav

@Nitnelav Nitnelav closed this as completed Mar 7, 2023
@neda-git
Copy link
Author

Hello @Nitnelav, I tried emission contrib by using the sample of hbefa dataset but It could not write the output_emission_events, I don't have the folder like simulation_output in this direction and it returns the errors, do you think my sample database still has the problem? Thank you in advance.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/nedam/PycharmProjects/ile-de-france2/output/toulouse_run.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-03-10T11:38:56,531 INFO Injector:81 === printInjector start ===
2023-03-10T11:38:56,531 INFO Injector:85 org.matsim.api.core.v01.Scenario
2023-03-10T11:38:56,533 INFO Injector:86 --> provider: ConstantFactory{value=org.matsim.core.scenario.MutableScenario@289778cd}[Scopes.SINGLETON]
2023-03-10T11:38:56,533 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:65)
2023-03-10T11:38:56,533 INFO Injector:89 --> scope: eager singleton
2023-03-10T11:38:56,534 INFO Injector:94 ==full==> InstanceBinding{key=Key[type=org.matsim.api.core.v01.Scenario, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:65), instance=org.matsim.core.scenario.MutableScenario@289778cd}
2023-03-10T11:38:56,534 INFO Injector:96
2023-03-10T11:38:56,534 INFO Injector:85 org.matsim.core.api.experimental.events.EventsManager
2023-03-10T11:38:56,534 INFO Injector:86 --> provider: ConstantFactory{value=org.matsim.core.events.EventsManagerImpl@7495699f}[Scopes.SINGLETON]
2023-03-10T11:38:56,534 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:66)
2023-03-10T11:38:56,534 INFO Injector:89 --> scope: eager singleton
2023-03-10T11:38:56,534 INFO Injector:94 ==full==> InstanceBinding{key=Key[type=org.matsim.core.api.experimental.events.EventsManager, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:66), instance=org.matsim.core.events.EventsManagerImpl@7495699f}
2023-03-10T11:38:56,535 INFO Injector:96
2023-03-10T11:38:56,535 INFO Injector:85 org.matsim.contrib.emissions.EmissionModule
2023-03-10T11:38:56,535 INFO Injector:86 --> provider: com.google.inject.internal.ConstructorBindingImpl$Factory@7c2312fa
2023-03-10T11:38:56,535 INFO Injector:87 --> source: org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:67)
2023-03-10T11:38:56,535 INFO Injector:89 --> scope: Scopes.NO_SCOPE
2023-03-10T11:38:56,535 INFO Injector:94 ==full==> ConstructorBinding{key=Key[type=org.matsim.contrib.emissions.EmissionModule, annotation=[none]], source=org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents$1.install(RunComputeEmissionsEvents.java:67), scope=Scopes.NO_SCOPE}
2023-03-10T11:38:56,535 INFO Injector:96
2023-03-10T11:38:56,535 INFO Injector:99 === printInjector end ===
2023-03-10T11:38:56,539 INFO EmissionModule:141 entering createLookupTables
2023-03-10T11:38:56,583 INFO EmissionModule:156 leaving createLookupTables
2023-03-10T11:38:56,585 INFO EmissionModule:196 entering createEmissionHandlers
2023-03-10T11:38:56,602 INFO EventsManagerImpl:160 adding Event-Handler: org.matsim.contrib.emissions.WarmEmissionHandler
2023-03-10T11:38:56,603 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.LinkEnterEventHandler
2023-03-10T11:38:56,603 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.LinkEnterEvent
2023-03-10T11:38:56,604 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler
2023-03-10T11:38:56,604 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.LinkLeaveEvent
2023-03-10T11:38:56,604 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler
2023-03-10T11:38:56,605 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent
2023-03-10T11:38:56,605 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler
2023-03-10T11:38:56,605 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.VehicleEntersTrafficEvent
2023-03-10T11:38:56,606 INFO EventsManagerImpl:176
2023-03-10T11:38:56,607 INFO EventsManagerImpl:160 adding Event-Handler: org.matsim.contrib.emissions.ColdEmissionHandler
2023-03-10T11:38:56,607 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler
2023-03-10T11:38:56,607 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.LinkLeaveEvent
2023-03-10T11:38:56,607 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler
2023-03-10T11:38:56,608 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent
2023-03-10T11:38:56,608 INFO EventsManagerImpl:166 org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler
2023-03-10T11:38:56,608 INFO EventsManagerImpl:227 > org.matsim.api.core.v01.events.VehicleEntersTrafficEvent
2023-03-10T11:38:56,608 INFO EventsManagerImpl:176
2023-03-10T11:38:56,608 INFO EmissionModule:205 leaving createEmissionHandlers
Exception in thread "main" org.matsim.core.utils.io.UncheckedIOException: java.io.FileNotFoundException: /home/nedam/PycharmProjects/ile-de-france2/output/simulation_output/output_emissions_events.xml.gz (No such file or directory)
at org.matsim.core.utils.io.IOUtils.getOutputStream(IOUtils.java:340)
at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:354)
at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:365)
at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:509)
at org.matsim.core.events.algorithms.EventWriterXML.(EventWriterXML.java:39)
at org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents.main(RunComputeEmissionsEvents.java:75)
Caused by: java.io.FileNotFoundException: /home/nedam/PycharmProjects/ile-de-france2/output/simulation_output/output_emissions_events.xml.gz (No such file or directory)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:237)
at org.matsim.core.utils.io.IOUtils.getOutputStream(IOUtils.java:319)
... 5 more

@Nitnelav
Copy link
Collaborator

You can try creating the /home/nedam/PycharmProjects/ile-de-france2/output/simulation_output directory i guess

@neda-git
Copy link
Author

In fact, it doesn't find the output_emission_events.xml in this folder, because it didn't create by emissions.RunComputeEmissionsEvents.

@neda-git
Copy link
Author

Hello @Nitnelav, could you please let me know your hbefa csv files are like this row sample:
for the parameters without values what should i do that? I have full hbefa database, i exported the data in .XLSX then I saved that in CSV(séparateur: point-virgule).

Case;VehCat;Year;TrafficScenario;Component;RoadCat;AmbientCondPattern;IDSubsegment;Subsegment;Technology;SizeClasse;EmConcept;KM;%OfSubsegment;EFA;EFA_weighted;EFA_km;EFA_km_weighted;EFA_WTT;EFA_WTT_km;EFA_WTW;EFA_WTW_km

2015_Cold_Detailed[4.2.2];pass. car;2015;REF F HB42;HC;Urban;Ø/France - Avg;111903;PC petrol ECE-15'03;petrol (4S);not specified;PC P Euro-0;212826,0313;7,67883E-05;7,009304523;0,575411737;;;;;;

@syhwawa
Copy link

syhwawa commented Jan 23, 2024

Hello @neda-git. I am also trying to run matsim emission contrib using the HBFEA using some example files that matsim scenarios provide.

I think I met the the same error that you posted in the issue. Could you please let you know how did you resolve the following error? Many thanks.

2024-01-23T15:43:53,436  INFO EventsManagerImpl:160 adding Event-Handler: org.matsim.contrib.emissions.ColdEmissionHandler
2024-01-23T15:43:53,436  INFO EventsManagerImpl:166   org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler
2024-01-23T15:43:53,436  INFO EventsManagerImpl:227     > org.matsim.api.core.v01.events.LinkLeaveEvent
2024-01-23T15:43:53,436  INFO EventsManagerImpl:166   org.matsim.api.core.v01.events.handler.VehicleLeavesTrafficEventHandler
2024-01-23T15:43:53,436  INFO EventsManagerImpl:227     > org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent
2024-01-23T15:43:53,436  INFO EventsManagerImpl:166   org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler
2024-01-23T15:43:53,436  INFO EventsManagerImpl:227     > org.matsim.api.core.v01.events.VehicleEntersTrafficEvent
2024-01-23T15:43:53,436  INFO EventsManagerImpl:176 
2024-01-23T15:43:53,437  INFO EmissionModule:205 leaving createEmissionHandlers
Exception in thread "main" org.matsim.core.utils.io.UncheckedIOException: java.io.FileNotFoundException: /mnt/efs/eqasim_test/simulations/eqasim_emission_1pc_20240124/output_emissions_events.xml.gz (No such file or directory)
        at org.matsim.core.utils.io.IOUtils.getOutputStream(IOUtils.java:340)
        at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:354)
        at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:365)
        at org.matsim.core.utils.io.IOUtils.getBufferedWriter(IOUtils.java:509)
        at org.matsim.core.events.algorithms.EventWriterXML.<init>(EventWriterXML.java:39)
        at org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents.main(RunComputeEmissionsEvents.java:75)
Caused by: java.io.FileNotFoundException: /mnt/efs/eqasim_test/simulations/eqasim_emission_1pc_20240124/output_emissions_events.xml.gz (No such file or directory)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
        at org.matsim.core.utils.io.IOUtils.getOutputStream(IOUtils.java:319)
        ... 5 more

@neda-git
Copy link
Author

Hi @syhwawa , for solving this issue try to extract the dataset from here https://www.hbefa.net/ , sample data is not complete and in your case some emission factors are not exist in your hbefa dataset. Hope it works for you.

@syhwawa
Copy link

syhwawa commented Jan 26, 2024

Thanks very much for your reply! @neda-git. Sure thing. I will give a try using the full HBEFA dataset.

@Nitnelav
Copy link
Collaborator

Hi there, just so you know I have been working on some improvements on the emission code here : eqasim-org/eqasim-java#173

It is still requires a few changes before merging but you can cherrypick what you need from there if you need it.

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

No branches or pull requests

4 participants