Release History > PTV xServer 1.16 > Migration Guide PTV xTour API

Migration Guide PTV xTour Server API

Data Structure Changes

In PTV xTour Server 1.16, some of the data structures have been refactored in order to implement more powerful time calculation mechanisms. The following sections show all structural changes that have been made. Each section contains two UML diagrams which illustrate the changes between the two versions. Coloured elements have the following meanings:

Colour Meaning
Red Removed classes or attributes
green New classes or attributes

TimeEvents

With PTV xTour Server 1.16 the type TimeEvent has been replaced by the type TourEvent. The new data type is quite similar to the old type. It has the same two attributes startTime and period to describe the time the event refers to.

The attribute type has been split into the two different values descriptions and violations. Similar to the old API, these fields are arrays of String and contain values of the new enumerations TourEventDescription and TourEventViolation.

In addition TourEvent holds two more attributes: logisticPointId and tourIndex. LogisticPointId refers to the LogisticPoint (Depot or TransportPoint) where this event takes place. For events like DRIVING that occur between two logistic points this value is -1. The second new attribute is tourIndex which points to the tour within the chain starting with 0. This value helps assigning a TourEvent to a tour.

The following two diagrams show the differences between PTV xTour Server 1.14 and PTV xTour Server 1.16.

UML PTV xTour Server 1.14

UML PTV xTour Server 1.16

BreakRule & RestRule

In PTV xTour Server 1.16 the Break- and RestRules have been completely redesigned. The 1.14 approach comprised two classes BreakRule and RestRule which defined all driver regulations. These classes were connected to a vehicle and also included attributes which specified remaining periods from previous tours. A drawback of this approach is that driver regulations must be specified for each vehicle. Therefore identical regulations cannot be shared by multiple vehicles. In addition the old regulations were restricted to rules on a daily basis. Weekly- or biweekly regulations could not be specified.

With PTV xTour Server 1.16 we present a new design for this. Regulations are now globally specified and connected to the PlanningParamsobject. Each regulation (=> class RegulationBase) has a unique id. This id can be referenced within the type DriverSettings which specifies individual settings for each vehicle.

RegulationBase is an abstract class and can be subclassed for other regulation types in the future. With version 1.16 there is one implementation called DriverRegulations which is based on regulations according the European Union and German working rules. See Section 2 for details for DriverRegulations.

UML PTV xTour Server 1.14

UML PTV xTour Server 1.16

Removed classes and attributes

The following classes have been removed:

Class Replacement
RemainingPeriods single string
BreakRule regulations in PlanningParams
RestRule regulations in PlanningParams
RemainingPeriodsInterpretation -
TimeEvent TourEvents
TimeEventType TourEventDescriptions and TourEventViolations

The following attributes have been removed:

Class Attribute Replacement
Restrictions maxWastedPeriodPerTour -
Restrictions maxWastedPeriodPerTourPoint -
TourPointResult idlePeriod -
TourPointResult wastedPeriod -
AbstractTourResult idlePeriod -
AbstractTourResult wastedPeriod -
BaseVehicle treatServiceAsWorkingPeriod -
TourViolation TOUR_POINT_SERVICE_PERIOD -
TourViolation MAX_WASTED_PERIOD_PER_TOUR -
TourViolation MAX_WASTED_PERIOD_PER_TOUR_POINT -
TourPointViolation SERVICE_PERIOD -
TourPointViolation MAX_WASTED_PERIO -
ChainResult timeEvents tourEvents
ChainResult remainigRestPeriods remainingPeriods
ChainResult remainigBreakPeriods remainingPeriods
SequencingPlanResult timeEvents tourEvents
SequencingPlanResult remainigRestPeriods remainingPeriods
SequencingPlanResult remainigBreakPeriods remainingPeriods

Added classes and attributes

The following classes have been added:

The following attributes have been added to existing classes:

Class Attribute Replaces
ChainResult tourEvents timeEvents
ChainResult remainingPeriods reaminingRestPeriods and remainingBreakPeriods
SequencingPlanResult tourEvents timeEvents
SequencingPlanResult remainingPeriods reaminingRestPeriods and remainingBreakPeriods
AbstractTourResult remainingPeriods -

New API in Detail

DriverRegulations

With PTV xTour Server 1.16 the old break and rest rules have been redesigned. The new settings are globally specified as a subclass of RegulationsBase. In PTV xTour Server 1.16 there is one implementation called DriverRegulations which is based on regulations according to the European Union and German working rules. The first four attributes beginningOfCalendarWeek,breakRule, dailyRestRule and weeklyRestRule can be used to set up regulations in accordance with the European Union. These attributes should be used in conjunction. The attribute workingRule can be used to set rules according to the German working regulation and can be used in addition to the EU settings. If in doubt, set up the EU rules and leave out the working rule.

The last attribute is called breakIntervals and can be used as an additional constraint if a specific break should be taken in several intervals.

In detail, DriverRegulations has the following attributes:

DriverSettings

To use the globally specified regulations a vehicle must specify a new attribute of type DriverSettings. This type points to a specific regulation with its regulationsId attribute. In addition each rule within this regulation can be activated or deactivated. To consider remaining periods from previous tours the attribute remainingPeriods can be set.

Here are the attributes in detail: