Models and optimizes capacity & dispatch of electricity supply systems, off-grid or connected to a (weak) central grid