Handling Imperfect Monitoring in Self-Adaptive Solar Energy Harvesting Systems Mehran Alidoost Nia DRTS Research Lab, School of ECE, College of Engineering, University of Tehran, Tehran, Iran alidoostnia@ut.ac.ir Mehdi Kargahi 1 DRTS Research Lab, School of ECE, College of Engineering, University of Tehran, Tehran, Iran 2 School of Computer Sciences, IPM, Tehran, Iran kargahi@ut.ac.ir Alessandro Abate Department of Computer Science, University of Oxford, Parks Road, Oxford, OX1 3QD, United Kingdom aabate@cs.ox.ac.uk Abstract— Ubiquitous and perpetual nature of cyber-physical systems (CPSs) have made them mostly battery-operated in many applications. The batteries need recharge via environmental energy sources. Solar energy harvesting is a conventional source for CPSs, whereas it is not perfectly predictable due to environmental changes. Thus, the system needs to adaptively control its consumption with respect to the energy harvesting. In this paper, we propose a model-driven approach for analyzing self- adaptive solar energy harvesting systems; it uses a feedback control loop to monitor and analyze the behavior of the system and the environment, and decides which adaptation action must be triggered against the changes. We elaborate a data-driven method to come up with the prediction of the incoming changes, especially those from the environment. The method takes the energy harvesting data for prediction purposes, and models the environment as a Markov chain. We empower the proposed system against the runtime monitoring faults as well. In this regard, the system is able to verify an incomplete model, i.e. when some data is missed. To this aim, we propose a pattern-matching system that simulates the current behavior of the system using random walk, and matches it with the history to estimate the omitted data. The results show an accuracy of at least 96% when decisions are made by imperfect monitoring. Keywords— self-adaptive systems, runtime verification, solar energy harvesting, pattern-matching, cyber-physical systems, monitoring faults. I. INTRODUCTION Cyber-physical systems (CPSs) face many fluctuations caused by changes mostly from the environment. To respond those changes, the CPS needs some types of adaptation. Since CPSs are expected to react to those changes autonomously, self- adaptation is a major requirement in that domain. A self- adaptive system (SAS) is a closed-loop which repeatedly monitors the local system and the environment, and is capable of adjusting and evaluating the system behavior in response to changes imposed from the environment. Adaptation actions are triggered whenever the system violates what it is intended to do or when a better functionality/performance can be achieved [1]. Therefore, self-adaptation is a complement to CPSs which equips them to autonomously respond to runtime changes. Fig.1 denotes an overall view to a self-adaptive solar energy harvesting system. As denoted in the figure, the architecture of a SAS consists of a local system, a control feedback loop and the environment. Local system refers to the cyber part of a CPS that is managed by a control loop called MAPE (monitoring, analyzing, planning, and executing). The environment consists of unmanaged components. Changes mainly come from the environment and affect the local system. MAPE is responsible for monitoring the change in the system, and triggering an appropriate adaptation action against that change. Self-adaptive systems have many applications in real-world such as load balancing of large-scale webservers [2], dynamic power management [3], unmanned vehicles [4], healthcare monitoring systems [5], intelligent transport systems [6], and energy harvesting from the environment [7]. In this paper, we focus on solar energy harvesting as a case study. The application is composed of a solar energy site and a set of sensors that use the solar batteries as their source of energy. Each sensor operates in several operational modes that can be adjusted based on the expected energy harvesting from the environment. As the expected energy harvesting is changed (e.g. if the weather is going to be rainy), the self-adaptive system adjusts power mode of sensors to balance power consumption of sensors with the expected energy harvesting from the environment. The change comes from the environment, and adaptation action is triggered to adapt sensors’ functionality with the upcoming situations. A self-adaptive system needs to rigorously monitor and analyze the behavior of the environment and the local system at runtime [13]. Model-driven approach offers a rigorous solution for monitoring and analyzing the self-adaptive systems. In this approach, the model of the system is defined as the composition of the environment and local system, and behavior of the both can be verified based on predefined properties at runtime. The self-adaptive system must proactively decide about a few future steps of the system in advance, and this is done using runtime quantitative verification (RQV). The environment has stochastic nature that modelling of the future steps brings uncertainty to the model. Thus, the composed model of the environment and local system can be analyzed using predefined properties. The significant point in monitoring and analyzing rounds of MAPE is the variability of the model. This is why we need parametric Markov models. As the model of the environment (and some part of the local system) is supposed to be stochastic and we need to predict future steps, the predictions can be updated at runtime e.g. some parameter(s) is updated. In this way, the model of the system can be changed periodically. Therefore, we may need to reconstruct the model in each monitoring round. Due to transient faults in monitoring round of MAPE at runtime, we may not have sufficient information about the changes. Therefore, decision-making about adaptation action should be done based on an incomplete model. The main challenge of the research is to provide a solution for decision- making about an incomplete model caused by monitoring faults (e.g. when valuation of a parameter is unknown at runtime).