Optimal control for studying wave energy in hydraulic systems