Power Optimization and Real-time Management of Grid-connected Microgrid with Nonlinear Battery Degradation Model in Energy Market