 This paper proposes a novel approach to manage peak shaving using a combination of particle swarm optimization, PSO, and user-defined constraints. It also introduces a dynamic clustered load scheduling scheme for microgrids with PV systems, battery energy storage systems, and electric vehicles. The proposed technique uses estimated load demands and profiles of PV power for the next day to determine the limits of feed-in and demand. An optimal rule-based management technique is then developed for the peak shaving of utility grid power, setting the charge-slash-discharge schedules of the battery and EV one day ahead. Using this approach, the authors were able to improve the percentage peak shaving, PPS, by approximately 7%. This article was authored by Aisha Abasi, Kiran Sultan, Sufian Afsar, and others.