In recent years, along with the rise of global warming issue, researches of renewable energy usage for producing electricity are sprung up. The penetration of renewable energy usage to microgrid brings new challenge as most of the renewable energy are unpredictable. In order to get optimal microgrid operation, integration of methods and softwares are needed in microgrid analysis. This study will use OpenDSS in cooperation with Matlab. Thus optimization algorithm implementation can be achieved by Matlab and simulations of microgrid performed in OpenDSS. The establishment constructs a flexible framework for microgrid analysis which is extensible for various practical studies.