Comments (13)
That sounds very interesting and useful to me. I see two ways to calculate the CO2 emission by litre of fuel:
- 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.
- 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.
@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.
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.
Also for starters, I was planning to use these metrics:
from sustainable-mobility-api.
@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.
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 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.
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.
I fully agree with everything you say above, which is why I am asking you about the API design ;-)
from sustainable-mobility-api.
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.
OK. Do you know of a good Python library we can lean on for unit conversion?
from sustainable-mobility-api.
@ErikM1995 we have a pull request open (#43) now that will hopefully fulfil your feature request! :-)
from sustainable-mobility-api.
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)
- Create Helm chart for deploying CO2 estimation endpoint(s)
- Time based distance estimation
- HTTP API should support estimation for multiple multi-leg itineraries via a single request HOT 2
- Add simple sustainable labeling to CO2 estimates
- Fix servers selection in server and specification HOT 1
- Calling docker setup with invalid parameters returns 200 OK return HOT 1
- Consider if/how to incorporate power generation CO2 emissions used for electric vehicles
- Consider if/how to incorporate vehicle speed into CO2 estimates
- Determine if/how to factor weather conditions into CO2 estimation
- Add country as input parameter HOT 1
- Research + implementation of regional layers of CO2 calculation
- Update HTTP API dependencies HOT 2
- Create documentation website
- Add support for all modes defined by OpenTripPlanner
- Determine if/how to support the extension modes (GTFS) and NeTEx submodes
- Migrate from Pipenv to Poetry
- Consolidate Flask and Serverless code
- Add support for compression (e.g. gzip)
- [API] Consider whether to use GeoJSON for origin/destination locations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sustainable-mobility-api.