bicyclingplus / atp-bc-tool-analysis

Analyzing inputs/outputs from the CTC Active Transportation Benefits/Costs tool, to identify and investigate potential issues (analysis notebooks only - input/output data is not included)
0 stars 0 forks source link

Basic test cases for crashes and miles traveled calculations #8

Open mRaffill opened 6 months ago

mRaffill commented 6 months ago

Write the expected output for a given input for all of the existing crashes, new crashes, existing miles traveled, and new miles traveled calculations.

List of equations/calculations to include (what I'm thinking of so far based on the list of equations - not sure if all of these are necessary or if I'm missing any):

Crashes


1. Existing Crashes


The individual equations separately:


Just the new crashes calculation:

Travel


1. Existing Travel



mRaffill commented 6 months ago

Outline of the examples - draft, figuring out which variations of inputs and equations to include (and how to format everything)

Individual equations

  1. Model way-level crashes $CC{cmow} = e^{Ɑ{movf}} L_{w} (EV_{cmw})^{0.4}$ Input: bicycle volume class = medium, pedestrian volume class = medium, bicycle functional class = minor road, pedestrian functional class = minor road, bicycle exposure = 50, pedestrian exposure = 100, length = 0.1 miles Output (clean this up later):
crash injury death
bicycle 0.006479752972821321 0.006399938546174876 0.0000798105472792838
pedestrian 0.0005025612581982916 0.00046553139561149337 0.00003702989425876207
combined 0.0024379007085415555 0.0023318741573381987 0.00007344270530744104
  1. Model intersection-level crashes $CC{cmoi} = e^{Ɑ{movf}} * (EV_{cmi})^{0.4}$ Input: bicycle volume class = medium, pedestrian volume class = medium, bicycle functional class = minor road, pedestrian functional class = minor road, bicycle exposure = 50, pedestrian exposure = 100 Output (clean this up later):
crash injury death
bicycle 0.23665525955763556 0.2331519719675065 0.0035033178659148456
pedestrian 0.11882957851970188 0.11406042517643525 0.004769203707708837
combined 0.22654948471430836 0.22030752178996574 0.005522112004484099
  1. Total existing crashes - a mix of intersections and ways with different volumes and volume/functional classes (wait, what is the volume/functional class for combined mode? I get how it is calculated, but how do you assign it to a given node/way? need to figure that out before adding combined mode to this)

Input: intersection 1: {pedestrian exposure = 600, bicycle exposure = 100, bicycle volume class = medium, pedestrian volume class = medium, bicycle functional class = minor road, pedestrian functional class = minor road} intersection 2: {pedestrian exposure = 1000, bicycle exposure = 50, bicycle volume class = medium, pedestrian volume class = high, bicycle functional class = major road, pedestrian functional class = major road}

way 1: {pedestrian exposure = 100, bicycle exposure = 50, bicycle volume class = low, pedestrian volume class = low, bicycle functional class = minor road, pedestrian functional class = minor road, length = 0.1 miles} way 2: {pedestrian exposure = 600, bicycle exposure = 200, bicycle volume class = medium, pedestrian volume class = medium, bicycle functional class = major road, pedestrian functional class = major road, length = 0.2 miles} way 3: {pedestrian exposure = 200, bicycle exposure = 100, bicycle volume class = medium, pedestrian volume class = medium, bicycle functional class = minor road, pedestrian functional class = minor road, length = 0.05 miles}

a) Model only total crashes Output: crash injury death
bicycle 0.5675192248517249 0.558079161544122 0.00944012723993069
pedestrian 0.5335986390914865 0.5135308344530437 0.020067893569492255
combined xxx xxx xxx

b) Split user and model total crashes Input: model crashes same as above, user inputted crashes:

bicycle pedestrian
crash 3 intersections, 2 roadway 6 intersections, 4 roadway
injury 2 intersections, 2 roadway 5 intersections, 4 roadway
death 1 intersections, 0 roadway 1 intersections, 0 roadway
years 3 years, 3 years 3 years, 3 years
Output: crash injury death
bicycle 1.2270076899406899 1.0232316646176487 0.20377605089597225
pedestrian 2.2134394556365944 2.0054123337812175 0.2080271574277969
combined xxx xxx xxx
  1. New Crashes (should I use real infrastructure types from the table or just put random numbers for the % crash decrease and % travel increase? Should I separate this by mode?) $NC{cmojk}=EC{cmoj} (1 + \sum{i}\sum{F}E_{ik} \frac{Ni}{L} I_{F})^{p}CRF_{mojk}$ a) length-based segment improvement Input: total existing crashes = 10, crash reduction factor = 50%, travel increase factor (Eik) = 25%, infrastructure length = 0.5 miles, project length = 1 mile, infrastructure type = new Output: 5.241203390786843 b) count-based segment improvement Input: total existing crashes = 10, crash reduction factor = 50%, travel increase factor (Eik) = 25%, infrastructure count = 10, project length = 1 mile, infrastructure type = new Output: 5.093384799130433 c) count-based intersection improvement Input: total existing crashes = 10, crash reduction factor = 50%, travel increase factor (Eik) = 25%, infrastructure count = 10, project # of intersections = 20 mile, infrastructure type = new Output (same as the first case): 5.241203390786843 d) combination Input: total existing crashes = 10, project length = 1 mile, project # of intersections = 20 infrastructure 1: {travel increase factor (Eik) = 25%, crash reduction factor = 20%, infrastructure length = 0.5 miles, infrastructure type = new} infrastructure 2: {travel increase factor (Eik) = 15%, crash reduction factor = 10%, infrastructure length = 0.7 miles, infrastructure type = new} infrastructure 3: {travel increase factor (Eik) = 30%, crash reduction factor = 50%, infrastructure count = 15 (on segment), infrastructure type = new} infrastructure 4: {travel increase factor (Eik) = 50%, crash reduction factor = 50%, infrastructure count = 15 (on intersection), infrastructure type = new} Output: 0.061680522832233284 crashes

  2. Existing (weighted) miles traveled a) Bike Input: set of ways with length and bicycle demand way 1: {bicycle demand = 50, length = 0.1 miles} way 2: {bicycle demand = 75, length = 0.2 miles} way 3: {bicycle demand = 25, length = 0.05 miles} Output: 305.70231676196283 miles b) Walk Input: set of intersections with adjacent ways length and pedestrian demand intersection 1: {pedestrian demand = 200, adjacent selected ways lengths = 0.1 miles, 0.2 miles} intersection 2: {pedestrian demand = 400, adjacent selected ways lengths = 0.1 miles, 0.05 miles} Output: 202.07823960880205 miles

  3. New miles traveled (oh, should this also have variations of different modes?) $PT{cmk}=WET{cm} + \sum{i}\sum{F}E{ik} \frac{Ni}{L} I{F}$ a) length-based segment improvement Input: existing miles traveled = 200, project length = 1 mile, travel increase factor (Eik) = 25%, infrastructure length = 0.5 miles, infrastructure type = new Output: 225 miles b) count-based segment improvement Input: existing miles traveled = 200, project length = 1 mile, travel increase factor (Eik) = 25%, infrastructure count = 10, infrastructure type = new Output: 209.46969696969697 miles c) count-based intersection improvement Input: existing miles traveled = 200, project # of intersections = 20 mile, travel increase factor (Eik) = 25%, infrastructure count = 10, infrastructure type = new Output: 225 miles (same as part a) d) combination Input: existing miles traveled = 200, project length = 1 mile, project # of intersections = 20 infrastructure 1: {travel increase factor (Eik) = 25%, infrastructure length = 0.5 miles, infrastructure type = new} infrastructure 2: {travel increase factor (Eik) = 15%, infrastructure length = 0.7 miles, infrastructure type = new} infrastructure 3: {travel increase factor (Eik) = 30%, infrastructure count = 15 (on segment), infrastructure type = new} infrastructure 4: {travel increase factor (Eik) = 50%, infrastructure count = 15 (on intersection), infrastructure type = new} Output: 338.04545454545456 miles

mRaffill commented 6 months ago

^ I think these test cases for individual equations are done now, but I'm not sure if I included everything that's necessary or if I would need more variations or combinations of equations

Questions so far:

mRaffill commented 4 months ago

The current new crashes equations don't specify what to do about the increase in volume for combined mode crashes (https://github.com/mRaffill/atp-bc-tool-analysis/issues/7#issuecomment-2051327211).

I wrote the test cases for new crashes like this:

Input: total existing crashes = 10, crash reduction factor = 50%, travel increase factor (Eik) = 25%, infrastructure length = 0.5 miles, project length = 1 mile, infrastructure type = new

This makes sense for bicycling and pedestrian-only crashes, but the combined mode doesn't have separate travel increase factors that you can get directly from the selected infrastructure. Instead of using the travel increase factors directly for the combined mode column, I came up with a potential alternate (and simplified) equation in https://github.com/mRaffill/atp-bc-tool-analysis/issues/2#issuecomment-2067183326:

$NC{cmojk}=(EC{cmojk} (PV{cmjk}/EV{cmj})^{p}) CRF_{mojk}$

I would need to update the test cases to take into account this difference in calculations between bicycle/pedestrian new crashes and combined new crashes. I'll only add this into the final unit tests if the new equation itself looks good and is actually implemented, but I'll write new test cases for the combined mode with this equation here: (in-progress)


a) length-based segment improvement

Input: total existing crashes = 10, combined crash reduction factor = 50%, existing bicycle volume = 50, existing pedestrian volume = 100, bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor (Eik) = 25%, infrastructure length = 2640 feet, project length = 5280 feet, infrastructure type = new

    Output: tbd

b) count-based segment improvement

Input: total existing crashes = 10, combined crash reduction factor = 50%, existing bicycle volume = 50, existing pedestrian volume = 100, bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor (Eik) = 25%, infrastructure count = 10, project length = 5280 feet, infrastructure type = new

    Output: tbd

c) count-based intersection improvement

Input: total existing crashes = 10, combined crash reduction factor = 50%, existing bicycle volume = 50, existing pedestrian volume = 100, bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor (Eik) = 25%, infrastructure count = 10, project # of intersections = 20, infrastructure type = new

    Output: tbd

d) combination

Input: total existing crashes = 10, existing bicycle volume = 50, existing pedestrian volume = 100, project length = 5280 feet, project # of intersections = 20 infrastructure 1: {bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor = 0%, combined crash reduction factor = 0%, infrastructure length = 2640 feet, infrastructure type = new} infrastructure 2: {bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor = 15%, combined crash reduction factor = 50%, infrastructure length = 3696 feet, infrastructure type = new} infrastructure 3: {bicycle travel increase factor (Eik) = 25%, pedestrian travel increase factor = 50%, combined crash reduction factor = 30%, infrastructure count = 15 (on segment), infrastructure type = new} infrastructure 4: {bicycle travel increase factor (Eik) = 0%, pedestrian travel increase factor = 50%, combined crash reduction factor = 40%, infrastructure count = 15 (on intersection), infrastructure type = new}

    Output: tbd