[Ovmsdev] RFC: Battery status MSG protocol

Michael Balzer dexter at expeedo.de
Wed Dec 5 03:43:13 HKT 2012


Mark,

that's an even better idea, reduces server complexity as no type switch 
will be needed.

Just one addition: to be able to store and retrieve multiple records 
within one type (e.g. multiple cells for type "cell data"), an "address" 
or "recno" field could be added after the type. That would be part of 
the primary key, so the server ensures there's at most one record no. x 
of type y.

I think that's necessary to keep the xfer data volumes low, otherwise 
all blob data of a type would need to be updated if just a part of it 
changes.

So that would be:

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


For general purpose type codes, maybe some classification scheme would 
make sense? Maybe adopt some standard scheme already defined for 
automotive data? ...if there is one...

Regards,
Michael


Am 04.12.2012 06:14, schrieb Mark Webb-Johnson:
> 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>
>       o type (integer type code)
>       o lifetime (storage lifetime requested, in seconds)
>       o 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 <mailto:OvmsDev at lists.teslaclub.hk>
>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.teslaclub.hk/pipermail/ovmsdev/attachments/20121204/3b0359b5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dexter.vcf
Type: text/x-vcard
Size: 206 bytes
Desc: not available
URL: <http://lists.teslaclub.hk/pipermail/ovmsdev/attachments/20121204/3b0359b5/attachment.vcf>


More information about the OvmsDev mailing list