  In this paper, we implement an advanced safety filter to smoothly limit the
current of an inverter-based Battery Energy Storage System. The task involves
finding suitable Control Barrier Function and Control Lyapunov Function via
Sum-of-Squares optimization to certify the system's safety during grid
transients. In contrast to the conventional safety filter, the advanced safety
filter not only provides a safety certificate but also achieves finite-time
convergence to a nominal region. Within this region, the action of the nominal
control, i.e. the Enhanced Direct Power Control, remains unaltered by the
safety filter. The advanced safety filter is implemented using a Quadratically
Constrained Quadratic Program, providing the capability to also encode
quadratic input constraints. Finally, we showcase the effectiveness of the
implementation through simulations involving a load step at the Point of Common
Coupling, and we compare the outcomes with those obtained using a standard
vector current controller.
