*2.2. MAS-Based System Architecture*

A hierarchical MAS-based architecture is adopted in this work (as shown in Figure 1), consisting of device agents, household agents, an aggregator agent and a network agent. The connected loads and DG units are represented by device agents (DAs). The DAs are responsible for the energy optimization of respective appliances based on the given price signals and associated constraints. DAs of each house are coordinated by a house agent (HA) that interfaces with the external market and network agents through an aggregator. The aggregator coordinates the end-users through dynamic prices and supports the DSO with the required flexibility during network issues.

**Figure 1.** Multi-Agent Systems (MAS)-based system architecture.

The transformer agent (TA) represents a network agent that monitors and controls the MV/LV transformer. The agent-based architecture enables the system to be sufficiently scalable, since more end-users and their appliances can be easily included in the system in terms of new agents. At the same time, the platform can be expanded to wider network areas by implementing more transformers in terms of additional TAs. A more detailed description of the system architecture can be found in [16].

The interactions among the agents in the MAS environment are depicted in Figure 2. In normal operations, the HA adjusts overall energy consumption by optimizing the predicted consumption of the DAs. The final day-ahead profile is sent to the TA to check network security constraints. In case the TA detects an imminent overloading of the transformer, the tariff-based DR phase is triggered (as depicted in Figure 2b). At this phase, the TA calculates the resulting ageing and thermal overloading cost. Based on the cost, it determines required changes in the network tariff at different time instants of the day while keeping the daily average constant. The updated network tariff is sent to the HAs as a flexibility request through the aggregator for an iterative solution of the problem.

**Figure 2.** Interaction among the involved agents.

#### **3. Modeling**

In this section, the modeling of the proposed mechanism is discussed in detail. At any given time, the total available flexibility depends upon the type of loads in the network. Therefore, in order to procure the required flexibility, the behavior of the loads for different price levels needs to be taken into consideration. The Markov Chain Monte-Carlo method is applied in this regard to perform the modeling of household loads [31].

The day-ahead scheduling of the appliances has two aspects. First, the response of the devices needs to be modeled for dynamic prices, and then their behavior needs to be adjusted for changes in the price if flexibility is requested by the TA.
