teslamate icon indicating copy to clipboard operation
teslamate copied to clipboard

Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity

Open jensk22 opened this issue 1 year ago • 13 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What happened?

(I don't know how to escalate a Discusiion to an Issue, so here we go) The issue is described in Discussion: https://github.com/teslamate-org/teslamate/discussions/3470 )

My Tesla Model S 70D Y2015, which has approx 68,8/67,2kWh Usable from new, is reported with 'original' capacity in excess of 83 kWh

image

Assuming the ('$aux'::json -> 'RatedEfficiency')::text::float is in effect the Ideal Efficiency of 190Wh/km instead of the Rated Efficiency of 150Wh, I changed the Graph Query to: and that produces proper 'old' capacity numbers (which for me is around 66.1kWh because I started using Teslamate as late as at odeometer=70kKm). So the :

Below is not a proper fix, the right solution is to update the ('$aux'::json -> 'RatedEfficiency')::text::float to be correct!

SELECT convert_km(AVG(p.odometer)::numeric,'$length_unit') AS odometer, AVG(c.ideal_battery_range_km * ('$aux'::json -> 'RatedEfficiency')::text::float / c.usable_battery_level) AS "kWh", MAX(cp.id) AS id, to_char(cp.end_date, 'YYYY-MM-dd') AS Title FROM charging_processes cp JOIN (SELECT charging_process_id, MAX(date) as date FROM charges WHERE usable_battery_level > 0 GROUP BY charging_process_id) AS last_charges ON cp.id = last_charges.charging_process_id INNER JOIN charges c ON c.charging_process_id = cp.id AND c.date = last_charges.date INNER JOIN positions p ON p.id = cp.position_id WHERE cp.car_id = $car_id AND cp.end_date IS NOT NULL AND cp.charge_energy_added >= ('$aux'::json -> 'RatedEfficiency')::text::float GROUP BY 4

New graph: image

Expected Behavior

image

Steps To Reproduce

Open Teslamate Navigate to Dashboards/Battery Health

Relevant log output

None

Screenshots

image

Additional data

No response

Type of installation

Docker

Version

v1.27.4

jensk22 avatar Nov 24 '23 13:11 jensk22

@jensk22 have you tried with the battery health dashboard currently on master?

oivindoh avatar Nov 26 '23 13:11 oivindoh

Below is not a proper fix, the right solution is to update the ('$aux'::json -> 'RatedEfficiency')::text::float to be correct!

Sorry, I wouldn't know how to make a calculation that only works for your car or specifically for that model. I don't know which models have this peculiarity. The data is extracted from what is stored in the "rated_efficiency" field of the "cars" table. Something you could do is to modify the value you have in that table and test if it adapts to what you mention, but I don't know what other implications it could have with other calculations from other dashboards.

About the dashboard, if we change that value arbitrarily it will affect all other car models. Have in mind, that there are many model variants: American, European, Asian, etc.

jheredianet avatar Nov 27 '23 15:11 jheredianet

Hi,

Where do you get the

'$aux'::json -> 'RatedEfficiency

from???

regards Jens


From: Juan Carlos Heredia @.> Sent: 27 November 2023 16:22 To: teslamate-org/teslamate @.> Cc: jensk22 @.>; Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

Below is not a proper fix, the right solution is to update the ('$aux'::json -> 'RatedEfficiency')::text::float to be correct!

Sorry, I wouldn't know how to make a calculation that only works for your car or specifically for that model. I don't know which models have this peculiarity. The data is extracted from what is stored in the "rated_efficiency" field of the "cars" table. Something you could do is to modify the value you have in that table and test if it adapts to what you mention, but I don't know what other implications it could have with other calculations from other dashboards.

About the dashboard, if we change that value arbitrarily it will affect all other car models. Have in mind, that there are many model variants: American, European, Asian, etc.

— Reply to this email directly, view it on GitHubhttps://github.com/teslamate-org/teslamate/issues/3486#issuecomment-1828044108, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWBH7YVZHYBDM4YBGIIOOJDYGSV2TAVCNFSM6AAAAAA7ZDLQJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGA2DIMJQHA. You are receiving this because you were mentioned.

jensk22 avatar Nov 27 '23 17:11 jensk22

BTW, it is not for 'my' car, I found in Discussions, that a Tesla Model S 90D had the same issue, 'Calculated Capacity' is way off 🙂


From: Jens K Jensen @.> Sent: 27 November 2023 18:16 To: teslamate-org/teslamate @.>; teslamate-org/teslamate @.> Cc: Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

Hi,

Where do you get the

'$aux'::json -> 'RatedEfficiency

from???

regards Jens


From: Juan Carlos Heredia @.> Sent: 27 November 2023 16:22 To: teslamate-org/teslamate @.> Cc: jensk22 @.>; Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

Below is not a proper fix, the right solution is to update the ('$aux'::json -> 'RatedEfficiency')::text::float to be correct!

Sorry, I wouldn't know how to make a calculation that only works for your car or specifically for that model. I don't know which models have this peculiarity. The data is extracted from what is stored in the "rated_efficiency" field of the "cars" table. Something you could do is to modify the value you have in that table and test if it adapts to what you mention, but I don't know what other implications it could have with other calculations from other dashboards.

About the dashboard, if we change that value arbitrarily it will affect all other car models. Have in mind, that there are many model variants: American, European, Asian, etc.

— Reply to this email directly, view it on GitHubhttps://github.com/teslamate-org/teslamate/issues/3486#issuecomment-1828044108, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWBH7YVZHYBDM4YBGIIOOJDYGSV2TAVCNFSM6AAAAAA7ZDLQJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGA2DIMJQHA. You are receiving this because you were mentioned.

jensk22 avatar Nov 27 '23 17:11 jensk22

Hi, Where do you get the '$aux'::json -> 'RatedEfficiency from??? regards Jens

Hi, this is the query:

SELECT efficiency * 100.0 AS rated_efficiency FROM cars WHERE id = 1

Also discussed here https://github.com/teslamate-org/teslamate/discussions/3470

jheredianet avatar Nov 27 '23 17:11 jheredianet

Hi Juan

I looked at the Teslamate tables using teslamate=# select * from information_schema.tables where table_schema = 'public';

and decided that the charging_processes has kWh added as well as rated- and and ideal_km_added, so I propose that Rated and Ideal Efficiency can be calculated as: teslamate=# select charge_energy_added, end_rated_range_km - start_rated_range_km as RatedKm, end_ideal_range_km - start_ideal_range_km as IdealKm, charge_energy_added / (end_rated_range_km - start_rated_range_km) as RatedkWhKm, charge_energy_added / (end_ideal_range_km - start_ideal_range_km) as IdealkWhPerKm from charging_processes where charge_energy_added > 10;

charge_energy_added | ratedkm | idealkm | ratedkwhkm | idealkwhperkm ---------------------+---------+---------+------------------------+------------------------ 10.34 | 68.91 | 54.40 | 0.15005079088666376433 | 0.19007352941176470588 11.94 | 79.61 | 62.86 | 0.14998115814596156262 | 0.18994591154947502386 10.24 | 68.24 | 53.89 | 0.15005861664712778429 | 0.19001670068658378178 12.26 | 81.69 | 64.50 | 0.15007956910270534949 | 0.19007751937984496124 25.04 | 166.92 | 131.79 | 0.15001198178768272226 | 0.18999924121708779118 23.44 | 156.25 | 123.36 | 0.15001600000000000000 | 0.19001297016861219196 14.59 | 97.30 | 76.80 | 0.14994861253854059609 | 0.18997395833333333333 13.96 | 93.79 | 74.05 | 0.14884316025162597292 | 0.18852126941255908170 43.60 | 290.63 | 229.44 | 0.15001892440560162406 | 0.19002789400278940028 14.51 | 96.73 | 76.35 | 0.15000516902718908301 | 0.19004584151931892600 14.28 | 95.19 | 75.16 | 0.15001575795776867318 | 0.18999467802022352315 10.76 | 72.47 | 57.22 | 0.14847523113012280944 | 0.18804613771408598392 13.64 | 90.91 | 71.77 | 0.15003849961500384996 | 0.19005155357391667828 10.23 | 68.18 | 53.82 | 0.15004400117336462306 | 0.19007803790412486065 10.98 | 73.16 | 57.76 | 0.15008201202843083652 | 0.19009695290858725762 19.32 | 128.78 | 101.66 | 0.15002329554278614692 | 0.19004524886877828054 16.32 | 108.78 | 85.88 | 0.15002757859900717044 | 0.19003260363297624592 10.34 | 68.92 | 54.41 | 0.15002901915264074289 | 0.19003859584635177357 16.20 | 107.99 | 85.25 | 0.15001389017501620520 | 0.19002932551319648094 30.90 | 206.04 | 162.66 | 0.14997087944088526500 | 0.18996680191811139801 18.12 | 120.81 | 95.39 | 0.14998758380928731065 | 0.18995701855540413041 33.68 | 224.54 | 177.27 | 0.14999554645052106529 | 0.18999266655384441812 23.03 | 153.50 | 121.18 | 0.15003257328990228013 | 0.19004786268361115696 13.75 | 92.38 | 72.95 | 0.14884174063650140723 | 0.18848526387936943112 11.83 | 79.59 | 62.83 | 0.14863676341248900616 | 0.18828585070826038517 34.98 | 230.23 | 181.78 | 0.15193502150023889154 | 0.19243041038618109803 18.54 | 123.63 | 97.59 | 0.14996360106770201407 | 0.18997848140178296957 --More--

I don't know how Adrian calculates the efficiencies, but given Teslamate is open source a more 'into the code' guy shoul dbe able to decipher 🙂 But they are shown here:

[cid:b8db8b47-7193-4cd5-8bf1-bcd32382b9fb]

regards Jens


From: Jens K Jensen @.> Sent: 27 November 2023 18:18 To: teslamate-org/teslamate @.>; teslamate-org/teslamate @.> Cc: Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

BTW, it is not for 'my' car, I found in Discussions, that a Tesla Model S 90D had the same issue, 'Calculated Capacity' is way off 🙂


From: Jens K Jensen @.> Sent: 27 November 2023 18:16 To: teslamate-org/teslamate @.>; teslamate-org/teslamate @.> Cc: Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

Hi,

Where do you get the

'$aux'::json -> 'RatedEfficiency

from???

regards Jens


From: Juan Carlos Heredia @.> Sent: 27 November 2023 16:22 To: teslamate-org/teslamate @.> Cc: jensk22 @.>; Mention @.> Subject: Re: [teslamate-org/teslamate] Battery Health Issue with Model S appears to use Ideal Efficiency and not Rated Efficiency, causing far too high an 'old' capacity (Issue #3486)

Below is not a proper fix, the right solution is to update the ('$aux'::json -> 'RatedEfficiency')::text::float to be correct!

Sorry, I wouldn't know how to make a calculation that only works for your car or specifically for that model. I don't know which models have this peculiarity. The data is extracted from what is stored in the "rated_efficiency" field of the "cars" table. Something you could do is to modify the value you have in that table and test if it adapts to what you mention, but I don't know what other implications it could have with other calculations from other dashboards.

About the dashboard, if we change that value arbitrarily it will affect all other car models. Have in mind, that there are many model variants: American, European, Asian, etc.

— Reply to this email directly, view it on GitHubhttps://github.com/teslamate-org/teslamate/issues/3486#issuecomment-1828044108, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWBH7YVZHYBDM4YBGIIOOJDYGSV2TAVCNFSM6AAAAAA7ZDLQJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGA2DIMJQHA. You are receiving this because you were mentioned.

jensk22 avatar Nov 27 '23 18:11 jensk22

Hi @jensk22

I've made un update for your suggestion. It's on my own repository ("on develop branch") at https://github.com/jheredianet/Teslamate-CustomGrafanaDashboards/tree/develop

You may import manually the BatteryHealth dashboard as explained there and test if the estimations now are more accurate. If so, I'll made a pull request to be used in Teslamate.

Let me know how it goes.

jheredianet avatar Nov 30 '23 21:11 jheredianet

I Imported the JSON Content as 'Battery Health2' and results are fine! image

I read your instructions on 'your' ithub, and did not dare change the UID, so soon I will figure out whether Grafana/Delete works by UID or by name :-)

jensk22 avatar Dec 01 '23 08:12 jensk22

Great!!! I'll make a pull request on the main repository of Teslamate.

https://github.com/teslamate-org/teslamate/pull/3531

jheredianet avatar Dec 01 '23 09:12 jheredianet

I performed a pull and update today - issue is still there:-( So I looked here and saw that my' issue is still open. Anything I can do to help?

image

(The manually imported Battery Healt totally continues my 'LinkMyTesla' data from 2016-2020, so seems correct. On top it calculates Current capaity as 65.1kWh which is within 0,1 kWh from what OBD2/ScanMyTesla reports :-))

image

jensk22 avatar Jan 23 '24 10:01 jensk22

BTW, The Max Range (new) is not updated when I fill in the 'known' Max capacity wen new. My Nominal Capacity was first 71.2 kWh - Buffer of 2,4 kWh = 68,8 kWh, but later Tesla change dthe Buffer to 4 kWh (according to OBD2 BMS data). Newer the less, you can ofcourse not handle that and I am perfectly happy to enter say 68.8 kWh as Max New to get: image

jensk22 avatar Jan 23 '24 10:01 jensk22

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 23 '24 01:02 github-actions[bot]

I propose that you release the fix that was the effect of: 'Battery Health Issue with Model S #3470'

As I have reposted, the new Efficiency graph that I Imported and tests as 'Battery Health 2'uses Rated and works correct, se snip: image

You just need to release it (don't know if you could collapse the now 3 x Battery Health Dashboards into one.

regards Jens

jensk22 avatar Feb 23 '24 08:02 jensk22

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 25 '24 01:03 github-actions[bot]