# On Managing Knowledge for MAPE-K Loops in Self-Adaptive Robotics Using a Graph-Based Runtime Model
## 3 Extending the MAPE Scheme: The DSR
### The DSR as a Runtime Model  
In our software architecture, the DSR is the core item, storing all the information shared among the agents in the architecture. Thus, events, such as the detection of a person or the roll container, the presence of close obstacles, or the evolution of the battery level, are annotated in this graph. Moreover, we can also see in the DSR if the robot launched the picking up of the roll container, and is now approaching the roll container. There will be information annotated from the beginning (design-time), but also updates provided at runtime. Following the work by [4], we can state that the described DSR is a runtime model. **Definition 1**. : _A model is characterized by three elements: an original the model refers to, a purpose that defines what the model should be used for, and an abstraction function that maps only purposeful and relevant characteristics of the original to the model._  
In our case, the _original_ to which the model refers to is a real robot working in a retail scenario. At design-time, we can have at our disposal a grid-based map of the environment, a distribution of picking areas, or the features of the robot. The original also includes a mission manager that, in this case, collects the needs from the human pickers (requiring an empty roll container or asking for a loaded roll container to be moved to a different position). The _purpose_ of our model is to allow the robot to satisfy these missions, but also to take into consideration the fulfilment of certain non-functional properties. For instance, unsafe situations must be proactively avoided. As described in [6], the DSR manages perceptions and actions within the same representation. Thus, the model covers physical properties of the robot and the environment, but also the current behaviour of the robot with respect to the current goals and the context. The purpose of the model is then to centralize all the information the robot needs to achieve a mission, including that related to the synchronization of the decision making modules running in the system. Details will be provided in next Sections. With respect to the abstraction of the context, relevant information about the robot (battery level, payload, etc.) is annotated by different perception modules in the DSR. In a robot-centric view, its maximum speed or the algorithm employed for localization are autonomously chosen according to parameters such as the presence of close obstacles or people, or to the uncertainty on its pose. Non-functional properties are encoded as QoS metrics and also annotated and updated in the model, and then considered for tuning these parameters. The representation of the environment includes the location of static entities but also the presence of dynamic ones, such as people or roll containers. The model also describes the current behaviour of the robot with respect to the current goals and the context. Significantly, and contrary to the example in [4], we maintain an unique runtime model storing all the information related to structural context and behaviour. **Definition 2**. : _A runtime model is a model that complies with Definition 1 and, in addition, part of its purpose is to be employed at runtime and its encoding enables its processing at runtime._  
Being updated by all agents in the software architecture, the DSR is a runtime model that describes the as is situation on the whole running system [25]. Thus, it is a descriptive model of the system and environment. Figure 2 shows how the DSR evolves in a real trial. For the sake of clarity, we have further simplified the DSR representation with respect to Figure 1, leaving only the nodes that we consider most significant for the presentation of this example. The DSR, at time \(t\) in the figure, illustrates when the **robot** arrives to the **picking area 1** where the human picker has left a roll container to be picked up and moved to a new delivering area.