[Ovmsdev] New Metric Units

Michael Balzer dexter at expeedo.de
Sat Nov 5 18:48:02 HKT 2022


Michael,

adding unit conversion support to the shell and Duktape commands is a 
good idea.

Metrics are not meant to provide a user interface, they should be 
defined to be efficient and non-redundant.

Btw, metrics names also shall not use upper case characters, and shall 
only use "." as a separator.

Regards,
Michael


Am 05.11.22 um 11:22 schrieb Michael Geddes:
> Hi all,
> Some of the code I copied from Kona/Kia code had both kwh/100km and 
> km/kwh metrics in the code as 'Other'.
> Adding the various power consumption Units is not particularly hard (I 
> will have a pull-request soon) - though the conversions between them 
> all required some thought!
> ... but it also made me think these two metrics that are (with the 
> consumption units added) defined like this:
> m_v_trip_consumption1 = 
> MyMetrics.InitFloat("xiq.v.trip.consumption.KWh/100km", 10, 0, kWHP100K);
> m_v_trip_consumption2 = 
> MyMetrics.InitFloat("xiq.v.trip.consumption.km/kWh 
> <http://xiq.v.trip.consumption.km/kWh>", 10, 0, kPkWH);
>
> These are effectively the same metric but in different units!
> I'm wondering if we would be better to have scripting and Duktape 
> support for converting metrics to different unit! This might be also 
> quite useful for those strange countries that insist on using miles as 
> a measurement.
>
> On top of the 'metric list' and 'metric set' we could add a 'metric 
> get' which gets a single value.. and add unit support for get/set.
>
> I've also got a pull request that improves the precision of the 
> km<->mi conversions and factors it out.
>
> //.ichael
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20221105/d2619784/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20221105/d2619784/attachment-0001.sig>


More information about the OvmsDev mailing list