Optimizing speed profiles for sustainable train operation with wayside energy storage systems