Optiflow - Driver breaks (configurable working hours preset)

Questions refering to the PTV Optiflow based API within PTV Developer (launched on 20.12.2023)
Post Reply
CAPcargo
Posts: 62
Joined: Tue May 19, 2015 12:53 pm

Optiflow - Driver breaks (configurable working hours preset)

Post by CAPcargo »

Hi everyone,

I have a question regarding driver break configuration in Optiflow.

When comparing the driver break properties between xServer and Optiflow, I noticed some important differences.

One of the most obvious and practical differences is the configurableWorkingHoursPreset field available in xTour2 and xRoute2:

CWH.png
CWH.png (11.9 KiB) Viewed 28 times

I reviewed the Optiflow break settings concept and I understand that the idea is to provide a more generic and expressive way to define regulations. However, I think it would still be very useful if commonly used regulations could also be provided directly by PTV, similar to how it worked in xServer.

Otherwise, each API consumer has to implement and maintain the same regulation logic on their own.

So my question is:
  • Are there any plans to introduce a preset-based feature in Optiflow?
  • Or maybe these regulations are already defined internally according to the Optiflow data model and can somehow be reused directly (or shared separately)?
Thanks in advance.
Marko Arsovski
CAPcargo
Last edited by Bernd Welter on Wed May 13, 2026 5:48 pm, edited 1 time in total.
Reason: just some styling
User avatar
Bernd Welter
Site Admin
Posts: 3104
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Optiflow - Driver breaks (configurable working hours preset)

Post by Bernd Welter »

Great question! Here's how break and rest rules work across the two APIs in the context of MAY 2026 (this topic is subject to change!)

Routing API: WorkingHoursPreset

The Routing API offers ready-made presets that automatically apply regulation-compliant break/rest schedules when calculating a single route.
The WorkingHoursPreset is available in the calculateRoutePost endpoint under the driver object. Here's the structure:

Code: Select all

{
  "body": {
    "driver": {
      "workingHoursPreset": "EU_DRIVING_TIME_REGULATION_FOR_SINGLE_DAY",
      "workLogbook": {
        "lastTimeTheDriverWorked": "2026-05-13T06:00:00Z",
        "accumulatedDrivingTimeSinceLastBreak": 0,
        "accumulatedWorkingTimeSinceLastBreak": 0,
        "accumulatedDrivingTimeSinceLastDailyRest": 0,
        "accumulatedTravelTimeSinceLastDailyRest": 0
      }
    }
  }
}
:!: These presets are not available in the Optimization API.

Optimization API: vehicle.breaks.working / vehicle.breaks.driving

In route optimization, you model break rules manually using these two parameters. You can absolutely simulate EU 561/2006 this way. Here's the documented example for a simplified single-day EU regulation:

Code: Select all

"breaks": {
  "working": [
    {      "maximumWorkingDuration": 21600,      "minimumBreakDurations": [900, 900]    },
    {      "maximumWorkingDuration": 32400,      "minimumBreakDurations": [900, 900, 900]    }
  ],
  "driving": [
    {      "maximumDrivingDuration": 16200,      "minimumBreakDurations": [900, 1800]    }
  ]
}
What this models:
Rule Setting Meaning
Driving break maximumDrivingDuration: 16200 (4.5h) After 4.5h driving → break required
Driving break split minimumBreakDurations: [900, 1800] 15 min + 30 min (or one 45 min break)
Working break 1 maximumWorkingDuration: 21600 (6h) After 6h working → break required
Working break 2 maximumWorkingDuration: 32400 (9h) After 9h working → additional break
So yes — you can simulate EU 561/2006 in the Optimization API using breaks.working and breaks.driving. You just need to configure the durations manually rather than selecting a preset. The example above is a good starting point for single-day planning.

For multi-day rest periods (11h daily rest, 56h weekly driving limits), those are only handled by the Routing API's multi-day presets and cannot be directly modeled in the Optimization API's break settings.

Preset Modelable? Reason
EU_DRIVING_TIME_REGULATION_FOR_SINGLE_DAY ✅ Driving + working breaks only
EU_DRIVING_TIME_REGULATION_FOR_LONG_SINGLE_DAY ✅ Same, with extended driving limit
EU_WORKING_TIME_DIRECTIVE_FOR_SINGLE_DAY ✅ Working breaks only
EU_WORKING_TIME_DIRECTIVES_FOR_LONG_SINGLE_DAY ✅ Working breaks only
US_HOURS_OF_SERVICE_REGULATIONS_FOR_SINGLE_DAY ✅ Driving break only
US_HOURS_OF_SERVICE_REGULATIONS_FOR_SHORT_HAUL_AND_SINGLE_DAY ⚠️ No breaks scheduled (short-haul exemption) — trivial
EU_DRIVING_TIME_REGULATION_FOR_MULTIPLE_DAYS ❌ Requires daily rest (11h), weekly limits
EU_DRIVING_TIME_REGULATION_FOR_TEAM_AND_MULTIPLE_DAYS ❌ Requires daily rest, team rules
US_HOURS_OF_SERVICE_REGULATIONS_FOR_MULTIPLE_DAYS ❌ Requires daily rest (10h)
Here are some examples:
Break 30 min, max 8h driving between breaks, max 11h driving, max 14h travel
EU_DRIVING_TIME_REGULATION_FOR_SINGLE_DAY
Break 45 min, max 4.5h driving, max 9h driving total, max 13h travel

Code: Select all

"breaks": {
  "working": [
    {      "maximumWorkingDuration": 21600,       "minimumBreakDurations": [900, 900]    },
    {      "maximumWorkingDuration": 32400,      "minimumBreakDurations": [900, 900, 900]    }
  ],
  "driving": [
    {      "maximumDrivingDuration": 16200,      "minimumBreakDurations": [900, 1800]    }
  ]
}
EU_DRIVING_TIME_REGULATION_FOR_LONG_SINGLE_DAY
Same as above but max driving extended to 10h (twice per week exception)

Code: Select all

"breaks": {
  "working": [
    {      "maximumWorkingDuration": 21600,      "minimumBreakDurations": [900, 900]    },
    {      "maximumWorkingDuration": 36000,      "minimumBreakDurations": [900, 900, 900]    }
  ],
  "driving": [
    {      "maximumDrivingDuration": 16200,      "minimumBreakDurations": [900, 1800]    }
  ]
}
EU_WORKING_TIME_DIRECTIVE_FOR_SINGLE_DAY
Break 30 min, max 6h working between breaks, max 9.5h travel

Code: Select all

"breaks": {
  "working": [
    {      "maximumWorkingDuration": 21600,      "minimumBreakDurations": [1800]    }
  ]
}
EU_WORKING_TIME_DIRECTIVES_FOR_LONG_SINGLE_DAY
If working > 9h, break must be 45 min. Max 10h working.

Code: Select all

"breaks": {
  "working": [
    {      "maximumWorkingDuration": 21600,      "minimumBreakDurations": [1800]    },
    {      "maximumWorkingDuration": 36000,      "minimumBreakDurations": [1800, 900]    }
  ]
}
US_HOURS_OF_SERVICE_REGULATIONS_FOR_SINGLE_DAY

Code: Select all

"breaks": {
  "driving": [
    {      "maximumDrivingDuration": 28800,      "minimumBreakDurations": [1800]    }
  ]
}
:!: Important Limitations
Routing Preset Feature Optimization API
Max total driving time (e.g. 9h/11h) ❌ Not directly enforceable via breaks — use vehicle.workingHours to limit total shift
Max total travel time (e.g. 13h/14h) ❌ Same — use shift duration as proxy
Daily rest periods (10h/11h) ❌ Not available
Weekly driving limits (56h) ❌ Not available
  • The maximumWorkingDuration / maximumDrivingDuration settings control when breaks are triggered, but they don't cap the total driving or working time. To enforce total shift limits, combine breaks with vehicle.workingHours (earliest start / latest end).
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:
Image
Post Reply