The model used the 2012 Household Travel Survey to calibrate trip lengths for internal and external person trips. Trips were calibrated based on generalized cost trip length frequencies and validated to time and distance trip length frequencies and average trip lengths. The validation results are shown in Figure 1 and Figure 2 . Trip lengths by time and distance met the validation targets and aligned closely with observed data.
No observed data was available for internal and external truck calibration. Truck trips were calibrated based on previous model estimation and validated relative to person work and other trip lengths.
Average Trip Length Validation
Code
viewof varSelect = Inputs. select (new Map ([['Time' , 'Time' ], ['Distance' , 'Dist' ]]), {value : 'Variable' , label : "Variable" })
// viewof varSelect = Inputs.select(new Map([['Generalized Cost','GC'], ['Distance', 'Dist'], ['Time', 'Time']]), {value: 'Variable', label: "Variable"})
viewof purpSelect = Inputs. select (new Map ([['Internal Trip Purposes' , 'MainPurposes' ], ['External Trip Purposes' , 'Externals' ]]), {value : 'PurpType' , label : "Purpose Set" });
Code
dataLT = transpose (dataStats)
filtered_data = dataLT. filter (function (dataL) {
return varSelect == dataL. Variable &&
purpSelect == dataL. PurpType ;
})
Code
import {Legend, Swatches} from "@d3/color-legend"
import {howto, altplot} from "@d3/example-components"
Code
Plot. plot ({
y : {
axis : null
},
x : {
tickFormat : "s" ,
grid : true
},
color : {
domain : ["Model" , "Observed" ],
range : ["#376092" , "#77933c" ],
legend : true
},
facet : {
data : filtered_data,
y : "Purpose" ,
label : null ,
marginLeft : 95
},
style : {
fontSize : 16
},
marginTop : 10 ,
marginBottom : 60 ,
marginRight : 60 ,
marginLeft : 95 ,
height : 750 ,
marks : [
Plot. barX (filtered_data, {
y : "DataSource" ,
x : "AVG_TRIP_LEN" ,
fill : "DataSource" ,
fx : "DataSource"
}),
Plot. ruleX ([0 ])
]
})
Code
Inputs. table (filtered_data)
Trip Length Frequency Validation
Code
optionsTripPurp =
[
['Home-Based Work' , 'HBW' ],
['Home-Based Shopping' , 'HBShp' ],
['Home-Based Other' , 'HBOth' ],
['Home-Based School - Primary' , 'HBSchPr' ],
['Home-Based School - Secondary' , 'HBSchSc' ],
['Non-Home-Based Work' , 'NHBW' ],
['Non-Home-Based Non-Work' , 'NHBNW' ],
['Light Trucks' , 'LT' ],
['Medium Trucks' , 'MD' ],
['Heavy Trucks' , 'HV' ],
['Internal-to-External' , 'IX' ],
['External-to-Internal' , 'XI' ]
]
viewof vTripPurp = Inputs. select (new Map (optionsTripPurp), {value : 'HBW' , label : "Trip Purpose:" })
viewof vTlfType = Inputs. select (new Map ([['Time' , 'Time' ], ['Distance' , 'Dist' ]]), {value : 'Time' , label : "Variable:" })
Code
freqT = transpose (freq)
freqT_filtered_Obs = freqT. filter (function (freqData) {
return vTripPurp == freqData. TRIPPURP &&
vTlfType == freqData. TLFTYPE &&
'freqObs' == freqData. freqSource ;
})
freqT_filtered_Mod = freqT. filter (function (freqData) {
return vTripPurp == freqData. TRIPPURP &&
vTlfType == freqData. TLFTYPE &&
'freqMod' == freqData. freqSource ;
})
Code
colorScale = d3. scaleOrdinal ()
. domain (["Model" , "Observed" ])
. range (["#376092" , "#77933c" ]);
key2 = Legend (colorScale, {title : "Data Source" })
Code
dataX = transpose (xvals)
filtered_x = dataX. filter (function (dx) {
return vTripPurp == dx. Purpose &&
vTlfType == dx. TLF ;
})
maxXValue = Math . max (... filtered_x. map (function (dx){
return dx. xValue ;
}));
Code
Plot. plot ({
grid : true ,
aspectRatio : 0.5 ,
x : {label : 'Distance/Time/Cost' , tickFormat : d => d, domain : [0 , maxXValue] },
y : {label : 'Frequency' , tickFormat : f => ` ${ Math . round (f * 100 )} %` },
marginRight : 60 ,
marginLeft : 60 ,
style : {
fontSize : 15
},
marginTop : 60 ,
marginBottom : 60 ,
marks : [
Plot. line (
freqT_filtered_Mod, {x : 'BIN' , y : 'freq' , stroke : "#376092" , strokeWidth : 4 }),
Plot. line (
freqT_filtered_Obs, {x : 'BIN' , y : 'freq' , stroke : "#77933c" , strokeWidth : 4 }),
Plot. frame ({strokeOpacity : 0.2 }),
]
});