Abstract
In this research, a model of energy management system, which includes renewable energy sources, electrical grid, battery, electric vehicle, diesel engine and loads, is considered. The model is assumed to be under conditions of loads that operate at 20% of nominal power. A method is proposed for the key objectives of power optimization and cost reduction of using electricity in the system with considerations of the electricity price and half-hour control period. This algorithm is based on Lagrange multiplier theorem to achieve high processing speed.