Novel Simulation Approaches for Smart Grids

The complexity of the power grid, in conjunction with the ever increasing demand for electricity, creates the need for efficient analysis and control of the power system. The evolution of the legacy system towards the new smart grid intensifies this need due to the large number of sensors and actuators that must be monitored and controlled, the new types of distributed energy sources that need to be integrated and the new types of loads that must be supported. At the same time, integration of human-activity awareness into the smart grid is emerging and this will allow the system to monitor, share and manage information and actions on the business, as well as the real world. In this context, modeling and simulation is an invaluable tool for system behavior analysis, energy consumption estimation and future state prediction. In this paper, we review current smart grid simulators and approaches for building and user behavior modeling, and present a federated smart grid simulation framework, in which building, control and user behavior modeling and simulation are decoupled from power or network simulators and implemented as discrete components. This framework enables evaluation of the interactions between the communication infrastructure and the power system taking into account the human activities, which are at the focus of emerging energy-related applications that aim to shape user behavior. Validation of the key functionality of the proposed framework is also presented.


Introduction
Any smart city aspires to provide a clean, economic and safe environment in which to live, work and play, and relies on the orchestration of energy, water, transportation, public health, safety and other key services to offer an improved quality of life to its citizens.The importance of the energy infrastructure is high since all other functions will eventually cease, if energy infrastructure becomes unavailable for a significant enough period of time.Apart from the smooth and secure operation of the energy grid, modern cities have to achieve specific targets with respect to energy source mix (increase the use of renewables), the reduction of Greenhouse Gas (GHG) emissions and the improvement in energy efficiency.To achieve these goals, the flexible operation of smart grids (enabled by technology) in combination with innovative smart grid solutions and applications are extensively pursued.Smart energy grids employ intelligent sensing and actuating elements of diverse types to (a) modernize power systems through self-healing designs, automation, remote monitoring and control; (b) inform and educate consumers to enable intelligent decision making; and (c) facilitate the safe, secure and reliable integration of distributed renewable energy resources, and above all, to improve energy efficiency.
Smart grids are complex systems and thus their management and optimization are challenging tasks.To operate their infrastructures efficiently, transmission and distribution network operators use sophisticated management systems including Supervisory Control and Data Acquisition (SCADA), DMS (Distribution Management System), OMS (Outage Management System), DSM (Demand Side Management) and EMS (Energy Management System).Such systems can be used in a stand-alone fashion or, in case they are used for the management of the distribution grid, combined into integrated ADMS (Advanced Distribution Management System) platforms.The ADMS, which at least integrates SCADA, DMS and OMS, provides functionality for system status monitoring, analysis (e.g., load flow calculations, state estimation), operation (e.g., switch management, load shedding, fault management, service restoration), optimization (e.g., Volt-Var control, distribution network reconfiguration, feeder balancing, demand response), planning (e.g., load forecasting, optimal placement of capacitor banks for reactive power compensation) and simulation [1][2][3].
The role of the citizen becomes increasingly dominant in the operation of the smart grid; the citizen is at the same time a sensor (who senses several physical phenomena) and an actuator (regulating the energy system demand).As a "sensor", the user senses his/her environment and energy-relevant parameters either in an objective manner (e.g., when energy consumption or physical parameters like temperature are sensed) or in a subjective manner (e.g., when the experienced comfort is sensed).As an actuator, the user becomes a complex decision making entity affected by a wealth of parameters ranging from environmental consciousness and social norms to direct or indirect rewards and simple monetary motives.In any case, the smart grid that integrates human-activity awareness becomes a complex Cyber-Physical System (CPS) that will be able to monitor, share and manage information and actions on the business, as well as the real world.The basic building blocks that have enabled this approach are the Internet of Things and Internet of Services, which, combined, result in the Internet of Energy, a term lately proposed.While the impact of the actuating role of the citizen may be more evident, the sensing role is of equal importance.Metering data can be collected either from the users or from installed hardware devices.The former comes at almost no cost, given that mobile devices and relevant applications are widespread, while the latter comes at significantly higher cost.As data quality is concerned, user-generated data may be of higher quality especially when considering estimated future user behavior [4].Additionally, the collection of data from the consumers themselves raises their awareness, which leads to behavior transformation.Thus, the evaluation of the user behavior dynamics and their interaction with the smart grid (both its communication part and its power system part) is a complex system to study.
Modern smart energy grids consist of subcomponents that belong to different engineering domains including mechanical, electrical, control and software.Modeling and simulation in these domains often involve different languages and tools; this consequently implies that a framework which aims at supporting accurate simulation (and prediction) of energy consumption, and optimization of energy delivery in such a complex environment should be capable of accommodating heterogeneous modeling and simulation technologies.This approach of hybrid simulation/co-simulation of (a) smart power grids; (b) smart buildings, which are of significant importance for the performance of city distribution grids; and (c) cyber-physical systems in general, has received much attention during the past few years from both industry and the research community.
In this paper, we focus on open simulation tools that can be exploited to study the smart grid operation taking into account the interaction between the user and the system, and to test different algorithms for the control of the building and of the smart grid, exploiting elaborate building energy performance models.Such tools would allow (a) the identification and testing of new schemes for smart grid control and optimization (e.g., new schemes for the efficient support of relevant ADMS functions); (b) the definition of optimal building control algorithms and (c) the definition of appropriate goals that designers of user behavior transformation campaigns should take into account.
To this goal, we first discuss how the user behavior can be modeled so that different user behaviors can be tested.Then we review simulation tools and interconnection infrastructures and principles that can be extended in order to deliver a federated platform in which building, control and user behavior modeling and simulation are decoupled from power or network simulators and implemented as discrete components.Our main contribution is the presentation and validation of the key functionality of such a federated smart grid simulation tool that allows for the development of the components to evolve independently and exploit best domain tools for fast prototyping.
The rest of the paper is organized as follows.In Section 2, we discuss the role of the user, which may change in response to alternative behavior shaping approaches and the potential impact on the smart grid.In Section 3, we review current relevant frameworks for the co-simulation of the power and communication systems, while in Section 4 we present current approaches for building energy modeling and control.Section 5 discusses technical issues relevant to the user modeling.Section 6 presents our approach to smart grid simulation integrating building models, and optimization and control taking into account user behavior impacts.The implementation of key functionality of the proposed framework is reported in Section 7, which also includes validation results.Finally, conclusions and future work are presented in Section 8.

Techno-Human Collective Systems in Smart Grids
User (occupant) behavior is a major determinant of energy consumption in buildings, particularly in the residential sector [5,6].The factors that influence the occupant behavior which are related to the building's energy profile form a wide set [7].These include: (a) user gender, age, experience and may change together with the user, (b) cultural, socio-economical and ethnographical information, (c) external factors and gradual shifts such as oil and gas price adjustments, weather conditions per year, or more sudden shifts due to changes in legislation or the emergence of new energy providers in the market.
Occupant behavior is one of the most significant sources of uncertainty in the prediction of building energy use [8].User behavior modeling is a difficult and complex task since occupant behavior may not be only comfort-driven (e.g., adjusting a thermostat, opening a window for ventilation, turning on lights) but also purpose-driven (e.g., entering/leaving a room, consuming domestic hot water, using an appliance) or even completely stochastic.In any case, it drastically changes the indoor environment conditions in terms of temperature, humidity, illuminance, pollution etc., which influences the overall energy performance of the building [9,10].
The user behavior modeling is continuously gaining attention because in order to improve energy efficiency in smart grids we need to derive a fine-grained building's energy profile chart and identify where energy is wasted and how exactly its energy profile can be improved [11].This will allow smart grid operators to increase efficiency and exploit the increase of the number and types of energy generation sources.To this end, the development of accurate occupants' behavior models is absolutely necessary.Although elaborate metering over large numbers of consumers for an adequate time span would help towards capturing the user behavior at fine levels, the situation is further complicated nowadays because, unlike past decades where the user behavior did not change significantly over consecutive years, this is no longer true.The energy stakeholders, having understood its importance, have targeted the user behavior transformation as a (soft) tool to improve energy efficiency through the reduction of the total energy consumption and the reduction of the peak load values.
The user behavior transformation campaigns designed and launched worldwide introduce new problems: first and foremost their designers use their own tools to simulate and assess the effectiveness of the campaigns they design.These tools come from diverse disciplines including sociology, psychology and marketing to name a few and result in a user behavior description that does not follow any formal model or standard.A second and very important intricacy is that there is interplay between the users sensing and actuating roles.In other words, monitoring the energy consumption and receiving recommendations about potential energy savings, the occupant acts differently and this is a continuous process affected by many parameters.As a result, while in other disciplines, behavioral prediction models can be conceived through literal observation, assuming that the behavior of interest is clearly defined [12], this is not the case for the energy consumption behavior.
Novel techno-human systems are designed towards improving energy efficiency and collective awareness, realizing crowd-sensing to assist demand forecast but primarily towards shaping the user behavior to manage the energy demand.More than ten smart phone applications are currently (February 2015) offered for collecting energy consumption data and realize participatory sensing.The right incentives need to be provided to the crowd so as to draw and retain users to the crowdsourcing system.Credit and reputation-based mechanisms have been proposed in different crowd-sourcing application sectors [13].The consumer behavior and practices are influenced by many factors [14] including direct feedback from devices like smart meters, indirect feedback like elaborate enhanced billing, target setting and rewarding, combination of interventions and community-oriented targets.In UK, focus has been paid to providing tangible awards instantly, making energy efficient behavior the social norm and setting as default the greener options wherever possible (in EMS or other systems), with significant results [15].
There are several complementary influence processes that shape opinion formation in society; these include group (or normative) influence and influence due to formation of stereotypes [16,17].Many theoretical models for opinion formation in networks rely on the informational influence [18,19] to explain how an individual user updates his/her opinion in the face of information learned from his/her neighbors, and characterize the evolution of opinions in the network in terms of convergence time, and the emergence of a consensus or polarization.Yet, all these models have not been sufficiently used before in shaping and formation of the public opinion towards energy efficiency.
Lately, smart grid actors usually adopt the cleanweb approach, i.e., use cleanweb technologies (Internet, social and mobile-based technologies) to solve the problems of sustainability and resource constraints.Cleanweb drives green consciousness, focusing on mass data gathering, processing and targeted distribution to make users think green and not just instructing them to act so.More than 2000 cleanweb start-ups exist in Europe and North America [20], according to Sonny Masero, Cleanweb Initiative Leadership Council member.For example, Opower recently announced that its software platform led its customers into energy saving of 11TWh, which represents over $1.1 billion in bill savings [21].In many cases, cleanweb applications employ modern tools, such as social networks to augment their impact.Indicatively, Opower uses Facebook, while nCube and WeSpire (a company aiming at making impact to people by motivating them towards an arbitrary cause set each time by its customers) use their own social network and leader dashboards in order to foster, among others, user behavior transformation towards energy efficiency.
With respect to energy efficiency improvements that can be achieved through collective efforts, the coalitional game approach has also been proposed [22].Coalitional game theory is used to model situations where the value of the game players increases when they cooperate in order to gain more value, namely when the value of a group of players surpasses the additive value of the players standing as individuals.When this property, known as super-additivity, holds, groups of users sharing common interests emerge, leading to the creation of coalitions of users.After the initial coalition formation is completed, the value of the coalition should be fairly distributed to the users.This idea of binding participants to form some social grouping was exploited on a much larger scale in a series of recent trials on 170,000 domestic energy consumers [23].Two studies in the Sacramento Municipal Utility District of California and the Puget Sound area of Washington state provided feedback to customers on their home electricity and natural gas usage, with the novelty being the focus on peer comparisons.Customers were provided with monthly or quarterly feedback reports, which compared their usage to those of their neighbors in similarly-sized houses and these formed the peer groups.
In larger buildings/establishments, the main tools for shaping the energy consumption are the demand-response (DR) programs and the Energy Management Systems (EMS).The DR programs are becoming increasingly dynamic and countries one-after-the-other adopt this scheme establishing the necessary policy frameworks.The Energy Management Systems are becoming smarter and more dynamic taking into account an ever increasing set of parameters and supporting intelligent energy consumption rules decided and set by their operators.In establishments where intelligent EMSs are absent, applications that allow the building operators to gather data and receive advice are nowadays being designed.

Co-Simulation of Smart Grid
Modeling and simulation is an invaluable tool for power system behavior analysis, energy consumption estimation and future state prediction.Smart grids as complex real-world systems have been traditionally simulated either through integrated or co-simulation tools (see [24] for a review of smart grid simulation tools).Integrated simulators combine components for network and power system simulation into a single tool following a unique modeling paradigm and time synchronization method and a common interface for simulation setup and execution monitoring.An example of an integrated simulator combining MATLAB for the modeling of the distribution grid and OMNeT++ for the modeling of the communication network is presented in [25].The tool is capable of calculating detailed voltage and performing power analysis, and has been used for the assessment of the impact of large PhotoVoltaic panels on voltage levels of the grid connection.
Although the integrated tools usually lead to a more controllable environment avoiding (a) error-prone development of time synchronization mechanisms and (b) inconsistencies stemming from the use of different modeling paradigms, they fail to exploit in full the advanced functionality provided by established tools in the different domains of power and communication system simulation.Furthermore, they do not facilitate reuse of the individual components.Co-simulation, on the other hand, has emerged as a promising approach to simulating complex systems like smart electric grids.In this approach, two or more simulators (typically one power and one network simulator) are combined to realize a smart grid simulation tool.The individual simulators need not comply with the same modeling approach; in this way, both continuous time and discrete event simulators can be supported.This ability to combine heterogeneous simulation tools is particularly important in smart grid simulators where the power system commonly uses a continuous modeling approach (continuous dynamics) while the communication system uses a discrete event simulation modeling approach (discrete dynamics).However, there is a need to provide proper coupling (interfacing) between the different tools for data exchange and address the heterogeneity in the way time advances in the different simulators to provide efficient time synchronization.

Co-Simulator Architecture
A high level view of a typical smart grid simulator is depicted in Figure 1.A power system simulator is responsible for modeling and simulating the power network including the energy generators (both legacy and renewable), the power transmission and distribution network and the end-user loads.Each of these system elements introduces diverse simulation requirements in terms of modeling, time scale and control.This, in turn, makes the accurate simulation of the whole power network a complex process; for this reason, and in the interest of simulating power network phenomena as accurately as possible, most of the existing power simulators focus on parts of the power system.Furthermore, since weather conditions may affect the state of the generators and the loads, it is common for sophisticated power system simulators to also integrate weather data.
A network simulator is used to evaluate the impact of the communication infrastructure on the performance of the applications that are running on top of it.Such a tool can support simulations of several protocols at different layers of the networking protocol stack including data-link, network, transport and application layer protocols.Advanced network simulators include support for several wired and wireless technologies used in Personal Area Networks (PAN), Local Area Networks (LAN), Metropolitan Area Networks (MAN) and Wide Area Networks (WAN).
In the case of smart energy grid, power system and network simulators are combined to provide a tool for the analysis of the interactions between the power and the communication systems.
To support this, smart grid-specific control logic must be embedded in the combined simulation tool.This logic introduces components for wide area monitoring, system optimization and control actions to enforce smart grid optimization decisions.Furthermore, it may also include capabilities for predicting future system states.In Figure 1, the control logic has been separated from the power and network simulators in order to emphasize its prominent role in the smart grid as the main element for decision making.In practice, the functionalities of this block are accommodated in components of the communication or power system simulation tools targeting smart grids.These components include smart meters, actuators and control and optimization applications.
In the remainder of this section, we briefly review existing co-simulation tools for smart energy grids.Emphasis is given on open tools that support distribution network simulations and are, thus, of major interest in simulation studies for energy management in smart cities.

Non-Distributed Approaches
A co-simulation framework (called GECO) is proposed in [26,27].The framework integrates a power system dynamic simulator (PSLF) and a network simulator (ns-2) together using a synchronization mechanism that aims to eliminate accumulating errors due to explicit synchronization points between the different simulators (explicit synchronization was used in the EPOCHS simulator).The power system dynamics were calculated in simulation rounds (using a time-stepped approach), the outcome of which (i.e., the new system state) is considered as an event for the global event scheduler.This scheduler is implemented in ns-2 and combines network and power system events into a global event queue.The tool was used to evaluate the performance of a remote relay backup protection scheme in a power grid based on software agents associated with the individual relays and the smart grid controller.The two types of agents required (slave and master) were implemented in the application layer in ns-2.
The adevs [28] is an integrated power and network simulator that complies with the principles of hybrid modeling and simulation based on Discrete Event System Specification (DEVS) formalism.The simulator integrates (a) discrete event models for the communication subsystem; (b) continuous models of power subsystem dynamics and (c) discrete models for control.The communicationsrelated models were implemented in the ns-2 tool, while the rest of the models (both continuous and discrete) were implemented through the adevs simulation tool which provides a realization of the DEVS technique.The differential-algebraic equations-based models for power generation and transmission implemented with adevs were integrated into ns-2 using an interface that allowed these models to be manipulated as a single discrete event process.The role of simulation controller was undertaken by ns-2.The combined ns-2/adevs tool was employed in a case study for automatic load control and assessed the impact of network latency and throughput on the performance of the loadshedding control scheme.Highly related to this tool is THYME which is a software library for building simulators integrating adevs-based modules for power system dynamics with existing network simulators like ns-2 and OMNET++, and discrete control systems.
A co-simulation platform combining the Open Distribution System Simulator (Opendss) and the In Figure 1, the control logic has been separated from the power and network simulators in order to emphasize its prominent role in the smart grid as the main element for decision making.In practice, the functionalities of this block are accommodated in components of the communication or power system simulation tools targeting smart grids.These components include smart meters, actuators and control and optimization applications.
In the remainder of this section, we briefly review existing co-simulation tools for smart energy grids.Emphasis is given on open tools that support distribution network simulations and are, thus, of major interest in simulation studies for energy management in smart cities.

Non-Distributed Approaches
A co-simulation framework (called GECO) is proposed in [26,27].The framework integrates a power system dynamic simulator (PSLF) and a network simulator (ns-2) together using a synchronization mechanism that aims to eliminate accumulating errors due to explicit synchronization points between the different simulators (explicit synchronization was used in the EPOCHS simulator).The power system dynamics were calculated in simulation rounds (using a time-stepped approach), the outcome of which (i.e., the new system state) is considered as an event for the global event scheduler.This scheduler is implemented in ns-2 and combines network and power system events into a global event queue.The tool was used to evaluate the performance of a remote relay backup protection scheme in a power grid based on software agents associated with the individual relays and the smart grid controller.The two types of agents required (slave and master) were implemented in the application layer in ns-2.
The adevs [28] is an integrated power and network simulator that complies with the principles of hybrid modeling and simulation based on Discrete Event System Specification (DEVS) formalism.The simulator integrates (a) discrete event models for the communication subsystem; (b) continuous models of power subsystem dynamics and (c) discrete models for control.The communications-related models were implemented in the ns-2 tool, while the rest of the models (both continuous and discrete) were implemented through the adevs simulation tool which provides a realization of the DEVS technique.The differential-algebraic equations-based models for power generation and transmission implemented with adevs were integrated into ns-2 using an interface that allowed these models to be manipulated as a single discrete event process.The role of simulation controller was undertaken by ns-2.The combined ns-2/adevs tool was employed in a case study for automatic load control and assessed the impact of network latency and throughput on the performance of the load-shedding control scheme.Highly related to this tool is THYME which is a software library for building simulators integrating adevs-based modules for power system dynamics with existing network simulators like ns-2 and OMNET++, and discrete control systems.
A co-simulation platform combining the Open Distribution System Simulator (Opendss) and the ns-2 network simulator is introduced in [29].Execution of the individual simulators takes place in a sequential fashion and data exchange between them is accomplished through the use of script files.The OpenDSS tool simulates discrete events and supports steady-state analysis of power distribution systems and distributed renewable generation systems.The combined simulator was used to assess a control scheme that activates distributed storage batteries in a segment of the distribution network to compensate for the temporary loss of power from a large photovoltaic solar source (such loss could, for example, be due to "cloud transient" or "solar ramping" phenomenon).The results evaluated the impact of the communication delay between the meter that monitors the output of the solar PV array and the storage controller that dispatches storage units.
In contrast to previous simulators that are domain-specific, simulation of smart energy grids can be supported by multi-domain modeling and simulation solutions.In the area of multi-domain modeling, the Modelica language has received great attention in the past few years because of its ability to offer an extensive set of standard libraries for physical modeling and accurately model phenomena with continuous dynamics like those found in power systems.Modelica initially included support for steady-state and detailed transient modeling of power systems through the Spot library and currently through the PowerSystems library [30].The library includes models for different elements of a power system including power generation, transmission lines, loads, transformers, capacitor banks etc. [31].
A power simulator modeled with Modelica can be combined with a communication network simulator to evaluate the performance of networked control algorithms with stringent timing requirements in smart grids.In this context, [32], proposes a smart grid simulator composed of ns-2 (for network simulation) and Modelica (for energy and control system simulation).To avoid synchronization complications, the design choice was to let ns-2 be the simulation time master and Modelica be executed upon requests sent by the ns-2.The implication of this choice is that while network events can be handled on time, events inside Modelica cannot be propagated to ns-2.

Distributed or Federated Approaches
In the domain of distributed or federated smart grid simulation, GridSpice [33] is a cloud-based simulation framework integrating the Gridlab-D tool for power generation and distribution simulation and MATPOWER (a Matlab-based software) for optimal power flow simulation.The tool does not combine any specialized network simulator but instead relies on the abstract network modeling provided by GridLAB-D.The distinctive characteristic of GridSpice is that the simulations run on a dynamically sized cluster consisting of worker nodes running parts of the simulation (simulation subtasks) and a master node responsible for the creation of the simulation and the synchronization between its subtasks.For each new simulation, a supervisor process implemented in RePast Simphony is initiated; the aim of the supervisor is to (a) schedule new subtasks (which are subsequently allocated to available worker nodes); (b) maintain a global simulation clock; and (c) synchronize the boundary states between subtasks.GridSpice is an example of a multi-agent system; the supervisor is an agent-based discrete event simulator in which each sub-simulation task (either for distribution, generation or market) is an agent.The tool can be used for studies like optimizing the placement of distributed generation and developing optimal dispatch schedules for flexible loads.
The EPOCHS simulator [34] federates the ns-2 network simulator with two power simulators (PSLF for electromechanical transient simulation and PSCAD/EMTDC for electromagnetic transient simulation) and an agent subsystem allowing users to investigate the performance of smart grid control algorithms in complex scenarios.The simulator follows the time-stepped model using fixed synchronization points and the different subsystems (power, network and agent-based control) are integrated through an RTI middleware.The motivation behind the development of EPOCHS was that as the communication and power systems were getting more tightly coupled, there was a need to test new protection and control schemes that could exploit in full the new communication facilities.These emerging schemes were drastically different from traditional protection systems that based their decisions on local measurements and conventional control systems that operated over slow communication systems of predictable performance.The RTI followed the spirit of HLA as a framework for federating simulators but used custom interface for easier implementation.A representative case study included the assessment of the performance of a backup relay system in the presence of faults causing line disruptions.
The Virtual Grid Integration Laboratory (VirGIL) [35] is a modular co-simulation framework that relies on the Functional Mockup Interface (FMI) [36] to integrate a commercial power system simulator (DIgSILENT's Powerfactory), a network simulator (OMNeT++), whole-building models (simplified models derived from EnergyPlus [37] and expressed with Modelica) and a component for optimization and control.The FMI is an open standard that supports model exchange between tools that may use different underlying semantics (e.g., discrete state machines and differential algebraic equations) and co-simulation of dynamic models.In VirGIL, the different components are exported as Functional Mockup Units (FMU) (as either FMU for co-simulation or FMU for Model Exchange) and the coordination of their execution as well as the data exchange are addressed by the Ptolemy II simulation tool that supports the analysis and the design of heterogeneous systems.VirGIL was used to (a) assess a simple demand response algorithm to reduce the power consumption of a building by adjusting HVAC system operation parameters, and (b) implement Volt-Var control by adjusting the reactive power infeed of a battery connected to the building under test.
The FNCS platform [38] uses a federated approach for integrating a power distribution simulator (GridLAB-D), a transmission simulator developed by Pacific Northwest National Laboratory (PowerFlow) and a network simulator (NS-3).FNCS supports federation by introducing a number of components running within the individual simulators and a component (FNCS broker) running in a separate process.The components integrated within the simulators include an inter-simulation communicator that handles the communication between the broker and the simulator, a communication management component allowing nodes inside the simulators to send and receive messages from other simulators and a time management component (incorporating a number of synchronization strategies with different resource usage and performance characteristics) that provides the interfaces for time synchronization between the simulators.An application component is integrated in the network simulator to realize application layer agents.The broker handles the delivery of the messages between the simulators.With respect to this, FNCS follows the publish/subscribe scheme of HLA and implements it using ZeroMQ.

Discussion
There are a number of remarks that can be made based on the review of the representative smart grid simulation tools that was just presented:

‚
There is an increasing need to support simulation fidelity and scalability, which has triggered significant research efforts towards distributed or federated smart grid simulation platforms.

‚
There are different approaches regarding the integration of the control logic into the simulation components.In most of the approaches the control logic is integrated either inside the power simulator (e.g., in Opendss, the simulator proposed in [32], FNCS and GridSpice) or inside the network simulator (e.g., in GECO).In the adevs simulator and VirGIL, on the other hand, the control logic can be decoupled from the power and the network simulator and implemented in separate components.Furthermore, FNCS and VirGIL support integration of detailed building simulators in a federated fashion.

‚
There is an emerging use of the multi-domain Modelica modeling language for power system simulations (e.g., in [31,32]).The language can be also used for the modeling of buildings and of control systems.This has the potential to reduce development times and result in fast prototyping.

‚
There is a strong interest to integrate FMI-compliant modules into smart grid simulators.A notable relevant example is VirGIL in which all simulation components interface with the master algorithm through the FMI interface (the master algorithm supported by Ptolemy II orchestrates the execution of the individual components).In addition, adevs supports FMI extensions.

Building Energy Management Simulation
The combined tools presented above focus on the modeling and simulation of the distribution smart grid.In this regard, efficient modeling of end-user loads as well as of distributed power sources is essential for the accuracy of the simulation results.However, since the detailed modeling of every aspect of the distribution system incurs great complications to the distribution system simulators, most of these tools include less abstracted models for loads and distributed generators either at the individual or aggregate scales.
Buildings (residential, commercial or industrial) represent a major electricity consumer in modern cities (e.g., in U.S. buildings represent the 40% of the primary energy consumption).These buildings have different types of loads; however, typically, they all include lighting, ventilation, heating and cooling loads, which may be controlled by a building management system.Furthermore, nowadays, buildings may accommodate distributed energy generators like small wind turbines, photovoltaic panels and batteries, and include modern loads like electric vehicles.Realistic models for these loads and generators may be found in power simulators, with GridLAB-D being a notable example [39].In this regard, GridLAB-D includes building thermal response and thermostat control models, appliance models, battery storage models and vehicle charging system models, as well as models for distributed generation resources such as diesel backup generators, microturbines and photovoltaics.However, power simulators lack inevitably the sophisticated and detailed building energy models that can be found in dedicated building simulators such as the open-source EnergyPlus and the commercial TRNSYS.
EnergyPlus [37] is a whole-building energy analysis and thermal load simulation program.The tool includes sophisticated models for buildings, envelopes, and electromechanical systems and is capable of calculating energy consumption for heating, cooling, ventilation, lighting and user-defined loads.EnergyPlus comes with many features including heat balance-based zone simulation, combined heat and mass transfer model for multizone air flow, advanced fenestration models, a variety of built-in HVAC and lighting control strategies, active solar models for simulating photovoltaic systems and support for importing weather data.It also supports FMI import and export for co-simulation with other simulation engines.
Apart from domain-specific tools, building energy modeling and simulation can also be accomplished by Modelica.To illustrate the feasibility of such an approach, in [40] a simple building energy and control system model is decomposed into smaller components belonging to different types of physical domains (building, electrical, environment, energy market), each one of those is modelled with Modelica.The complete model of energy consumption of a building is then simulated using the Modelica simulation environment Dymola.A similar model has been also used in [41] and was used to compare the performance of event-based simulation with a domain-specific tool (GridLAB-D) and continuous-time simulation with Modelica.The results showed that while Modelica can support fast prototyping its scalability is inferior to that of GridLAB-D.
Detailed building energy modeling and simulation is facilitated by combining different simulation tools with each one focusing on particular aspects of the whole system model.In this regard, a significant approach (albeit not a standardized one) to interface different simulation tools with each other is the Building Controls Virtual Test Bed (BCVTB).This open-source software environment supports both co-simulation and real-time simulation, in which the simulation time is synchronized to the wall clock time and the simulator may be coupled to hardware.The BCVTB framework is based on the Ptolemy II heterogeneous simulation platform used as middleware.Simulators that can be integrated in BCVTB include EnergyPlus, Dymola (Modelica modeling and simulation environment), MATLAB and Simulink, Radiance (ray-tracing software for lighting analysis), ESP-r (integrated building energy modeling program) and TRNSYS.
Building simulators can be also combined with network simulation tools to provide more realistic simulations taking into account the characteristics of the communication link (usually wireless in a home area network) and the load of the network interconnecting sensors (e.g., temperature sensors in an HVAC simulation scenario) and actuators (HVAC thermostat controller).An example of such a combined simulator is presented in [42] where the system relies on the FMI to support a co-simulation scenario involving a TinyOS emulator and the Modelica simulation tool for evaluating the impact of a wireless sensor and actuator network (simulated in TinyOS) on the performance of a hydronic heating system (simulated in Modelica).HybridSim also stresses the need for a unified framework based on the SysML modeling language that would allow systems engineers (naturally familiar with SysML) to integrate the outputs of different domain engineering groups for the design of overall systems in an efficient and convenient manner.Such a framework allows the integration of discrete-event simulation of the SysML statechart model (a popular formalism for specifying behavior in SysML) with the continuous dynamics described in Modelica and provides a capability that is significantly greater than that provided by SysML or Modelica individually.

User-Behavior Modeling
In the first attempts to take the user behavior into account in calculating the energy performance of a building, as well as of the power system, the research community turned its attention to discrete event simulation models (DES).DES models represent a system based on a series of chronological sequences of events where each event changes the system's state in discrete time.Such models had been already used in other disciplines or for other purposes such as network simulations, where the state transition of the system and the sequence of actions were defined deterministically.Later on, another type of simulation tool appeared: agent-based simulation (ABS) models comprise a number of autonomous, responsive and interactive agents which cooperate, coordinate and negotiate among one another to achieve their objectives.Discrete Event Simulation (DES) and Agent Based Simulation (ABS) were compared with respect to the applicability of these methods to modeling human centric service systems [43].The conclusion of this work was that combining DES/ABS for modeling human reactive behavior leads to the best results for general application domains.
Focusing on energy systems performance, an agent-based modeling approach was proposed in 2013 that helps to both predict real-world occupant behaviors observed in an operating building and to calculate behavior impact on energy use and occupant comfort at the aid of an energy simulator [44].
It is shown that uncertainties of occupant behaviors can be accounted for and simulated, lending the potential to augment existing simulation methods.Observing that in real-world buildings, occupant behaviors are closely correlated to an individual's comfort level, it is obvious that if the real-time changing conditions are not taken into account such as the zone air temperature, outside air temperature, humidity, air speed, and relevant climatic influences, the energy performance of the building lacks accuracy.This mandates the coupling of any user behavior simulation tool with the building energy and condition simulation tool.Although the results of this work have been validated through real-life data, they do have limitations: they cannot be easily adjusted to new sites by means of simple parameter tweaking (site-type, location, climate, etc.) and they do not incorporate the normative beliefs.Other efforts to combine user behavior modeling with energy modeling include for example, the work in [45], where the energy system is modeled using the TIMES (The Integrated MARKAL-EFOM) System which is a successor of MARKAL framework model, developed by the International Energy Agency under the auspices of the Energy Technology Systems Analysis Program (IEA-ETSAP).Virtual technologies have been introduced, in order to model the consumers' investment and the habitual behavior.More specifically, the Information Campaign Habitual Behavior Change, and the Information Campaign Investment Behavior Change models were used.However, this work aims at long term evaluation of the power system and not the optimization of the power grid into small time scales.Additionally, its granularity comes down to the community and not the building level.
Focusing on the importance and impact of occupant behavior in building energy performance, Yan et al. have performed a thorough survey and concluded that there are many gaps in knowledge and limitations to current methodologies.In [46], they explore a four-step iterative process: (1) occupant monitoring and data collection; (2) model development; (3) model evaluation; and (4) model implementation into building simulation tools.They claim that a major theme in user modeling is to develop an efficient means to implement occupant behavior models and integrate them into building energy modeling programs.Furthermore, Sun et al. have developed a stochastic model of overtime occupancy [47].In this work, they prove that, as in the US 11.5% of the workforce worked overtime for an average of 9 hours per week, appropriately modeling this behavior becomes very important.
From the perspective of international organization, recently, the International Energy Agency has launched the EBC (Energy in Building and Communities) program which, in its Annex 66, is focusing on the "Definition and simulation of occupant behavior in building".The rationale behind this move was that smart grid stakeholders need more elaborate tools to assess alternative Demand-Response programs operating in different regulatory and societal environments and time scales, while currently available frameworks (e.g., [48]) provide only partial answers.EBC anticipates to overcome the current obstacles (inconsistency, complexity, lack of consensus in common language for description, and great discrepancies in behavior) and aims to define and simulate occupant behavior in a consistent and common way considering that international cooperation is extremely important for both knowledge discovery and data sharing.
To sum up, a flexible user behavior model, which (a) will be applicable for Energy Efficiency validation in residential buildings; (b) will evolve over time as users evolve (age, habits, family, socio-economic characteristics); and (c) can be fine-tuned based on collected data, is necessary for proper decisions making by the interested parties.Once the researchers agree on the user behavior model and parameters, the results of user behavior simulation could be injected in the tools simulating the energy and communication part of the smart grid to obtain a more realistic view.

Proposed System
Simulating power consumption at the city level is a challenging (if not infeasible) task mainly because of the stochastic usage profiles of a vast number of loads.Since simulation of a city smart distribution grid is a valuable tool to explore ways to optimize energy usage and predict future consumption, it is common for such simulation studies to consider only certain types of responsive loads with a relatively good margin for energy cost savings.As this is the case with buildings, many simulation studies for energy consumption in cities consider primarily building consumption; they often include further simplifications and abstractions for loads and usage patterns to make the simulation tractable.Agent-based modeling and simulation is a convenient tool in such studies because the whole system can be represented by a set of interacting agents (linked to energy devices) with autonomous behaviors [49,50].
Shrinking the size of the simulated power distribution system, e.g., by addressing groups of buildings, campuses, or city districts and quarters, allows for more accurate simulations and provides better insight into the system behavior and dynamics.Recalling that each of the power, communication and building simulation tools addresses diverse needs and provides unique advantages, a co-simulation framework for a reduced-scale city smart distribution grid seems to be the natural choice.In this section, we present the framework's components, discuss federation technologies leveraging standardized solutions and comment on the type of studies that can be supported on this framework.

Framework Architecture
The architecture of the proposed framework for modeling and simulation of city smart grid is illustrated in Figure 2. The framework combines a power system simulator (GridLAB-D), a communication network simulator (NS-3), which can also simulate wireless sensor and actuator networks, and FMI-based components for modeling and simulation of (a) smart buildings, HVAC and BMS; (b) grid optimization and control functions; and (c) end-user behavior and profile evolution.The system involves modeling and simulation in different domains including mechanical, electrical, control and software engineering.Modeling and simulation in these domains often involve tools and models that are expressed in different languages and formats.
communication network simulator (NS-3), which can also simulate wireless sensor and actuator networks, and FMI-based components for modeling and simulation of (a) smart buildings, HVAC and BMS; (b) grid optimization and control functions; and (c) end-user behavior and profile evolution.The system involves modeling and simulation in different domains including mechanical, electrical, control and software engineering.Modeling and simulation in these domains often involve tools and models that are expressed in different languages and formats.The GridLAB-D is an open-source power simulator for the distribution network.It is a discrete-event, agent-based simulation tool that can support a number of simulation functions including power flow and control, also with support for distributed generation and support, distribution automation and load-shedding.The tool includes models for end-use appliances and consumer behavior, and features a flexible simulation core that can determine the state of a large number of independent devices and can, thus, support large-scale simulations.NS-3 is an open-source discrete event communication system simulator, with a large number of protocols for the data-link, network and transport layers of the TCP/IP protocol suite; the tool also supports a number of traffic profiles and application-layer protocols.
The combination of GridLAB-D and NS-3 can provide a smart grid simulator suitable for a large number studies and analyses; however, there are parts of the system which, depending on the simulation study, may need to be modeled in a more detailed way or be prototyped in an easier, faster and more user-controllable manner.Major system components with such requirements include the building, the grid optimization and control, and the user energy profiling and profile evolution components.Relying on an approach that decouples building and BMS modeling from the power  The GridLAB-D is an open-source power simulator for the distribution network.It is a discrete-event, agent-based simulation tool that can support a number of simulation functions including power flow and control, also with support for distributed generation and support, distribution automation and load-shedding.The tool includes models for end-use appliances and consumer behavior, and features a flexible simulation core that can determine the state of a large number of independent devices and can, thus, support large-scale simulations.NS-3 is an open-source discrete event communication system simulator, with a large number of protocols for the data-link, network and transport layers of the TCP/IP protocol suite; the tool also supports a number of traffic profiles and application-layer protocols.
The combination of GridLAB-D and NS-3 can provide a smart grid simulator suitable for a large number studies and analyses; however, there are parts of the system which, depending on the simulation study, may need to be modeled in a more detailed way or be prototyped in an easier, faster and more user-controllable manner.Major system components with such requirements include the building, the grid optimization and control, and the user energy profiling and profile evolution components.Relying on an approach that decouples building and BMS modeling from the power system simulator, allows for both the incorporation of available detailed models provided by dedicated tools (like EnergyPlus) and the fast prototyping of new models with the desired level of detail determined by the modeler.In this context, there is on-going effort to link the EnergyPlus simulator in a platform (realized via the FNCS infrastructure) that already combines GridLAB-D and NS-3.On the other hand, VirGil addresses the second possibility and considers Modelica-based building models; these models can be derived from relevant EnergyPlus components after a series of simplifications and model order reductions.This provides for a more controllable modeling based on the specific requirements in terms of simulation fidelity and scalability.In any case, the approach of decoupling building modeling and simulation from the rest of the smart grid simulation system increases the modularity of the system, allows the control of the system complexity and eases fast prototyping and experimentation.
The same arguments also hold for the decoupling of the optimization and control, and user behavior modeling from the smart grid simulator.Regarding the former, implementing grid optimization and control in Modelica or some other FMI-compliant tool allows for the exploitation of available, efficient solvers for differential equations which may not be found in power simulators.Such facilities are essential for optimization problems like grid Optimal Power Flow (OPF).In the presented framework the incorporation of a separate optimization and control component can, on one hand, provide capabilities that are currently missing from GridLAB-D (e.g., to address the OPF problem, GridLAB-D is commonly combined with MATLAB-based tools) and on the other hand, to allow the modeler select the tool used for the development of (possibly) hierarchical and distributed control techniques.Regarding user behavior modeling, the decoupling of this component from the modeling paradigm of the power and the network simulators allows modelling following best domain practices and tools (e.g., dedicated tools for agent-based modeling and simulation can be used).

Interconnection of Framework Components
For the interconnection of the different components, the presented framework relies on the functionality provided by HLA.The HLA is a co-simulation standard for distributed computer simulation systems, in which federates (independent implementations of system components) communicate through a Run Time Infrastructure (RTI) providing the services for time synchronization and data exchange among federates.The HLA federates can be located in different platforms or hosted in the same machine; the former allows for scalable simulations of large systems and exploitation of grid or cloud computing facilities.Concepts from the HLA RTI (e.g., the publish/subscribe communication paradigm) have already been used in a number of smart grid simulation frameworks like EPOCHS, FNCS and GridSpice (see Section 3.3).
In the presented framework, the building, optimization and control, and user behavior modeling components are attached to the interconnection infrastructure through the use of the FMI and its interfacing with the HLA.The FMI represents a major development in the area of integrated modeling and co-simulation, and supports model exchange and co-simulation of dynamic models supported by functions for the time synchronization of the different subsystems.The FMI implementation by a simulation tool enables the exporting of its models as an FMU (Functional Mock-up Unit), which primarily includes the model description and a set of shared libraries for the model implementation.Several FMUs can be coupled and executed within a co-simulation environment.
The execution of the FMUs requires a simulation master.In the framework of Figure 2, the HLA RTI serves the role of the simulation master for the whole system including the FMUs.The suitability of this approach has been presented in [51,52] and has been also used in [53].In a different direction, Ptolemy II has been used as the simulation master in the VirGIL distributed co-simulation platform (see Section 3.3); in that platform, all components are implemented as FMUs.
In Figure 2, user behavior and behavior evolution (shaping) modeling has been addressed in a separate component in order to emphasize the importance of assessing the impact of user behavior on the operation of the smart grid.

Validation of Key System Functionality
A major characteristic of the framework presented in Section 6 is that part of the functionality of the power simulator can be implemented in a number of FMUs which can subsequently be integrated with the power and network simulators through an efficient interconnection infrastructure.In this regard, federating a simulator with no FMI support and a simulation component implemented as an FMU becomes a key integration requirement.In this section, we present the implementation and integration of a simulation testbed that realizes this essential requirement and can be used as the basis for the developments needed to implement the framework illustrated in Figure 2.

Component Implementation and Integration
The architecture of the testbed that has been used to validate the key system functionality is depicted in Figure 3.This testbed federates the GridLAB-D power simulator and a custom FMU component implementing a simple algorithm to control the load injected to the power system (more details on the control system will be given in Section 7.2).The two simulators are interconnected through the co-simulation controller that is currently used in the FNCS simulation framework (FNCS broker [38]).This controller, which is implemented using the zeroMQ library for distributed messaging, allows the different simulators to communicate in a publish/subscribe fashion and controls the advancement of the global simulation time.
broker [38]).This controller, which is implemented using the zeroMQ library for distributed messaging, allows the different simulators to communicate in a publish/subscribe fashion and controls the advancement of the global simulation time.Each simulator communicates with the co-simulation controller through a co-simulation communication manager (also implemented using zeroMQ).This component is responsible for registering the federate to the broker, communicating time advancements requests and receiving indications about the granted time advance.The implementation of the communication manager was based on a skeleton C++ code provided by FNCS to implement the interface towards the broker.This code was suitably enhanced to implement the interfaces towards the execution controllers.
The role of the execution controller is to (a) manage the initialization and termination of the simulator; (b) update simulator parameters, request simulation execution according to the time granted, and retrieve simulation data; and (c) calculate the requested time advancement.On the power simulator side, the implementation of the execution controller exploits the capability of GridLAB-D to operate in a mode where the simulation execution can be controlled by an external module (GridLAB-D's server mode).In this mode, a module (like the execution controller of Figure 3 Each simulator communicates with the co-simulation controller through a co-simulation communication manager (also implemented using zeroMQ).This component is responsible for registering the federate to the broker, communicating time advancements requests and receiving indications about the granted time advance.The implementation of the communication manager was based on a skeleton C++ code provided by FNCS to implement the interface towards the broker.This code was suitably enhanced to implement the interfaces towards the execution controllers.
The role of the execution controller is to (a) manage the initialization and termination of the simulator; (b) update simulator parameters, request simulation execution according to the time granted, and retrieve simulation data; and (c) calculate the requested time advancement.On the power simulator side, the implementation of the execution controller exploits the capability of GridLAB-D to operate in a mode where the simulation execution can be controlled by an external module (GridLAB-D's server mode).In this mode, a module (like the execution controller of Figure 3) can instruct the simulator, through HTTP requests, to (a) pause at a specific time instance; (b) accept new values for simulator parameters; (c) provide results for global variables and object properties (in an XML structure); and (d) resume operation up to a specified pause point.The execution controller was written in Python, which provides constructs for versatile parsing of XML files.
On the control simulator side, both the execution controller and the FMU were implemented in C. The FMU realizes the control logic and interacts with the execution controller through an interface complying with the FMI for co-simulation v2.0 specification.The import of the FMU was facilitated by the FMI Library 2.0 software [54].All software components needed to realize the testbed of Figure 3 were executed on Debian GNU/Linux 8.2.

Simulation Execution Flow and Results
The scenario that was used to validate the interconnection of testbed components involved the control of the average power demand of 100 consumers.Each consumer, represented by a house object in GridLAB-D, features an electrical resistance heating element that is used to maintain the indoor temperature within the limits set by the heating system thermostat.The scenario assumes that control needs to be exercised over the aggregate power demand and that this control is implemented by reducing the thermostat set point.
For validation purposes we have implemented a simple control scheme which operates as follows: instantaneous aggregate power values for all consumers simulated in GridLAB-D are communicated every 5 min to the controller implemented as an FMU.The controller calculates an exponential weighted moving average of the aggregate power demand and requests a reduction of the thermostat set point if this average is above a predefined threshold.
The interactions between the testbed components for the realization of this scenario are shown in Figure 4.At the beginning of the simulation, the communication controllers register the simulators with the federation controller (using FNCS messages) and request simulator process initialization.After initialization, the GridLAB-D simulator pauses at the simulation start time.The FMU import and initialization undertaken by the execution controller of the control system simulator involves operations like unzipping of the FMU, loading of shared object files, parsing of XML model description files, instantiation of the FMU and setting of initial values for the FMU parameters.
The time synchronization of the execution of the simulators is achieved through a time-stepped approach in which the control system simulator determines the simulation step.In this regard, this simulator always requests a time advancement of 5 min while the power system simulator requests an advancement of a very large duration (denoted as "infinity" in Figure 4).Time advancement requests are realized through specific FNCS messages.Based on these requests, the FNCS broker calculates the time advancement that will be granted to the simulators and sends this value to the communication controllers.From this point on, the execution of the simulators takes place in a sequential manner.
The GridLAB-D simulator is executed first and simulates up to the time granted.By querying GridLAB-D, the execution controller retrieves the new value for the instantaneous power load of each house (using the XML structure depicted in Figure 5), forms an aggregation and communicates it to the control system simulator.Upon receiving the aggregated power value together with the granted simulation time, the execution controller of this simulator interacts with the FMU for the execution of the time step.This interaction consists of an FMISetReal operation to pass the value of the aggregate load to the FMU, an FMIDoStep call to instruct the FMU to execute the simulation and an FMIGetReal operation to retrieve the new thermostat set point calculated by the control algorithm.This value is propagated to the execution controller of the power simulator, which, in turn, interacts with GridLAB-D to update the heating set point of each house.At the power simulator side, the communication manager and the execution controller exchange data through shared files, while at the control simulator side the corresponding modules communicate using a UDP socket.The interactions between the testbed components for the realization of this scenario are shown in Figure 4.At the beginning of the simulation, the communication controllers register the simulators with the federation controller (using FNCS messages) and request simulator process initialization.After initialization, the GridLAB-D simulator pauses at the simulation start time.The FMU import and initialization undertaken by the execution controller of the control system simulator involves operations like unzipping of the FMU, loading of shared object files, parsing of XML model description files, instantiation of the FMU and setting of initial values for the FMU parameters.
The time synchronization of the execution of the simulators is achieved through a time-stepped approach in which the control system simulator determines the simulation step.In this regard, this The scenario just described was simulated in order to validate the testbed functionality (and not to evaluate the control algorithm).Regarding the simulation parameters, each one of the 100 house objects has a heater with power consumption of 5.38 kW, a thermostat with a dead-band of 5 ˝F and an initial set point of 70 ˝F, and a random floor area (sample of the uniform distribution in [1500,2500] ft 2 ).No other power load was included and all other house parameters were left at their default values in GridLAB-D.The outdoor temperature was set to 35 ˝F and the power threshold for the control algorithm was fixed at 200 kW.In the calculation of the exponential moving average for the power demand the previous value contributes with a weight of 0.9, while the current value contributes with a weight of 0.1 (smoothing was used in order to absorb rapid fluctuations of power load).
aggregate load to the FMU, an FMIDoStep call to instruct the FMU to execute the simulation and an FMIGetReal operation to retrieve the new thermostat set point calculated by the control algorithm.This value is propagated to the execution controller of the power simulator, which, in turn, interacts with GridLAB-D to update the heating set point of each house.At the power simulator side, the communication manager and the execution controller exchange data through shared files, while at the control simulator side the corresponding modules communicate using a UDP socket.The scenario just described was simulated in order to validate the testbed functionality (and not to evaluate the control algorithm).Regarding the simulation parameters, each one of the 100 house objects has a heater with power consumption of 5.38 kW, a thermostat with a dead-band of 5 °F and an initial set point of 70 °F, and a random floor area (sample of the uniform distribution in [1500,2500] ft 2 ).No other power load was included and all other house parameters were left at their default values in GridLAB-D.The outdoor temperature was set to 35 °F and the power threshold for the control algorithm was fixed at 200 kW.In the calculation of the exponential moving average for the power demand the previous value contributes with a weight of 0.9, while the current value contributes with a weight of 0.1 (smoothing was used in order to absorb rapid fluctuations of power load).
The aggregate power demand and the average house air temperature for a simulation time of one day are illustrated in Figures 6 and 7, respectively (the staircase-like line in the latter figure corresponds to the thermostat set point).The results (obtained from GridLAB-D every 10 s) show that as long as the moving average power value is below threshold, the thermostat remains at its initial set point and the evolution of power demand and temperature is identical for both cases (i.e., with and without power control).At about 3.5 h after the simulation start time, the power average exceeds the threshold and the thermostat set point rapidly decreases by 3 °F.This results in a situation where the heaters are turned off for more than 0.5 h (this happens because the houses' temperature are above the new thermostat set point).The aggregate power demand and the average house air temperature for a simulation time of one day are illustrated in Figures 6 and 7, respectively (the staircase-like line in the latter figure corresponds to the thermostat set point).The results (obtained from GridLAB-D every 10 s) show that as long as the moving average power value is below threshold, the thermostat remains at its initial set point and the evolution of power demand and temperature is identical for both cases (i.e., with and without power control).At about 3.5 h after the simulation start time, the power average exceeds the threshold and the thermostat set point rapidly decreases by 3 ˝F.This results in a situation where the heaters are turned off for more than 0.5 h (this happens because the houses' temperature are above the new thermostat set point).
When the house temperature reaches the set point of the thermostat the power demand increases up to approximately 438 kW (in this case 80% of the heaters are simultaneously on).The fluctuations of the aggregate power (and of the average temperature) start decreasing only after the thermostat reaches its final set point of 61 ˝F.With this temperature setting, the results show that the average power demand has been reduced from approximately 230 kW to 170 kW (this means that this simple control algorithm reduces aggressively the thermostat set point).
The above observations on the behavior of the system verify that the two simulators operate in a coordinated fashion and that the output of the power simulator is coherent with the decisions of the control algorithm.In this way, the simulation study serves for the validation of the key functionality of the proposed framework.When the house temperature reaches the set point of the thermostat the power demand increases up to approximately 438 kW (in this case 80% of the heaters are simultaneously on).The fluctuations of the aggregate power (and of the average temperature) start decreasing only after the thermostat reaches its final set point of 61 °F.With this temperature setting, the results show that the average power demand has been reduced from approximately 230 kW to 170 kW (this means that this simple control algorithm reduces aggressively the thermostat set point).
The above observations on the behavior of the system verify that the two simulators operate in a coordinated fashion and that the output of the power simulator is coherent with the decisions of the control algorithm.In this way, the simulation study serves for the validation of the key functionality of the proposed framework.

Conclusions and Future Work
The need to evaluate new techniques and control algorithms for the optimization of the smart energy grid operation dictates the design of efficient and modular smart grid simulation tools that can allow for (a) the fast prototyping of user behavior models and human interactions; (b) easy

Conclusions and Future Work
The need to evaluate new techniques and control algorithms for the optimization of the smart energy grid operation dictates the design of efficient and modular smart grid simulation tools that can allow for (a) the fast prototyping of user behavior models and human interactions; (b) easy integration of elaborate building models and (c) implementation of alternative control strategies.Towards this goal, in this paper we first reviewed applications that drive green consciousness and cause user behavior transformation and discussed major existing platforms for smart grid and building simulation.This investigation has shown that there are a large number of energy-related applications that aim to shape user behavior and the relevant market is growing fast.As the impact of user behavior on the energy consumption is significant, there is a need to convert experimental findings into useful simulation models which can, in turn, be used in smart grid simulators to predict future system behavior.In the simulation domain, there exist several tools with enhanced functionality for the co-simulation of the power and the communication systems.To satisfy the requirements for smart grid performance analysis, we then proceeded to propose a framework for the co-simulation of the power system, the communication network and components for modeling and simulation of control and optimization schemes, building energy systems and user behavior.The rationale behind our proposal is that decoupling optimization and control, user behavior and building energy modeling from generic power and communication network simulators has the potential to reduce development times (due to exploitation of domain-specific best practices and tools) and, thus, deserves further elaboration.A major characteristic of the proposed framework is that part of the functionality of the power simulator can be implemented in a number of FMUs, which can subsequently be integrated with the power and network simulators.Regarding the interconnection of different simulation system components, the combination of HLA and FMI can provide standard-based solutions for distributed simulation of both discrete-and continuous-time models.We implemented the key functionality of the proposed framework and we presented the first results of the validation process.In our future work, we anticipate thoroughly assessing the benefits brought by the proposed framework and provide further results based on the complete functionality of the platform.
A final remark is due on how smart grid cyber security studies can be supported in simulation environments.Security for smart grids has been extensively addressed in the literature (see e.g., [55,56]); different types of cyber-attacks (targeting at compromising devices, data, privacy and network availability) have been identified and protection techniques based on access control, authentication, privacy preservation and intrusion detection have been proposed.Regarding the evaluation of security aspects through simulation-based platforms, there are two lines of research, both of which have primarily evolved from relevant developments that assess the security of SCADA or more generic cyber-physical systems.The first consists of approaches that combine network simulation and attack modeling in order to evaluate the impact of data and network availability attacks on the operation of smart grid [57][58][59].The second has to do with testbeds that incorporate simulation, emulation and hardware-in-the-loop components with the aim to provide a more realistic environment for experimentation and assess the vulnerabilities of real implementations of protocols and software components running on smart grid nodes [60][61][62][63][64]. Compared to simulation platforms, such experimental testbeds are capable of supporting a wider range of security-related studies (e.g., studies that assess the impact of security attacks against devices and real implementations of the protection mechanisms or evaluate the performance of data filtering and system state estimator algorithms in the presence of faulty data); however, their development is far more costly and time consuming.In this respect, complementing advanced smart grid simulation tools (like those discussed in the paper) with simulation and emulation functionality that can be used for accurately predicting the behavior of the system under realistically modeled cyber-attacks, represents an important research challenge.

Figure 1 .
Figure 1.High level view of a typical smart grid co-simulator.

Figure 1 .
Figure 1.High level view of a typical smart grid co-simulator.

Figure 3 .
Figure 3. Simulation testbed for the validation of key system functionality.

Figure 3 .
Figure 3. Simulation testbed for the validation of key system functionality.

Figure 5 .
Figure 5. Structure of message for the power load of a GridLAB-D house object (house #12 in this example).

Figure 5 .
Figure 5. Structure of message for the power load of a GridLAB-D house object (house #12 in this example).

Figure 6 .
Figure 6.Effect of average power control on aggregate load.

Figure 6 .
Figure 6.Effect of average power control on aggregate load.

Figure 6 .
Figure 6.Effect of average power control on aggregate load.

Figure 7 .
Figure 7. Effect of average power control on house air temperature (the dashed staircase-like line corresponds to thermostat set point).

Figure 7 .
Figure 7. Effect of average power control on house air temperature (the dashed staircase-like line corresponds to thermostat set point).
In this context, FNCS and GridSpice, which are both based on the GridLAB-D power simulator, represent major efforts to deliver open platforms for simulating a wide range of smart grid applications and use cases.However, they aim to address slightly different simulation requirements: FNCS supports detailed simulations of the communication network, while GridSpice focuses more on providing a more scalable, cloud-based solution integrating only power simulators.VirGIL is also based on an open-source federation interconnection framework and an open-source network simulator; however, in what regards the power simulation, VirGIL integrates a commercial tool.By including Powerfactory, VirGIL is also able to address transient simulations, which is not the case for FNCS and GridSpice.This type of simulation is also supported in EPOCHS, which however is no longer being actively maintained.‚In the case of federated systems, heterogeneous technologies for the component interconnection infrastructure have been used.Although all of these technologies exploit the publish/subscribe communication paradigm for data exchange, they are based on different software (e.g., FNCS is based on ZeroMQ, GridSpice on RePast Simphony and VirGIL on Ptolemy II communication framework for distributed simulations).