Cyber-Physical System Design Contracts
Total Page:16
File Type:pdf, Size:1020Kb
Cyber-Physical System Design Contracts Patricia Derler Edward A. Lee Martin Törngren University of California, University of California, KTH Royal Institute of Berkeley Berkeley Technology [email protected] [email protected] [email protected] Stavros Tripakis University of California, Berkeley [email protected] ABSTRACT tinct disciplines such as control engineering, software engineer- This paper introduces design contracts between control and em- ing, mechanical engineers, network engineering, etc. The com- bedded software engineers for building Cyber-Physical Systems plexity and heterogeneity of all the different design aspects require (CPS). CPS design involves a variety of disciplines mastered by methodologies for bridging the gaps between the disciplines in- teams of engineers with diverse backgrounds. Many system prop- volved. This is known to be challenging since the disciplines have erties influence the design in more than one discipline. The lack of different views, encompassing terminology, theories, techniques clearly defined interfaces between disciplines burdens the interac- and design approaches. tion and collaboration. We show how design contracts can facilitate In this paper, we focus on interactions between control and em- interaction between 2 groups: control and software engineers. A bedded software engineers. A multitude of modeling, analysis and design contract is an agreement on certain properties of the system. synthesis techniques that deal with codesign of control functions Every party specifies requirements and assumptions on the system and embedded software have been developed since the 1970s. We and the environment. This contract is the central point of inter- use the term codesign for approaches that provide an awareness of domain communication and negotiation. Designs can evolve inde- constraints across the disciplines such that design of different as- pendently if all parties agree to a contract or designs can be modi- pects can proceed in parallel. fied iteratively in negotiation processes. The main challenge lies in Advances in embedded system design methods and supporting the definition of a concise but sufficient contract. We discuss de- tools have led to a strong adoption of model-based design, in which sign contracts that specify timing and functionality, two important systems are designed at a higher level of abstraction, followed by properties control and software engineers have to agree upon. Vari- the generation of an implementation. This is a well-established ous design approaches have been established and implemented suc- practice in control engineering and it is also becoming more com- cessfully to address timing and functionality. We formulate those mon in embedded software engineering. approaches as design contracts and propose guidelines on how to Despite these advances, gaps between the control and embed- choose, derive and employ them. Modeling and simulation support ded software disciplines remain. There is no clear specification for the design contracts is discussed using an illustrative example. of required interactions and many assumptions such as timing are still implicit. Differences in concepts and concerns between con- trol and software engineering, some of which are mentioned in Ta- Categories and Subject Descriptors ble1, hinder communication. For instance, performance refers to C.3 [Computer Systems Organization]: Special-purpose and Ap- bandwidth and settling time in the control domain, and to response plication based Systems—Real-time and embedded systems time and context switching time in the embedded software domain. Central concepts such as the sampling-to-actuation (StA) delay in 1. INTRODUCTION control theory and the response time or execution time for embed- ded software, do not, by definition, correspond to the same time 1 Cyber-Physical Systems (CPS) design involves various dis- interval [34]. 1 This work was supported in part by the iCyPhy Research Cen- The interdisciplinary dependency of design aspects poses a ma- ter (Industrial Cyber-Physical Systems, supported by IBM and jor problem as decisions in one domain will affect the other. De- United Technologies), the NSF Expeditions in Computing project pendencies are typically non-linear and, since they affect both the ExCAPE: Expeditions in Computer Augmented Program Engineer- control and embedded software design, they are associated with ing, and the Center for Hybrid and Embedded Software Systems trade-offs [2]. For instance, changing the required speed of a feed- (CHESS) at the UC Berkeley (supported by the National Sci- ence Foundation, NSF awards #0720882 (CSR-EHS: PRET) and #0931843 (ActionWebs), the Naval Research Laboratory (NRL #N0013-12-1-G015), and the following companies: Bosch, Na- Permission to make digital or hard copies of all or part of this work for tional Instruments, and Toyota). Additional support was received personal or classroom use is granted without fee provided that copies are from the ArtistDesign network of excellence and from the Royal not made or distributed for profit or commercial advantage and that copies Institute of Technology (KTH). bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific The models discussed in this paper are available online and hy- permission and/or a fee. perlinks behind figures in this PDF link to the individual models. ICCPS’13, April 8-11, 2013, Philadelphia, PA, USA Ptolemy models are available in executable form using Web Start Copyright 2013 ACM 978-1-4503-1996-6/13/04 ...$15.00. and we provide the source files for Simulink models. Concepts/ Control Embedded software constraints can be met. Domain: The elements of our design contract framework are the follow- Metrics, Robustness, noise Utilization, response ing: (a) concepts relevant to timing constraints and functionality; Constraints sensitivity, band- time, memory foot- (b) design contracts utilizing these concepts; (c) a process and guide- width, overshoot, print, WCET, slack, lines on how to choose, derive and employ design contracts. The settling time power consumption guidelines encompass specific considerations for modeling and sim- Design pa- Choice of strategy Task partition- ulation support. In the rest of the paper, we present the above ele- rameters (PID, optimal, adap- ing, scheduling, ments in detail. Section2 reviews the state of the art and provides tive, etc.), noise/ro- inter-process com- an overview of design approaches and supporting tools. Examples bustness trade-off munication of formalized design contracts are given in Section3. In Section4 Formalisms, ODEs, continuous- C code, synchronous we describe guidelines for deriving and applying design contracts. Theory time control theory, languages, schedul- Section5 presents conclusions and future directions. sampled data control ing theory, model- theory checking, task mod- els, UML/SysML 2. RELATED WORK We first provide a broad overview of research areas related to the Table 1: Concepts in control and embedded software design codesign of control systems and embedded software followed by a brief survey of work related to contracts. back control system will have an impact on the sampling period 2.1 Design Approaches implemented by the computer system and may also have a signif- The research field of embedded control systems as part of a CPS icant impact on the StA delay that can be tolerated. Likewise, the was initiated already in the early 1970s, a time when computer re- partitioning of executable code into tasks will, together with a trig- sources were scarce and thus the problems of implementing a con- gering and scheduling scheme, have an impact on the characteris- troller were critical. The Artist roadmaps give an overview of the tics of time delays in the control system. evolution of the field2. A number of aspects that have to be con- As a basis for mutual understanding, it is essential to establish sidered in CPS design have been identified over the years. These an explicit semantic mapping between the two domains. In this pa- include concepts that link control and embedded software, as well per, we propose a framework of design contracts between control as trade-offs regarding memory, accuracy and speed. In this paper, and embedded software engineers, with the goals of bridging the we focus mainly on timing properties such as periods, StA delays gap between the two worlds, making implicit assumptions explicit, and jitter. With respect to control and embedded software codesign, and thus facilitating interaction and communication. Figure1 il- we identify the following strands in state of the art research. lustrates the concept. System-level requirements and external con- Separation of concerns. The basic idea is to decouple control straints form boundary conditions for design contracts. External and embedded software design. Representative approaches include constraints (which could correspond to other contracts) restrict the the synchronous programming languages [7], and the Logical Exe- freedom available to control and embedded software engineers. For cution Time approach (LET) of Giotto [24] and its successors [29, example, the choice of processing platform bounds achievable ex- 23]. This research also includes robust control design, which guar- ecution speeds and thus the control performance. The closed-loop antees robust performance despite bounded timing variations. This control design, including choice