This article presents an approach to implement a Nonlinear Model Predictive Controller (NMPC) in real-time with a non-standard cost index. The proposed technique's applications are presented to maximize the energy produced by a Wave Energy Converter (WEC) when the cost index is a non-quadratic piecewise discontinuous functional of some design variables. The presented framework is based on pseudo-quadratisation and weight scheduling, which is implemented using the ACADO toolkit for MATLAB/Simulink. The proposed strategy features code generation and deployment on the real-time target machines for industrial applications. The simulations and experiments confirm the success of the proposed approach in achieving the feasible operation of the NMPC and an optimal power capture by the wave energy converters.This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited.