Bidirectional energy flow