## 1 Introduction  
Over the last two decades, using renewable energy sources (RESs) such as wind turbines (WTs) and photovoltaic (PV) systems has increased considerably due to some environmental concerns and their unique features. From this perspective, traditional centralized power generations are replaced with modern forms of decentralized power generation, which can change consumption and production patterns pragmatically. In the modern electricity market, a new expression has been recently introduced to present a bilateral role. In fact, prosumers are regarded as an entity consumes electrical energy and reserve the capability to generate electricity in a reasonable way. It is often argued that market reform and regulatory support promote electricity market and ensure the promising profits to individual prosumers. In addition, the distribution system operator (DSO) encourages prosumers to achieve benefits and reduction in maintenance and expansion cost of equipment. In the U.S. and some European countries, the development of this kind of market has led to achieving a great balance between supplies and demand as well [1; 2; 3; 4; 5]. Recently, Iran's electricity market has depicted some developments in the increasing use of renewable energy sources as well as cost adjustment by the integration of prosumers and consumers in a prosumer market. These electricity markets have been established for prosumer aggregators, namely smart cities, zero-carbon building, off-grid islands, or residential and commercial aggregators. It is important to note that residential buildings play an active role in this market because they can be equipped with modern energy technologies such as plug-in hybrid electric vehicles (PHEVs). Besides, they can also supply energy for consumers through the nearest aggregator [6]. In fact, among different types of electric vehicles (EVs; such as a PHEV, fuel cell electric vehicle (FCEV) [7], and fully electric vehicle (FEV)), PHEV is the most prominent EV in Iran. Therefore, we have considered PHEV in our model [8]. Moreover, there is an ability to deploy load management and minimize energy consumption in order to achieve some economic benefits. Due to the high penetration of RESs and dynamic behavior of their electricity production during different days, a variable amount of electricity can be achieved in different hours of a specific day [9]. Although solar and wind generations are highly dependent on weather conditions, there may be insufficient renewable outputs energy during adverse weather conditions. As a result, decision-makers of this residential building intend to sell extra electricity to the consumers at a reasonable price. Similarly, consumers are also mainly motivated by the prices that are more affordable than utility rates. Since the electricity prices in Iran are based on the progressive tax scheme, where prices rise with more electricity consumption rate, consumers will avoid paying extra cost by a proper interacting with the prosumers. The presence of local energy management systems (EMSs) seems essential in order to manage some energy storage systems like stationary batteries (SBs) and PHEVs in a sensible way. Energy storage systems (ESSs), along with other applications, are deployed to increase revenues and improve the operation of RESs efficiently. The primary purpose of taking advantage of energy management systems (EMS) in the current study is to reduce the incoming power from the utility at peak hours and providing extra-generated power for contracted consumers. As a result, an advanced charge and discharge schedule appears to be necessary, particularly for residential buildings, which have been contracted to some consumers with a specific amount of power during scheduled periods like peak hours. Likewise, this is more favorable to store generated electricity from RESs to support contracted consumers instead of purchasing from the network during peak hours.