Convex modeling of pumps in order to optimize their energy use