[Ovmsdev] New Metric Units

Michael Geddes frog at bunyip.wheelycreek.net
Sat Nov 5 20:09:19 HKT 2022


Yeah - this was copied code from kia/kona and is what triggered these
ideas; I totally agree this shouldn't be doubled up on.

I've got some commits centred round Metrics that I'll just check over and
push up ... and then I'll just have the single xiq.v.trip.consumption metric
(unless you have some ideas for the namespace) which will be much neater.

If it's ok with you then I might do that unit conversion proposal.
Would it ok if the unit specifications were the same as to the
programatic codes in ovms_metrics.h?
(kWh,   WattHours , MetersPSS )
I would probably add a command
metric units <spec>
to list all (matching) units and their associated Labels.

//.ichael

On Sat, 5 Nov 2022 at 18:48, Michael Balzer <dexter at expeedo.de> wrote:

> 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",
> 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 listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
> --
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20221105/f279a2ae/attachment.htm>


More information about the OvmsDev mailing list