Generation of electricity and water