# Open Standards/Multipurpose AC-Battery/Data specification

This part describes the data transfer from the control head to the AC battery packs and vice versa.

# Data format

The data transmission is unidirectional only, but chained through all battery packs. So it is possible to address 1..10 battery packs in a chain without effort in distinguishing addresses.
The data transfer is always initiated by the master control unit. It sends data to the first battery pack. Then, the first battery pack sends the data to the next battery pack and so on. The last battery pack returns data to the master control unit.
It shall be possible to activate an AC battery pack with a simple micro controller. Because of this, the transfer shall be done via UART interface.
Logical levels: 0V = recessive level, dominant level is 3..3,5V with max. 10mA.
Communication speed: 125kHz (fractal of 1MHz)
Data format: 8Bit LSB first, even parity, 1 start bit, 2 stop bits. Every frame gets a checksum which is simply add over bytes mod256, with inverted bits.

# Data transfers

There are three groups of data transfers: Master control to all, master control to dedicated battery packs and battery packs to master control

## Master to all

If the master control wants to send data to all battery packs, he uses this method.
The master control sends a header to communicate the meaning of the data. Then one or more data bytes will come (see table). After all data bytes, a checksum (add mod256 inverted) is added. Then a break of minimum 2 bytes will come to signalize the end of transfer (if length could not be retrieved from the header)
The battery pack simply forwards this message to the next battery pack, without modifications.

### Messages Master to all

The header 0x02: Average current is very important for the battery management due to the fact that the AC battery packs don't have own current sensors. This message must be sent minimum every second.
| Header | data bytes | meaning |
| 0x02 | 2 short int | Average current flowing. -512A..0A..+511A, resolution 15.625mA/inc |
| 0x0D | 32 Byte string | Write current user ident to non volatile memory |
| 0x10 | | |
| 0x23 | 1 Byte | Emergency shut down. Data content: 0xFA |
| 0x3E | | |
| 0x46 | | |

## Write Chained Data

This method is used to write different data to the battery packs.
The master control sends a header to communicate the meaning of the data. Then several data bytes for all battery packs will come (meaning: see table). The first battery pack receives the relevant data for him directly after the header from the control master. Then it forwards the header and the next data (without the relevant data for itself) to the second battery pack and generates a correct, new checksum. With every battery pack, the message gets shorter. If the number of bytes is correct, only the header and the checksum is returned to the master control.

### Messages of Write Chained Data

| Header | data bytes | meaning |
| 0x5B | 1 per switching cell | Set discharge limit for cell bypass. 0...250 inc = 0..100%, resolution 0.4%/inc. 251...255 = cell bypass |
| 0x68 | 1 per switching cell | Set charge limit for cell bypass. 0...250 inc = 0..100%, resolution 0.4%/inc. 251...255 = cell bypass |
| 0x75 | | |
| 0x8A | | |
| 0x97 | | |
| 0xA4 | | |
By the use of setting limits it is possible to override a built in cell management and optimize it via control head. Normally, in discharge mode for example, discharged cells are deactivated and not used anymore. So there is a degradation of the possible output voltage. A cell management can disable (bypass) the most empty cells much earlier time by time, so that all cells will have the same charge left. The same method can be used for charging as well.

## Read Chained Data

This method is used to read different data from the battery packs.
The master control sends a header to communicate the meaning of the requested data and a checksum. The first battery pack adds the requested data and forwards the header, his data and a new checksum to the second battery pack. The next battery pack also appends his data, and so on. After the last battery pack, the master control receives the data of all battery packs in a chain. With this method, it is possible to find out how many battery packs are in a chain and how many switch cells they contain.

### Messages of Read Chained Data

| Header | data bytes | meaning |
| 0xB9 | 1 per switching cell | Read current capacity. 0...250 inc = 0..100%, resolution 0.4%/inc. 251...255 = cell defect. |
| 0xC1 | 2 int per battery pack | Read current limit for battery packs. 0..511A, resolution 15,625mA/inc (may be temperature dependent) |
| 0xDC | 3 byte per battery pack | Read temperatures: MinOperating, actual, MaxOperating. Scaling: 0...250 = -50..+200 °C, 251...255: N/A. |
| 0xEF | 32 bytes string per pack | Read Vendor name (used for rental management) |
| 0xF2 | 32 bytes string per pack | Read user ident (used for rental management) |
| 0xFD | 32 bytes string per pack | Read serial no. and type |