Optimized Renewable Energy Integration: Advanced Modeling, Control and Design of A Standalone Microgrid