A new algorithm optimizes the simultaneous transfer of data and power underwater