TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

Tesla Winds and Elevation Web Browser App

Discussion in 'Model S: User Interface' started by SomeJoe7777, Jun 11, 2016.

  1. SomeJoe7777

    SomeJoe7777 Marginally-Known Member

    Joined:
    Mar 28, 2015
    Messages:
    534
    Location:
    Houston, TX
    I've been a fan of mochouinard's Tesla Headwind Estimator for a long time. However, a problem is that the app relies on another web site to obtain the wind data, and that web site (and all others like it) will charge you if you obtain weather information from them too often. mochouinard ran into this problem (because his app is quite popular) and had to disable it.

    I've come up with a replacement web app to estimate winds (and elevation) for the Tesla while driving, and I'm using a method that can get around this limitation. Each person who wants to use the app can obtain their own API keys from OpenWeatherMap.org (for winds) and Geonames.org (for elevation). That way, no one API key will run into the limitations and the app can be free.

    I believe the app is ready for use, and it is now live at http://teslawinds.com. When you first browse to the app, it will ask you to type in the two API keys you can register for and obtain for free from OpenWeatherMap.org and Geonames.org. I recommend you obtain the API keys on a desktop or laptop browser rather than in the car.

    Once you have obtained the API keys (the Geonames site calls it the "username" or "handle"), bring up the web site in the car, type in the API keys, click the Verify button and the app will verify that both API keys work properly. If they do, you'll be redirected to the app, if not you can correct your keys and hit Verify again.

    Once you are redirected to the app, bookmark it to save the API keys, that way you will not have to enter them again.

    The main app looks like this:

    [​IMG]


    Center Pane (Course): Your course is shown at the top of the rotating compass both in degrees (0-360), and a 16-compass-point direction. Your ground speed (computed by GPS) is at the bottom. The air speed is the ground speed with the headwind or tailwind added in. This is the equivalent speed at which the car will use energy. Tailwinds reduce the air speed, headwinds increase it. The blue arrow in the compass is the wind direction for your area. The compass and wind arrow will rotate as you drive. The cars position, and therefore the course, compass, and speeds are updated every 30 seconds.

    Left Pane (Winds): The direction that the local winds are coming from and their speed is shown at the top in blue. This direction is shown on the compass in the center pane as well by the blue arrow. The weather station that reported the winds is also shown above the wind direction and speed. The components of the wind (crosswind and head/tail wind) are shown surrounding your car. Crosswinds appear with a yellow arrow, headwinds appear with an orange arrow (they cause increased energy usage), and tailwinds appear with a green arrow (they reduce energy usage). The crosswind and head/tailwind speeds are also shown. The arrows size themselves dynamically, so stronger winds will appear with larger arrows. Winds under 1 MPH are not shown. Also at the bottom of this pane are the position, wind, and elevation update timers. WInds are updated every 5 minutes.

    Right Pane (Elevation): The current elevation based on your location is shown at the top in feet, and is updated every 1 minute. The graphic in the middle will show your Model S on an incline if there is a measurable grade that you are driving on. If the model S is climbing, the grade is shown in orange (climbing increases energy use), if the model S is descending, the grade is shown in green (descents decrease energy use). Your ground speed must average at least 30 MPH over a 1 minute interval for the app to compute the grade and elevation change rate. This is to ensure that noise and minor errors in the elevation mapping database are smoothed out. Note that the incline that your model S is shown on is exaggerated for visibility. At the bottom of this pane is the current version of the app, which as of this writing is 1.0.0.197.


    Current Limitations:

    - I've made considerable effort to reduce the required CPU power for this app, but as we all know, sometimes the Tesla browser is just slow. I haven't had any real trouble but please let me know if you do.
    - Right now, the app displays imperial units only. I will work on allowing the switch to SI units in a future version.
    - Elevation is from a mapping database, thus it represents the ground level. Elevation is not altitude, and will not take into account bridges, overpasses, or tunnels.
    - All computations other than course and speed rely on the API calls, which require Internet connectivity. If you are driving in an area where you do not have a data connection, errors will appear in the app that say "No wind/elevation data obtained". These errors will clear when Internet connectivity returns.


    I hope this app helps you on any driving trips where winds and elevation can be a consideration for energy use. I appreciate any feedback you have.
     
    • Like x 12
    • Love x 11
    • Helpful x 1
  2. aesculus

    aesculus Still Trying to Figure this All Out

    Joined:
    May 31, 2015
    Messages:
    1,981
    Location:
    Northern California
    Tried it but my accounts did not verify.:(
     
  3. shs1

    shs1 Member

    Joined:
    Apr 5, 2016
    Messages:
    17
    Location:
    Mariposa CA
    My OpenWeatherMap Key verified, but my Geonames username did not. Trying on my laptop before going to the car.
     
    • Like x 1
  4. StaticDischarge

    Joined:
    Mar 25, 2015
    Messages:
    38
    Location:
    Edmonds, WA
    geonames is ok but the openweathermap.org key doesn't verify. Made a couple of new ones, same result.
     
  5. SomeJoe7777

    SomeJoe7777 Marginally-Known Member

    Joined:
    Mar 28, 2015
    Messages:
    534
    Location:
    Houston, TX
    Make sure you are using the actual API keys, not your account username or password. For OpenWeatherMap.org, you create a new account. After that, log in with your newly-created account, go to the API Keys tab to see your API key:


    [​IMG]

    For Geonames.org, they call the API key your "username". There are two steps. First, create an account along with a username:

    [​IMG]

    Now, once the account is created, you go to the manage your account page, and you need to click on the link at the bottom to enable your account for the free web services:

    [​IMG]


    In the Tesla Winds app, you will type in the OpenWeatherMap.org API key, and the Geonames username.
     
    • Helpful x 2
    • Informative x 1
    • Like x 1
  6. shs1

    shs1 Member

    Joined:
    Apr 5, 2016
    Messages:
    17
    Location:
    Mariposa CA
    Joe,

    All working now. Thanks. I could not find the manage account on the Geonames site, but your link worked. Wonderful app and getting the elevation is a real plus as well. Thanks again.
     
  7. StaticDischarge

    Joined:
    Mar 25, 2015
    Messages:
    38
    Location:
    Edmonds, WA
    still having no luck with openweathermap. Made a new key, still won't verify. any ideas?

    Thanks!
     
  8. SomeJoe7777

    SomeJoe7777 Marginally-Known Member

    Joined:
    Mar 28, 2015
    Messages:
    534
    Location:
    Houston, TX
    Log into the OpenWeatherMap account and check the "My Services" tab. Make sure is says that you're subscribed to the Current Weather and Forecast, and that it's the free plan, as shown below:

    [​IMG]

    If yours doesn't show this, you may need to find a way to add it, or you may need to create a new account from the link I posted above.
     
    • Helpful x 1
  9. StaticDischarge

    Joined:
    Mar 25, 2015
    Messages:
    38
    Location:
    Edmonds, WA
    Yes, services show current weather and free plan, look sjust like the screen shot. I'll make a new account and see what happens with that.
     
  10. byan1232

    byan1232 Member

    Joined:
    Dec 30, 2015
    Messages:
    332
    Location:
    New York, NY
    Works perfectly! Great job. I'm currently driving from CA back home to NJ so it will give me time to test out your app.
     
  11. Peter_M

    Peter_M Member

    Joined:
    Oct 10, 2013
    Messages:
    736
    Location:
    Ottawa, Canada
    Same for me - the geonames.org username verifies, but not the openweathermap.org key, and I have the Current Weather and Forecast free plan.
     
  12. SomeJoe7777

    SomeJoe7777 Marginally-Known Member

    Joined:
    Mar 28, 2015
    Messages:
    534
    Location:
    Houston, TX
    #12 SomeJoe7777, Jun 11, 2016
    Last edited: Jun 11, 2016
    If your OpenWeatherMap.org key does not verify on a desktop/laptop, you may want to try it in the car. If your desktop browser doesn't provide geo locations, it's conceivable that the key may not verify on the desktop browser.

    Edit: I made a modification to the Javascript to account for desktop browsers that may not have geolocation available. If this was the problem, your key should now verify properly on such desktop browsers. Reload the page on the desktop browser to ensure you have the current version.
     
  13. Thumper

    Thumper Member

    Joined:
    May 6, 2011
    Messages:
    581
    Location:
    Corvallis, OR
    Thanks. This looks very helpful. I'll try it.
     
  14. Peter_M

    Peter_M Member

    Joined:
    Oct 10, 2013
    Messages:
    736
    Location:
    Ottawa, Canada
    Yup, works now. Thanks!
     
  15. Peter_M

    Peter_M Member

    Joined:
    Oct 10, 2013
    Messages:
    736
    Location:
    Ottawa, Canada
    Would you be able to add an option for metric: km/h and m/min?
     
  16. ZBB

    ZBB Emperor

    Joined:
    Feb 27, 2013
    Messages:
    1,419
    Location:
    Scottsdale
    Looks great -- thanks for making this avail.
     
  17. SomeJoe7777

    SomeJoe7777 Marginally-Known Member

    Joined:
    Mar 28, 2015
    Messages:
    534
    Location:
    Houston, TX
    That is next on the to-do list, but it may be a few weeks before I have time to implement it.
     
  18. aesculus

    aesculus Still Trying to Figure this All Out

    Joined:
    May 31, 2015
    Messages:
    1,981
    Location:
    Northern California
    Totally missed that step. And your update for the desktop location fixed the OpenWeatherMap.org issue.
     
    • Like x 1
  19. ZBB

    ZBB Emperor

    Joined:
    Feb 27, 2013
    Messages:
    1,419
    Location:
    Scottsdale
    I set up API accounts this morning and got it working. Went for a quick drive and a it works great.

    The geonames.org activate link is easy to miss. Their activate email also went to my junk folder... Once those steps were done, it worked like a charm. Nice way to easily add the API accounts!
     
  20. bmah

    bmah Obscure Member

    Joined:
    Mar 17, 2015
    Messages:
    742
    Location:
    Lafayette, CA
    Very cool, thanks for making this available! Tried this on a Sunday drive, just for kicks. It looks like this would be most useful on drives where you hold a roughly constant heading and rate of ascent/descent, and where you don't have a lot of terrain affecting the winds locally. (That was not the case for the drive I took, but that was a good experiment to understand the capabilities and limitations of the app.) I liked the presentation of data, lots of information presented in an easy-to-understand way. Once again thanks for sharing this!

    Bruce.
     
    • Like x 1

Share This Page