[Ovmsdev] RFC: Battery status MSG protocol

Mark Webb-Johnson mark at webb-johnson.net
Tue Dec 4 13:14:34 HKT 2012


Michael,

I really like this, but think it best to use a generic message type for historical data that can be supported in the server, and retrieved from the clients in a standardised way.

Perhaps just:

MP-0 H,<type>,<lifetime>,<data>
type (integer type code)
lifetime (storage lifetime requested, in seconds)
data (a blob of data to be dealt with by the application however it wants)

We can maintain a registry of 'types' - as they are just numbers, they can be vehicle specific, or general purpose.

The server could then just store that in a special table. It can timestamp it when it receives the data, and generate an expiry date based on NOW()+<lifetime-seconds>, so that it can be auto-purged. It would be keyed by the vehicleid, type, and timestamp.

So, not using carmessages, but cardata (or something like that).

For access, we can just use the existing command/response functions (C/c).

Does that make sense? If so, I can get server support for this quite easily and quickly?

Regards, Mark.

On 2 Dec, 2012, at 4:00 AM, Michael Balzer wrote:

> Hi Mark,
> 
> this is my first draft of a battery data protocol as implemented in the Twizy module 2.0 (see vehicle_twizy_battstatus_msgp()).
> 
> For each battery pack (min 1), a message of type "B" transports the current state and collected min/max values:
> 
>    // Output pack status:
>    // MP-0 B,<packnr>,<nr_of_cells>
>    //  ,<volt_alertstatus>,<temp_alertstatus>
>    //  ,<soc>,<soc_min>,<soc_max>
>    //  ,<volt_act>,<volt_act_cellnom>
>    //  ,<volt_min>,<volt_min_cellnom>
>    //  ,<volt_max>,<volt_max_cellnom>
>    //  ,<temp_act>,<temp_min>,<temp_max>
> 
> The units now are 1/100 % for the SOCs, 1/100 V for the voltages and 1 °C for the temperatures. Maybe floats are more readable / standard for SOC & V?
> 
> Alert status are enums of...
>    0 = unknown
>    1 = nominal
>    2 = suspicious
>    3 = alert
>    4 = fail
> 
> For each cell in each pack, a message of type "H" transports the cell details accordingly:
> 
>        // Output cell status:
>        // MP-0 H,<packnr>,<cellnr>
>        //  ,<volt_alertstatus>,<temp_alertstatus>,
>        // ,<volt_act>,<volt_min>,<volt_max>,<volt_maxdev>
>        // ,<temp_act>,<temp_min>,<temp_max>,<temp_maxdev>
> 
> Numbering of packs and cells begins at "1" to reserve "0" for an "all" selector.
> Alert status uses the same enum scheme as on the pack level.
> Voltages on the cell level are in unit mV, temperatures in °C. The maximum deviations are signed to reflect the direction of the deviation.
> 
> Of course, a cell need not be a physical cell, it's just the smallest monitorable unit in a pack. Monitoring huge packs will not be possible with the current OVMS hardware, unless we consider streaming all sensor data to the server.
> 
> I thought about how much could be stored in the server now and had a first look at the current server implementation. The primary key of table "ovms_carmessages" would need to be changed, as it currently is bound to just the message type character (and also case insensitive, reducing the number of possible message types). The key would need to be extended by the packnr on "B" messages and the pack + cellnr on "H" messages.
> 
> So, generally speaking, we could introduce 2-3 key extension columns that can be used dynamically based on the message type. That would also enable storing of other historical records. To keep the database clean, an expire mechanism could drop all rows older than e.g. 24 hours.
> 
> Please comment.
> 
> Regards,
> Michael
> 
> -- 
> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
> 
> <dexter.vcf>_______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20121204/7e35d008/attachment.htm>


More information about the OvmsDev mailing list