Operation and control of pressure retarded osmosis for maximum power