The problem with time in mixed continuous/discrete time modelling Kenneth C. Rovers K.C.Rovers@utwente.nl Jan Kuper J.Kuper@utwente.nl Gerard J.M. Smit G.J.M.Smit@utwente.nl Computer Architecture for Embedded Systems group * CTIT, Department of EEMCS, University of Twente P.O. Box 217, 7500 AE Enschede, The Netherlands ABSTRACT The design of cyber-physical systems requires the use of mixed continuous time and discrete time models. Current modelling tools have problems with time transformations (such as a time delay) or multi-rate systems. We will present a novel approach that implements signals as functions of time, directly corresponding to their mathe- matical representation. This enables an exact implementa- tion of time transformations and as an additional advantage enables local control over time. A representation of com- ponents and signals in both domains is provided, together with composition operators to allow the specification of sig- nal flow diagrams. 1. INTRODUCTION In designing cyber-physical systems, i.e. embedded sys- tems which include peripherals interfacing with the physical world, a modelling tool for simulation is essential. Such a tool must support both the continuous time (CT) and dis- crete time (DT) domain, because of the tight integration of the environment and the systems’s computational and phys- ical facets [7]. Considering time is such an import aspect, it might be surprising that current modelling tools have a problem with time. This problem occurs in systems with time delays or multi-rate systems for example. The problem is that a sin- gle (global) time step is chosen by the solver for simulation, at which the whole system under design is evaluated. This time step must meet the requirements of all components in the system. Several components, such as integration, may require a very small time step to achieve enough accuracy, a resolution not needed for the rest of the system. Further, CT signals are implemented as a sequence of discrete values at simulation time steps. A time delay component there- fore buffers values and interpolates between available values introducing inaccuracies caused by the modelling tool. In this paper we propose a novel approach to mixed CT/DT modelling. By implementing CT signals as functions of time, time delays or multi-rate systems can be implemented ex- actly without loosing efficiency. Of course, considering a signal as a function of time is not new, but implementing them as such is. We will set the scope in section 2 and anal- yse the problem in more detail in section 3. Next, we will identify the many faces of time (section 4) and present our solution (section 5) followed by some results (section 6). * This research is partly funded by Thales Nederland B.V. and STW projects CMOS Beamforming (07620) and NEST (10346). 2. ABOUT TIME The scope of this paper involves the modelling of mixed CT and DT systems. In such systems signals represents measurable quantities over an independent value, in our case time. So it concerns time. We differentiate between continuous time and discrete time. Continuous time is unbroken or whole, i.e. defined for all time. Discrete time quantises time to distinct separate mo- ments in time. Thus there are two kinds of signals: Signals in the CT domain are functions of time, i.e. they represent the value of the signal over all time. Signals in the DT domain are a list of values at discrete moments, also called samples. However, computation- ally an operation is defined on an individual value (pos- sibly depending on previous values using state). A function that takes a signal and transform it to a new signal is called a signal transformation. In case of DT sig- nals, the implementation of a signal transformation corre- sponds to an operation or function on a value. In case of CT, a signal transformation corresponds to a function on a function, i.e. it is a so called higher order function. A signal transformation can be with respect to the inde- pendent value, i.e. a time-shift corresponds to a delay of the signal. Other transformations are reflection or scaling. Signal flow diagrams or block diagrams are popular in system design tools because of their intuitive use and ease of understanding [2]. Components in such diagrams denote signal transformations and arrows denote signals. Compo- sition of signal transformations is analogous to connection blocks in a signal flow diagram. To compose components from different domains, the sig- nal representation must be changed. To go from the CT domain to the DT time domain, the signal is sampled at specific sample times by an analogue-to-digital converter (ADC). To go from the DT domain to the CT domain, the sample is hold until the next value by a digital-to-analogue converter (DAC). 3. PROBLEM ANALYSIS There are many mixed continuous/discrete time modelling tools [2]. Probably the most well-known is Simulink. Exist- ing tools perform a simulation by extracting a set of ordinary differential equations (ODEs) from the model. This set is (in the general case) solved numerically. Typical solvers are the Euler methods or the Runge-Kutta methods. Such solvers operate iteratively with a fixed or variable step size.