Wiki source code of SIRI MonitoredVehicleJourney Element
Last modified by Reya Jasmin on 2025/01/22 21:18
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = SIRI MonitoredVehicleJourney Element = | ||
2 | |||
3 | The SIRI ##MonitoredVehicleJourney## element contains most of the relevant real-time information about particular vehicles in the MTA Bus Time system. It is used by the responses to both the [[VehicleMonitoring>>Developers.SIRIVehicleMonitoring]] and [[StopMonitoring>>Developers.SIRIStopMonitoring]] calls. As much as possible, the values in a ##MonitoredVehicleJourney## element correspond to the values in the MTA's GTFS data. | ||
4 | |||
5 | The XML below illustrates the SIRI MonitoredVehicleJourney element. Other notes on the contents of a ##MonitoredVehicleJourney## follow the example. | ||
6 | |||
7 | |||
8 | |||
9 | |||
10 | ##<MonitoredVehicleJourney> | ||
11 | \\\\ <!~-~- The 'fully qualified' route name (GTFS agency ID + route ID) for the trip the vehicle is serving. Not intended to be customer-facing. ~-~-> | ||
12 | <LineRef>MTA NYCT_B63</LineRef> | ||
13 | \\\\ <!~-~- The GTFS direction for the trip the vehicle is serving ~-~-> | ||
14 | <DirectionRef>1</DirectionRef> | ||
15 | \\\\ <!~-~- A compound element uniquely identifying the trip the vehicle is serving ~-~-> | ||
16 | <FramedVehicleJourneyRef> | ||
17 | \\\\ <!~-~- The GTFS service date for the trip the vehicle is serving ~-~-> | ||
18 | <DataFrameRef>2011-01-28</DataFrameRef> | ||
19 | \\\\ <!~-~- The GTFS trip ID for trip the vehicle is serving, prefixed by the GTFS agency ID ~-~-> | ||
20 | <DatedVehicleJourneyRef>MTA NYCT_20110102EA_087800_B63_0002_B63_19</DatedVehicleJourneyRef> | ||
21 | </FramedVehicleJourneyRef> | ||
22 | \\\\ <!~-~- The GTFS Shape_ID, prefixed by GTFS Agency ID ~-~-> | ||
23 | <JourneyPatternRef>MTA NYCT_B630152</JourneyPatternRef> | ||
24 | \\\\ <!~-~- The GTFS route_short_name ~-~-> | ||
25 | <PublishedLineName>B63</PublishedLineName> | ||
26 | \\\\ <!~-~- GTFS Agency_ID ~-~-> | ||
27 | <OperatorRef>MTA NYCT</OperatorRef> | ||
28 | \\\\ <!~-~- The GTFS stop ID for the first stop on the trip the vehicle is serving, prefixed by Agency ID ~-~-> | ||
29 | <OriginRef>MTA_801131</OriginRef> | ||
30 | \\\\ <!~-~- The GTFS stop ID for the last stop on the trip the vehicle is serving, prefixed by Agency ID ~-~-> | ||
31 | <DestinationRef>MTA_801042</DestinationRef> | ||
32 | \\\\ <!~-~- The GTFS trip_headsign for the trip the vehicle is serving ~-~-> | ||
33 | <DestinationName>BAY RIDGE SHORE RD via 5 AV</DestinationName> | ||
34 | \\\\ <!~-~- If a bus has not yet departed, OriginAimedDepartureTime indicates the scheduled departure time of that bus from that terminal in ISO8601 format ~-~-> | ||
35 | <OriginAimedDepartureTime>2011-01-28T14:45:00.000-04:00 </OriginAimedDepartureTime> | ||
36 | \\\\ <!~-~- SituationRef, present only if there is an active service alert covering this call ~-~-> | ||
37 | <SituationRef> | ||
38 | <SituationSimpleRef>MTA NYCT_8d065d76-2813-46ee-b024-20f956232831</SituationSimpleRef> | ||
39 | </SituationRef> | ||
40 | \\\\ <!~-~- Always true ~-~-> | ||
41 | <Monitored>true</Monitored> | ||
42 | \\\\ <!~-~- The most recently recorded or inferred coordinates of this vehicle ~-~-> | ||
43 | <VehicleLocation> | ||
44 | <Longitude>-73.97857</Longitude> | ||
45 | <Latitude>40.68448</Latitude> | ||
46 | </VehicleLocation> | ||
47 | \\\\ <!~-~- Vehicle bearing: 0 is East, increments counter-clockwise ~-~-> | ||
48 | <Bearing>345.7</Bearing> | ||
49 | \\\\ <!~-~- Indicator of whether the bus is making progress (i.e. moving, generally), not moving (with value noProgress), laying over before beginning a trip (value layover), or serving a trip prior to one which will arrive (prevTrip). ~-~-> | ||
50 | <ProgressRate>normalProgress</ProgressRate> | ||
51 | \\\\ <!~-~- Optional indicator of vehicle progress status. Set to "layover" when the bus is in a layover waiting for its next trip to start at a terminal, "spooking" which means a bus is in revenue service, but it is not transmitting real time data (in this case it will use schedule data including schedule deviation), and/or "prevTrip" when the bus is currently serving the previous trip and the information presented 'wraps around' to the following scheduled trip. ~-~-> | ||
52 | <ProgressStatus>layover</ProgressStatus> | ||
53 | \\\\ <!~-~- Optional indicator of whether the bus occupancy is deemed to be "full","seatsAvailable" or "standingAvailable". If bus occupancy information is not available, this indicator is not shown (aka hidden.) ~-~-> | ||
54 | <Occupancy>seatsAvailable</Occupancy> | ||
55 | \\\\ <!~-~- The vehicle ID, preceded by the GTFS agency ID ~-~-> | ||
56 | <VehicleRef>MTA NYCT_7582</VehicleRef> | ||
57 | \\\\ <!~-~- Depending on the system's level of confidence, the GTFS block_id the bus is serving. Please see "Transparency of Block vs. Trip-Level Assignment" section below ~-~-> | ||
58 | <BlockRef>MTA NYCT_20120902CE_JG_24900_B35-26-JG_1503</BlockRef> | ||
59 | \\\\ <!~-~- Call data about a particular stop ~-~-> | ||
60 | <!~-~- In StopMonitoring, it is the stop of interest; in VehicleMonitoring it is the next stop the bus will make. ~-~-> | ||
61 | \\\\ <MonitoredCall> | ||
62 | \\\\ <!~-~- The GTFS stop ID of the stop prefixed by agency_id ~-~-> | ||
63 | <StopPointRef>MTA_308214</StopPointRef> | ||
64 | \\\\ <!~-~- The ordinal value of the visit of this vehicle to this stop, always 1 in this implementation ~-~-> | ||
65 | <VisitNumber>1</VisitNumber> | ||
66 | \\\\ <!~-~- Predicted arrival/departure times in ISO8601 format ~-~-> | ||
67 | <ExpectedArrivalTime>2015-06-04T10:46:08.361-04:00</ExpectedArrivalTime> | ||
68 | <ExpectedDepartureTime>2015-06-04T10:46:08.361-04:00</ExpectedDepartureTime> | ||
69 | \\\\ <!~-~- SIRI container for extensions to the standard ~-~-> | ||
70 | <Extensions> | ||
71 | \\\\ <!~-~- The MTA Bus Time extensions to show distance of the vehicle from the stop ~-~-> | ||
72 | <Distances> | ||
73 | \\\\ <!~-~- The distance of the stop from the beginning of the trip/route ~-~-> | ||
74 | <CallDistanceAlongRoute>3038.9</CallDistanceAlongRoute> | ||
75 | \\\\ <!~-~- The distance from the vehicle to the stop along the route, in meters ~-~-> | ||
76 | <DistanceFromCall>1101.7</DistanceFromCall> | ||
77 | \\\\ <!~-~- The distance displayed in the UI, see below for an additional note ~-~-> | ||
78 | <PresentableDistance>5 stops away</PresentableDistance> | ||
79 | \\\\ <!~-~- The number of stops on the vehicle's current trip until the stop in question, starting from 0 ~-~-> | ||
80 | <StopsFromCall>5</StopsFromCall> | ||
81 | </Distances> | ||
82 | </Extensions> | ||
83 | \\\\ </MonitoredCall> | ||
84 | \\\\ <!~-~- The collection of calls that a vehicle is going to make. ~-~-> | ||
85 | <OnwardCalls> | ||
86 | \\\\ <!~-~- A stop that the vehicle is going to make, if the detailLevel is set to calls ~-~-> | ||
87 | <OnwardCall> | ||
88 | \\\\ <!~-~- The GTFS stop ID of the stop ~-~-> | ||
89 | <StopPointRef>MTA_308215</StopPointRef> | ||
90 | \\\\ <!~-~- The ordinal value of the visit of this vehicle to this stop, always 1 in this implementation ~-~-> | ||
91 | <VisitNumber>1</VisitNumber> | ||
92 | \\\\ <!~-~- The GTFS stop name of the stop ~-~-> | ||
93 | <StopPointName>5 AV - GARFIELD PL</StopPointName> | ||
94 | \\\\ <!~-~- SIRI container for extensions to the standard ~-~-> | ||
95 | <Extensions> | ||
96 | \\\\ <!~-~- The MTA Bus Time extensions to show distance of the vehicle from the stop ~-~-> | ||
97 | <Distances> | ||
98 | \\\\ <!~-~- The distance of the stop from the beginning of the trip/route ~-~-> | ||
99 | <CallDistanceAlongRoute>3267.1</CallDistanceAlongRoute> | ||
100 | \\\\ <!~-~- The distance from the vehicle to the stop along the route, in meters ~-~-> | ||
101 | <DistanceFromCall>1329.9</DistanceFromCall> | ||
102 | \\\\ <!~-~- The distance displayed in the UI ~-~-> | ||
103 | <PresentableDistance>6 stops away</PresentableDistance> | ||
104 | \\\\ <!~-~- The number of stops on the vehicle's current trip until the stop in question, starting from 0 ~-~-> | ||
105 | <StopsFromCall>6</StopsFromCall> | ||
106 | </Distances> | ||
107 | </Extensions> | ||
108 | \\\\ </OnwardCall> | ||
109 | \\\\ ... more OnwardCalls | ||
110 | \\\\ </OnwardCalls> | ||
111 | </MonitoredVehicleJourney>## | ||
112 | |||
113 | === The PresentableDistance field: === | ||
114 | |||
115 | The logic that determines whether stops or miles are shown in the PresentableDistance field is below: | ||
116 | |||
117 | show distance in miles if and only if: | ||
118 | |||
119 | ##(distance in miles to _immediate next stop_ is > D) OR (distance in stops to current stop is > N AND distance in miles to current stop > E)## | ||
120 | |||
121 | in other words, show distance in stops if and only if (the below is just the inverse of the above, according to DeMorgan's law): | ||
122 | |||
123 | ##(distance in miles to _immediate next stop_ is <= D) AND (distance in stops to current stop <= N OR distance in miles to current stop <= E)## | ||
124 | |||
125 | Show "approaching" if and only if: | ||
126 | |||
127 | ##distance_in_miles to immediate next stop < P## | ||
128 | |||
129 | show "at stop" if and only if: | ||
130 | |||
131 | ##distance_in_miles to immediate next stop < T## | ||
132 | |||
133 | Current Parameter Values: | ||
134 | |||
135 | |=Parameter|=Value | ||
136 | |D| .5 miles | ||
137 | |N| 3 stops | ||
138 | |E| .5 miles | ||
139 | |P| 500 feet | ||
140 | |T| 100 feet | ||
141 | |||
142 | === Transparency of Block vs. Trip-Level Assignment === | ||
143 | |||
144 | MTA Bus Time tries to assign buses to blocks- a sequence of trips that start and end at a depot. This allows the system to make a statement about what a bus will do after it reaches the end of its current trip. | ||
145 | |||
146 | However, there is not always enough affirmative and corresponding evidence to make such a strong statement. In this case, MTA Bus Time falls back to a trip-level assignment, where it just picks a trip from the schedule that is representative of the route and stopping pattern that the bus is likely to pursue. | ||
147 | |||
148 | The SIRI API now reflects this distinction as described here and in other items below. If the assignment is block-level, the new ##BlockRef## field of the ##MonitoredVehicleJourney## is present, and populated with the assigned block id. |