Text this: Nonlinear control for battery energy storage systems in power grids