OBA RT - GTFS, Delay Prediction calculation.

177 views
Skip to first unread message

Ali Shan

unread,
Oct 13, 2017, 6:29:34 AM10/13/17
to onebusaway-developers
Hello,

Problem:
We are having a problem in delay calculation in OBA Application, We are providing the realtime feed to the OBA Application with delay value 0, So it is converting all the Departure/Arrivals with On time, even the vehicle not on the stop, 

Please clarify the below questions.

Question) is there a way to avoid giving the Delay field in our realtime feed and let OBA Application to predict the delay?

Question) Do We have to give the the delay field in our RT-GTFS feed and provide to OBA application then OBA can predict the delay, If Yes then how can we calculate the delay auto?

Question) OBA application can calculate the delay by providing current location and trip detail realtime feed, Or we required some other tool to calculate the delay bu current location e.g (OTP)?



I read the (Google RealTime Proto), there is three values,
https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto
Can we use uncertainty to avoid to provide delay field and allow OBA application to calculate delay,

message StopTimeEvent {
   
// Delay (in seconds) can be positive (meaning that the vehicle is late) or
   
// negative (meaning that the vehicle is ahead of schedule). Delay of 0
   
// means that the vehicle is exactly on time.
    optional int32 delay
= 1;

   
// Event as absolute time.
   
// In Unix time (i.e., number of seconds since January 1st 1970 00:00:00
   
// UTC).
    optional int64 time
= 2;

   
// If uncertainty is omitted, it is interpreted as unknown.
   
// If the prediction is unknown or too uncertain, the delay (or time) field
   
// should be empty. In such case, the uncertainty field is ignored.
   
// To specify a completely certain prediction, set its uncertainty to 0.
    optional int32 uncertainty
= 3;

   
// The extensions namespace allows 3rd-party developers to extend the
   
// GTFS Realtime Specification in order to add and evaluate new features
   
// and modifications to the spec.
    extensions
1000 to 1999;
 
}






Sheldon A. Brown

unread,
Oct 13, 2017, 6:40:12 AM10/13/17
to onebusaway...@googlegroups.com
Delay is indeed optional, so if you leave it off, it is calculated.
But we need to back up first. Do you have valid stop time
predictions?

OneBusAway does not generate arrival predictions, it relies on GTFS-RT
to do that. It can calculate schedule deviation however, if it is
given proper stop time updates per GTFS-RT.

Sheldon
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to onebusaway-devel...@googlegroups.com.
> To post to this group, send email to onebusaway...@googlegroups.com.
> Visit this group at https://groups.google.com/group/onebusaway-developers.
> For more options, visit https://groups.google.com/d/optout.

Ali Shan

unread,
Oct 13, 2017, 6:52:16 AM10/13/17
to onebusaway-developers
Hello Sheldon,

No we dont have Stop Time Predictions (GTFS - RT), we have only the Stop time which we provided by GTFS data to OBA application,

Means OBA will not vari there departure/arrival time by current location, We have to provide all the values in GTFS-RT like Stop update time, Delay and all.

Commonly how we are calculating delay? someone have to keep update  GTFS-RT Feed OR is there a way to calculate it (Question out of OBA application )

Thanks Sheldon...

Sheldon A. Brown

unread,
Oct 13, 2017, 6:56:55 AM10/13/17
to onebusaway...@googlegroups.com
Ok -- one more question to be sure I understand. Do you have
real-time bus positions then, and trip Ids? Is it just arrival
predictions you are missing?

Sheldon
>> > email to onebusaway-devel...@googlegroups.com.
>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> > Visit this group at
>> > https://groups.google.com/group/onebusaway-developers.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to onebusaway-devel...@googlegroups.com.

Ali Shan

unread,
Oct 13, 2017, 7:00:26 AM10/13/17
to onebusaway-developers
Yes, We have Real time bus position and trip id,
Below is example GTFS -RT  update which is we are giving to OBA,

[{"trip:":"76624","lat":"25.377794512196512","lon":"68.33464361911821","busno":"bus1","service":"LOCAL","dest":"76624","nextstop":"S_42461","late":0,"SOURCE":"","TRACK":"","TRACK_CHANGE":""},{"trip:":"19184","lat":"25.3778018951416","lon":"68.33464050292969","busno":"bus2","service":"LOCAL","dest":"19184","nextstop":"S_80391","late":0,"SOURCE":"","TRACK":"","TRACK_CHANGE":""},{"trip:":"96219","lat":"25.37813877","lon":"68.3347694","busno":"bus3","service":"LOCAL","dest":"96219","nextstop":"S_50796","late":0,"SOURCE":"","TRACK":"","TRACK_CHANGE":""}]
>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> > Visit this group at
>> > https://groups.google.com/group/onebusaway-developers.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Sheldon A. Brown

unread,
Oct 13, 2017, 7:50:00 AM10/13/17
to onebusaway...@googlegroups.com
Ok, then you have two options:

1) you can modify GtfsRealtimeSource (perhaps add a flag
interpolateArrivalTimes) that does a trivial prediction based on its
current position in relation to the schedule. OBA calls this
effective schedule deviation, and its calculated based on the ratio of
progress along the trip compared to the position in the schedule.
Some code that does that is here:
https://github.com/camsys/onebusaway-gtfs-realtime-feed/blob/master/onebusaway-gtfs-rt-feed-builder/src/main/java/org/onebusaway/realtime/soundtransit/services/LinkTripServiceImpl.java#L678

The output of the above method is delay which is calculated as
(time_of_update - effective_schedule_deviation).

2) you could plug in your GTFS-RT feed into a prediction engine such
as Transitime (it will actually accept GTFS-RT as an input) and have
it spit out arrival time predictions. Then point OBA at the GTFS-RT
that Transitime generates.

There is a pretty steep learning curve to Transitime, and
unfortunately very little documentation, but if you are not a
developer this may be your best bet.


Good luck!

Sheldon
>> >> > email to onebusaway-devel...@googlegroups.com.
>> >> > To post to this group, send email to onebusaway...@googlegroups.com.
>> >> > Visit this group at
>> >> > https://groups.google.com/group/onebusaway-developers.
>> >> > For more options, visit https://groups.google.com/d/optout.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "onebusaway-developers" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to onebusaway-devel...@googlegroups.com.
>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> > Visit this group at
>> > https://groups.google.com/group/onebusaway-developers.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to onebusaway-devel...@googlegroups.com.

Sheldon A. Brown

unread,
Oct 13, 2017, 7:57:39 AM10/13/17
to onebusaway...@googlegroups.com
Also note that the code I linked to is for example purposes only. It
wont directly drop in place, but should be fairly easy to port over or
at least be inspired by...

Sheldon

Ali Shan

unread,
Oct 13, 2017, 8:09:25 AM10/13/17
to onebusaway-developers
yes Noted Sheldon,

We are using below mentioned project to generate Real-time GTFS Feed,

https://github.com/OneBusAway/onebusaway-gtfs-realtime-trip-updates-producer-demo/wiki

Do you recommend us to use you mentioned feed generation project?
https://github.com/camsys/onebusaway-gtfs-realtime-feed/

Thanks Sheldon.
>>> >> > To post to this group, send email to onebusaway...@googlegroups.com.
>>> >> > Visit this group at
>>> >> > https://groups.google.com/group/onebusaway-developers.
>>> >> > For more options, visit https://groups.google.com/d/optout.
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "onebusaway-developers" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> > an
>>> > To post to this group, send email to onebusaway...@googlegroups.com.
>>> > Visit this group at
>>> > https://groups.google.com/group/onebusaway-developers.
>>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "onebusaway-developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

Sheldon A. Brown

unread,
Oct 13, 2017, 8:11:52 AM10/13/17
to onebusaway...@googlegroups.com
No, not recommending that all -- just giving you some example code by
which you could generate trivial predictions.

The project I linked to is very specific to a particular light rail
deployment. It will not meet your needs.

Sheldon
>> >>> >> > email to onebusaway-devel...@googlegroups.com.
>> >>> >> > To post to this group, send email to
>> >>> >> > onebusaway...@googlegroups.com.
>> >>> >> > Visit this group at
>> >>> >> > https://groups.google.com/group/onebusaway-developers.
>> >>> >> > For more options, visit https://groups.google.com/d/optout.
>> >>> >
>> >>> > --
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups
>> >>> > "onebusaway-developers" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an
>> >>> > email to onebusaway-devel...@googlegroups.com.
>> >>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> >>> > Visit this group at
>> >>> > https://groups.google.com/group/onebusaway-developers.
>> >>> > For more options, visit https://groups.google.com/d/optout.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "onebusaway-developers" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to onebusaway-devel...@googlegroups.com.
>> >> To post to this group, send email to onebusaway...@googlegroups.com.
>> >> Visit this group at
>> >> https://groups.google.com/group/onebusaway-developers.
>> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to onebusaway-devel...@googlegroups.com.

Ali Shan

unread,
Oct 13, 2017, 8:21:01 AM10/13/17
to onebusaway...@googlegroups.com
Ok, mean i have to track down the code and understand how can I use the same logic in my code.

Well let me go through your provided solutions and check which I can do easily 


Thanks Sheldon.








>> >>> >> > To post to this group, send email to
>> >>> >> > onebusaway...@googlegroups.com.
>> >>> >> > Visit this group at
>> >>> >> > https://groups.google.com/group/onebusaway-developers.
>> >>> >> > For more options, visit https://groups.google.com/d/optout.
>> >>> >
>> >>> > --
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups
>> >>> > "onebusaway-developers" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an

>> >>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> >>> > Visit this group at
>> >>> > https://groups.google.com/group/onebusaway-developers.
>> >>> > For more options, visit https://groups.google.com/d/optout.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "onebusaway-developers" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an

>> >> To post to this group, send email to onebusaway...@googlegroups.com.
>> >> Visit this group at
>> >> https://groups.google.com/group/onebusaway-developers.
>> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
You received this message because you are subscribed to a topic in the Google Groups "onebusaway-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/onebusaway-developers/bWvYOQXHj0s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to onebusaway-developers+unsub...@googlegroups.com.
To post to this group, send email to onebusaway-developers@googlegroups.com.

Ali Shan

unread,
Oct 16, 2017, 6:55:59 AM10/16/17
to onebusaway...@googlegroups.com
Dear Sheldon, 

As i read there AVL will update the Transit arrival time, so it meaning arrival time will change if the vehicle is moving on rout. 

its just for my understanding.

This presentation by : Sean Barbeau
Inline image 1






>> >>> >> > To post to this group, send email to
>> >>> >> > onebusaway...@googlegroups.com.
>> >>> >> > Visit this group at
>> >>> >> > https://groups.google.com/group/onebusaway-developers.
>> >>> >> > For more options, visit https://groups.google.com/d/optout.
>> >>> >
>> >>> > --
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups
>> >>> > "onebusaway-developers" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an

>> >>> > To post to this group, send email to onebusaway...@googlegroups.com.
>> >>> > Visit this group at
>> >>> > https://groups.google.com/group/onebusaway-developers.
>> >>> > For more options, visit https://groups.google.com/d/optout.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "onebusaway-developers" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an

>> >> To post to this group, send email to onebusaway...@googlegroups.com.
>> >> Visit this group at
>> >> https://groups.google.com/group/onebusaway-developers.
>> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "onebusaway-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> To post to this group, send email to onebusaway-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/onebusaway-developers.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "onebusaway-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/onebusaway-developers/bWvYOQXHj0s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to onebusaway-developers+unsubscri...@googlegroups.com.

To post to this group, send email to onebusaway-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/onebusaway-developers.
For more options, visit https://groups.google.com/d/optout.



--

Regards,

Ali Shan 

alts-ltd.com


 

Reply all
Reply to author
Forward
0 new messages