toll pricing table structure#
Toll pricing table provides the ability to set time-varying tolls on a given link/direction which are differentiated by time of day and vehicle class.
| Field | Type | NULL allowed | Default Value | Foreign key | Description | 
|---|---|---|---|---|---|
| link | INTEGER | NO | Link(link) | link identifier of the link that is to be tolled | |
| dir | INTEGER | NO | 0 | direction of link (AB or BA, as 0 or 1) that is to be tolled | |
| start_time | INTEGER | NO | 0 | Entry start time in seconds from when toll is active | |
| end_time | INTEGER | NO | 0 | Entry end time in seconds after which toll specified is not active | |
| price | REAL | NO | 0 | Toll price paid by passenger vehicles | |
| md_price | REAL | NO | 0 | Toll price paid by medium duty vehicles (can be null, default value assumed as 1.5x price and can be customized in the scenario file) | |
| hd_price | REAL | NO | 0 | Toll price paid by heavy duty vehicles (can be null, default value assumed as 2x price and can be customized in the scenario file) | 
(* - Primary key)
The SQL statement for table and index creation is below.
CREATE TABLE IF NOT EXISTS Toll_Pricing(
    link            INTEGER NOT NULL,
    dir             INTEGER NOT NULL DEFAULT 0,
    start_time      INTEGER NOT NULL DEFAULT 0,
    end_time        INTEGER NOT NULL DEFAULT 0,
    price           REAL    NOT NULL DEFAULT 0,
    md_price        REAL    NOT NULL DEFAULT 0,
    hd_price        REAL    NOT NULL DEFAULT 0,
    CONSTRAINT "link_fk" FOREIGN KEY("link") REFERENCES "Link"("link") DEFERRABLE INITIALLY DEFERRED -- check
    CHECK("dir" >= 0),
    CHECK("dir" >= 0),
    CHECK("price" >= 0),
    CHECK(TYPEOF("dir") == 'integer')
);