-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dynamic label options for dev-emulator configs #30
Conversation
These include the mode "moped" and will be used to test the dynamically configurable label options.
@JGreenlee now that e-mission/e-mission-phone#1014 is merged, maybe we should merge this too? |
Does the URL need to be changed to:
instead of my fork and branch? Also, for the purpose of testing and making sure this works, I added a new mode "Moped". But we don't have |
MET is 0 (car-like) |
The commit history for I did eventually find this issue (e-mission/e-mission-docs#696 (comment)) which explained a few things, but not the information I was looking for. Is there a systematic breakdown somewhere explaining where each of these |
Also eyeballing, I am seeing similar estimates (they are a lot more fuel efficient than I thought!) However, I haven't been able to find any specific stats for overall efficiency. So I am still not sure what to put down. |
I found this in the history...
|
I see it now (I missed that commit because it isn't in But that's only for |
you would use a similar method, (also outlined in e-mission/e-mission-docs#688) for the other modes, for mopeds. I think that 100mpg is a fine eyeball figure. Note that it is not clear that anybody wants to use "moped" just yet - this is just an example showing the method to add new modes. So you can pick whatever you had in mind when you created that placeholder mode. Presumably if a partner wants to add a new mode, they have a clear picture of what they have in mind - e.g. scooter or motorcycle or ... If they don't, this will help focus their mind a bit 😄 |
According to https://www.epa.gov/greenvehicles/greenhouse-gas-emissions-typical-passenger-vehicle, a gallon of gas creates about
That can't be right. We're expecting something around So we are off by an multiple of 1000. Why? We are looking for kg CO2 per meter, right? Not per kilometer? |
What we currently have for Does a gas car really emit By that logic, we're basing our estimates on a car has 0.0273403 mpg. |
Either our units are mislabeled, or there is something wrong with using |
My calculations are in e-mission/e-mission-docs#688 if you want to compare |
But where are the calculations for gas vehicles? I only see electric vehicles. I specifically want to know where the numbers came from that were added in this commit: e-mission/e-mission-phone@1a1dcbd |
e-mission/e-mission-docs#139 It's linked from e-mission/e-mission-docs#688 but a little further down. |
Although I still have not seen where the It uses Based on the |
So although I don't know where the original |
I bet it is the wrong unit. The variable name should probably be And what are we multiplying with in the footprint calculations? If you look through e-mission/e-mission-docs#139 the original calculations are in a HTML file linked in there. |
Working backwards to trace this through the code, I can see that the this.populateCustomFootprints = function() {
let modeOptions = this.inputParams["MODE"].options;
let modeCO2PerMeter = modeOptions.map((opt) => {
if (opt.range_limit_km) {
if (this.range_limited_motorized) {
Logger.displayError("Found two range limited motorized options", {
first: this.range_limited_motorized, second: opt});
}
this.range_limited_motorized = opt;
console.log("Found range limited motorized mode", this.range_limited_motorized);
}
if (angular.isDefined(opt.co2PerMeter)) {
return [opt.value, opt.co2PerMeter];
} else {
return undefined;
}
}).filter((modeCO2) => angular.isDefined(modeCO2));;
this.customPerMeterFootprint = Object.fromEntries(modeCO2PerMeter);
console.log("After populating, custom perMeterFootprint", this.customPerMeterFootprint);
} This mapping is stored in
fh.getFootprintForMetrics = function(userMetrics, defaultIfMissing=0) {
var footprint = fh.getFootprint();
var result = 0;
for (var i in userMetrics) {
var mode = userMetrics[i].key;
if (mode == 'ON_FOOT') {
mode = 'WALKING';
}
if (mode in footprint) {
result += footprint[mode] * mtokm(userMetrics[i].values);
}
else if (mode == 'IN_VEHICLE') {
result += ((footprint['CAR'] + footprint['BUS'] + footprint["LIGHT_RAIL"] + footprint['TRAIN'] + footprint['TRAM'] + footprint['SUBWAY']) / 6) * mtokm(userMetrics[i].values);
}
else {
console.warn('WARNING FootprintHelper.getFootprintFromMetrics() was requested for an unknown mode: ' + mode + " metrics JSON: " + JSON.stringify(userMetrics));
result += defaultIfMissing * mtokm(userMetrics[i].values);
}
}
return result;
} and on line 42, the values that came from So it definitely should be called |
If these calculations were double-checked against and seemed congruent with figures that were off by a scale 1000, there's probably something off with them too. Double checking e-mission/e-mission-docs#688 (comment) for math or units errors |
Yes, these calculations also result in kg CO2 per km. I double checked everything up to:
And this seems correct.
The only problem is last line, which reports the values as "kg/meter", when they are actually of "kg/km". So the math is good but the units are mislabeled (just as the units were off for gas modes). This is good news. All the numbers are right - we can simply rename And for moped, we can try that again and get kg / km this time: 100 miles per gallon = 160.394 km per gallon |
I'll update this PR with the rename and the new calculations - we'll also need phone changes because we are renaming a property. I am glad we caught this before we have people start making their own |
This was probably just me tweaking the calculations and running out of time/priority to change the variable name. We should really have a single unified source across the phone and the public dashboard, which is the issue that I plan to have @ananta-nrel work on as his first task |
As a side note, I find it interesting that because mopeds are so efficient on gas, they actually result in fewer emissions than e-car drove alone ( I think that illustrates really well how electrification is not the whole solution - mode shift is equally essential. |
An investigation in e-mission#30 revealed that this field was mislabeled - it is actually kg per kilometer, not per meter. Fortunately, all the numbers are correct, so we can just give it a new name that is accurate and descriptive.
Used 100 mpg as an estimated average for mopeds, which yields 0.05555 kg CO2 / km: e-mission#30
The investigation in e-mission/nrel-openpath-deploy-configs#30 revealed that this field was mislabeled - it is actually kg per kilometer, not per meter. Fortunately, all the numbers are correct, so we can just give it a new name that is accurate and descriptive.
e-mission#30 was merged, but there are a few things missing to get dynamic label options working fully as expected: - change key -> value -- the phone expects each option to have a field by the name of 'value'. The old trip_confirm_options used 'value'. I think I was using 'key' in the new format because it is more concise, but we still need to support both this format and the trip_confirm_options format, and it is not worth going back and changing all the places in the phone code where 'value' is used. -add baseMode for each of the MODE options (to work with e-mission/e-mission-phone#1023) -add missing modes: "bikeshare" and "not_a_trip". Evidently, these were left off in the first PR. I think it may have been based on an older version so I checked all the options against the newest trip_confirm_options. -capitalize English text for 'E-bike' and make it appear before 'bike' - this is what the latest trip_confirm_options has
Since MOPED was included in e-mission/nrel-openpath-deploy-configs#30, the config will be looking for an icon + color for MOPED (at least on dev-emulator configs for now). The MDI library actually has an icon for 'moped', and we'll use green since a moped is a) a derivative of a bicycle and b) fairly emission-friendly Note that this doesn't make MOPED show up on all configurations (or even the default configurations) - only when the labelOptions points to MOPED as a baseMode for one of its mode options
As discussed in e-mission/e-mission-docs#945, we will be supporting the dynamic configuration of users' choices for MODE, PURPOSE, and/or REPLACED_MODE labels.
This is being implemented in e-mission/e-mission-phone#1014.
To test this, I've switched both dev-emulator-study and dev-emulator-program to use this mechanism, including all the old modes and purposes, plus a new mode "Moped".