GithubHelp home page GithubHelp logo

Comments (13)

MarkusShepherd avatar MarkusShepherd commented on May 28, 2024 2

That sounds very interesting and useful to me. I see two ways to calculate the CO2 emission by litre of fuel:

  1. Obtaining the numbers of emission by volume of fuel. In many respects that should be easy and fairly accurate as that's the very source of CO2 being emitted.
  2. If we use average km/l or miles/gallons numbers for cars, we can convert the fuel volume into distance travelled, and plug this into our model as-is.

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024 1

@ErikM1995, thanks for the suggestion. I am taking a more in-depth look into this idea now. I will post my findings as comments here so that we can discuss things like the data sources/model and API.

from sustainable-mobility-api.

MarkusShepherd avatar MarkusShepherd commented on May 28, 2024 1

Yeah, more or less. I'd think analogous to Mode we could create a class Fuel, an Enum with different instances like PETROL, DIESEL, LPG (?), and field avg_co2_per_liter.

As for the method API, I don't like these overly long names (just couldn't be bothered to read all that stuff), so would rather have something like estimator.from_distance() and estimator.from_fuel() or similar. Not a hill I'm willing to die on though... 😉

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024 1

Also for starters, I was planning to use these metrics:

image

https://www.nrcan.gc.ca/sites/www.nrcan.gc.ca/files/oee/pdf/transportation/fuel-efficient-technologies/autosmart_factsheet_6_e.pdf

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

@MarkusShepherd in terms of Python architecture, would we perhaps create a new class like CO2_Estimator that handles mode- and fuel-based estimations?

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

Relatedly, Transport and Environment published an interactive article today called "How clean are electric cars?".

To answer this question we have developed a tool (see below) that compiles all the most up-to-date data on CO2 emissions linked to the use of an electric, diesel or petrol car.

We might be able to dig into their source data for our purposes.

from sustainable-mobility-api.

MarkusShepherd avatar MarkusShepherd commented on May 28, 2024

@MarkusShepherd in terms of Python architecture, would we perhaps create a new class like CO2_Estimator that handles mode- and fuel-based estimations?

What would that class look like? I'm not sure I see a benefit in a class that just throws different purposes together.

If we want to have one unified way to calculate emissions (and we'd first need to convince ourselves that's something useful), the best way I see is to change the estimator.estimate_co2() signature to

def estimate_co2(**kwargs) -> float:
    # do something

and then select the lower level functionality depending on what arguments were passed. But right now I'd say it'll only obscure the API, so if distance and fuel based estimates are the only two use cases, why not just have two different methods or classes to call?

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

So for now, just defining a new function like the following?

def estimate_co2_from_fuel_consumed(fuel_type, volume, units):
    # howdy

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

I fully agree with everything you say above, which is why I am asking you about the API design ;-)

from sustainable-mobility-api.

MarkusShepherd avatar MarkusShepherd commented on May 28, 2024

Hmmm... I've stumbled across the question of units for fuel calculations. Some are measured by volume (litres, gallons, cubic metres, ...), while others are measured by mass (kg, tonne, whatever Americans use). Then there's electricity of course that's measure directly in energy... You noted the unit in some example above, but at that point I only thought of litres vs gallons, not volume vs mass.

So we would need co2_per_unit and unit for each fuel type, plus potentially some conversions between units. Also, it would be great to link Mode and Fuel via litres/km (or miles/gallon for the metrically challenged 😜).

Sorry, turned out a bit of rambling, seems like there's quite a number of use cases that need to be considered...

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

OK. Do you know of a good Python library we can lean on for unit conversion?

from sustainable-mobility-api.

brylie avatar brylie commented on May 28, 2024

@ErikM1995 we have a pull request open (#43) now that will hopefully fulfil your feature request! :-)

from sustainable-mobility-api.

ErikM1995 avatar ErikM1995 commented on May 28, 2024

Wow, nice work guys! Great to see that you really took the time to think about the possibilities of this idea. About the units of measurement, I always use https://www.co2emissiefactoren.nl/lijst-emissiefactoren/ . This is a pretty good databank formed by the Dutch ministry of economics and environment and some energy companies, but unfortunately that's in Dutch. Many of the fuel names are in English though.

They also open up the debate whether you'd want to incorporate the well to wheel, well to tank or tank to wheel CO2 ratio, interesting stuff!

from sustainable-mobility-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.