Traffic and Custom Roads
Contents
PC*Miler Connect includes several time-based routing functions you can use to set a departure or an arrival time. If the Traffic add-on is licensed and installed, and you have an Internet connection, traffic data can be applied to boost the precision of time estimates.
The setting below can be added to the PCMSERVE.INI
file to activate traffic data for time-based routing. This setting is equivalent to the “Historical Traffic” option in the PC*Miler user interface. If set to TRUE, traffic will be enabled:
HistoricalRoadSpeeds=True/False
If traffic data is not used
Travel times and ETAs are calculated based on average road speeds (either PC*Miler default or user-specified road speeds) by class of road in each state or province.
If traffic is enabled
When a departure or arrival time and date are entered, travel times and ETAs will be calculated based on historical, typical, or real-time traffic data, depending on the arrive/depart and day/time settings. (Historical data reflects how average traffic patterns affect road speeds. Typical data uses road speeds that would occur if there were no traffic.)
If a departure or arrival time and date are not entered, default travel times reflect free-flow conditions—think middle of the night. (This is the “Typical” option mentioned above.)
The following functions can be used for time-based routing
- PCMSSetDepartureTime sets a departure time from the origin.
- PCMSSetArrivalTime sets an arrival time at the destination.
- PCMSGetETA generates the estimated time of arrival based on the parameters in PCMSSetDepartureTime.
- PCMSGetETD generates the estimated time of departure based on the parameters in PCMSSetArrivalTime.
- PCMSSetRoadSpeedType indicates if time estimate calculations for a route will be based on the traditional PC*Miler average road speeds by road type or historical traffic data.
- PCMSTrafficStatus queries the Traffic subscription status.
Sample code for using time-based routing
// Declarations
int ArrivalYear; // Arrival Time Zone
int ArrivalMonth; // Arrival Month (e.g. 10 for October)
int ArrivalDay; // Arrival Day (e.g. 23 for 23rd day of October)
int ArrivalHour; // Arrival Hour (e.g. 10 for ten o'clock)
int ArrivalMinute; // Arrival Minute (e.g. 10 for tenth minute)
int ArrivalSecond; // Arrival Second (e.g. 0 for zeroth second)
int DepartYear; // Arrival Time Zone
int DepartMonth; // Arrival Month (e.g. 10 for October)
int DepartDay; // Arrival Day (e.g. 23 for 23rd day of October)
int DepartHour; // Arrival Hour (e.g. 10 for ten o'clock)
int DepartMinute; // Arrival Minute (e.g. 10 for tenth minute)
int DepartSecond; // Arrival Second (e.g. 0 for zeroth second)
// Create a new trip
trip = PCMSNewTrip(server);
// Add the stops to trip
ret = PCMSAddStop(trip, "Dublin, PA");
ret = PCMSAddStop(trip, "Boston, MA");
ret = PCMSAddStop(trip, "Philadelphia, PA");
ret = PCMSAddStop(trip, "Baltimore, MD");
// Set Road Speed Type
// 0 = default road speeds, 2 = Historical Road Speeds
ret = PCMSSetRoadSpeedType(trip, 2);
/*
** Date Type used below
** Date Type - user wants current system time = 1, user specifying
** date and time = 2, user specifying day of week and time = 3
*/
// Set arrival time to be Jul-28-2017 at 8:30 AM
ret = PCMSSetArrivalTime(trip, // Trip ID
3, // Date Type
6, // EasternTimeZone 1;
2017, // Arrival Year (e.g. 2017)
7, // Arrival Month (e.g. 10 for October)
28, // Arrival Day(e.g. 23 for 23rd day of October)
8, // Arrival Hour (e.g. 23 for 11:00 PM)
30, // Arrival Minute (e.g. 10 for tenth minute)
0, // Arrival Second (e.g. 0 for zeroth second)
5); // Arrival Day Of Week (1 == Monday, ... 0 = Sunday)
// Run trip
ret = PCMSCalculate(trip);
// Get the number of stops in trip
int numStops = PCMSNumStops(trip);
// Get the Estimated Time Of Departure for each stop
for (int j = 0; j < numStops; j++) {
ret = PCMSGetETD(trip, // Trip ID
j, // Stop Number
&DepartYear, // Departure Time Zone
&DepartMonth, // Departure Month (eg. 10 for October)
&DepartDay, // Departure Day (e.g. 23 for 23rd day)
&DepartHour, // Departure Hour
&DepartMinute, // Departure Minute (e.g tenth minute)
&DepartSecond); // Departure Second (e.g zeroth second)
}
// Dump Detail Report
DumpReport(trip, 0, RF_Lines);
// Delete the Trip
PCMSDeleteTrip(trip);
Avoids and Favors
Custom routing preferences, such as avoiding or favoring certain roads or overriding road restrictions, can be applied to routes generated via PC*Miler Connect.
Route Modifiers
Route Modifiers, which include Avoids, Favors, and Closures, are created, managed, and stored in Content Tools, and then synced with the PC*Miler user interface.
Overriding Truck Restrictions
Truck-restricted roads can be overridden in the PC*Miler user interface.
Applying Custom Preferences
Once you have created and synced these preferences, the PCMSSetCustomMode
function can be used to enable or disable custom routing programmatically.
Alternatively, custom preferences can be activated or deactivated using the CustomRoute
setting in the PCMSERVE.INI
file. When set to TRUE, avoided, favored, and overridden roads set in PC*Miler will be used. The default is FALSE.
CustomRoute=FALSE
Once custom routing is activated, you can use PCMSAFActivateSet
to activate or deactivate a specific Avoid/Favor set created and named in Content Tools.
Sites
(Feature Available in Version 32 and Higher)
(Streets add-on license required) A Site extends a location to include a boundary polygon around its perimeter, entry and exit points (gates), and other valuable information. For example, a Site can be a warehouse, a shopping mall, a distribution center, a yard, a business park, etc.
Routing to a Site can provide more accurate directions and time and distance estimates by taking a driver directly to the proper entry and exit points, rather than just an address or a latitude/longitude point.
Sites are created around custom places in the Content Tools web tool and synced with the PC*Miler user interface.
Enabling Sites Routing
If you want to route to a road within a Site, you must first enable street-level routing using one of these two methods:
- In the
pcmserve.ini
file, under the [Options] section, set UseStreets=True - Use PCMSSetRouteLevel to set street-level routing
Disabling Sites Routing
With streets routing enabled, Sites routing is turned on by default. If you would like to disable Sites routing—for example, if you are only using PC*Miler Connect for rating—it can be turned off using one of two methods:
- A setting in the
pcmserve.ini
file. Under the [Options] section, set UseSites=False - Via the PCMSUseSites API (Available in Version 34 and Higher)
NOTE: UseSites is set to False by default if you are not licensed for the Streets add-on.
Geofences
Geofences set up in the PC*Miler user interface can be activated or exported via PC*Miler Connect. A geofence is a geographic area that will either generate an alert when a route enters it, or will be avoided by the route.
By default, geofence data is loaded at startup as read-only, and not saved when PC*Miler Connect shuts down. A setting in the PCMSERVE.INI
file under [ConnectOptions] can be edited so that geofence data is automatically saved on shutdown.
Setting | Value |
---|---|
GeofenceAutoSave= | TRUE FALSE |
The following functions are for activating and exporting data:
- PCMSGeofenceActivateSet activates or deactivates a specific geofence set for routing and reporting purposes using the name of that set.
- PCMSGeofenceExportSet exports detailed information for a specific geofence set out to a delimited text file.