=Paper= {{Paper |id=Vol-1742/MRT16_paper_7 |storemode=property |title=An Infrastructure for Generating Run-time Model Traces for Maintenance Tasks |pdfUrl=https://ceur-ws.org/Vol-1742/MRT16_paper_7.pdf |volume=Vol-1742 |authors=Lorena Arcega,Jaime Font,Oystein Haugen,Carlos Cetina |dblpUrl=https://dblp.org/rec/conf/models/ArcegaFHC16 }} ==An Infrastructure for Generating Run-time Model Traces for Maintenance Tasks== https://ceur-ws.org/Vol-1742/MRT16_paper_7.pdf
   An Infrastructure for Generating Run-time Model
             Traces for Maintenance Tasks
                         Lorena Arcega∗† , Jaime Font∗† , Øystein Haugen‡ and Carlos Cetina∗
                               ∗ Universidad San Jorge, SVIT Research Group, Zaragoza, Spain

                                              Email: {larcega,jfont,ccetina}@usj.es
                                † University of Oslo, Department of Informatics, Oslo, Norway
                    ‡ Østfold University College, Department of Information Technology, Halden, Norway

                                                 Email: oystein.haugen@hiof.no


   Abstract—Current research efforts are focused on taking         to extract and understand the run-time information. Then, run-
advantage of the models at run-time for run-time decision-         time information is necessary at design-time to make decision
making related to run-time system concerns associated with         regarding the system maintenance.
autonomic and adaptive systems. In addition, all systems need
maintenance over time as new requirements emerge or when              The goal of our work is to extend the use of models at
bug-fixing becomes necessary. Models at run-time can provide       run-time to perform maintenance task. This work presents
an execution trace of a high level of abstraction that is useful   our generic infrastructure to generate run-time model traces
for maintenance tasks. In this paper, we propose a generic         through the use of connection rules specified at design-time
infrastructure, which is able to get the run-time model trace.     called Code-Model Connection Rules.
Our infrastructure creates a descriptive model of the running
code by means of Code-Model Connection Rules. These rules             The Code-Model Connection Rules maps model elements to
translate the behaviour of the running source code in model        different point in the source code such as methods or values
traces. We validate our infrastructure in a Smart Hotel. The       of variables. Our generic infrastructure is divided in two parts:
results of our infrastructure show promising results towards       Controller and Translator. It controls the implementation code,
the generation of model traces from source code at run-time.       check it through the Code-Model Connection Rules, and, if
However, further work is required to a better specification of
the rules, to solve some issues with the model dependencies and    changes in the run-time model are necessary, our generator
to allow the propagation of changes in the models to the source    translates the changes in the model at run-time.
code.                                                                 We validate our infrastructure in our Smart Hotel. The
                                                                   infrastructure creates model traces from source-code to mod-
                      I. I NTRODUCTION                             els. The results of the validation of our infrastructure show
   Models at run-time research efforts are concerned with how      promising results towards the generation of model traces from
abstractions of software implementations can be used at run-       source code at run-time. However, further work is required to
time to manage software changes at run-time [1]. Current           a better specification of the Code-Model Connection Rules, to
research works are focused on how models can be used to            solve some issues with the model dependencies and to allow
support run-time adaptations in autonomous systems (i.e., in       the performance of maintenance tasks at model level, that is,
self-* systems) [2]. Usually, the adaptation actions are driven    the propagation of changes in the models to the source code.
by a MAPE-K loop [3] and prescriptive models. That is,                The remainder of the paper is structured as follows. In
changes in the model are transferred to the system.                Section II, we introduce the Smart Hotel. In Section III, we
   In software development, all systems evolve over time           describe the steps of our approach. In Section IV, we validate
as new requirements emerge or when bug-fixing becomes              our approach with the Smart Hotel case study and then discuss
necessary. Lehman et al. [4] pointed out that up to the 80% of     the results. In Section VI, we examine the works related with
the lifetime of a system is spent on maintenance and evolution     this one. Finally, in Section VII, the conclusions of our work
activities. Currently, research efforts in feature location are    are presented.
concerned with identifying software artifacts associated with
a program functionality (a feature). Feature location is one                                  II. BACKGROUND
of the most important and common activities performed by              The running example and the evaluation of this paper are
developers during software maintenance and evolution [5].          performed through a Smart Hotel [8]. In this section, we
   The amount of run-time data produced by many applications       present the models that are used by the Smart Hotel.
tends to be huge and is recorded in different forms. Relevant         We use Pervasive Modeling Language (PervML) [9] to
information has to be extracted and stored with the correspond-    describe the Smart Hotel. PervML1 is a Domain Specific
ing artifacts produced at design-time to reveal the causes of      Language (DSL) that describes pervasive systems using high-
unexpected software behavior [6]. The purpose of the analysis      level abstraction concepts such as services. This language
is to find the effects within a chain of effects occurred during
software execution [7]. Therefore, some techniques are needed        1 https://tatami.dsic.upv.es/pervml/index.php
                                       Lighting Services Model                                                                     different kinds of devices or software systems that are in
                                                                                                                                   charge of providing the basic pervasive system function-
                                                             <>                                                           ality.
                                                                Lighting
                                                                                                                                 • The Components Structural Specification is used to
                                                         + switchOn()

                                           *
                                                  1..*
                                                         + switchOff()
                                                                                   1..*
                                                                                                                                   assign devices and software systems to each one of the
                                                                                            *
                                                         + isLighting():Boolean                     <>
             <>
                                                                                                LightingByPresence
                                                                                                                                   service components.
           LightingByLight
                                                                                                + enable()
                                                                                                                                 • The Components Functional Specification is used to
 + setTresholdLighting(luxes:Integer)
 + getCurrentTreshold():Integer
                                                                                                + disable()
                                                                                                + isEnabled():Integer
                                                                                                                                   specify the actions that are executed when an operation
                  *
                                                                                                         *
                                                                                                                                   of a service is invoked.
                                                             <>                                                          Because of space constraints, Fig. 1 shows only a small part
                                                           GradualLighting
                                                                                                                               of the PervML models related to the functioning of the lights
                                                   + setIntensity(intensity:Integer)
                                                   + getIntensity():Integer
                                                                                                                               in the Smart Hotel. The concrete syntax of PervML is similar
                  1                                                                                   1..*
                                                                                                                               to the one used by UML. The Smart Hotel provides services
              <>                                                                           <>
           LightingDetection                                                                     PresenceDetection             which offer operations for switching on and switching off the
         (from SensorServices)                                                                  (from SensorServices)
                                                                                                                               lights or setting the light intensity. The Gradual Lighting State
       + currentLighting():Integer                                                         + presenceDetected():Boolean
                                                                                                                               Machine shows the state machine related to the gradual lights.
                                                                                                                               This kind of service supports setting the light intensity from
                                                                                                                               0% to 100% by means of a set of operations.
                            Gradual Lighting State Machine                                                                        The output system is obtained through a model to text
                                                                                                                               transformation. That is, each element of the model is translated
                                               isLighting(), getIntensity(), setIntensity(intensity) [intensity=0]             to one or more Java bundles. In addition, we use an implemen-
                                                                                                                               tation framework of PervML and the OSGI framework [10].
                               new                               OFF
                                                                                                                               See [9] for more implementation details.

                                                                                                                                          III. F ROM S OURCE -C ODE TO M ODELS
switchOff(), setIntensity(intensity) [intensity=0]

                                                                                                                                  This work presents our generic infrastructure to generate
                                                                                                                               run-time model traces through the use of connection rules
                                                                                                                               specified at design-time called Code-Model Connection Rules.
                                                                           switchOn(), setIntensity(intensity) [intensity>0]   The infrastructure monitors the software changes in the run-
                                                                  ON
                                                                                                                               ning system and put the running information into a descriptive
                                                                                                                               model at run-time.
                                                                                                                                  Fig. 2 shows an overview of our Run-time Model Trace
                                     isLighting(), getIntensity(), setIntensity(intensity) [intensity>0]                       Generator. At design-time, the software engineer creates the
                                                                                                                               models that specify the system and are used to generate the
                                                                                                                               run-time model. From the models, the code is implemented,
                               Fig. 1. Smart Hotel PervML Models
                                                                                                                               usually manually by using the models as a reference and in
                                                                                                                               some cases it is doing automatically or semi-automatically.
                                                                                                                               The software engineer also species the rules, Code-Model
is focused on specifying heterogeneous services in distinct
                                                                                                                               Connection Rules, which will generate the descriptive model
physical environments. This DSL has been applied to develop
                                                                                                                               at run-time.
solutions in the Smart Hotel domain.
                                                                                                                                  In a regular use, the deployment of the system is performed
   PervML uses six different models which globally provide                                                                     running the source code. When the software engineer wants to
the information that is required to describe a pervasive system.                                                               obtain the run-time model trace, he can activate the Run-time
These models are:                                                                                                              Model Trace Generator.
   • The Services Model describes the kinds of services that                                                                      In the Run-time Model Trace Generator, our infrastructure
     are provided in the pervasive system. It is used for                                                                      controls the implementation code, checks it through the Code-
     specifying the common characteristics of these similar                                                                    Model Connection Rules, and, if changes in the run-time model
     services.                                                                                                                 are necessary, our generator translates the changes in the model
   • The Structural Model indicates the number and kind                                                                        trace at run-time.
     of services that are provided by the pervasive system in                                                                     As a summary, the key idea of our infrastructure is a
     every system location.                                                                                                    loop which is responsible for translating the information of
   • The Interaction Model is used for describing the com-                                                                     the run-time knowledge from source code to models. Next
     munication that is produced between the different com-                                                                    subsections present the Code-Model Connection Rules used in
     ponents of the services.                                                                                                  our infrastructure and the steps of our Run-time Model Trace
   • The Binding Providers Model is used to describe the                                                                       Generator.
                                                                                              Run-time Knowledge




                creates
                             creates
                                                                        executes             Run-time Model Trace
                                                                                                   Generator
                                            creates




                                                                                                 r




                                                                                                                Tr
                                                                                             lle




                                                                                                                  an
                                                                                           ro




                                                                                                                    sl
                                                                                         nt
                                   Code-Model




                                                                                                                    at
                                                                                                   Code-Model




                                                                                        Co




                                                                                                                       o
                    Source                                                                                                   Run-time




                                                                                                                         r
   Models                          Connection                          Running                   Connection Rules             Model
                     Code                                               Code                            &
                                     Rules                                                           Models
                                                                                                                              traces




                Design-time                                                                          Run-time

                                        Fig. 2. Overview of the Run-time Model Trace Generator



A. The Code-Model Connection Rules                                  this case it returns true if the model element GradualLighting
   To generate a model from the executed source code, we            is not in the LightingServices model. The third parameter
developed a Code-Model Connection Rules, which are ex-              (ADD ELEMENT(Lighting- Services.GradualLighting)) is the
pressed using Event-Condition-Action (ECA) rules [11]. We           kind of modification that must be performed in the run-time
are not reinventing the ECA rules. The ECA rules have been          model. In the smart hotel, it is the addition of the model
intensely studied and used for the management of self-adaptive      element GradualLighting in the LightingServices model.
systems [8]. However, we use these ECA rules in a novel way            On the other hand, when the code indicates that the
to perform changes in a run-time model when the code is             GradualLightingService is not available any longer (re-
executed.                                                           move(mainGradualLightService)), the element must be re-
   The definition of our rules is based on the ERA language         moved from the run-time model. The rule is similar to the
[12] to provide mechanism for specifying the execution of           one for adding model elements:
external actions (actions in the run-time model) instead of
                                                                    (remove(mainGradualLightService),
internal actions (actions in the running code of the system).
                                                                        IS( LightingServices . GradualLighting ) ,
   The Code-Model Connection Rules take the following
                                                                        DEL ELEMENT(LightingServices.GradualLighting));
shape: ’when a line of the source code is executed, the state
of variables change, or both take place, then a model element          The first parameter (remove(mainGradualLightService))
should be created, modified, or deleted in the run-time model’.     is the line of code that must be executed to trig-
   For example, when the line of code that creates the gradual      ger the Model-Code Connection rule. The second pa-
lighting service (GradualLightService mainGradualLightSer-          rameter (IS(LightingServices.GradualLighting)) indicates if
vice=new GradualLightService()) is executed, the Gradual-           the model element is in the model. The third parameter
Lighting model element in the run-time model must appear.           (DEL ELEMENT(LightingServices.Gradual- Lighting)) is the
In this particular case, the rule is depicted as follows:           modification that must be performed in the run-time model. In
( GradualLightService mainGradualLightService=new                   this case it is a deletion of the model element GradualLighting
     GradualLightService(),                                         in the LightingServices model.
     IS NOT(LightingServices.GradualLighting) ,                        Although the idea of the Code-Model Connection Rules is
     ADD ELEMENT(LightingServices.GradualLighting));                domain independent, our current implementation is tailored
                                                                    to the Smart Hotel. Even though these rules have helped us
   In this rule, the first parameter (GradualLightService           to address the research questions, our future work involves
mainGradualLightService=new GradualLightService()) is the           designing independent domain rules that combine debug ex-
line of code that triggers the rule. The second parame-             pressiveness to specify the state of the variables and execution
ter (IS NOT(LightingServices.GradualLighting)) indicates the        points (triggers) and OCL-like expressions to specify (condi-
condition that must be fulfilled and in which model. The            tions and actions in the run-time model).
keyword IS NOT checks if the model element appears in the              Some model elements may require few rules to be syn-
run-time model and return true if it is not in the model. In        chronized with the code, but others may require more effort.
These rules are a trade-off, the more specifications the engineer                                   Run-time Model Trace
                                                                                                          Generator
makes, the richer the run-time model will be, but at the cost
                                                                                           Controller                      Translator
of the increase in the amount of time that must be spent by                                Checking the                 Querying the
                                                                                           running code and               models and
the software engineer in order to specify them.                        Running
                                                                                           evaluating rules        executing required           Run-time
                                                                                                                              actions            Model
   One of the main characteristics of our approach is that,             Code
                                                                                         Java Code                                               traces
                                                                                                                             EMF
by means of the Code-Model Connection Rules, the software                                Language         Code-Model
                                                                                                                             Intrspection
                                                                                         Intrspection   Connection Rules     Capabilities
engineer can change the set of the models defined at design-                             Capabilities          &
                                                                                                                                            A Our approach
                                                                                                            Models
time that will be used at run-time. That is, the software                                                                                   A Technology
engineer can decide how many model elements should be
connected with the running code.                                                 Fig. 3. Details of the Run-time Model Trace Generator
B. Run-time Model Trace Generator
   Szvetis and Zdum [13] creates a classification of the objec-             Code-Model Connection Rule is fulfilled. In the running
tives, techniques, kinds and architectures used with models at              example, our approach checks if the GradualLighting
run-time. According to their categories, we can classify our                model element appears in the LightingServices run-time
infrastructure to work with models at run-time as follows:                  model, (’IS NOT(LightingServices.GradualLighting)’).
   • Objectives: The main one is monitoring the system by               • Translator: The response of the controller is used to
      using models in order to help the understanding of the                translate the source code into models (see Fig. 3). The
      system behavior. In addition, we use models to raise the              implementation of the translator is developed by means
      abstraction level and bring closer the problem to the user.           of the EMF Introspection Capabilities [15].
      Finally, the use of models provides platform-independent              Our infrastructure uses the action of the Code-Model
      views of the system under observation.                                Connection Rule to determine the modifications that must
   • Technique: We use the introspection technique that deals               be performed in the run-time model. In the running
      with extraction of run-time system data in order to                   example, the action determines that the GradualLight-
      apply model-based techniques on the analyzed behavior.                ing model element must be added to the LightingSer-
      In addition, they subdivided the introspection in three               vices run-time model (’ADD ELEMENT( LightingSer-
      main groups: event log checking, instrumentation and                  vices.GradualLighting)’). If the model element does not
      management API.                                                       appear in the run-time model, it checks the design-time
      Specifically, our infrastructure is similar to the instrumen-         models and takes the information that is needed in order
      tation group. Even though, we do not insert any extra                 to add this model element to the run-time model. If
      source code to the system. We use the rules to translate              the model element appears in the run-time model, our
      the running software of a system into a model.                        approach checks if some modifications are necessary.
   • Kind: Our infrastructure does not depend on one kind of                The run-time model is modified in order to add, modify
      model. We use a domain specific language (PervML, see                 or delete the model elements specified in the Code-
      section II), however, the model generated depends on the              Model Connection Rules. In the running example, the
      defined rules and the user can choose whoever he wants.               GradualLighting model element is added to the run-time
   • Architecture: We use a model-aware middle-ware archi-                  model.
      tecture. This architecture allows us to monitor the system        The model generated at run-time only includes elements that
      while our solution checks the rules and creates the model       have been executed. This run-time model is the main artifact
      at run-time.                                                    that the software engineer can use to improve his knowledge
   The Code-Model Connection rules previously presented               of the system. We extract the run-time representation of the
enables to reflect running-code changes into a descriptive run-       system as models to enable reasoning on a high level of
time model. The details of our infrastructure are depicted in         abstraction.
Fig. 3.
   • Controller: When the system is running, the running                                            IV. VALIDATION
      source code needs to be controlled (see Fig. 3). The               We validate whether our infrastructure creates the correct
      implementation of the controller is developed by means of       models at run-time. To do that, we compare our model traces
      the Java Code Language Introspection Capabilities [14].         generated at run-time with an oracle that is composed by the
      Our infrastructure uses the run-time state of the code as       models of the defined scenarios in [8]. We generate a run-time
      input to check conditions from the Code-Model Con-              model trace while the other model trace is extracted from a
      nection Rules. In the running example, our approach             previous work [8], we compare both traces in order to detect
      detects every time that the line ’GradualLightService           differences.
      mainGradualLightService = new GradualLightService()’               We defined the experimental design of our study using
      is executed.                                                    the Goal-Question-Metric method (GQM) [16]. We used the
      Once a relevant change in the state of the code is              template presented in [17]. The GQM method was defined as
      detected, our approach checks if the conditions of the          a mechanism for defining and interpreting a set of operation
                                                                                                                    (C)
               (A)                                                (B)                                  Checking Smart Hotel Results
    Smart Hotel at Design-time                           Smart Hotel at Run-time                              after Run-time


 Smart Hotel
   PervML
   Models


    Source                                                   Run-time Model Trace
     Code                                                          Generator



 Code-Model
 Connection        Definition of                                                                              Comparison with
   Rules           the scenario                                                                                 the oracle




                                        Fig. 4. The validation process followed in the Smart Hotel



goals using measurements. In this evaluation, our goal was the        to represent the Smart Hotel. In addition, at design-time, the
following:                                                            Code-Model Connection Rules and the scenario are defined
   • Object: Our Smart Hotel                                          to allow the generation of the trace model from the code at
   • Purpose: Validation                                              run-time, as shown in Fig. 4 (A).
   • Issue: The correctness of the models generated at run-              After running the scenario, see Fig. 4 (B), our Run-time
      time                                                            Model Trace Generator (see Fig. 4 left) generates the run-
   • Context: The infrastructure for of our Run-time Model            time model. The infrastructure monitors the running code
      Trace Generator                                                 and applies the corresponding Code-Model Connection Rules
   To fulfill this goal, we focused on answering the following        to translate source code behavior into a descriptive run-time
research question:                                                    model trace.
   1) Does our infrastructure generate the same model traces             For the comparison, see Fig. 4 (C), we collect the traces by
        as the oracle?                                                means of the Reconfiguration Tracker that is provided by the
   Basili in [16] and Travassos in [18] describe four kinds           implementation of the Smart Hotel that we used [8].
of studies: in-vivo, in-vitro, in-virtuo, and in-silico. In our          At the end, we have two set of models that represents the
case, we chose to carry out in-virtuo experiments, where the          behavior of the system. One of the set is generated by our
real world is described as computer models. This experiment           Run-time Model Generation and the second set is the oracle.
involves the interaction among participants and a computerized        Then, we can compare the results of the two approaches.
model of reality. The simulated environment offers major                 The number of model elements in the run-time model
advantages regarding the cost and the feasibility of replicating      depends on the Code-Model Connection Rules defined. As we
a real-world configuration. In addition, some scenarios such          wanted to determine if the models generated was equivalent,
as res or floods cannot be replicated in the real world.              we performed the validation with a set of rules that connected
   The Smart Hotel is developed by means of a software                all the possible elements with the source code. By this way,
product line, the PervML model and the source code of the             we could compare both models traces easily.
Smart Hotel are configured with a feature model. The feature             Therefore, the number of rules that the software engineer
model specifies the 39 different features that the Smart Hotel        must use is an open topic that will be addressed in the future.
has implemented. We use the PervML model traces of the [8]            The specification of the rules takes times and it is not always
approach as an oracle to evaluate the presented approach. That        necessary to specify all of them. Thus, I hope I can guide the
is, we make use of a set of implementation codes whose model          software engineer about what are the rules he need to specify.
realizations are known beforehand and will be considered as              A concrete example of our validation is shown in Fig. 5.
the ground truth, enabling us to compare the run-time traces          The Smart Hotel is defined with a large number of models
extracted from the [8] approach with the results of the models        (see section II), however in this section we only show one of
generated by our infrastructure.                                      these models. As the examples show, all the models obtained
   Figure 4 shows the entire process that we have followed            are a subset of the entire definition of the Smart Hotel.
in this validation. For the validation, we used the Smart                The fist one of the models of Fig. 5, Smart Hotel PervML
Hotel defined in [8]. The Smart Hotel presents 476 model              Structural Model, corresponds to the one that defines the
elements in the design-time models. It consists of 268 classes        entire system of the Smart Hotel. The second one, Smart
implemented in about 67,207 methods of Java source code.              Hotel PervML Structural Model in Watching a Movie Scenario
In the evaluation set-up, a simulated environment was used            represents the model generated in the Watching a Movie
          Smart Hotel PervML Structural Model                      Structural model (see bottom part of Fig. 5).

                                                                   A. Does our infrastructure generate the same model traces as
                                                                   the oracle?
                                                                      The results of our infrastructure show promising results
                                                                   towards the generation of model traces from source code at
                                                                   run-time.
                                                                      The results obtained in this validation suggest that our
                                                                   infrastructure generates a valid model trace from the running
                                                                   scenarios. All the generated traces contain the main devices
                                                                   and services necessary for execute the defined scenario.
                                                                      However, the trace generated with our infrastructure con-
                                                                   tained more information than the trace from the oracle. But, the
                                                                   trace from the oracle was contained in the trace generated with
                                                                   our infrastructure. The major difference between our generated
          Smart Hotel PervML Structural Model                      model traces at run-time and the traces from the oracle lies in
              Watching a Movie Scenario
                                                                   the number of attributes of the model element.
                                                                      In addition, it is necessary further specific experiments in
                                                                   order to identify more relevant correlations between the source
                                                                   code and the run-time models. However, the Code-Model
                                                                   Connection Rules have flexibility to enable and disable the
                                                                   model elements that must appear in the run-time model trace.
                                                                      Another issue detected is related to the dependencies be-
                                                                   tween model elements. The management of the dependencies
                                                                   through the use of the Code-Model Connection Rules is
                                                                   cumbersome and error prone. We detect that a dependency
                                                                   tree could be very useful to check the consistency of the model
                                                                   trace while it is being generated.
                                                                      Moreover, our infrastructure generates the model trace to
                                                                   increase the level of abstraction and to ease the maintenance
                                                                   task. But nevertheless, the maintenance task must be per-
            Fig. 5. Smart Hotel PervML Structural Models           formed at source code level because the infrastructure does
                                                                   not allow propagate changes in the models to the source code
                                                                   of the system.
Scenario.
                                                                      In spite of the results, this initial effort must not be underes-
   The definition of the Watching a Movie scenario is as
                                                                   timated since the Run-time Model Trace Generator produced
follows:
                                                                   proper output to see the first results. The overall performance
   ’The user of the hotel decides to watch a movie from the
                                                                   of the infrastructure needs more tests. Further work is required
of which the hotel offers. The user can select the movie in the
                                                                   to see if these concerns are reasonable and if so, find out how
screen of the control panel. In addition, the user will be able
                                                                   to these previous problems can be solved.
to choose the room preferences (illumination and temperature)
for a better experience. The system will give him many options                       V. T HREATS TO VALIDITY
so he can choose the one that suits him more. The user is
enjoying the movie but, someone is calling to his cell phone          We use the classification of threats to validity in [19]. This
with Bluetooth technology synchronized with the rooms main         classification distinguishes four aspects of validity:
system. This call will be notified through the main screen. He        1) Construct validity: This aspect of validity reflects the
is forced to stop watching the movie but he will have the option          extent to which the operational measures that are studied
to continue where he left at any other time during his stay.’             represent what the researchers have in mind and what is
   Then, the main devices that are involved in this scenario              investigated based on the research questions.
are the cell phone, the control panel, the central dock. Some             The purpose validation does not have a true/false answer.
other devices related to this scenario are ones related to the            To minimize this threat the scenarios were designed
illumination and temperature services. In the same way, the               by two experts in the Smart Hotel. These experts have
main service in this scenario is the multimedia service, and              developed the Smart Hotel and in other model-based
also the ones related to illumination and temperature.                    tools (in the induction hob domain and train control
   This trace generated from this scenario is formed by 23                software domain). Their participation was limited to the
channels, 13 devices and 9 services in the Smart Hotel PervML             design of the scenarios.
     The measure used in our research is the similarity of our      infrastructure to generate the run-time model from source
     model traces extracted and the oracle. These similarity        code.
     measures have been proved in other kind of models with            Bodenstaff et al [23] uses event log checking to check a
     fair results [20].                                             model against the running system. They assume that the event
  2) Internal validity: This aspect of validity is of concern       log is consistent with the running system and also with a model
     when causal relations are examined. There is a risk that       if essential parts of the model do not contradict. In contrast to
     the factor being investigated may be affected by other         our approach, they are focus on identifying relevant parts of
     neglected factors.                                             the log event and extract them as models while our approach
     In our work, this is a very low risk due to the human task     generates the models directly from the running system.
     are reduced to the minimum. The comparison between                Szvetits et al. [6] propose the usage of run-time models
     the traces were performed automatically by a computer,         in combination with model-driven techniques and interactive
     therefore the humans did not affect the final result.          visualizations to ease tracing between log file entries and
  3) External validity:This aspect of validity is concerned         corresponding software artifacts. They creates a repository-
     with to what extent it is possible to generalize the           based approach to augment root cause analysis with interactive
     finding, and to what extent the findings are of relevance      tracing views to maximize the re-usability of models created
     for other cases.                                               during the software development process. In contrast to our
     The software system used in the validation is repre-           approach, they focus their work on the interactive visualiza-
     sentative of those used in practice. Given the scale           tions while our work is focused on the generation of run-time
     and complexity of our Smart Hotel, we consider our             models from non-model-based system. However, we can apply
     evaluation a good starting point representing a realistic      their techniques to analyze the model traces that we extract
     case. However, this threat can be reduced if we experi-        from the running system.
     ment with other software systems of different sizes and           Some other approaches insert monitoring functionality into
     domains.                                                       the system in order to observe the system behavior.
  4) Reliability: This aspect is concerned with to what extent         Nierstrasz et al. [24] use instrumentation at run-time in
     the data and the analysis are dependent on the specific        combination with and Abstract Syntax Tree (AST) model as
     researchers.                                                   abstraction above the byte-code level. They use the concept
     The main risk relies on the selection of the running           of links to be set as annotations to AST nodes which are
     scenarios to obtain the execution trace of the models.         transferred by a compiler plugin before execution. This results
     Since we are experts in the Smart Hotel system, we             in code to be inserted in the program at nodes where links are
     can claim that our scenarios are good representatives          installed. Such links can also be installed by other links or
     of the entire system, and, therefore, our infrastructure       manipulated by themselves.
     generates the correct models for all the system. However,         Hamann et al. [25] propose monitoring of JVM hosted
     depending on the chosen scenarios, the result may differ.      applications by using platform-aligned model (PAM) as link
                                                                    between the platform-specific model (PSM) and the platform-
                    VI. R ELATED W ORK                              independent model (PIM). A PAM is iteratively designed
   Some approaches use the run-time models to visualize and         through assumptions which are stated, checked, and refined.
analyze data from model-based systems. Although they do                This kind of approaches requires the source code of the
not generate the run-time models, their works are based on          system to be available. In contrast to us, this approaches extract
extracting information from run-time models.                        the run-time data and then they translate the extracted data as
   Graf and Mller-Glaser [21] define various debugging-             models to enable reasoning on a high level of abstraction while
perspectives independent of the actual execution platform for       we extract the data as models at run-time and do not introduce
identifying error occurrences. They extract run-time informa-       anything new in the source code.
tion out of the executed binary from the target platform and
transport this information back to the model level. Obtained                              VII. C ONCLUSION
run-time information can then be used to visualize the internal        This work proposes a generic infrastructure to generate
state of the executable. In contrast to our approach, they extend   run-time models through the use of connection rules called
the UML meta-model with meta-classes that allow storage of          Code-Model Connection Rules. Specifically, our infrastructure
data acquired by the model mapping.                                 allows change from source-code to descriptive models increas-
   Maoz [22] introduces an approach which uses model-based          ing the abstraction level.
traces to record the run-time of a system through abstractions         Our validation in our Smart Hotel compares the result
provided by models used in its design. The traces include           obtained from our infrastructure and from a oracle. We use the
information about the systems from which they were gen-             model traces generated to determine if the results obtained are
erated, the models that induced them and the relationships          correct. The results of the validation of our infrastructure show
between them at run-time. The approach is focused on metrics        promising results towards the generation of model traces from
and operators for such traces to understand the structure and       source code at run-time. However, further work is required to
behavior of a running system while we are focused on the            a better specification of the Code-Model Connection Rules, to
solve some issues with the model dependencies and to allow                       [16] V. R. Basili, “The role of experimentation in software engineering:
the performance of maintenance tasks at model level, that is,                         Past, current, and future,” in Proceedings of the 18th International
                                                                                      Conference on Software Engineering, ser. ICSE ’96. Washington, DC,
the propagation of changes in the models to the source code.                          USA: IEEE Computer Society, 1996, pp. 442–449. [Online]. Available:
   In addition to the previous one, our future work involves                          http://dl.acm.org/citation.cfm?id=227726.227818
designing independent domain rules that combine debug ex-                        [17] V. R. Basili, G. Caldiera, and H. D. Rombach, “The goal question metric
                                                                                      approach,” in Encyclopedia of Software Engineering. Wiley, 1994.
pressiveness to specify the state of the variables and execution                 [18] M. O. B. G. H. Travassos, “Contributions of in virtuo and in silico
points (triggers) and OCLlike expressions to specify (condi-                          experiments for the future of empirical studies in software engineering,”
tions and actions in the run-time model).                                             in In Proceedings of the Workshop on Empirical Studies in Software
                                                                                      Engineering (ESEIW). IEEE Computer Society, 2003.
                                                                                 [19] P. Runeson and M. Höst, “Guidelines for conducting and reporting
                         ACKNOWLEDGMENT                                               case study research in software engineering,” Empirical Softw. Engg.,
                                                                                      vol. 14, no. 2, pp. 131–164, Apr. 2009. [Online]. Available:
   This work has been partially supported by the Ministry of                          http://dx.doi.org/10.1007/s10664-008-9102-8
                                                                                 [20] M. Ehrig, A. Koschmider, and A. Oberweis, “Measuring similarity
Economy and Competitiveness (MINECO) through the Span-                                between semantic business process models,” in Proceedings of the
ish National R+D+i Plan and ERDF funds under the project                              Fourth Asia-Pacific Conference on Comceptual Modelling - Volume
Model-Driven Variability Extraction for Software Product Line                         67, ser. APCCM ’07. Darlinghurst, Australia, Australia: Australian
                                                                                      Computer Society, Inc., 2007, pp. 71–80. [Online]. Available:
Adoption (TIN2015-64397-R).                                                           http://dl.acm.org/citation.cfm?id=1274453.1274465
                                                                                 [21] P. Graf and K. D. Muller-Glaser, “Dynamic mapping of runtime in-
                                                                                      formation models for debugging embedded software,” in Seventeenth
                              R EFERENCES                                             IEEE International Workshop on Rapid System Prototyping (RSP’06),
                                                                                      June 2006, pp. 3–9.
 [1] U. Aßmann, N. Bencomo, B. H. C. Cheng, and R. B.                            [22] S. Maoz, “Using model-based traces as runtime models,” Computer,
     France, “Models@run.time (Dagstuhl Seminar 11481),” Dagstuhl                     vol. 42, no. 10, pp. 28–36, Oct 2009.
     Reports, vol. 1, no. 11, pp. 91–123, 2012. [Online]. Available:             [23] L. Bodenstaff, A. Wombacher, M. Reichert, and R. Wieringa,
     http://drops.dagstuhl.de/opus/volltexte/2012/3379                                “Made4ic: an abstract method for managing model dependencies in
 [2] H. Giese, N. Bencomo, L. Pasquale, A. J. Ramirez, P. Inverardi,                  inter-organizational cooperations,” Service Oriented Computing and
     S. Wätzoldt, and S. Clarke, Models@run.time: Foundations, Applica-              Applications, vol. 4, no. 3, pp. 203–228, 2010. [Online]. Available:
     tions, and Roadmaps. Cham: Springer International Publishing, 2014,              http://dx.doi.org/10.1007/s11761-010-0062-7
     ch. Living with Uncertainty in the Age of Runtime Models, pp. 47–100.       [24] O. Nierstrasz, M. Denker, and L. Renggli, Model-Centric, Context-Aware
 [3] IBM, “An architectural blueprint for autonomic computing,” IBM, Tech.            Software Adaptation. Berlin, Heidelberg: Springer Berlin Heidelberg,
     Rep., 2006.                                                                      2009, pp. 128–145. [Online]. Available: http://dx.doi.org/10.1007/978-
 [4] M. M. Lehman, J. Ramil, and G. Kahen, “A paradigm for the behavioural            3-642-02161-9 7
     modelling of software processes using system dynamics,” Imperial Col-       [25] L. Hamann, M. Gogolla, and M. Kuhlmann, “Ocl-based runtime mon-
     lege of Science, Technology and Medicine, Department of Computing,               itoring of jvm hosted applications,” Electronic Communications of the
     Tech. Rep., Sep 2001.                                                            EASST, vol. 44, 2011.
 [5] B. Dit, M. Revelle, M. Gethers, and D. Poshyvanyk, “Feature location
     in source code: A taxonomy and survey,” in Journal of Software
     Maintenance and Evolution: Research and Practice, 2011.
 [6] M. Szvetits and U. Zdun, “Enhancing root cause analysis with runtime
     models and interactive visualizations,” in 8th International Workshop on
     Models at Run.time, Miami, Florida, USA, September 2013. [Online].
     Available: http://eprints.cs.univie.ac.at/3764/
 [7] H. W. Dettmer, Goldratt’s theory of constraints: a systems approach to
     continuous improvement. ASQ Quality Press, 1997.
 [8] C. Cetina, “Achieving autonomic computing through the use of variabil-
     ity models at run-time,” Ph.D. dissertation, Universidad Politécnica de
     Valencia, 2010.
 [9] J. Muñoz, “Model driven development of pervasive systems. building a
     software factory,” Ph.D. dissertation, Universidad Politécnica de Valen-
     cia, 2008.
[10] D. Marples and P. Kriens, “The open services gateway initiative:
     an introductory overview,” IEEE Communications Magazine, vol. 39,
     no. 12, pp. 110–114, Dec 2001.
[11] J. O. Kephart and W. E. Walsh, “An artificial intelligence perspective on
     autonomic computing policies,” in Proceedings of the 5th IEEE Inter-
     national Workshop on Policies for Distributed Systems and Networks.
     POLICY ’04, June 2004, pp. 3–12.
[12] J. J. Alferes, F. Banti, and A. Brogi, Logics in Artificial Intelligence:
     10th European Conference, JELIA 2006 Liverpool, UK, September 13-
     15, 2006 Proceedings. Berlin, Heidelberg: Springer Berlin Heidelberg,
     2006, ch. An Event-Condition-Action Logic Programming Language,
     pp. 29–42.
[13] M. Szvetits and U. Zdun, “Systematic literature review of the objectives,
     techniques, kinds, and architectures of models at runtime,” Software &
     Systems Modeling, vol. 15, no. 1, pp. 31–69, 2016. [Online]. Available:
     http://dx.doi.org/10.1007/s10270-013-0394-9
[14] K. Arnold, J. Gosling, and D. Holmes, The Java programming language
     4th Edition. Addison-wesley, 2016.
[15] “The eclipse project: Emf model query.” [Online]. Available:
     https://projects.eclipse.org/projects/modeling.emf.query