“…For each hour, each bat in the population adjusts the charging and discharging mode of ESS, using the next rules: a) If the purchasing price of active power from the market ( , , ) is smaller than the limit of ESS charging price (0.4 of the highest purchasing price of active power from the market [26]) then bat sets the ESS mode for charging state and produces a positive random amount of the ESS power in this range {PCh,max, 0}, where PCh,max is the maximum ESS power of charge. b) If the purchasing price of active power from the market ( , , ) is above the limit of ESS charging price, and ESS state of charge at time t (SOCt) is less than the maximum limit (SOCmax), and the full renewable DERs power generation is greater than the full MG load power, then the bat sets the mode of ESS as a charging mode and adjusts the power of ESS as a positive random amount in the range of difference between the full renewable DERs power generation and the total demand load of MG. c) If the sale price of active power of the market ( ,(, ) is above the ESS discharging price limit (0.7 of the highest sale price of active power of the market [26]) and SOCt is less than the minimum limit (SOCmin), then the bat sets the mode of ESS for discharging and produces a negative random amount of the ESS power in this range {0, PDis,max}, where PDis,max is the maximum ESS power of discharge . 5.…”