Deterministic model of battery, uphill currents, and nonequilibrium phase transitions