SlideShare a Scribd company logo
.lusoftware verification & validation
VVS
Testing of Cyber-Physical Systems:
Diversity-driven Strategies
Lionel Briand
COW 57, London, UK
Cyber-Physical Systems
• A system of collaborating computational elements controlling
physical entities
2
Context
• Projects on verification of cyber-physical systems, control
systems, autonomous systems, …
• Focus on safety, performance, resource usage …
• Automotive, satellite, energy, manufacturing …
3
Controllers
4
Plant
Controller
Actuator Sensor
Disturbances
Reference Inputs
Decision-Making Components
5
Sensor
Controller
Actuator Decision
Plant
Development Process
6
Functional modeling:
• Controllers
• Plant
• Decision
Continuous and discrete
Simulink models
Model simulation and
testing
Architecture modelling
• Structure
• Behavior
• Traceability
System engineering modeling
(SysML)
Analysis:
• Model execution and
testing
• Model-based testing
• Traceability and
change impact
analysis
• ...
(partial) Code generation
Deployed executables on
target platform
Hardware (Sensors ...)
Analog simulators
Testing (expensive)
Hardware-in-the-Loop
Stage
Software-in-the-Loop
Stage
Model-in-the-Loop Stage
Simulink Models - Simulation
• Simulation Models
• heterogeneous
8
Software Plant
Model
Network Model
• continuous behavior
• are used for
• algorithm design testing
• comparing design options
Cruise Control: Plant
9
Problem
• How do we automatically verify and test CP functional models
(e.g., controller, plant, decision) at MiL?
• What types of requirements / properties do we check?
• Commercial tools:
• Cannot handle continuous operators, floating point models (e.g., SLDV,
Reactis)
• Based on model structural coverage: low fault detection
• Can only handle linear systems and specific properties (Linear analysis
toolbox)
10
Challenges
• Limited work on verification and testing of controllers and
decision-making components in CP systems
• Space of test input signals is extremely large.
• Model execution, especially when involving plant models,
is extremely expensive.
11
More Challenges
• Test oracles are not simple Boolean properties and easily
known in advance – they involve analyzing changes in
value over time (e.g., signal patterns) and assessing levels
of risk.
• Simulatable plant model of the physical environment is not
always available or fully accurate and precise.
12
Diversity Strategies
• Strategy: Maximize diversity of test cases
• Assumption: “the more diverse the test cases the higher their fault revealing
capacity”
• Challenge: Define “diversity” in context, pair-wise similarity computation, test
selection algorithm
• Examples of early work
• ISSRE 2003, Leon and Podgurski, filtering and prioritizing test cases, relying on code
coverage
• FSE 2010, Hemmati et al., Similarity-based test selection applied to model-based testing
based on state models for control systems, selection with GA
• Full control on test budget: Maximize fault detection for a given test suite size
13
Testing Controllers
14
Controllers are Pervasive
15
• Supercharger bypass flap controller
üFlap position is bounded within
[0..1]
üImplemented in MATLAB/Simulink
ü34 (sub-)blocks decomposed into 6
abstraction levels
Supercharger
Bypass Flap
Supercharger
Bypass Flap
Flap position = 0 (open) Flap position = 1 (closed)
Simple Example
16
MiL Test Cases
17
Model
Simulation
Input
Signals
Output
Signal(s)
S3
t
S2
t
S1
t
S3
t
S2
t
S1
t
Test Case 1
Test Case 2
Initial
Desired Value
Final
Desired Value
time time
Desired Value
Actual Value
T/2 T T/2 T
Test Input Test Output
Plant
Model
Controller
(SUT)
Desired value Error
Actual value
System output+
-
MiL Testing of Controllers
18
Requirements and Test Objectives
InitialDesired
(ID)
Desired ValueI (input)
Actual Value (output)
FinalDesired
(FD)
time
T/2 T
Smoothness
Responsiveness
Stability
20
21
Test Generation Approach
• We formalize controller’s requirements in terms of
desired and actual outputs
Smoothness
• We rely on controller’s feedback to automate test
oracles
desired value
actual value
< Threshold Desired Value
(Setpoint)
Actual Value (feedback)
System
Output
+
-
Control
Signal
Plant
(environment)Controller
A Search-Based Test Approach
Initial Desired (ID)
FinalDesired(FD)
Worst Case(s)?
• Search directed by model
execution feedback
• Finding worst case inputs
• Possible because of automated
oracle (feedback loop)
• Different worst cases for
different requirements
• Worst cases may or may not
violate requirements
22
Initial Solution
HeatMap
Diagram
1. Exploration
List of
Critical
RegionsDomain
Expert
Worst-Case
Scenarios
+
Controller-
plant
model
Objective
Functions
based on
Requirements
2. Single-State
Search
time
Desired Value
Actual Value
0 1 2
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
Initial Desired
Final Desired
23
Results
• We found much worse scenarios during MiL testing than our
partner had found so far
• These scenarios are also run at the HiL level, where testing is
much more expensive: MiL results -> test selection for HiL
• But further research was needed:
• Simulations are expensive
• Configuration parameters
24
Final Solution
+
Controller
Model
(Simulink)
Worst-Case
Scenarios
List of
Critical
PartitionsRegression
Tree
1.Exploration with
Dimensionality
Reduction
2.Search with
Surrogate
Modeling
Objective
Functions
Domain
Expert
Visualization of the
8-dimension space
using regression treesDimensionality
reduction to identify
the significant variables
(Elementary Effect Analysis)
Surrogate modeling
to predict the fitness
function and
speed up the search
(Machine learning)
25
Open Loop Controllers
On
Off
CtrlSig
• Mixed discrete-continuous behavior:
Simulink stateflows
• No plant model: Much quicker simulation
time
• No feedback loop -> no automated oracle
• The main testing cost is the manual
analysis of output signals
• Goal: Minimize test suites
• Challenge: Test selection
• Entirely different approach to testing
echniques. We consider this criterion
ows have complex internal structures
ations, making them less amenable to
hey have rich time-continuous outputs.
following contributions:
lem of testing Stateflows with mixed
ehaviours. We propose two new test
output stability and output continuity
ting test inputs that are likely to pro-
uts exhibiting instability and disconti-
vely.
ox coverage and the blackbox output
eria to Stateflows, and evaluate their
or continuous behaviours. The former
aditional state and transition coverage
d the latter is defined based on the re-
s criterion [?].
ness of our newly proposed and the
ria by applying them to three Stateflow
wo industrial and one public domain.
RESULT.
(c) Engaging state of SCC -- mixed discrete-continuous behaviour
Disengaging
Engaged
[disengageReq]/time := 0
[time>5]
[time>5]
time + +;
OnMoving OnSlipping
OnCompleted
time + +;
ctrlSig := f(time)
Engaging
time + +;
ctrlSig := g(time)
time + +;
ctrlSig := 1.0
[¬(vehspd = 0)
time > 2]
[(vehspd = 0)
time > 3]
[time > 4]
Figure 1: Supercharge Clutch Controller (SCC) Stateflow.
transient states [?], engaging and disengaging, specifying that mov-
ing from the engaged to the disengaged state and vice versa takes
six milisec. Since this model is simplified, it does not show han-
dling of alterations of the clutch state during the transient states28
Selection Strategies Based on Search
• White-box structural coverage
• State Coverage
• Transition Coverage
• Input signal diversity
• Output signal diversity
• Failure-Based selection criteria
• Domain specific failure patterns
• Output Stability
• Output Continuity
S3
t
S3
t
29
System
Output
Input
Signals
Output
Signals
Controller
Plant
(environment)
30
instability
failure pattern
discontinuity
failure pattern
output diversity
• We assume test oracles are manual
Test Generation Approach
• We rely on output signals to produce small test
suites with high fault-revealing ability
Output Diversity -- Vector-Based
31
Output
Time
Output Signal 2
Output Signal 1
Normalized Euclidian
Distance
32
Output Diversity -- Feature-Based
increasing (n) decreasing (n)constant-value (n, v)
signal features
derivative second derivative
sign-derivative (s, n) extreme-derivatives
1-sided
discontinuity
discontinuity
1-sided continuity
with strict local optimum
value
instant-value (v)
constant (n)
discontinuity
with strict local optimum
increasing
C
A
B
33
Output Diversity -- Feature-Based
increasing (n) decreasing (n)constant-value (n, v)
signal features
derivative second derivative
sign-derivative (s, n) extreme-derivatives
1-sided
discontinuity
discontinuity
1-sided continuity
with strict local optimum
value
instant-value (v)
constant (n)
discontinuity
with strict local optimum
increasing
C
A
B
Similarity: To which extent any part of a signal is similar to a
feature
Failure-based Test Generation
34
Instability Discontinuity
0.0 1.0 2.0
-1.0
-0.5
0.0
0.5
1.0
Time
CtrlSigOutput
• Search: Maximizing the likelihood of presence of specific failure
patterns in output signals
• Domain-specific failure patterns elicited from engineers
0.0 1.0 2.0
Time
0.0
0.25
0.50
0.75
1.0
CtrlSigOutput
Search
• Whole test suite generation approach
• Used when objective functions characterize the test suite
• Optimize test objective for a given test suite size (budget
for manual oracles)
• Maximize the minimum distances of each output signal
vector from the other output signal vectors
• Adaptation of Simulated Annealing
35
Faulty Model Output
36
Correct Model Output
Fault-Revealing Ability
Covers the fault and Covers the fault but
is Likely to reveal it is very unlikely to reveal it
Results
• The test cases resulting from state/transition coverage
algorithms cover the faulty parts of the models
• However, they fail to generate output signals that are
sufficiently distinct from expectations, hence yielding a low
fault revealing rate
• Diversity strategies significantly outperforms coverage-based
and random testing
• Output-based algorithms are much more effective, both based
on diversity and failure patterns
37
Results
• Feature-based diversity fares significantly better than
vector-based diversity
• Strategies based on failure patterns find different types of
faults than diversity strategies
• Existing commercial tools: Not effective at finding faults,
not applicable to entire Simulink models, e.g., Simulink
Design Verifier
38
Example Failures
39
Example Failures
40
Instability
Discontinuity
Conclusions
• Maximizing output diversity helps identify scenarios
where the discrepancy between the produced and
expected signal is large
• Useful when test output signals are analyzed manually
• Simulink models and their outputs are complex
• Helps maximize fault detection within a fixed budget
• Properly defining diversity was a challenge
41
Reflections on Diversity
• Useful strategy when no precise guidance, directly
related to the test objectives, is available for the search
• In the general, the key issue is how to define diversity in
an optimal way given the objectives
• In practice, how diversity is defined also depends on
what information is available at a reasonable cost
• The time complexity of computing diversity is a major
cost of the search – it must be accounted for
42
Acknowledgements
• Shiva Nejati
• Reza Matinnejad
• Delphi Automotive Systems, Luxembourg
43
References
• R. Matinnejad et al., “MiL Testing of Highly Configurable Continuous Controllers:
Scalable Search Using Surrogate Models”, IEEE/ACM ASE 2014 (Distinguished paper
award)
• R. Matinnejad et al., “Effective Test Suites for Mixed Discrete-Continuous Stateflow
Controllers”, ACM ESEC/FSE 2015 (Distinguished paper award)
• R. Matinnejad et al., “Automated Test Suite Generation for Time-continuous
Simulink Models“, IEEE/ACM ICSE 2016
• R. Matinnejad et al., “Test Generation and Test Prioritization for Simulink Models
with Dynamic Behavior“, under minor revision with IEEE TSE
44
.lusoftware verification & validation
VVS
Testing of Cyber-Physical Systems:
Diversity-driven Strategies
Lionel Briand
COW 57, London, UK

More Related Content

PDF
Automated Testing of Autonomous Driving Assistance Systems
PDF
Test Case Prioritization for Acceptance Testing of Cyber Physical Systems
PDF
Metamorphic Security Testing for Web Systems
PDF
HITECS: A UML Profile and Analysis Framework for Hardware-in-the-Loop Testing...
PDF
Scalable Software Testing and Verification of Non-Functional Properties throu...
PDF
Automated Test Suite Generation for Time-Continuous Simulink Models
PDF
Testing Machine Learning-enabled Systems: A Personal Perspective
PDF
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Automated Testing of Autonomous Driving Assistance Systems
Test Case Prioritization for Acceptance Testing of Cyber Physical Systems
Metamorphic Security Testing for Web Systems
HITECS: A UML Profile and Analysis Framework for Hardware-in-the-Loop Testing...
Scalable Software Testing and Verification of Non-Functional Properties throu...
Automated Test Suite Generation for Time-Continuous Simulink Models
Testing Machine Learning-enabled Systems: A Personal Perspective
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...

What's hot (20)

PDF
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
PDF
Automated Testing of Autonomous Driving Assistance Systems
PDF
Can we predict the quality of spectrum-based fault localization?
PDF
Testing the Untestable: Model Testing of Complex Software-Intensive Systems
PDF
Incremental Reconfiguration of Product Specific Use Case Models for Evolving ...
PDF
System Testing of Timing Requirements based on Use Cases and Timed Automata
PDF
Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers
PDF
Functional Safety in ML-based Cyber-Physical Systems
PDF
Improving Fault Localization for Simulink Models using Search-Based Testing a...
PDF
AN EMPIRICAL STUDY ON THE POTENTIAL USEFULNESS OF DOMAIN MODELS FOR COMPLETEN...
PDF
Comparing Offline and Online Testing of Deep Neural Networks: An Autonomous C...
PDF
Applying Product Line Use Case Modeling ! in an Industrial Automotive Embedde...
PDF
Supporting Change in Product Lines within the Context of Use Case-driven Deve...
PDF
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
PDF
OCLR: A More Expressive, Pattern-Based Temporal Extension of OCL
PDF
Artificial Intelligence for Automated Software Testing
PDF
Testing Dynamic Behavior in Executable Software Models - Making Cyber-physica...
PDF
Requirements in Cyber-Physical Systems: Specifications and Applications
PDF
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
PDF
Automating System Test Case Classification and Prioritization for Use Case-Dr...
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
Automated Testing of Autonomous Driving Assistance Systems
Can we predict the quality of spectrum-based fault localization?
Testing the Untestable: Model Testing of Complex Software-Intensive Systems
Incremental Reconfiguration of Product Specific Use Case Models for Evolving ...
System Testing of Timing Requirements based on Use Cases and Timed Automata
Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers
Functional Safety in ML-based Cyber-Physical Systems
Improving Fault Localization for Simulink Models using Search-Based Testing a...
AN EMPIRICAL STUDY ON THE POTENTIAL USEFULNESS OF DOMAIN MODELS FOR COMPLETEN...
Comparing Offline and Online Testing of Deep Neural Networks: An Autonomous C...
Applying Product Line Use Case Modeling ! in an Industrial Automotive Embedde...
Supporting Change in Product Lines within the Context of Use Case-driven Deve...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
OCLR: A More Expressive, Pattern-Based Temporal Extension of OCL
Artificial Intelligence for Automated Software Testing
Testing Dynamic Behavior in Executable Software Models - Making Cyber-physica...
Requirements in Cyber-Physical Systems: Specifications and Applications
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
Automating System Test Case Classification and Prioritization for Use Case-Dr...
Ad

Similar to Testing of Cyber-Physical Systems: Diversity-driven Strategies (20)

PDF
Automated Testing of Hybrid Simulink/Stateflow Controllers
PDF
MiL Testing of Highly Configurable Continuous Controllers
PDF
Making Model-Driven Verification Practical and Scalable: Experiences and Less...
PDF
SBST 2019 Keynote
PDF
Achieving Scalability in Software Testing with Machine Learning and Metaheuri...
PDF
Keynote presentation at DeepTest Workshop 2025
PDF
AI in SE: A 25-year Journey
PDF
TEST GENERATION FOR ANALOG AND MIXED-SIGNAL CIRCUITS USING HYBRID SYSTEM MODELS
PDF
Test Generation for Analog and Mixed-Signal Circuits Using Hybrid System Mode...
PDF
Enabling Automated Software Testing with Artificial Intelligence
PDF
Zander eng scd_final
PDF
Keynote SBST 2014 - Search-Based Testing
PDF
Mining Assumptions for Software Components using Machine Learning
PDF
Systematic Model based Testing with Coverage Analysis
PPTX
Logic Simulation, Modeling, and Testing
PDF
SSBSE 2020 keynote
PPTX
VLSI Testing : Logic Simulation Part 1.pptx
PPT
Dill may-2008
PDF
Scalable and Cost-Effective Model-Based Software Verification and Testing
PDF
VLSI testing and analysis
Automated Testing of Hybrid Simulink/Stateflow Controllers
MiL Testing of Highly Configurable Continuous Controllers
Making Model-Driven Verification Practical and Scalable: Experiences and Less...
SBST 2019 Keynote
Achieving Scalability in Software Testing with Machine Learning and Metaheuri...
Keynote presentation at DeepTest Workshop 2025
AI in SE: A 25-year Journey
TEST GENERATION FOR ANALOG AND MIXED-SIGNAL CIRCUITS USING HYBRID SYSTEM MODELS
Test Generation for Analog and Mixed-Signal Circuits Using Hybrid System Mode...
Enabling Automated Software Testing with Artificial Intelligence
Zander eng scd_final
Keynote SBST 2014 - Search-Based Testing
Mining Assumptions for Software Components using Machine Learning
Systematic Model based Testing with Coverage Analysis
Logic Simulation, Modeling, and Testing
SSBSE 2020 keynote
VLSI Testing : Logic Simulation Part 1.pptx
Dill may-2008
Scalable and Cost-Effective Model-Based Software Verification and Testing
VLSI testing and analysis
Ad

More from Lionel Briand (20)

PDF
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
PDF
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
PDF
Automated Test Case Repair Using Language Models
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
PDF
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
PDF
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
PDF
Precise and Complete Requirements? An Elusive Goal
PDF
Large Language Models for Test Case Evolution and Repair
PDF
Metamorphic Testing for Web System Security
PDF
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
PDF
Fuzzing for CPS Mutation Testing
PDF
Data-driven Mutation Analysis for Cyber-Physical Systems
PDF
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
PDF
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
PDF
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PDF
PRINS: Scalable Model Inference for Component-based System Logs
PDF
Revisiting the Notion of Diversity in Software Testing
PDF
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
PDF
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
PDF
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Automated Test Case Repair Using Language Models
Automated Testing and Safety Analysis of Deep Neural Networks
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Precise and Complete Requirements? An Elusive Goal
Large Language Models for Test Case Evolution and Repair
Metamorphic Testing for Web System Security
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
Fuzzing for CPS Mutation Testing
Data-driven Mutation Analysis for Cyber-Physical Systems
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PRINS: Scalable Model Inference for Component-based System Logs
Revisiting the Notion of Diversity in Software Testing
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
System and Network Administraation Chapter 3
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
L1 - Introduction to python Backend.pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
Softaken Excel to vCard Converter Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
Understanding Forklifts - TECH EHS Solution
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Odoo POS Development Services by CandidRoot Solutions
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
System and Network Administraation Chapter 3
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
L1 - Introduction to python Backend.pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Design an Analysis of Algorithms I-SECS-1021-03
Which alternative to Crystal Reports is best for small or large businesses.pdf
Odoo Companies in India – Driving Business Transformation.pdf
How Creative Agencies Leverage Project Management Software.pdf

Testing of Cyber-Physical Systems: Diversity-driven Strategies

  • 1. .lusoftware verification & validation VVS Testing of Cyber-Physical Systems: Diversity-driven Strategies Lionel Briand COW 57, London, UK
  • 2. Cyber-Physical Systems • A system of collaborating computational elements controlling physical entities 2
  • 3. Context • Projects on verification of cyber-physical systems, control systems, autonomous systems, … • Focus on safety, performance, resource usage … • Automotive, satellite, energy, manufacturing … 3
  • 6. Development Process 6 Functional modeling: • Controllers • Plant • Decision Continuous and discrete Simulink models Model simulation and testing Architecture modelling • Structure • Behavior • Traceability System engineering modeling (SysML) Analysis: • Model execution and testing • Model-based testing • Traceability and change impact analysis • ... (partial) Code generation Deployed executables on target platform Hardware (Sensors ...) Analog simulators Testing (expensive) Hardware-in-the-Loop Stage Software-in-the-Loop Stage Model-in-the-Loop Stage
  • 7. Simulink Models - Simulation • Simulation Models • heterogeneous 8 Software Plant Model Network Model • continuous behavior • are used for • algorithm design testing • comparing design options
  • 9. Problem • How do we automatically verify and test CP functional models (e.g., controller, plant, decision) at MiL? • What types of requirements / properties do we check? • Commercial tools: • Cannot handle continuous operators, floating point models (e.g., SLDV, Reactis) • Based on model structural coverage: low fault detection • Can only handle linear systems and specific properties (Linear analysis toolbox) 10
  • 10. Challenges • Limited work on verification and testing of controllers and decision-making components in CP systems • Space of test input signals is extremely large. • Model execution, especially when involving plant models, is extremely expensive. 11
  • 11. More Challenges • Test oracles are not simple Boolean properties and easily known in advance – they involve analyzing changes in value over time (e.g., signal patterns) and assessing levels of risk. • Simulatable plant model of the physical environment is not always available or fully accurate and precise. 12
  • 12. Diversity Strategies • Strategy: Maximize diversity of test cases • Assumption: “the more diverse the test cases the higher their fault revealing capacity” • Challenge: Define “diversity” in context, pair-wise similarity computation, test selection algorithm • Examples of early work • ISSRE 2003, Leon and Podgurski, filtering and prioritizing test cases, relying on code coverage • FSE 2010, Hemmati et al., Similarity-based test selection applied to model-based testing based on state models for control systems, selection with GA • Full control on test budget: Maximize fault detection for a given test suite size 13
  • 15. • Supercharger bypass flap controller üFlap position is bounded within [0..1] üImplemented in MATLAB/Simulink ü34 (sub-)blocks decomposed into 6 abstraction levels Supercharger Bypass Flap Supercharger Bypass Flap Flap position = 0 (open) Flap position = 1 (closed) Simple Example 16
  • 17. Initial Desired Value Final Desired Value time time Desired Value Actual Value T/2 T T/2 T Test Input Test Output Plant Model Controller (SUT) Desired value Error Actual value System output+ - MiL Testing of Controllers 18
  • 18. Requirements and Test Objectives InitialDesired (ID) Desired ValueI (input) Actual Value (output) FinalDesired (FD) time T/2 T Smoothness Responsiveness Stability 20
  • 19. 21 Test Generation Approach • We formalize controller’s requirements in terms of desired and actual outputs Smoothness • We rely on controller’s feedback to automate test oracles desired value actual value < Threshold Desired Value (Setpoint) Actual Value (feedback) System Output + - Control Signal Plant (environment)Controller
  • 20. A Search-Based Test Approach Initial Desired (ID) FinalDesired(FD) Worst Case(s)? • Search directed by model execution feedback • Finding worst case inputs • Possible because of automated oracle (feedback loop) • Different worst cases for different requirements • Worst cases may or may not violate requirements 22
  • 21. Initial Solution HeatMap Diagram 1. Exploration List of Critical RegionsDomain Expert Worst-Case Scenarios + Controller- plant model Objective Functions based on Requirements 2. Single-State Search time Desired Value Actual Value 0 1 2 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Initial Desired Final Desired 23
  • 22. Results • We found much worse scenarios during MiL testing than our partner had found so far • These scenarios are also run at the HiL level, where testing is much more expensive: MiL results -> test selection for HiL • But further research was needed: • Simulations are expensive • Configuration parameters 24
  • 23. Final Solution + Controller Model (Simulink) Worst-Case Scenarios List of Critical PartitionsRegression Tree 1.Exploration with Dimensionality Reduction 2.Search with Surrogate Modeling Objective Functions Domain Expert Visualization of the 8-dimension space using regression treesDimensionality reduction to identify the significant variables (Elementary Effect Analysis) Surrogate modeling to predict the fitness function and speed up the search (Machine learning) 25
  • 24. Open Loop Controllers On Off CtrlSig • Mixed discrete-continuous behavior: Simulink stateflows • No plant model: Much quicker simulation time • No feedback loop -> no automated oracle • The main testing cost is the manual analysis of output signals • Goal: Minimize test suites • Challenge: Test selection • Entirely different approach to testing echniques. We consider this criterion ows have complex internal structures ations, making them less amenable to hey have rich time-continuous outputs. following contributions: lem of testing Stateflows with mixed ehaviours. We propose two new test output stability and output continuity ting test inputs that are likely to pro- uts exhibiting instability and disconti- vely. ox coverage and the blackbox output eria to Stateflows, and evaluate their or continuous behaviours. The former aditional state and transition coverage d the latter is defined based on the re- s criterion [?]. ness of our newly proposed and the ria by applying them to three Stateflow wo industrial and one public domain. RESULT. (c) Engaging state of SCC -- mixed discrete-continuous behaviour Disengaging Engaged [disengageReq]/time := 0 [time>5] [time>5] time + +; OnMoving OnSlipping OnCompleted time + +; ctrlSig := f(time) Engaging time + +; ctrlSig := g(time) time + +; ctrlSig := 1.0 [¬(vehspd = 0) time > 2] [(vehspd = 0) time > 3] [time > 4] Figure 1: Supercharge Clutch Controller (SCC) Stateflow. transient states [?], engaging and disengaging, specifying that mov- ing from the engaged to the disengaged state and vice versa takes six milisec. Since this model is simplified, it does not show han- dling of alterations of the clutch state during the transient states28
  • 25. Selection Strategies Based on Search • White-box structural coverage • State Coverage • Transition Coverage • Input signal diversity • Output signal diversity • Failure-Based selection criteria • Domain specific failure patterns • Output Stability • Output Continuity S3 t S3 t 29
  • 26. System Output Input Signals Output Signals Controller Plant (environment) 30 instability failure pattern discontinuity failure pattern output diversity • We assume test oracles are manual Test Generation Approach • We rely on output signals to produce small test suites with high fault-revealing ability
  • 27. Output Diversity -- Vector-Based 31 Output Time Output Signal 2 Output Signal 1 Normalized Euclidian Distance
  • 28. 32 Output Diversity -- Feature-Based increasing (n) decreasing (n)constant-value (n, v) signal features derivative second derivative sign-derivative (s, n) extreme-derivatives 1-sided discontinuity discontinuity 1-sided continuity with strict local optimum value instant-value (v) constant (n) discontinuity with strict local optimum increasing C A B
  • 29. 33 Output Diversity -- Feature-Based increasing (n) decreasing (n)constant-value (n, v) signal features derivative second derivative sign-derivative (s, n) extreme-derivatives 1-sided discontinuity discontinuity 1-sided continuity with strict local optimum value instant-value (v) constant (n) discontinuity with strict local optimum increasing C A B Similarity: To which extent any part of a signal is similar to a feature
  • 30. Failure-based Test Generation 34 Instability Discontinuity 0.0 1.0 2.0 -1.0 -0.5 0.0 0.5 1.0 Time CtrlSigOutput • Search: Maximizing the likelihood of presence of specific failure patterns in output signals • Domain-specific failure patterns elicited from engineers 0.0 1.0 2.0 Time 0.0 0.25 0.50 0.75 1.0 CtrlSigOutput
  • 31. Search • Whole test suite generation approach • Used when objective functions characterize the test suite • Optimize test objective for a given test suite size (budget for manual oracles) • Maximize the minimum distances of each output signal vector from the other output signal vectors • Adaptation of Simulated Annealing 35
  • 32. Faulty Model Output 36 Correct Model Output Fault-Revealing Ability Covers the fault and Covers the fault but is Likely to reveal it is very unlikely to reveal it
  • 33. Results • The test cases resulting from state/transition coverage algorithms cover the faulty parts of the models • However, they fail to generate output signals that are sufficiently distinct from expectations, hence yielding a low fault revealing rate • Diversity strategies significantly outperforms coverage-based and random testing • Output-based algorithms are much more effective, both based on diversity and failure patterns 37
  • 34. Results • Feature-based diversity fares significantly better than vector-based diversity • Strategies based on failure patterns find different types of faults than diversity strategies • Existing commercial tools: Not effective at finding faults, not applicable to entire Simulink models, e.g., Simulink Design Verifier 38
  • 37. Conclusions • Maximizing output diversity helps identify scenarios where the discrepancy between the produced and expected signal is large • Useful when test output signals are analyzed manually • Simulink models and their outputs are complex • Helps maximize fault detection within a fixed budget • Properly defining diversity was a challenge 41
  • 38. Reflections on Diversity • Useful strategy when no precise guidance, directly related to the test objectives, is available for the search • In the general, the key issue is how to define diversity in an optimal way given the objectives • In practice, how diversity is defined also depends on what information is available at a reasonable cost • The time complexity of computing diversity is a major cost of the search – it must be accounted for 42
  • 39. Acknowledgements • Shiva Nejati • Reza Matinnejad • Delphi Automotive Systems, Luxembourg 43
  • 40. References • R. Matinnejad et al., “MiL Testing of Highly Configurable Continuous Controllers: Scalable Search Using Surrogate Models”, IEEE/ACM ASE 2014 (Distinguished paper award) • R. Matinnejad et al., “Effective Test Suites for Mixed Discrete-Continuous Stateflow Controllers”, ACM ESEC/FSE 2015 (Distinguished paper award) • R. Matinnejad et al., “Automated Test Suite Generation for Time-continuous Simulink Models“, IEEE/ACM ICSE 2016 • R. Matinnejad et al., “Test Generation and Test Prioritization for Simulink Models with Dynamic Behavior“, under minor revision with IEEE TSE 44
  • 41. .lusoftware verification & validation VVS Testing of Cyber-Physical Systems: Diversity-driven Strategies Lionel Briand COW 57, London, UK