4.4 Theoretical Background
4.4.2 Building Emulation engine as a DES system
The subsection 4.4.1 studied the theoretical background and formalism on the models governing the discrete event systems. To become simulations, they require an algorithmic approach for their execution. The past was dominated by general purpose simulation-oriented languages like SIMULA and GPSS. Recent decades effort has focused towards enabling simulation architectures using conventional languages such as C++ [206], Java [207] and Python [208] using additional software libraries. Regardless of the language of choice, there are three main approaches for simulating the discrete event models [208, 209].
Firstly, in the event-based approach, the collection of events triggers state changes and generate follow-up events and actions to be executed. The event models specify that behavior of the system. The event-based approach is the simplest and one of the most commonly encountered. For example, a user activates a device or changes a setting and the system timely responds; thus this approach excels in modeling the non-deterministic behavior of a system.
Secondly, the activity-based approach simulates the system behavior as a collection of activities. Each activity model represents a time-consuming, specific action performed by that entity. The behavior is based on time schedules where activities start, last a given amount of time and end with appropriate actions in each phase. For example, the building heating using hot water radiators can be such an example of activity. With the activity start, the burner
starts to warm the water. When the water reaches a configured temperature T1, the flow
in the heating elements begins while the burner extinguishes when the water reaches the
configured temperature T2, T2≥ T1. The flow action continues until desired air temperature is
water temperature close to T2.
The third and last approach for DES is the process-based one. In that case, the model is a collection of processes that represent an entity throughout its life cycle as a sequence of actions and reactions driven by logically related activities. An example of such model is the building’s battery storage for which a collection of three activities can be envisioned as a model. Besides the idling activity where no energy is exchanged, a discharge activity and a charge activity model the power flow while enforcing the battery’s energy capacity limits. The process-based paradigm of DES simulation is easier to comprehend since it resembles real-world objects. According to Perumalla et al. [210] a pure process-oriented paradigm is following all the features, F1 to F5, listed below. The features F1 - F3 denote that a programming style can be created using conventional programming languages, whereas the F4 and F5 which are regulating the time, require special software architecture design and provisioning.
• F1: procedures can declare and use local variables. • F2: procedure calls can be nested.
• F3: procedures can be recursive and re-entrant.
• F4: primitives for advancing simulation time can be invoked in any procedure.
• F5: primitives for advancing simulation time can be invoked wherever a conditional, looping or other statements can appear.
Emulation engine design concept
This research work proposes an innovative solution by introducing a hybrid DES paradigm, based on the three design approaches mentioned above, as illustrated in Fig. 4.2.
P
2A
1A
2A
nP
1A
1A
2A
nE
nE
2E
1P
nA
1A
2A
nFigure 4.2 – The proposed hybrid DES engine. Pxdenotes the processes, Axthe activities and Ex
the events
each one representing a real world object, for example, an energy-related infrastructure, a sensor/actuator or an occupant. They execute concurrently, and they support all the features mentioned by Perumalla et al. in [210]. Those individual processes are named virtual entities (vEntities). Internally, each vEntity implements a dual, activity and event-driven approach depending on the capabilities and configuration of their model. Therefore, the state of each vEntity (process-based) changes based on the model (activity-based) or external and internal triggers (event-based).
Fig. 4.3 presents the logic of the process, activity, and events for some representative virtualized building components. The vEntities are studied in great detail in the subsection 4.5.3.
Battery
(Storage) Idle Charging Discharging Idle
Start charge Idle Battery full Energy demand Terminate energy delivery Idle 'ĞŶĞƌĂƚĞ Idle Luminosity levels PV (Generation) Idle Heat Water Heater (Load) Idle H Request for heating
Water temperature maintenance
esired room temperature ƌĞĂĐŚĞĚ Low threshold High threshold High threshold Idle
Figure 4.3 – Representative examples of the virtualized infrastructure using the hybrid modeling approach
Concluding, even though the building simulation might seem to be designed as an agent-based simulation (ABS), the frontier with DES is actually thin [211]. In ABS, an agent typically holds intelligence such as rule-based decisions or local optimization algorithms. Its aim is to maximize the benefits for him or its team in case of collaborating agents. Therefore, the overall evolution of the system depends on those agents interaction. On the contrary, vEntities are configured dynamic models, characterized by their activities and various states, while their interactions are solely in the form of events.