Skip to content

Flight API

Michael Jeulin-L edited this page Jun 8, 2022 · 7 revisions

Class: default

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new default(dataSet, data)

Parameters

Name Type
dataSet ADEME_2022
data DataI

Defined in

flight/index.ts:71

Properties

avgEmission

Private avgEmission: undefined | number

Defined in

flight/index.ts:67


data

Private data: DataI

Defined in

flight/index.ts:68


dataSet

Private dataSet: ADEME_2022

Defined in

flight/index.ts:69

Methods

getData

getData(): DataI

Return the current data constants loaded

Returns

DataI

constant data loaded

Defined in

flight/index.ts:97


getDataset

getDataset(): ADEME_2022

Return the inner data set name

Returns

ADEME_2022

constant data loaded

Defined in

flight/index.ts:104


getEmissionAvg

getEmissionAvg(): number

Return the average co2 estimation in peq.kgCO2e/year.

description This constant is the ratio emission(2019)/#passengers(2019) from the Directorate General of Civil Aviation (DGAC).

Returns

number

The average co2 emission in peq.kgCO2e/year.

Defined in

flight/index.ts:178


getEmissionEstimated

getEmissionEstimated(travel, nbFlights): number

Compute the co2 emissions from air travels in kgCO2e/year

description Firstly the distances are calculated between the airports selected, then we use the factor emission expressed in kgCO2e/peq.km (peq = person equivalent) to get our first estimation per equivalent person:

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

Finally, we add a factor depending on the class of the seat taken (economy class, business class, first class).

Parameters

Name Type Description
travel FlightI -
nbFlights number the number of flight made a year.

Returns

number

the estimated flight emissions for the passengers in kgCO2e -1 in case of error (e.g. missing IATA airport)

Defined in

flight/index.ts:142


getHaulFactor

getHaulFactor(distance): number

Retrieve the emission factor from the flight distance

Parameters

Name Type Description
distance number distance of the flight in Km

Returns

number

emission factor in kgCO2e/peq.km

Defined in

flight/index.ts:113


build

Static build(dataset): default

Create a calculator instance from dataset

Parameters

Name Type
dataset ADEME_2022

Returns

default

new House calculator - Throw error if dataset not loaded.

Defined in

flight/index.ts:83

Clone this wiki locally