<!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>Cumulative Coverage of the Simulink-based MIL Unit Testing for Application Layer of Automotive</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Dmytro Humennyi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Valerii Kozlovskyi</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tatyana Nimchenko</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yanina Shestak</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Embedded division, N-iX corporation</institution>
          ,
          <addr-line>Lviv</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>National Aviation University</institution>
          ,
          <addr-line>Kyiv</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Taras Shevchenko National University of Kyiv</institution>
          ,
          <addr-line>Kyiv</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <fpage>163</fpage>
      <lpage>168</lpage>
      <abstract>
        <p>The publication addresses the topic of assessing the completeness of the test coverage of software code to ensure compliance with the criteria of the test process, which are given in ISO 26262 in Part 6. And are used for the automotive industry as an application level. The common case of cumulative coating collection, which is observed at the component levels, is taken into account. Attention is paid to the case when the component consists of modules that have been implemented by MATLAB Simulink. The publication contains some approaches to estimating the completeness of model coverage by collecting cumulative coverage.</p>
      </abstract>
      <kwd-group>
        <kwd>1 Automotive</kwd>
        <kwd>coverage estimation</kwd>
        <kwd>model-based test</kwd>
        <kwd>application level</kwd>
        <kwd>functional safety</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        for code coverage test. Problems and solutions describing alternative development methods, namely
Model Based Design, belong to Pelliccione, Patrizio [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. A complete review of testing methods for the
automotive industry is done in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Methods</title>
      <p>But a good solution is to abandon the classical and certainly effective method of development,
namely - writing program code, and adopt an alternative method - Model-Based-Design and its
"righthand side" of the V-scheme of development—Model-Based-Test.</p>
      <p>According to ISO 26262, the part of the software component (this also applies to the hardware
implementation), the failure of which threatens the life and health of both the vehicle user and the
environment, are classified on a scale of ASIL levels ranging from A to D, where D describes cases of
the highest threat.</p>
      <p>Along with other criteria indicating the safety of software implementation, there are
recommendations for evaluating the completeness of test coverage by test scenarios, followed by an
evaluation of each of these scenarios according to the expected behavior.</p>
      <p>It is important to note those levels of software implementation that require coverage assessment.
Thus, according to ISO 26262 - 6 (9.4.5) - MCDC coverage is recommended for ASIL A, B, C and
strongly recommended for ASIL D.</p>
      <p>From a Model-Based-Design perspective, the "Unit" abstraction must be implemented within a
single file and must occupy a subsystem allocated to it.</p>
      <p>The Simulink environment with Simulink Coverage, Simulink Report and Simulink Test allows you
to get an estimate of the test coverage for a single module.</p>
      <p>For the most part, according to recommendations from Mathworks, the Test Harness is based on the
Simulink Test tool. Test Harness includes such basic blocks as Test Assestments, Test Sequences, and
Unit Under Test, which perform the roles of test sequence verification, test sequence generator, and the
object under test, respectively. As shown in Fig. 1.</p>
      <p>Thus, one module is implemented in a subsystem, and both compliance and the percentage of test
coverage can be evaluated for it by embedded methods.</p>
      <p>If we consider the developed software from a higher degree of abstraction, then, by integrating with
each other, software modules form software components.</p>
      <p>Modules within components have gained additional entities - interfaces. These interfaces have
properties, in particular—data type. Coverage of two or more modules by tests implies that intermediate
interfaces are also covered by tests, thus reducing the risk of errors at the interface level.</p>
      <p>An important task is to develop methods for evaluating the completeness of component coverage
after the first level of integration.</p>
      <p>
        Mathworks provides several tools for assessing coverage at the integration level. One of them is
based on the Design Verifier Toolset and consists in looking for Dead-Logic in the implementation.
Design Verifier does not actually evaluate coverage. It points to parts of the implementation that are
not involved in any of the code or model scenarios. Thus, this tool does not comply with
recommendation ISO 26262-6 (9.4.5).
4. Results
name
refModelcovIds
topModelcovId
}
1
"TestHarness_NAME"
[2 1]
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
      </p>
      <p>Another way, supported by Mathworks, is to use Simulink Coverage Tools, available with
MATLAB, certified for ISO 26262 and ISO 29119 and gives access to coverage metrics for each of the
component subsystems.</p>
      <p>For example, Mathworks recommends using the following code:
cvdo = cvsim (mdl)
cvsave (&lt;path_to_file&gt;, cvdo)
cvhtml (&lt;path_to_file&gt;, cvdo)
with the .CVT file labeling the section describing the coverage. The section looks as follows:
CV_Database {
modelcov {
id
end
// alternative method of the testing
end
otherwise % Custom Tool
disp (' /// NDA');
disp ([' In the TestSuite exists ' num2str(NDA) ' TestCases']);
warning ('off','all');
SimOut = sim (['PATH TO FILE ' NameReq '.slx'],'ReturnWorkspaceOutputs','on');
warning ('on','all');
res = 'PASS'; % Default - The test is Done</p>
      <p>for TestCaseNum = 1:HowManyTestCasesAreHere % Repeat for eatch TestCase
% Find Fail testcase. ('-1' - The Test is FAIL;
% '1' - The Test is PASS.
if (min (eval (['NDA.REQ_' NameReq '_result.TestCase' num2str(TestCaseNum) '.Data']))
res = 'FAIL';
TestStatus(TestCaseNum) = -1;</p>
      <p>TestCaseStatus = 'FAIL';
else</p>
      <p>TestStatus(TestCaseNum) = 1;</p>
      <p>TestCaseStatus = 'PASS';
end
disp ([' Unit Test for TestCase #' num2str(TestCaseNum) ' is ' TestCaseStatus]);
end
disp ('- - - - - - - - - - - - - - - - - - - - - - - - - - - - -');
disp (' &lt;strong&gt;UNIT TEST RESULT:&lt;/strong&gt;');
disp ([' for REQ-' num2str(NameReq)]);
disp ([' ' TaskTicket]);
disp ([' ' res]);
TestSuiteStatus = [' REQ-' num2str(NameReq) '(' TaskTicket ') is ' res];
disp ('- - - - - - - - - - - - - - - - - - - - - - - - - - - - -');
res = TestSuiteStatus;
%% COVERAGE CALCULATION
% precondition
coverage.complexity = -1;
coverage.condition = -1;
coverage.decision = -1;
coverage.execution = -1;
coverage.mcdc = -1;
warning ('off','all');
% if option is activated then ...
if (TestMode.coverage.condition == true || ...</p>
      <p>TestMode.coverage.decision == true || ...</p>
      <p>TestMode.coverage.mcdc == true)
disp (' &lt;strong&gt;Coverage and Complexity:&lt;/strong&gt;');
mdl = ['NDA_' NameReq];
mdl_subsys = [PathTo.DesignModel 'NDA_' NameUUT];
open_system(mdl);
open_system(mdl_subsys);
[coverage.tests, coverage.data] = cvload (cvtFileName);
if TestMode.coverage.decision == true
cov = decisioninfo (coverage.data{1}, ['DesignModel_' NameUUT]);</p>
    </sec>
    <sec id="sec-4">
      <title>5. Conclusion</title>
      <p>During operation and augmentation, the method described by Mathworks showed critical
dependencies, specifically:
1. in a component, all interfaces must be shared by blocks;
2. if a model is connected as a linked model, then the linked model must have the same
dimensionality as the model to which it is authenticated.</p>
      <p>If these conditions are not met, the method is invalid.</p>
      <p>Promising for further consideration is a method that is based on the creation of Simulink libraries,
which would contain a component entirely. In this case, all the blocks included in the components would
have common interfaces with each other, so they would be suitable for collecting cumulative coverage.
However, this approach to estimating coverage is redundant due to the need to build and maintain a
library component. It is also not the typical, recommended by Mathworks, solution, hence causing
additional difficulties in the qualification and certification phase of the software product, methods and
tools that were used to build the vehicle.</p>
    </sec>
    <sec id="sec-5">
      <title>6. Acknowledgements</title>
      <p>I thank my colleagues, namely Oleksandr Denysenko and Oleksii Chkalov, for their support in the
process of working on this topic, without whom the work would have dragged on for a silly time.</p>
      <p>Last but not least, I thank Igor Kozakevych and Artem Kharchenko for organizational support in
producing the publication and Bogdan Poklad for editing and translation.</p>
    </sec>
    <sec id="sec-6">
      <title>7. References</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Yoon</surname>
          </string-name>
          ,
          <string-name>
            <surname>Sang-Ho</surname>
          </string-name>
          .
          <article-title>"Automatic code generation</article-title>
          .
          <source>"</source>
          (
          <year>2013</year>
          ). // https://kr.mathworks.com/content/ dam/mathworks/mathworks-dot-com/solutions/automotive/files/kr-expo-2013/Track_2_4.pdf
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Drozdenko</surname>
          </string-name>
          ,
          <string-name>
            <surname>Benjamin</surname>
          </string-name>
          , et al.
          <article-title>"Implementing a matlab-based self-configurable software defined radio transceiver</article-title>
          .
          <source>" International Conference on Cognitive Radio Oriented Wireless Networks</source>
          . Springer, Cham,
          <year>2015</year>
          . // https://genesys-lab.org/papers/Crown-Com-SDR.pdf
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Bispo</surname>
            , João,
            <given-names>Luís</given-names>
          </string-name>
          <string-name>
            <surname>Reis</surname>
          </string-name>
          , and João MP Cardoso.
          <article-title>"Techniques for efficient MATLAB-to-C compilation."</article-title>
          <source>Proceedings of the 2nd ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming</source>
          .
          <year>2015</year>
          . // https://repositorio.inesctec.pt/server/ api/core/bitstreams/275e8d49-c5c3
          <string-name>
            <surname>-</surname>
          </string-name>
          486e
          <string-name>
            <surname>-</surname>
          </string-name>
          adb6-4eb3d0460294/content
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Klaponin</surname>
            <given-names>Y.</given-names>
          </string-name>
          <article-title>Structural model of robot-manipulator for capture of no-cooperation client spacecraft / Klaponin Y</article-title>
          .,
          <string-name>
            <surname>Humennyi</surname>
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parkhomey</surname>
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rudnitska</surname>
            <given-names>O</given-names>
          </string-name>
          // CEUR Workshop Proceedings (.http://ceur.ws.
          <source>org)</source>
          Vol-
          <volume>2067</volume>
          urn:nbn:de:
          <fpage>0074</fpage>
          -
          <lpage>2067</lpage>
          -8-0 P.
          <fpage>151</fpage>
          -
          <lpage>157</lpage>
          . - ISSN 1613-0073 (http://ceurws.org)
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Pelliccione</surname>
          </string-name>
          ,
          <string-name>
            <surname>Patrizio</surname>
          </string-name>
          , et al.
          <article-title>"Automotive architecture framework: The experience of volvo cars</article-title>
          .
          <source>" Journal of systems architecture 77</source>
          (
          <year>2017</year>
          ):
          <fpage>83</fpage>
          -
          <lpage>100</lpage>
          . // https://www.researchgate.net/profile/ Patrizio-Pelliccione/publication/314033799_Automotive_
          <article-title>Architecture_Framework_The_ Experience_of_Volvo_Cars/links/5a1604020f7e9bc6481c7eab/Automotive-ArchitectureFramework-The-Experience-of-Volvo-Cars</article-title>
          .pdf
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Anton</given-names>
            <surname>Albinsson</surname>
          </string-name>
          , Fredrik Bruzelius, at al.
          <article-title>Validation of vehicle-based tyre testing methods</article-title>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>