Optimal Design of Trigeneration and District Energy in the Presence of Energy Storage