Suite et fin de ma réponse au code contest après la première partie. Dans ce billet, nous allons voir comment calculer les émissions de CO2 pour la partie de trajet sur la route 66. // Define points from the car journey on the US66 road [ // Here is the gts of the car datalogger @senx/dataset/route66_vehicle_gts // Here is the route 66 geoshape (+/- 20meters) @senx/dataset/route66_geoshape mapper.geo.within 0 0 0 ] MAP "onTheRoad" STORE $onTheRoad { 'timesplit' 60 s } MOTIONSPLIT 0 GET 'sectionOnTheRoad' STORE // Compute speed - result in m/s [ $sectionOnTheRoad mapper.hspeed 1 0 0 ] MAP // Convert in km/h so x3600 /1000 = 3.6 - mapper.mul expects a constant [ SWAP 3.6 mapper.mul 0 0 0 ] MAP 'speedFrames' STORE // Get distance between each points in km (first in meters, then in km) [ $sectionOnTheRoad mapper.hdist 0 1 0 ] MAP [ SWAP 0.001 mapper.mul 0 0 0 ] MAP 'distFrames' STORE // fuel consumption approximation is (8 liters/100km) × (speed (km/h) / 80) +1 // So it's Speed * 8 / 80 / 100 + 1 = V/10 + 1 // F = False => does not return the index $speedFrames <% 0.1 * 1.0 + %> F LMAP 'hundredKmFuelConsumption' STORE [ ] 'instantConsumption' STORE <% 'i' STORE // store index // Get each list and compute one by another // So we compute consumption for 100 km at given speed (computed previously) // with related distance // then we divide by 100 as first value is for 100 km $distFrames $i GET $hundredKmFuelConsumption $i GET * 100 / 'r' STORE $instantConsumption $r +! %> 'C' STORE 0 7 $C FOR CLEAR // For each GTS, compute fuel consumption as 1 point [ $instantConsumption mapper.sum MAXLONG MAXLONG 1 ] MAP // Sum all points to get total consumption 0 SWAP <% VALUES 0 GET + %> FOREACH // 1L = 2392g CO2 2392 * // Enjoy ! Le premier et le second bloc sont les mêmes que dans la premièr partie. Je vous y renvoie donc si besoin.
La société SenX a proposé un code contest suite à la publication de son article sur les formes géospatiales. L’objet du concours porte sur le trajet d’un véhicule aux USA et il consiste à déterminer : la distance réalisée sur la fameuse route 66 durant ce trajet, de déterminer les émissions de CO2 réalisées durant ce trajet sur la route 66. Maintenant que le gagnant a été annoncé (TL;DR: moi 😎🎉) et en attendant le corrigé officiel, voici ma proposition de solution. Distance parcourue sur la route 66 Les données de départ sont : @senx/dataset/route66_vehicle_gts : le trajet réalisé par le véhicule @senx/dataset/route66_geoshape : la route 66 // Define points from the car journey on the US66 road [ // Here is the gts of the car datalogger @senx/dataset/route66_vehicle_gts // Here is the route 66 geoshape (+/- 20meters) @senx/dataset/route66_geoshape mapper.geo.within 0 0 0 ] MAP "onTheRoad" STORE $onTheRoad { 'timesplit' 60 s } MOTIONSPLIT 0 GET 'sectionOnTheRoad' STORE // Compute distance for each GTS and output it as a single point [ $sectionOnTheRoad mapper.hdist MAXLONG MAXLONG 1 ] MAP // Sum all GTS 0 SWAP <% VALUES 0 GET + %> FOREACH // Convert to km 1000 / // Enjoy ! Explications :
On orchestre, on conçoit — et on code aussi. Parlons de votre plateforme, vos données ou votre projet IoT.
Contactez-nous →