Development of an Iterative Method for Optimization and Energy Management Problem Avoidance in a Smart Building: Considering Integration of Grid Supply, Pv and Bess | Synapse