Optimal Technology Selection and Operation of Microgrids in Commerical Buildings