Event Ordering in Discrete Flow Models Fernando J. Barros Universidade de Coimbra Departamento de Engenharia Informática Pólo II, P-3030 Coimbra, Portugal E-mail: barros@dei.uc.pt Abstract - A major goal in the design of modeling and simulation formalisms is to guarantee deterministic behavior. To achieve this aim we have developed an approach to establish a total order among events based on a formal and operational definition of causality. The proposed solution is very general enabling its application to any kind of discrete event system irrespective to the simulation engines used to perform model experimentation. Examples of event ordering are given in the DFSS and DEVS formalisms. Keywords: Discrete event simulation, DFSS formalism, simultaneous events, event ordering I. INTRODUCTION The order of events is of crucial importance to achieve deterministic simulations. Determinism imposes that whatever simulation engine is used to extract model behavior the results should be the same. Thus, the same model should produce the same traces irrespective to the type of simulation engine used, including, for example, sequential, distributed, conservative and optimistic. Non deterministic behavior is seldom tolerable in simulation because it affects statistical results in unpredictable ways. Letting the simulation engine choose what to do when certain situations occur may introduce unacceptable correlations unknown to the modeler putting in danger simulation results. To achieve reliable results all model behavior must be under complete control of the modelers. These must be able to decide all the parameters of the stochastic distributions guaranteeing the correct generation of random variates. While it is easy to order events by comparing their times, this comparison becomes more difficult when events happen at the same time. Traditional approaches assign priorities to events occurring at the same time to solve this problem. However, this strategy has many problems including the treatment of zero time delays, since the use of priorities can jeopardize causality. The most promising solution is to consider all events occurring at the same time simultaneously. This approach has been used in Yaddes [PRE, 89], the High Level Architecture [USD, 01], P-DEVS [CHO, 96] and DFSS [BAR, 97]. Thus the difficult task of assigning priorities to events is avoided and a deterministic interpretation can be made. However, depending on the implementation a problem still remains. If a model sends an output immediately after receiving an input, i.e. when zero delays are used, the order of these two events can be difficult to establish if an optimistic parallel simulator is used. Current solutions for event ordering have been developed for parallel simulation and they are based on partial orders and arbitrary tie break functions [LAM, 78] and on causal dependencies among events [RON, 99]. In this work we develop a formal framework able to establish a total order among events so any two pairs of events can be uniquely ordered. This total order, contrarily to partial event ordering, can order events in a deterministic manner. Our formal framework is developed on the causality principle that we give in a rigorous definition. The final result is very general and it can be used in any kind of simulation engine to establish event ordering in the presence of arbitrary network of models. II. BASIC ASSUMPTIONS The behavior of a simulation component depends both on its model and on the assumptions used to interpret this model. The same model can be differently interpreted yielding different simulation results. Before describing our approach to achieve event ordering we start to establish the basic assumptions used in this paper. ASSUMPTION 1. Digital computer representation. A digital computer can only represent the set of states S = {(p,e)| p ∈ P, e ∈ R + 0 } where P is a set of piecewise constant partial states (p-states) and e the time elapsed in p-state p. This assumption relates to the impossibility of a continuous update of variables in a digital computer. Analog computers, popular in the past, do not have this limitation. However, this kind of machine has virtually disappeared nowadays. Before presenting the causality assumption we define ε as the smallest infinitesimal positive number, i.e., ε = 0 + . This number can be defined by [BAR, 98], [BAR, 02].