Vehicle API - CompteCO2/Carbon-Weight GitHub Wiki

Class: default

Type aliases

Types

Ƭ Types: Object

Type declaration

Name Type
ConsumptionT ConsumptionT
DataE DataE
FuelE FuelE
ModelT ModelT
VehicleE VehicleE
VehicleT VehicleT

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new default(dataSet, data)

warning Should not be used : please use the static build method using dataset enum type DataE

Parameters

Name Type
dataSet DataE
data DataI

Properties

avgEmission

Private avgEmission: undefined | number


avgEmissionByVehicle

Private avgEmissionByVehicle: undefined | number


data

Private data: DataI


dataSet

Private dataSet: DataE

Methods

getData

getData(): DataI

Return the current data constants loaded

Returns

DataI

constant data loaded


getDataset

getDataset(): DataE

Return the inner data set name

Returns

DataE

constant data loaded


getEmissionAvg

getEmissionAvg(): number

Return the average co2 estimation from PC (private vehicle) in kgCO2e/year (by person).

todo review, source and explain differents computation

description It is a simple proportion taking the total private vehicle emission estimated from private vehicle divided by the number of people.

  • emission = emissions / #people
  • [kgCO2e/year/vehicle] = [kgCO2e/kg/year] / [people]

Returns

number

The estimated co2 emission in kgCO2e/year (per people)


getEmissionAvgByVehicle

getEmissionAvgByVehicle(): number

Return the average co2 estimation by PC (private vehicle) in kgCO2e/year (by vehicle).

description It is a simple proportion taking the total private vehicle emission estimated from private vehicle divided by the number of vehicle.

  • emission = emissions / #vehicles
  • [kgCO2e/year/vehicle] = [kgCO2e/kg/year] / [vehicle]

Returns

number

The estimated co2 emission in kgCO2e/year (per vehicle)


getEmissionConsumed

getEmissionConsumed(consumption): number

Compute a CO2 emission from the consumption in kgCO2e/year using fuel emission factors in kgCO2e/litre

description Depending on the availibity of the consumption parameter, it whether use the following:

Using consumption

  • Emission = Consumption * Factor
  • [kgCO2e/year] = [L/year] * [kgCO2e/L]

Using Mileage & MPG Emission = MPG * (Mileage / 100) * Factor [kgCO2e/year] = [L/100Km] * [100Km/year] * [kgCO2e/L]

Although this computation method is the most precise, it relies on a parameter that could be quite uncertain (depends on personal measure) or even unknown. Indeed, the exact MPG (or real fuel consumption) for the period of the annual mileage could be difficult to get with precision if not measured properly.

Parameters

Name Type Description
consumption ConsumptionT the measured consumption in { L } or { Mileage & MPG }

Returns

number

the emission in kgCO2/year -1 in case of error (missing information)


getEmissionEstimated

getEmissionEstimated(model): number

Compute CO2 emission estimation from driving a type of vehicle in kgCO2/year

description Allows you to get a fairly good CO2e emission estimation from only the vehicle type and your annual mileage.

The constant factor unit is gCO2e/km and are statistic averages depending on the three following parameters:

  • Vehicle Type: Light utility, Standard, Two Wheeler.
  • Fuel Type: CNG, Diesel, Electric, LPG, Petrol.
  • Year of manufacture: From 1990 To 2018.

So, the formula is kinda the same as the one used in "Registration Card". The change is on the emission factors that come from statistical source and already include vehicle aging.

  • Emission = Mileage * Factor / 1000
  • [kgCO2e/year] = [Km/year] * [kgCO2e/km]

Parameters

Name Type
model ModelT

Returns

number

the estimated emission in kgCO2e/year -1 in case of error (cannot find the data for this type of vehicle)


getEmissionMileage

getEmissionMileage(vehicle): number

Compute CO2 emission from driving a specific vehicle in kgCO2/year

todo review, source and explain the yearFactor constant computation

description The vehicle carbon emission is computed using the original emission/consumption factor. However, this value is evolving along the time as the vehicle get older and depends on factors such as driving habits and maintains mechanics. We thus use an extra factor that takes into account aging.

The computation could use the factor emission expressed in gCO2e/km which can be found on the registration card - V.7 field (EU):

  • Emission = Mileage * Factor * YearCorrection
  • [kgCO2e/year] = [Km/year] * [gCO2e/km] / 1000 * Cste

Or it could either use the fuel consumption factor expressed in "L/100Km". We find back the formula of the first method using the fuel consumption factor coerced with the extra aging factor:

  • Emission = MPG * (Mileage / 100) * FuelEmissionFactor * YearCorrection
  • [kgCO2e/year] = [L/100Km] * [100Km/year] * [kgCO2e/L] * Cste

Parameters

Name Type Description
vehicle VehicleT the vehicle measured factors in ({ gCO2e/km } or { L/100Km + FuelE }) and the Mileage

Returns

number

the estimated emission in kgCO2/year -1 in case of error (missing information)


build

Static build(dataset): default

Create a calculator instance from dataset

Parameters

Name Type
dataset DataE

Returns

default

new House calculator - Throw error if dataset not loaded.