<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Measuring Maintainability of DPRA A Pragmatic Approach Models:</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Irina Rychkova</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fabrice Boissier</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hassane Chraibi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Valentin Rychkov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>EDF R&amp;D, EDF Lab Paris-Saclay</institution>
          ,
          <addr-line>7 Bd. Gaspart Monge, Palaiseau</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Universite Paris 1 Pantheon-Sorbonne</institution>
          ,
          <addr-line>12, Place du Pantheon, 75005 Paris</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Dynamic Probabilistic Risk Assessment (DPRA) is a powerful concept that is used to evaluate design and safety of complex industrial systems. A DPRA model uses a conceptual system representation as a formal basis for simulation and analysis. In this paper we consider an adaptive maintenance of DPRA models that consist in modifying and extending a simpli ed model to a real-size DPRA model. We propose an approach for quantitative maintainability assessment of DPRA models created with an industrial modeling tool called PyCATSHOO. We review and adopt some metrics from conceptual modeling, software engineering and OO design for assessing maintainability of PyCATSHOO models. On the example of well-known "Heated Room" test case, we illustrate how the selected metrics can serve as early indicators of model modiability and complexity. These indicators would allow experts to make better decisions early in the DPRA model development life cycle.</p>
      </abstract>
      <kwd-group>
        <kwd>maintainability metrics</kwd>
        <kwd>conceptual models</kwd>
        <kwd>object oriented design</kwd>
        <kwd>DPRA models</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Dynamic Probabilistic Risk Assessment is a powerful concept that is used to
evaluate design and safety of complex systems where the static reliability methods
like fault trees nd their limits [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. A DPRA model is grounded on a
conceptual representation of a system: it formally describes some aspects of the physical
world (for example, a complex mechanical system) for purposes of understanding
and communication [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ]; it serves a formal basis for further system simulation
and analysis. For feasibility, proof of concept, algorithm benchmarking and other
preliminary studies simpli ed DPRA models are used. Adaptive maintenance is
an important part of a DPRA model life cycle: it consists in modifying and
extending a simpli ed model to a real-size DPRA model.
      </p>
      <p>
        In this work, we propose a maintainability assessment approach for DPRA
models created with an industrial modeling tool called PyCATSHOO[
        <xref ref-type="bibr" rid="ref6 ref7">6,7</xref>
        ].
PyCATSHOO is a tool dedicated for dependability analysis of hybrid systems
developed and used by EDF. PyCATSHOO models are executable modules that
can be written in Python or C++ and interpreted by PyCATSHOO engine.
      </p>
      <p>
        We de ne and test a set of metrics that can serve as early indicators of
PyCATSHOO model modi ability and complexity. We review some well-known
metrics from conceptual modeling, software engineering and object-oriented
design, including size measures, complexity measures, lexical measures and
OOspeci c measures [
        <xref ref-type="bibr" rid="ref13 ref20 ref26 ref5 ref9">9,20,13,26,5</xref>
        ]. Based on our review, we select and adapt a set
of metrics applicable to DPRA models and PyCATSHOO models in particular.
      </p>
      <p>We make an assumption that the selected metrics can show a di erence
between two PyCATSHOO model designs already at the early phase of model
development life cycle, helping experts to make better decisions.</p>
      <p>
        To validate this assumption, we apply the selected metrics and assess two
designs of the Heated Room system. "Heated Room" is a well-known test case
reported in [
        <xref ref-type="bibr" rid="ref3 ref6">3,6</xref>
        ]. It describes a system that consists of a room and a heater
that can switch on and o to maintain the ambient temperature. This example
illustrates a hybrid system that combines deterministic continuous phenomena
(i.e., temperature evolution) and stochastic discrete behaviour (i.e., functioning
of a heater).
      </p>
      <p>
        We create two sets of PyCATSHOO models as illustrated in Table 1: Set 1
follows the original design ideas from [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], Set 2 represents an alternative model
design promoting the low coupling design principle. The corresponding models in
two sets are semantically equivalent, i.e., they demonstrate the same simulation
traces. We compare measurements for the model sets and discuss the results.
      </p>
      <p>
        The reminder of this paper is organised as follows: Section 2 presents DPRA
models and PyCATSHOO modeling tool; Section 3 discusses the related works on
maintainability assessment; Section 4 presents our approach for maintainability
assessment of PyCATSHOO models; In Section 5 we describe two alternative
designs of the PyCATSHOO models for the Heated Room test case. We assess
maintainability of these designs and discuss our results in Section 6; Section 7
presents our conclusions.
EDF has a long-standing experience in using and developing DPRA tools for
complex systems. PyCATSHOO is one of the tools developed over last few
decades at EDF R&amp;D. PyCATSHOO implements the concept of Piecewise
Deterministic Markov Process (PDMP) using distributed stochastic hybrid automata.
The principles of this paradigm are described in details in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>Set 1</p>
      <p>Set 2
Design 1 Design 2
Case 0
Case 2</p>
      <p>Case 0a
Case 1a
Case 2a</p>
      <p>
        PyCATSHOO models are used for advanced risk assessment of EDF's hydro
and nuclear electrical generation eet. PyCATSHOO is grounded on the
ObjectOriented (OO) and Multi-Agent System (MAS) paradigms[
        <xref ref-type="bibr" rid="ref22">22</xref>
        ]. Following the
OO paradigm, PyCATSHOO de nes a system, its subsystem or component as
a class - an abstract entity that can be instantiated into objects. The latter
are concrete entities that communicate by message passing and that are able
to perform actions on their own encapsulated states. This paradigm has been
successfully implemented for modeling and analysis of stochastic hybrid systems
as reported in [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ]. Following MAS, PyCATSHOO models a system as a
collection of objects with a reactive agent-like behavior. A reactive agent acts using
a stimulus-response mode where only its current state and its perception of its
environment are relevant.
2.1
      </p>
    </sec>
    <sec id="sec-2">
      <title>DPRA Modeling with PyCATSHOO</title>
      <p>PyCATSHOO o ers a exible modeling framework that allows for de ning generic
components (classes) of hybrid stochastic automata to model a given system or
a class of systems with a particular behaviour. A hybrid stochastic automaton
may exhibit random transitions between its states according to a prede ned
probability law. It may also exhibit deterministic transitions governed by the
evolution of physical parameters.</p>
      <p>A modeling process with PyCATSHOO can be summarised as follows:
{ Conceptual level: A system is decomposed into elementary subsystems,
components.
{ Component level: Each system component is described with a set of
hybrid stochastic automata, state variables and message boxes. Message boxes
ensure message exchange between components.
{ System level: To de ne the system, the components are instantiated from
their corresponding classes. Components' message boxes are connected
according to the system topology.</p>
      <p>
        A DPRA model in PyCATSHOO combines the characteristics of conceptual
model and a software application: it formally describes some aspects of the
physical world for purposes of understanding and communication [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ]; it serves
a formal basis for further system simulation and analysis.
      </p>
      <p>PyCATSHOO o ers Application Programming Interfaces (APIs) in Python
and C++ languages. Once the model is designed, the system behaviour is
simulated. An analyst needs to use Monte Carlo sampling if the system exhibits
random transitions. Sequences (time histories of the system evolution) that lead
to desirable end states are traced and clustered.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], various modeling tools for DPRA are discussed. Whereas some
modeling tools propose a visual modeling interface, model complexity, high
development and maintenance costs are considered the main obstacle for e cient use of
DPRA models in industry [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Quantitative measures of model maintainability
would be of a great value, helping the experts to make better decisions early in
the DPRA model development life cycle.
      </p>
      <sec id="sec-2-1">
        <title>Maintainability of Models: State of the Art</title>
        <p>
          ISO 9000 is a set of international standards on quality management. It de nes
quality as "the totality of features and characteristics of a product or service that
bear on its ability to satisfy stated or implied needs" [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. Maintainability is a
quality characteristic that is de ned as "a set of attributes that bear on the e ort
needed to make speci ed modi cations."
3.1
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Maintainability in Software Engineering</title>
      <p>
        In Standard Glossary of Software Engineering Terminology [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] software
maintainability is de ned as \the ease with which a software system or component
can be modi ed to correct faults, improve performance or other attributes, or
adapt to a changed environment".
      </p>
      <p>
        According to ISO/IEC 25010, maintainability is a sub-characteristic of
product quality that can be associated with more concrete, "measurable", quality
metrics. Various types of metrics accepted in SE include: size metrics (e.g., Line
of Code), lexical metrics (e.g., Halstead software science metrics [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]), metrics
based on control ow graph (e.g., Mc'Cabe's cyclomatic complexity [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]) etc.
      </p>
      <p>
        Metrics speci c to Object-Oriented paradigm focus on OO concepts such as
object, class, attribute, inheritance, method and message passing. Chidamber &amp;
Kemerer's OO metrics [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] are among the most successful predictors in SE. They
include metrics focused on object coupling. In [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] ten software metrics and
their impact on the maintainability are studied. In [
        <xref ref-type="bibr" rid="ref27">27</xref>
        ], a systematic review of
software maintainability prediction models and metrics is presented. According
to this review, a list of successful software maintainability predictors include
Halstead metrics[
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], McCabe's complexity[
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] and size metrics.
      </p>
      <p>
        Abreu's Metrics for Object-Oriented Design (MOOD) are presented in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and
evaluated in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. According to MOOD, various mechanisms like encapsulation,
inheritance, coupling and polymorphism can in uence reliability or
maintainability of software.
      </p>
      <p>
        The maintainability index (MI) is a compound metric [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ] that helps to
determine how easy it will be to maintain a particular body of code. MI uses the
Halstead Volume, Cyclomatic Complexity, Total source lines of code.
      </p>
      <p>The models and metrics above address the maintainability at later phases of
software development life cycle. In the next part of this section, we consider
maintainability at design phase. In particular, maintainability of conceptual models.
3.2</p>
    </sec>
    <sec id="sec-4">
      <title>Maintainability in Conceptual Modeling</title>
      <p>
        Conceptual modeling is the activity of formally describing some aspects of the
physical and social world around us for the purposes of understanding and
communication [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ]. While ISO/IEC 25010 family standards is widely accepted for
evaluating software systems, no equivalent standard for evaluating quality of
conceptual models exist.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref23 ref25 ref4">23,25,4</xref>
        ] frameworks for conceptual modeling quality are presented. In
[
        <xref ref-type="bibr" rid="ref25">25</xref>
        ], the empirical quality is considered as a good indicator of the
maintainability. In [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] maintainability of conceptual schema is de ned as "the ease with
which the conceptual schema can evolve". Quantitative analysis and estimation
of conceptual model quality remains challenging due to lack of measurement [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ].
      </p>
      <p>
        An important body of knowledge is developed adopting and extending the
metrics from software engineering to the conceptual modeling. These metrics are
used to estimate quality of conceptual models and UML diagrams in particular.
In [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], a survey of metrics for UML class diagrams is presented. In [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ], a suite of
metrics for UML use case diagrams and complexity of UML class diagrams is
proposed. Directly measurable metrics are used as an early estimate of development
e orts, implementation time and cost of the system under development. In [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], a
set of metrics to measure structural complexity of UML class diagram are
proposed and validated. The authors promote an idea that the structural properties
(such as structural complexity and size) of a UML class diagram have an e ect
on its modi ability and maintainability. In [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], the same group of researchers
proposes metrics for measuring complexity of UML statechart diagrams.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref28">28</xref>
        ], `Maintainability Estimation Model for Object-Oriented software in
Design phase' (MEMOOD) is presented. This model estimates the
maintainability of class diagrams in terms of their understandability and modi ability.
Modi ability is evaluated using the number of classes, generalisations,
aggregation hierarchies, generalization hierarchies, direct inheritance tree.
4
      </p>
      <sec id="sec-4-1">
        <title>Maintainability Assessment of PyCATSHOO</title>
      </sec>
      <sec id="sec-4-2">
        <title>Models</title>
        <p>
          Intrinsically, maintainability is associated with the maintenance process, which
represents the majority of the costs of a software development life-cycle [
          <xref ref-type="bibr" rid="ref27">27</xref>
          ]. It
is valid for the model development life cycle as well.
        </p>
        <p>
          Assessment of conceptual model maintainability can help designers to
anticipate model complexity, to incorporate required enhancements and to improve
consequently the maintainability of the nal software [
          <xref ref-type="bibr" rid="ref28">28</xref>
          ]. In this work we adapt
and apply several metrics from SE and OO design to evaluate the maintainability
of PyCATSHOO models early at the model development life cycle.
        </p>
        <p>
          Adapting a maintainability de nition from [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ], we de ne maintainability of
a DPRA model as the ease with which a model or its component can be modi ed
to correct faults, improve performance or other attributes, or adapt to a changed
environment.
        </p>
        <p>
          According to [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ], maintainability consists of ve sub-characteristics:
modularity, reusability, analyzability, modi ability and testability. Modi ability
subcharacteristic is most relevant for DPRA models; it speci es a degree to which a
product (a DPRA model in our case) can be e ectively and e ciently modi ed
without introducing defects.
        </p>
        <p>Similar to software system maintainability, various types of maintainance for
DPRA models can be identi ed:
{ Adaptive - modifying the model to cope with changes in the environment;
{ Perfective { improving or enhancing a model to improve overall performance;
{ Corrective { diagnosing and xing errors, possibly ones found by users;
{ Preventive { increasing maintainability or reliability to prevent problems in
the future (i.e., model architecture, design).</p>
        <p>In this work, we focus on adaptive maintenance that re ects a transformation
of simpli ed DPRA models to real-size models.
4.1</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Adaptive Maintainability in PyCATSHOO Models</title>
      <p>Di erent classes of modi cations can be introduced into a PyCATSHOO model
while adapting it to a real-size model. In this work, we consider two classes of
PyCATSHOO model modi cations:
1. Component level modi cations - modi cations that consist in adapting
structure and/or behavior of a model component (e.g., state variables, PDMP
equation methods for continuous variables, start/stop conditions for PDMP
controller, transition conditions, message boxes etc.).
2. System level modi cations - modi cations that consist in adapting
structure and topology of the system (e.g., number of component instances, their
parameters, dependencies, connections via message boxes etc.).</p>
      <p>
        Each modi cation class can be related to di erent requirements and consequently
di erent technical solutions [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. We argue that the "right" architectural and
design decisions made for a simpli ed DPRA model pay o , improving
maintainability and reducing complexity of the real-size DPRA model and PyCATSHOO
models in particular. The maintainability metrics can serve as indicators for
DPRA domain experts in order to assess their design and architectural decisions
early in the modeling.
4.2
      </p>
    </sec>
    <sec id="sec-6">
      <title>Selecting Maintainability Metrics</title>
      <p>
        After a review of some existing metrics focusing on maintainability, we select
the set of metrics applicable to DPRA models and PyCATSHOO models in
particular. We propose a new metric to measure relative modi cations - RLOC.
We summarize the selected metrics in Table 2. Our choice was purely pragmatic:
possibility of seamless integration of metrics into current modeling process with
PyCATSHOO and availability of measurement tools were the main criteria for
our metrics selection. Radon3 is a Python tool which computes various code
metrics. Radon supports raw metrics, Cyclomatic Complexity, Halstead metrics
and the Maintainability Index. Cloc4 - Count Lines of Code - is a tool that
counts blank lines, comment lines, and physical lines of source code in many
programming languages. Given two versions of a code base, cloc can compute
di erences in source lines.
3 http://radon.readthedocs.io/en/latest/intro.html
4 https://sourceforge.net/projects/cloc/?source=typ_redirect
We compare two designs of the Heated Room model reported in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]:
Set 1: Original design. We take the original system model (Case 0) and
create new versions of this model applying system level modi cations (Case 1)
and component level modi cations (Case 2) de ned above (see Table 1). These
modi cations illustrate an adaptive maintenance of a DPRA model in order to
re ect real-size system requirements. This set of three models is created following
the original design ideas from [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] where system components are connected via
PyCATSHOO message boxes, i.e., point-to-point.
      </p>
      <p>
        Set 2: Alternative design. We create a set of semantically equivalent models
of the Heated Room with alternative design (Case 0a - 2a). We promote the
low coupling design principle by implementing well-known patterns of
objectoriented design (i.e., Mediator, Observer [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ]).
      </p>
    </sec>
    <sec id="sec-7">
      <title>Maintainability Assessment and Analysis of Results. We use the metrics</title>
      <p>from Table 2 for both sets of models from Table 1 and analyse the results.</p>
      <p>
        In the following sections, we explain the Heated Room test case, provide the
details on this experiment and discuss the maitainability assessment results.
\Heated Room" is the test case reported in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. This case is about a room which
contains a heater device equipped with a thermostat. The latter switches the
heater o when the room temperature reaches 20 C and switches it on when
the room temperature falls below 15 C. The temperature is governed by a linear
di erential equation as: dT =dt = T + where and depend on the mode
of heater. The heater is assumed to have a constant failure rate = 0:01 and
repair rate = 0:1.
radon
radon
5.1
      </p>
    </sec>
    <sec id="sec-8">
      <title>Set 1: The Original PyCATSHOO Model of Heated Room</title>
      <p>
        The original model of Heated Room is presented in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. It speci es the system
components and their representing classes. The diagram in Fig. 1a shows the
model from [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. For the moment of this publication, the PyCATSHOO modeling
tool does not have an explicit graphical modeling notation. We use the one that is
adopted by EDF experts working with PyCATSHOO. The Heater class de nes
two automata: for functional and for dysfunctional behavior of the heater.
      </p>
      <p>The Room class represents an observed subject: its temperature continuously
evolves. The Heater and the Room communicate via message boxes: the Room
component sends its current temperature to the heater, whereas the Heater
sends its current state (ON or OFF) and its power value to the Room. In the
original model design, the Room class contains the speci cation of a PDMP
controller that implements the physics of the process - the evolution of the room
temperature over time T (t).</p>
      <p>The PDMP controller is a part of the system. Other system components
dene the functioning of the PDMP controller in a distributed manner:
equationMethod() for the room temperature is de ned by the Room class, stop conditions
stopPDMP() (e.g., when the boundary temperature value is reached) are de ned
by the Heater class.</p>
      <p>
        In the initial model (Case 0), the Heated Room System class speci es the
system with one heater and one room connected via corresponding message
boxes (mb Room and mb Heater). The detailed speci cation of the model and
the Python code listing can be found in in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] and in our technical report [
        <xref ref-type="bibr" rid="ref29">29</xref>
        ].
      </p>
      <p>System level modi cations: In Case 1, we modify the structure and
topology of the Heated Room system by instantiating four heaters (H0..H3) and
connecting them explicitly to the room via message boxes. The Heater class does
not change: the heater components independently heat the room following their
initial control logic. Several heaters can be ON or OFF at the same time, based
on the room temperature and their functioning state (OK or NOK). We modify
the Room class and generalize the PDMP equation method in order to establish
the connection between the room and multiple heaters.</p>
      <p>Component level modi cations: In Case 2, we modify the control logic of the
Heater component in order to support the standby redundancy mechanism: one
heater (H0) will be declared as the main heater (the highest priority), whereas
the other heaters will serve as its backups. Backup heaters are switching on only
when all the other heaters with higher priority fail (NOK) and the temperature
drops below Tmin. If a heater with higher priority is repaired (OK), the backup
heaters with lower priority switches o . In this case, only one heater at a time
is heating the room.</p>
      <p>We modify the Heater class: ON/OFF transition conditions; stop condition
for the PDMP controller. We add new message boxes to communicate with
other heaters. We modify the Heated Room System class where new heaters are
explicitly connected to the room and to each other via message boxes.
5.2</p>
    </sec>
    <sec id="sec-9">
      <title>Set 2: The Alternative Design of Heated Room</title>
      <p>
        We integrate the low-coupling design principles early in modeling phase in order
to anticipate component level and system level modi cations. We use well-known
design patterns from OO software development [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ].
      </p>
      <p>The Mediator design pattern encapsulates the interactions between system
component and reduces direct dependencies between them. Integrating mediator
early in the model improves system scalability.</p>
      <p>The Mediator class maintains the lists of active components (heaters in our
case) and subjects or passive components (i.e., rooms) as shown in Fig. 1b. It
mediates the communication between the PDMP controller, the heater(s) and
the room(s) replacing the point to point connections via message boxes. Note
that an arbitrary number of rooms and heaters per room can be con gured with
this design.</p>
      <p>The mediator contains the con gurePDMP() method that allows to
"assemble" the PDMP behavior from the parts de ned by the active and passive
components (i.e., startPDMP(), stopPDMP(), equationMethod()).</p>
      <p>The Heater class is similar to the original design; the message boxes are
removed. The Mediator object updates the heaters with the new value of the
room temperature.</p>
      <p>The Room class contains a current temperature variable that is updated by
the Mediator component. Compared to the original design, the PDMP controller
speci cation is moved from the Room class to the Mediator class. This allows
to decouple the room and the heater.</p>
      <p>In the initial model (Case 0a), the Heated Room System class speci es the
system with one heater and one room attached to a mediator object. con
gurePDMP() method of the mediator terminates the system con guration.
5.3</p>
    </sec>
    <sec id="sec-10">
      <title>Adaptive Maintenance of the Alternative Model: Case 1a, 2a</title>
      <p>System level modi cations: Case 1a is an alternative design of the Heated
Room system with 4 independent heaters. The Heater, the Room and the
Mediator classes are not changed. In the Heated Room System class new heaters
are instantiated and attached to the mediator.</p>
      <p>Component level modi cations: Case 2a implements the standby
redundancy algorithm for heaters. We modify the Heater class following the logic
described in Case 2: ON/OFF transition conditions are changing; stop condition
for the PDMP controller changes.</p>
      <p>Compared to the original design, we do not connect heaters via message
boxes, but implement the Observer design pattern.</p>
      <p>The Observer design pattern allows for implementing speci c behavior
between a group of system components. It de nes a one-to-many dependency
between objects and when one system component changes state, all its dependents
are noti ed and updated automatically. Due to space limitations, we do not
provide the model details in this paper.
6</p>
      <sec id="sec-10-1">
        <title>Maintainability Assessment: Results</title>
        <p>We test the hypothesis from section 4.3 applying the metrics to the model sets
representing the original and the alternative designs. In this paper, we report on
application of the following metrics: Lines of Code (LOC); Relative modi cations
(RLOC) - a metric we propose, Cyclomatic Complexity (CC); Halstead's volume,
di culty, e ort, estimated bugs (V, D, E, B); compound measure Maintainability
index (MI). These metrics are computed statically from the code.
6.1</p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>Size Metrics</title>
      <p>LOC (Lines of Code) is a software metric used to measure the size of a computer
program. It is recognised as a valid indicator of complexity and maintainability.
We use LOC as a measure of the size of the PyCATSHOO model. The results of
LOC measurement for two sets of PyCATSHOO models (Case 0-2, Case 0a-2a)
are shown in Fig.2a. Stacked columns illustrate LOC per case; various colors
correspond to various components. The following can be observed:
- The Mediator class in Set 2 doubles the size of the simpli ed model;
- For the Set 1, the size of all the classes is growing in response to system and
component level modi cations;
- For the Set 2, only the Heater and the Heated Room System classes are growing.
RLOC. We propose to measure relative modi cations (RLOC) in response to
system and component modi cations. We use cloc tool to measure the di erence
between pairs of models (Case 0 and Case 1; Case 1 and Case 2) in both model
sets. We calculate total modi cation as a sum of modi ed, added and removed
lines in the "adapted" model. We de ne RLOC for a case as follows:
RLOCcase =</p>
      <sec id="sec-11-1">
        <title>LOCmodif + LOCadd + LOCrem</title>
      </sec>
      <sec id="sec-11-2">
        <title>LOCcase</title>
        <p>
          This metric allows for more precise measurement of modi cations as it takes
into consideration not only the total change in model size. Removing or
modifying the code (as well as model elements in concept model) are also considered.
Table 3 summarises the RLOC measures. RLOC for the Set 1 shows that the
model was modi ed on 82.25% to implement scalability (from 1 to 4 heaters)
and further on 108.69% to implement standby redundancy of the heaters.
While having bigger initial size (Fig. 2a), the model in the Set 2 was modi ed on
18.57% to scale for 4 heaters and on 83.4% to implement standby redundancy.
(a) LOC analysis
(b) CC analysis
McCabe [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ] proposed Cyclomatic Complexity Measure to quantify complexity
of a given software based on its ow-graph. A ow graph is based on
decisionmaking constructs of a program. Fig.2b illustrates cyclomatic complexity
measure for the model sets. Whereas the absolute CC values for all models indicate
low complexity (below 10), we are interested in the CC evolution in response to
adaptive model modi cations. The graph in Fig.2b indicates the faster
complexity growth for the Set 1. This corroborates with the previous measures.
Halstead metrics consider a program as a sequence of operators and their
associated operands. For a given problem, let: 1 = the number of distinct operators;
2 = the number of distinct operands; N1 = the total number of operators; N2
= the total number of operands. From these numbers, several measures can be
calculated. In this work, we measured volume (V), di culty (D), e orts (E) and
delivered bugs (B):
        </p>
        <p>V = N
log2 ; D =
Here D can be related to the di culty of a PyCATSHOO model to write or to
understand; B is an estimate for the number of errors. Fig.3 illustrates three
metrics for two modeling sets and an evolution of these metrics in response
to adaptive model modi cations. The results show that an estimate number of
errors (B) is higher for the Case 0a due to implementation of the Mediator;
however it seems to remain stable after adaptive modi cations (Case 1a-2a)
compared to the original design. Idem for the di culty and e ort measures.
Maintainability Index is a software metric which measures how maintainable
(easy to support and change) the source code is. The maintainability index is
calculated as a factored formula consisting of Lines Of Code (LOC), Cyclomatic
Complexity (CC) and Halstead volume (V):</p>
        <p>M I = 171
5:2
ln(V )
0:23</p>
        <p>
          CC
16:2
ln(LOC)
Fig.4 illustrates MI measure for the model sets:
-Room class of the Set 2 and Heated Room System class of both sets are
considered as 100% maintainable.
-MI of the Heater class decreases for both sets. This can be explained by its
growing complexity and size.
-Average MI, though it remains very high for both sets, drops from 84.2 to
79.2 for the Set 1 and from 86.4 to 85.75 for the Set 2. More metrics and their
discussion can be found in our technical report [
          <xref ref-type="bibr" rid="ref29">29</xref>
          ].
        </p>
        <sec id="sec-11-2-1">
          <title>Conclusion</title>
          <p>We proposed a pragmatic approach for maintainability assessment of DPRA
models created with PyCATSHOO modeling tool. We claim that the adopted
metrics can be used as early indicators for estimating maintainability of the
PyCATSHOO models.</p>
          <p>
            To validate our hypothesis, we created two model sets of the "Heated Room"
system. Models in Set 1 follow the original design reported in [
            <xref ref-type="bibr" rid="ref6">6</xref>
            ] and based on
point to point connection between system components. Set 2 promotes the
lowcoupling design principles. We used LOC, CC, Halstead and MI metrics on both
sets of models.
          </p>
          <p>The evaluation shows that the PyCATSHOO model based on design patterns
requires more e orts at creation compared to the model that uses
point-topoint connections. Nevertheless, complexity of this model grows slower when
the number of components increases or when new types of dependencies are
introduced. This indicates that the low coupling principle applied early in the
modeling improves scalability and maintainability of the real-size DPRA model.
The results corroborate with an engineering practice showing quantitatively the
di erence between designs even for a simple example of "Heated room" and thus
validate our hypothesis. Based on this, we conclude that the selected metrics can
be further considered for DPRA models assessment.</p>
          <p>Despite the encouraging results, we consider them as preliminaries. As the
next step, we plan to replicate our experiment and to assess the maintainability
of the real PyCATSHOO projects. We also plan to extend the list of metrics
integrating the metrics on Structural complexity and other OO-speci c metrics.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1. Brito e Abreu,
          <string-name>
            <surname>F.</surname>
          </string-name>
          :
          <article-title>The mood metrics set</article-title>
          .
          <source>In: proc. ECOOP</source>
          . vol.
          <volume>95</volume>
          , p.
          <volume>267</volume>
          (
          <year>1995</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Aldemir</surname>
          </string-name>
          , T.:
          <article-title>A survey of dynamic methodologies for probabilistic safety assessment of nuclear power plants</article-title>
          .
          <source>Annals of Nuclear Energy</source>
          <volume>52</volume>
          ,
          <issue>113</issue>
          {
          <fpage>124</fpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bouissou</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chraibi</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chubarova</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          :
          <article-title>Critical comparison of two user friendly tools to study piecewise deterministic markov processes (pdmp)</article-title>
          .
          <source>ESREL</source>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cher</surname>
            ,
            <given-names>S.S.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Akoka</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Comyn-Wattiau</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          :
          <article-title>Conceptual modeling quality-from eer to uml schemas evaluation</article-title>
          .
          <source>In: International Conference on Conceptual Modeling</source>
          . pp.
          <volume>414</volume>
          {
          <fpage>428</fpage>
          . Springer (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Chidamber</surname>
            ,
            <given-names>S.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kemerer</surname>
            ,
            <given-names>C.F.</given-names>
          </string-name>
          :
          <article-title>A metrics suite for object oriented design</article-title>
          .
          <source>IEEE Transactions on software engineering 20(6)</source>
          ,
          <volume>476</volume>
          {
          <fpage>493</fpage>
          (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Chraibi</surname>
          </string-name>
          , H.:
          <article-title>Dynamic reliability modeling and assessment with pycatshoo: Application to a test case</article-title>
          .
          <source>PSAM</source>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Chraibi</surname>
          </string-name>
          , H.:
          <article-title>Pycatshoo:toward a new platform dedicated to dynamic reliability assessments of hybrid systems</article-title>
          .
          <source>PSAM</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Coyne</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Siu</surname>
          </string-name>
          , N.:
          <article-title>Simulation-Based Analysis for Nuclear Power Plant Risk Assessment: Opportunities and Challenges</article-title>
          .
          <source>In: Proceeding of the ANS Embedded Conference on Risk Management for Complex Socio-Technical Systems</source>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Genero</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Manso</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Visaggio</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Canfora</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Piattini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Building measurebased prediction models for uml class diagram maintainability</article-title>
          .
          <source>Empirical Software Engineering</source>
          <volume>12</volume>
          (
          <issue>5</issue>
          ),
          <volume>517</volume>
          {
          <fpage>549</fpage>
          (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Genero</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Miranda</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Piattini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>De ning and validating metrics for uml statechart diagrams</article-title>
          .
          <source>Proceedings of QAOOSE</source>
          <year>2002</year>
          (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Genero</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Piattini</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Calero</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>A survey of metrics for uml class diagrams</article-title>
          .
          <source>Journal of object technology 4(9)</source>
          ,
          <volume>59</volume>
          {
          <fpage>92</fpage>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Gilb</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Designing maintainability in software engineering: a quanti ed approach</article-title>
          .
          <source>International Council on Systems Engineering (INCOSE)</source>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Halstead</surname>
            ,
            <given-names>M.H.</given-names>
          </string-name>
          :
          <article-title>Elements of software science</article-title>
          , vol.
          <volume>7</volume>
          . Elsevier New York (
          <year>1977</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Harrison</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Counsell</surname>
            ,
            <given-names>S.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nithi</surname>
            ,
            <given-names>R.V.</given-names>
          </string-name>
          :
          <article-title>An evaluation of the mood set of objectoriented software metrics</article-title>
          .
          <source>IEEE Transactions on Software Engineering</source>
          <volume>24</volume>
          (
          <issue>6</issue>
          ),
          <volume>491</volume>
          {
          <fpage>496</fpage>
          (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Hoyle</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Iso 9000: quality systems handbook (</article-title>
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16. IEEE:
          <article-title>Standard glossary of software ulengineering terminology</article-title>
          .
          <source>IEEE Software Engineering Standards Collection</source>
          . IEEE pp.
          <volume>610</volume>
          {
          <issue>12</issue>
          (
          <year>1990</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17. ISO/IEC: ISO/IEC 25010 -
          <article-title>Systems and software engineering - Systems and software Quality Requirements and Evaluation (SQuaRE) - System and software quality models</article-title>
          .
          <source>Tech. rep. (</source>
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Henry</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Object-oriented metrics that predict maintainability</article-title>
          .
          <source>Journal of systems and software 23(2)</source>
          ,
          <volume>111</volume>
          {
          <fpage>122</fpage>
          (
          <year>1993</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>Marchesi</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Ooa metrics for the uni ed modeling language</article-title>
          .
          <source>In: Software Maintenance and Reengineering</source>
          ,
          <year>1998</year>
          . Proceedings of the Second Euromicro Conference on. pp.
          <volume>67</volume>
          {
          <fpage>73</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>McCabe</surname>
            ,
            <given-names>T.J.:</given-names>
          </string-name>
          <article-title>A complexity measure</article-title>
          .
          <source>IEEE Transactions on software Engineering (4)</source>
          ,
          <volume>308</volume>
          {
          <fpage>320</fpage>
          (
          <year>1976</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Meseguer</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sharykin</surname>
          </string-name>
          , R.:
          <article-title>Speci cation and analysis of distributed object-based stochastic hybrid systems</article-title>
          .
          <source>In: International Workshop on Hybrid Systems: Computation and Control</source>
          . pp.
          <volume>460</volume>
          {
          <fpage>475</fpage>
          . Springer (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <surname>Michel</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ferber</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Drogoul</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , et al.
          <article-title>: Multi-agent systems and simulation: a survey from the agents community's perspective</article-title>
          .
          <source>Multi-Agent Systems: Simulation and Applications</source>
          ,
          <source>Computational Analysis, Synthesis, and Design of Dynamic</source>
          Systems pp.
          <volume>3</volume>
          {
          <issue>52</issue>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23. Moody, D.L.:
          <article-title>Theoretical and practical issues in evaluating the quality of conceptual models: current state and future directions</article-title>
          .
          <source>Data &amp; Knowledge Engineering</source>
          <volume>55</volume>
          (
          <issue>3</issue>
          ),
          <volume>243</volume>
          {
          <fpage>276</fpage>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <surname>Mylopoulos</surname>
          </string-name>
          , J.:
          <article-title>Conceptual modelling and telos</article-title>
          .
          <source>Conceptual Modelling, Databases, and CASE: an Integrated View of Information System Development</source>
          , New York: John Wiley &amp; Sons pp.
          <volume>49</volume>
          {
          <issue>68</issue>
          (
          <year>1992</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <surname>Nelson</surname>
            ,
            <given-names>H.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Poels</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Genero</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Piattini</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>A conceptual modeling quality framework</article-title>
          .
          <source>Software Quality Journal</source>
          <volume>20</volume>
          (
          <issue>1</issue>
          ),
          <volume>201</volume>
          {
          <fpage>228</fpage>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26.
          <string-name>
            <surname>Oman</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hagemeister</surname>
          </string-name>
          , J.:
          <article-title>Metrics for assessing a software system's maintainability</article-title>
          .
          <source>In: Conference of Software Maintenance</source>
          . pp.
          <volume>337</volume>
          {
          <fpage>344</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>1992</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          27.
          <string-name>
            <surname>Riaz</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mendes</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tempero</surname>
          </string-name>
          , E.:
          <article-title>A systematic review of software maintainability prediction and metrics</article-title>
          .
          <source>In: 3rd International Symposium on Empirical Software Engineering and Measurement</source>
          . pp.
          <volume>367</volume>
          {
          <fpage>377</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          28.
          <string-name>
            <surname>Rizvi</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Khan</surname>
          </string-name>
          , R.:
          <article-title>Maintainability estimation model for object-oriented software in design phase (memood)</article-title>
          .
          <source>arXiv preprint arXiv:1004.4447</source>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          29.
          <string-name>
            <surname>Rychkova</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Boissier</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chraibi</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rychkov</surname>
          </string-name>
          , V.:
          <article-title>A pragmatic approach for measuring maintainability of dpra models</article-title>
          .
          <source>arXiv preprint arXiv:1706.02259</source>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref30">
        <mixed-citation>
          30.
          <string-name>
            <surname>Wolfgang</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Design patterns for object-oriented software development</article-title>
          . Reading, Mass.:
          <string-name>
            <surname>Addison-Wesley</surname>
          </string-name>
          (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>