Optimization of the energy demand of reverse osmosis with a pressure-exchange system