[Ovmsdev] Leaf 2016 30Kwh flapping SOC

Tom Parker tom at carrott.org
Wed May 2 03:39:57 HKT 2018


On 02/05/18 01:08, ovms wrote:

> Think I found out why I was unable to send mail to this list. (wrong 
> sender address)
> My 2016 Leaf still has flapping SOC.

Do you have a 30kWh battery?

> I made the following changes in vehicle_nissanleaf.cpp and compiled 
> the code.
>
> *case 0x50d**:*   //Changed this from 5bc. 50d is the instrument SOC
>
> {
>
> uint16_t nl_gids = ((uint16_t) d[0] << 2) | ((d[1] & 0xc0) >> 6);
>
> if (nl_gids == 1023)
>
> {
>
> break;
>
> }
>
> uint16_t max_gids = MyConfig.GetParamValueInt("xnl", "maxGids", 
> GEN_1_NEW_CAR_GIDS);
>
> float km_per_kwh = MyConfig.GetParamValueFloat("xnl", "kmPerKWh", 
> GEN_1_KM_PER_KWH);
>
> float wh_per_gid = MyConfig.GetParamValueFloat("xnl", "whPerGid", 
> GEN_1_WH_PER_GID);
>
> m_gids->SetValue(nl_gids);
>
> StandardMetrics.ms_v_bat_soc->SetValue(*nl_gids / 4*);  //Changed this 
> so the value is divided by 4.
>
> SOC now shows exactly the same in the app as the instrument-panel 
> does, and is not flapping. (I know the instrument-panel is different 
> from the true SOC)
>

Right, so you've confirmed that if module sends a reasonable SOC to the 
server, the value stops flapping in the app?

> My coding capabilities are limited so if someone has a better idea, I 
> can test it on my car.
>

We can make the SOC calculation configurable so that you can choose to 
use the instrument panel SOC or an SOC based on the new car battery 
size. When I took over the leaf support I wanted to use the instrument 
panel soc too, see Tom Saxton's reply which convincingly dissuaded me 
wanting to switch: 
http://lists.openvehicles.com/pipermail/ovmsdev/2016-May/002993.html 
(this discussion that was before I knew SOC was available so I had some 
no longer relevant ideas about how to actually implement it).

Now we have the easier to configure v3 platform and more users wanting 
to use the instrument panel SOC I'll make it configurable. I should be 
able to get that done tonight.

> And now to a different thing:
>
> The app supports unlocking and locking of doors. The feature doesn't 
> seem to be implemented for the Nissan Leaf.
>
> I have all the CAN-codes needed to make this work. Please let me know 
> if I can contribute.
>

I'm uncomfortable doing this on my own car, but I'm very happy to have 
the feature implemented. I think it should be hidden behind a 
configuration option, so you can choose whether the standard 
functionality allows the car to be unlocked, but that is a different and 
not Leaf specific conversation.

You should be able to implement it quite easily by following the pattern 
used in CommandStartCharge() in the Leaf code and the Lock and UnLock 
implementations in the Tesla Roadster and Kia Soul code. Be sure to send 
the frame to the correct CAN bus. The console logging functions are very 
useful for confirming what is going on when you're developing.

Thanks for

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20180502/4f23ff4d/attachment.htm>


More information about the OvmsDev mailing list