Making Simulink Models Robust with Respect to Change Making Simulink Models Robust with Respect to Change By Monika Jaskolka, B.Co.Sc., M.A.Sc. a thesis submitted to the Department of Computing and Software and the School of Graduate Studies of McMaster University in partial fulfillment of the requirements for the degree of Doctor of Philosophy Doctor of Philosophy (December 2020) McMaster University (Software Engineering) Hamilton, ON, Canada Title: Making Simulink Models Robust with Respect to Change Author: Monika Jaskolka B.Co.Sc. (Laurentian University) M.A.Sc. (McMaster University) Supervisors: Dr. Mark Lawford, Dr. Alan Wassyng Number of Pages: xi, 206 ii For my husband, Jason iii Abstract Model-Based Development (MBD) is an approach that uses software models to describe the behaviour of embedded software and cyber-physical systems. MBD has become an increasingly prevalent paradigm, with Simulink by MathWorks being the most widely used MBD platform for control software. Unlike textual programming languages, visual languages for MBD such as Simulink use block diagrams as their syntax. Thus, some software engineering principles created for textual languages are not easily adapted to this graphical notation or have not yet been supported. A software engineering principle that is not readily supported in Simulink is the modularization of systems using information hiding. As with all software artifacts, Simulink models must be constantly maintained and are subject to evolution over their lifetime. This principle hides likely changes, thus enabling the design to be robust with respect to future changes. In this thesis, we perform repository mining on an industry change management system of Simulink models to understand how they are likely to change. Then, we explore the various modelling mechanisms available in the Simulink language to see how they could support modular design with information hiding. Next, we propose a module structure, syntactic interface, and modelling conventions for Simulink designs, which are supported by our iv open-source Simulink Module Tool. Finally, we apply the proposed techniques on case studies from the aerospace and nuclear domains, in order to demonstrate their practicality and validate their effectiveness. Overall, the approach helped support information hiding by encapsulating secrets and facilitating likely changes. It also had a positive effect on interface complexity, cohesion, and coupling. The larger system also exhibited reductions to cyclomatic complexity, testing effort, and execution time, but the smaller case study benefited less in these areas. v Acknowledgments My sincerest appreciation to Dr. Mark Lawford and Dr. Alan Wassyng for supervising me throughout my graduate studies. Thank you for encouraging me and providing me with incredible opportunities that enriched my studies. Many thanks to Dr. Jacques Carette and Dr. Ryszard Janicki for serving on my supervisory committee, as well as for providing constructive input and thought-provoking questions that shaped the course of my doctoral research. I would also like to thank my external examiner Dr. Pieter J. Mosterman for reviewing my thesis and for the interesting discussions at my defence. Thank you to Dr. Vera Pantelic for her indispensable input and guidance. It was a pleasure to work with you over the years. Many thanks to my colleagues and friends from the McMaster Centre for Software Certification (McSCert). I have immensely enjoyed publishing, developing tools, and working with such a dynamic group. Thank you to Stephen Scott for his collaboration on content presented in this thesis. vi Table of Contents Descriptive Note............................. ii Dedication................................ iii Abstract.................................v Acknowledgments............................ vi List of Figures.............................. xii List of Tables............................... xv List of Acronyms............................. xvi 1 Introduction.......................1 1.1 Motivation . .1 1.1.1 Why Simulink? . .2 1.2 Research Questions . .4 1.3 Thesis Contributions . .5 1.4 Related Publications and Submissions . .9 1.5 Thesis Outline . 10 2 Preliminaries....................... 11 2.1 Principles for Supporting Likely Changes . 11 2.1.1 Information Hiding . 12 2.1.2 Modularity . 13 2.1.3 Encapsulation . 13 2.1.4 Separation of Concerns . 14 2.1.5 Object-Orientation . 14 2.1.6 Aspect-Orientation . 15 2.2 Simulink . 15 2.2.1 Subsystems . 17 vii 2.2.1.1 Virtual Subsystem . 19 2.2.1.2 Nonvirtual Subsystem . 21 2.2.2 Library . 25 2.2.3 Model Reference . 26 2.2.4 Data Passing . 28 2.2.4.1 Data Store Memory . 28 2.2.4.2 Goto, From, and Goto Tag Visibility . 29 2.2.5 Workspaces and Data Dictionaries . 29 2.2.6 Exporting Data . 30 2.2.7 Stateflow . 30 2.3 C to Simulink Concept Mapping . 31 2.4 Chapter Summary . 32 3 Model Changes...................... 33 3.1 Related Work . 34 3.2 Methodology . 36 3.2.1 Tool Support . 38 3.2.2 Model Comparison Utility . 40 3.3 Changes in Simulink Models . 42 3.3.1 What basic elements change the most? . 44 3.3.2 What blocks are most often involved in changes? . 46 3.3.3 What does a commit usually entail? . 47 3.3.4 What are identified categories of change? . 50 3.3.4.1 Changes to Interface Elements . 54 3.3.4.2 Changes to Signal Routing and Attributes . 55 3.4 Chapter Summary . 56 4 Decomposition of Simulink Models............ 57 4.1 Related Work . 58 4.2 Comparison of Constructs . 60 4.2.1 Use in Industry . 61 4.2.2 Reusability . 64 4.2.3 Sharing of Program State . 66 4.2.4 Information Hiding and Encapsulation . 68 4.2.4.1 Limitation of Use . 69 viii 4.2.4.2 Restriction of Data Passing . 70 4.2.5 Code Generation . 78 4.2.6 Comparison Summary . 81 4.3 Conversion and Limitations . 82 4.4 Conventions for Modularity . 83 4.5 Chapter Summary . 85 5 A Simulink Module Structure............... 87 5.1 Related Work . 88 5.1.1 Model Structure . 88 5.1.2 Interfaces . 91 5.2 A Simulink Module . 92 5.3 A Simulink Module Interface . 94 5.3.1 Definition . 96 5.3.2 Limitations . 101 5.3.3 Representation . 102 5.3.4 Benefits . 102 5.4 Modelling Guidelines . 105 5.4.1 Simulink Functions . 105 5.4.2 Interfaces . 108 5.5 The Simulink Module Tool . 111 5.5.1 Subsystem to Simulink Function Conversion . 111 5.5.2 Scope Changes . 112 5.5.3 Function Calling . 114 5.5.4 Automatic Function Configuration . 115 5.5.5 Interface Generation . 116 5.5.6 Dependency Viewing . 117 5.5.7 Guideline Checking . 117 5.6 Chapter Summary . 117 6 Case Studies....................... 120 6.1 Evaluation Methods . 120 6.1.1 Design Equivalence . 121 6.1.2 Information Hiding . 123 6.1.3 Interface Complexity . 123 ix 6.1.4 Coupling and Cohesion . 124 6.1.5 Cyclomatic Complexity . 125 6.1.6 Testability . 126 6.1.7 Performance Comparison . 127 6.2 Aerospace Case Study . 127 6.2.1 Flight Control Computer(FCC) Components . 128 6.2.1.1 Attitude and Heading Reference System (AHRS) Voter . 128 6.2.1.2 Helicopter Outer Loop Control(HOLC).... 132 6.2.1.3 Helicopter Inner Loop Control(HILC)..... 132 6.2.1.4 Actuator Loop(AL)............... 133 6.2.2 Application of the Simulink Module Structure . 133 6.2.2.1 Attitude and Heading Reference System (AHRS) Voter . 134 6.2.2.2 Attitude and Heading Reference System (AHRS) Control . 135 6.2.2.3 Actuator Loop(AL)............... 139 6.2.3 Using the Simulink Module Tool . 139 6.2.4 Evaluation . 140 6.2.4.1 Information Hiding . 141 6.2.4.2 Interface Complexity . 142 6.2.4.3 Coupling and Cohesion . 143 6.2.4.4 Cyclomatic Complexity . 145 6.2.4.5 Testability . 146 6.2.4.6 Performance Comparison . 147 6.2.5 Case Study Summary . 147 6.3 Nuclear Case Study . 148 6.3.1 Application of the Simulink Module Structure . 149 6.3.1.1 Power Estimation(PE) Module . 149 6.3.1.2 Entire Shut Down System(SDS)........ 150 6.3.2 Using the Simulink Module Tool . 153 6.3.3 Evaluation . 157 6.3.3.1 Information Hiding . 157 6.3.3.2 Interface Complexity . 158 x 6.3.3.3 Coupling and Cohesion . 159 6.3.3.4 Cyclomatic Complexity . 161 6.3.3.5 Testability . 163 6.3.3.6 Performance Comparison . 163 6.3.4 Case Study Summary . 164 6.4 Challenges and Limitations . 165 6.4.1 Variable-Step Solvers and Continuous States . 165 6.4.2 Inheriting Sample Time . 166 6.4.3 Block States . 166 6.4.4 Algebraic Loops . 167 7 Conclusion........................ 172 7.1 Summary of Contributions . 172 7.2 Future Work . 174 7.3 Closing Remarks . 177 A Construct Comparison Generated Code.......... 178 A.1 Virtual Subsystem Generated Code . 178 A.2 Atomic Subsystem Generated Code . 183 A.3 Simulink Function Generated Code . 188 A.4 Library Import Generated Code . 193 A.5 Model Reference Generated Code . 198 Bibliography....................... 207 xi List of Figures 2.1 Simplified Simulink metamodel. 16 2.2 A simple Simulink example computing integer sums. 18 2.3 Summary of subsystems, classified as virtual and non-virtual. ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages242 Page
-
File Size-