I will have to study it more to understand how it works it out, I think that it measure's both ways not 100% sure. I was looking through my favorites and seen it and thought of this thread stright away. It seem very clever way of doing it.
They use a device at work on a hybrid machine that counts total amp-hours/watt-hrs in and out, like how much you have taken out and put back in I tried to get the info on how they do it but no chance there keeping there cards very close to there chest