For an Energy Management System EMS-controlled microgrid that uses a single-phase voltage source inverter VSI configuration to supply power for AC loads from DC energy storage devices, the DC link connecting the VSI to the DC energy storage devices experiences a voltage ripple that is a second-order harmonic of the AC frequency. When the EMS has a battery bank as the only DC energy storage device, the DC link voltage ripple causes a second-order harmonic ripple in battery current that leads to a reduction in battery life. Supercapacitors SCs, which are capable of operating through many more cycles than batteries, can be added to the EMS to form a battery and SC Hybrid Energy Storage System HESS.The EMS can then be used to filter out the second-order harmonic ripple in battery bank current and provide this current solely from the SC bank, extending battery life and reducing system operating costs. The design of a computer simulation of an EMS providing power to a microgrid is discussed in this thesis. Simulations provide theoretical results and laboratory results compare well with the theoretical results, showing that SCs can be used to remove the second-order harmonic current ripple from the battery bank.