Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Add # of passengers, ref #39
Browse files Browse the repository at this point in the history
  • Loading branch information
corradio committed Jul 10, 2019
1 parent f0c627f commit 24323ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion co2eq/transportation.js
Expand Up @@ -9,7 +9,7 @@ import {

import flightEmissions from './flights';

export const modelVersion = 4;
export const modelVersion = 5;

/*
Carbon intensity of transportation (kgCO2 per passenger and per km)
Expand Down Expand Up @@ -73,5 +73,10 @@ export function carbonEmissions(activity) {
return null;
}
}

// Take into account the passenger count if this is a car
if (activity.transportationMode === TRANSPORTATION_MODE_CAR) {
return carbonIntensity(activity.transportationMode) * distanceKilometers / (activity.passengerCount || 1);
}
return carbonIntensity(activity.transportationMode) * distanceKilometers;
}

0 comments on commit 24323ab

Please sign in to comment.