This work develops microgrid dispatch algorithms with a unified approach to model predictive control (MPC) to (a) operate in grid-connected mode to minimize total operational cost, (b) operate in islanded mode to maximize resilience during a utility outage, and (c) utilize weighting. This work develops microgrid dispatch algorithms with a unified approach to model predictive control (MPC) to (a) operate in grid-connected mode to minimize total operational cost, (b) operate in islanded mode to maximize resilience during a utility outage, and (c) utilize weighting. Microgrid Battery Dispatch Logic functions as the deterministic execution layer within a decentralized energy resource management system (DERMS). Its primary role is to arbitrate power flow between electrochemical storage assets, renewable generation sources, and critical loads to optimize the. GitHub - gowthamk-dev/Scada-GridMind: AI-powered microgrid energy management and SCADA platform with real-time monitoring, intelligent dispatch, digital twin simulation, and industrial protocol emulation.