matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

Cannot invoke "TransitStopFacility.getId()" because "stop1" is null #892

Closed gammapopolam closed 1 year ago

gammapopolam commented 1 year ago

Hi! I am trying to run a scenario with public transit and minibus contribs. Here are input files of scenario and logfile of latest run: click

Config info: 2023-03-10T12:29:29,420 INFO Gbl:64 JVM: 19.0.1; Oracle Corporation; mixed mode, sharing; 64-bit 2023-03-10T12:29:29,422 INFO Gbl:68 OS: Windows 11; 10.0; amd64 2023-03-10T12:29:29,422 INFO Gbl:71 CPU cores: 4 2023-03-10T12:29:29,424 INFO Gbl:72 max. Memory: 2008.0MB (2105540608B) 2023-03-10T12:29:29,424 INFO Gbl:110 MATSim-Build: r${buildNumber} (${timestamp})

Also I noticed that transit schedule file is not processed correctly:

2023-03-10T12:29:30,050  INFO CreateOperatorFromTransitSchedule:97 Returning 0 operators created from transit schedule file null
2023-03-10T12:29:30,122  INFO RandomStopProvider:125 Initialized with 0 of 0 stops covering 0.0 percent of activities
2023-03-10T12:29:30,138  INFO RandomStopProvider:136 No weights found. Probably no population given. Falling back to old behavior.
'023-03-10T12:29:30,138 ERROR MatsimRuntimeModifications:76 Getting uncaught Exception in Thread main
java.lang.NullPointerException: Cannot invoke "org.matsim.pt.transitSchedule.api.TransitStopFacility.getId()" because "stop1" is null
    at org.matsim.contrib.minibus.replanning.CreateNew24hPlan.run(CreateNew24hPlan.java:60) ~[classes/:?]
    at org.matsim.contrib.minibus.hook.AbstractOperator.init(AbstractOperator.java:99) ~[classes/:?]
    at org.matsim.contrib.minibus.hook.CarefulMultiPlanOperator.init(CarefulMultiPlanOperator.java:55) ~[classes/:?]
    at org.matsim.contrib.minibus.hook.OperatorInitializer.createAdditionalOperators(OperatorInitializer.java:98) ~[classes/:?]
    at org.matsim.contrib.minibus.hook.PBox.notifyStartup(PBox.java:132) ~[classes/:?]
    at org.matsim.contrib.minibus.hook.PControlerListener.notifyStartup(PControlerListener.java:82) ~[classes/:?]
    at org.matsim.core.controler.ControlerListenerManagerImpl.fireControlerStartupEvent(ControlerListenerManagerImpl.java:109) ~[classes/:?]
    at org.matsim.core.controler.AbstractController$1.run(AbstractController.java:79) ~[classes/:?]
    at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:70) ~[classes/:?]
    at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:53) ~[classes/:?]
    at org.matsim.core.controler.AbstractController.run(AbstractController.java:90) ~[classes/:?]
    at org.matsim.core.controler.NewControler.run(NewControler.java:83) ~[classes/:?]
    at org.matsim.core.controler.Controler.run(Controler.java:250) ~[classes/:?]
    at org.matsim.contrib.minibus.RunMinibus.run(RunMinibus.java:59) ~[classes/:?]
    at org.matsim.contrib.minibus.RunMinibus.main(RunMinibus.java:67) ~[classes/:?]

This error occured when I tried to edit transit schedule with which the scenario ran with no errors. But now, when I trying to back up to the latest working schedule, this error occurs too.

Are there any mistakes in my transit schedule file or it is a bug? Thanks in advance!

mrieser commented 1 year ago

Try running the TransitScheduleValidator: https://github.com/matsim-org/matsim-code-examples/wiki/pt#transit-schedule-validation

This might give you some first insights on where the problem is after you edited the schedule.

gammapopolam commented 1 year ago

Dear Dr. Rieser,

The transit schedule appears valid

mrieser commented 1 year ago

The error occurs when the minibus-contrib tries to use the transit schedule. If the transit schedule itself appears valid, then there must be some other reason for the error. Maybe some misconfiguration?

gammapopolam commented 1 year ago

Thanks for the support. Looks like it was a typo in configuration. I temporarily refused to use all of the routes in simulation.

Owen295 commented 1 year ago

@gammapopolam what parameter in your config did you fix , I have the same error on my minibus implementation. I have tried it with other inputs with validated schedules but I run into the same error with null stops.