Sample story

Deals with the web service platform called Drive&Arrive http://driveandarrive.ptvgroup.com/en/ that enables you and your stakeholders to stay up2date with the current transport's estimated time of arrival (ETA)
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Sample story

Post by Bernd Welter »

Here's just a set of succeeding requests with their meaning - you may also check this quick start guide
  • The first request defines a tour which is supposed to be driven in the next days. What we need to provide is core info such as (x,y) of the stops, the computed arrival times and the vehicle profile that shall be used for the reroutings. What we get in return is a so-called SCEM ID for the tour object as a whole and individual SCEM-IDs for all stops in the tour. This method is called when the dispatcher has defined the tour as a whole. Imagine the output of the call returns the stops SCEM ID as VWFJ7XRZBR. Attention: this SCEM ID is not valid anymore while you read this post ;-)

    Code: Select all

    {
      "tour": 
        {
          "stops": [
            {
              "coordinate": {
                "locationX": 8.42795,
                "locationY":  49.01313
              },
              "earliestArrivalTime": "2021-06-22T18:00:00.000+00:00",
              "latestDepartureTime": "2021-06-22T18:00:00.000+00:00",
              "serviceTimeAtStop": 0,
              "useServicePeriodForRecreation": false,
              "weightWhenLeavingStop": 0,
              "stopPositionInTour": 0,
              "customData": {
                "note":”PTV Headquarter (76131 Karlsruhe, Haid-und-Neu-Str. 15)”
              }
            }
          ],
          "vehicle": {
            "vehicleProfileID": "mg-car"
          },
          "drivers": [
            {
              "driverDescription": "",
              "raSTime": {
                "referenceTime": "2021-06-22T08:45:00.000+00:00",
                "periodDrivenSinceLastBreak": 0,
                "periodDrivenSinceLastRest": 0,
                "currentIdlePeriod": 0,
                "isSplitBreak": false,
                "isSplitRest": false
              }
            }
          ],
          "customData": {
            "Foo": "BWe Test Tour"
          }
        }
    }
  • Once the driver hast started to drive his vehicle position is supposed to be sent to the cloud everey once in a while, e.g. 5min. To do this we need to provide (x,y) and the timestamp of the GPS position's gathering. And we need to provide the SCEM ID of the stop the driver is currently heading for (received from the 1st call's output)

    Code: Select all

    {
      "event": {
        "eventType": "POSITION",
        "eventSubtype": "GPS",
        "visibility": true,
        "action": "NONE",
        "eventPayLoad": {
            "timeStamp": "2021-06-22T10:00:00.000+01:00",
            "coordinate": {
                "locationX": 8.60103,
                "locationY": 49.12385
            },
            "accuracy": 15,
            "heading": "45"
            "speed": "20",
        },
        "scemid": "VWFJ7XRZBR"
      }
    }
  • So whenever we want to get the ETA of a specific stop we can ask for it with this statement - refering to the SCEM ID once again (Sample Monitor)

    Code: Select all

    {
      "stopTimeInfos": [
        {
          "stopSCEMID": "VWFJ7XRZBR",
          "plannedETA": "YYYY-MM-DDThh:mm:ss.0000000+01:00",   		// PTA as it is specified.
          "eta": "YYYY-MM-DDThh:mm:ss.0000000+01:00",         		// calculated ETA 
          "etaSource": "CALCULATE_REFROUTE_ETA",               		// What triggered calculation
          "relatedTime": "YYYY-MM-DDThh:mm:ss.0000000+01:00",  		// Time of the triggering "event"
          "trafficTimeLoss": 8           							// current delays due to traffic incidents or patterns in seconds
        }
      ],
      "responseStatus": {
        "errorCode": "SUCCESS",
        "message": "59be17c35b46472592dda626008e412c"
      }
    }
  • Requesting the ETA manually is possible but also annoying. You can use the following method to define somekind of a callback whenever a new ETA has been computed.

    Code: Select all

    {
    "subscription": {
      "notificationType": "CALLBACK_URL",
      "notificationDescription": {
       "callBackURL":"http://yourOwnMiddlewareServer/qw1jfkqw?SCEMID=VWFJ7XRZBR",
       "ident": "BWe subscription"
      },
      "scemid": "VWFJ7XRZBR"
    },
    "source": "TEST BWE"
    }
Of course this is just a minimalistic story. We can also
  • define tours with more than one stop
  • update tour structures
Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply