[Ovmsdev] Remaining Charge calculator

Michael Balzer dexter at expeedo.de
Fri Dec 30 02:50:04 HKT 2022


Michael,

while it makes sense to add a general standard utility for this, I don't 
think the Hyundai/Kia code is a good candidate for this.

I find it confusing you need to take the voltage into account rather 
than the power. Also, the "WattHours" numbers don't seem to make sense 
-- why would you have different capacities in the same SOC differences, 
and why depending on the voltage? Also, the calculator seems to need / 
be based on rectangular steps instead of an actual charge curve?

A more natural generalized definition would in my opinion be based on 
modeling the actual curve, like the one I've implemented for the VW Up, 
see `OvmsVehicleVWeUp::CalcChargeTime()`. That takes the charge curve as 
direct (SOC → max power) coordinates, just adding the section gradients 
as a speed optimization (float divisions are very CPU intense on the ESP32):

   struct {
     int soc;  float pwr;    float grd;
   } ccurve[] = {
     {     0,       30.0,    (32.5-30.0) / ( 30-  0) },
     {    30,       32.5,    (26.5-32.5) / ( 55- 30) },
     {    55,       26.5,    (18.5-26.5) / ( 76- 55) },
     {    76,       18.5,    (11.0-18.5) / ( 81- 76) },
     {    81,       11.0,    ( 6.5-11.0) / ( 91- 81) },
     {    91,        6.5,    ( 3.0- 6.5) / (100- 91) },
     {   100,        3.0,    0                       },
   };

But maybe some other vehicle already has an even more generalized & easy 
to use approach. My function lacks temperature compensation, but 
normally delivers sufficiently close results.

Regards,
Michael


Am 29.12.22 um 13:02 schrieb Michael Geddes:
> Hi,
>
> There's a remaining charge calculator currently in the hyundai base 
> class which I have improved upon.  This configuration allows for the 
> charge voltage to be part of the equation.  This is the example from 
> data I collected with the ioniq 5 on 800v charging .. and I've written 
> a plugin so I can get more charge profile information at other charge 
> voltages.
>
> I'm happy to leave it in the Ioniq 5 code, but was wondering if I 
> should put the implementation in a common area.. vehicle.h maybe?
>
> //.ichael
>
> ---8<----------------------
>
> // Charging profile
> //  - Must be from lowest to highest to%.
> //  - Higher voltages must come before lower voltages for the same to%
> charging_step_t ioniq5_chargesteps[] = {
> // voltage, to%, WattHours
>   { 750,     10, 100000 },
>   { 750,     25, 190000 },
>   { 750,     45, 220000 },
>   { 750,     75, 120000 },
>   { 750,     80,  80000 },
>   { 400,     85,  60000 },
>   { 400,     90,  40000 },
>   { 100,     90,   1100 },
>   { 400,     95,  25000 },
>   { 100,     95,   7400 },
>   { 100,    100,   7200 },
>   { 0, 0, 0 },
> };
>
> int CalcRemainingChargeMins(int chargeVolt, float chargespeed, int 
> fromSoc, int toSoc, int batterySize, charging_step_t charge_steps[])
> {
>
> _______________________________________________
> 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 --------------
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/20221229/9a2dbf4f/attachment.sig>


More information about the OvmsDev mailing list