Abstract
Timing requirements are important aspects in workflow modelling, analysis and enactment. In the last few years, though, many workflow languages and tools have been proposed but only few of them address timing issues during enactment. This paper shows that time stream Petri nets (TSPNs), originally designed for multimedia/hypermedia modelling and analysis, are a well-suited formalism also for supporting the whole lifecycle of workflow processes with timing constraints. A novel approach to modelling, analysis and distributed enactment of workflow processes specified by TSPNs is proposed. Functional and temporal properties of a TSPN model can be checked using exhaustive verification or a DEVS-based simulation tool. Enactment rests on PN-Engine, a decentralized enactment engine based on the service-oriented computing paradigm, which enables execution of workflow processes where the coordinated activities may involve cross-boundary organizations. The approach is illustrated by means of a modelling example concerned with a wine-production process.
Keywords
1 Introduction
A workflow model 1 represents a business process in a form that supports automated manipulation. A workflow defines a set of activities and a set of procedural rules that determine the specific order in which the activities must be executed to achieve a common goal. A workflow language should at least be capable of capturing moment of choice, sequential composition, parallel execution and synchronization. 2 All of these constructs can be naturally expressed by Petri nets (PNs). Formal semantics, local state-based system description, and abundant analysis techniques and tools make PNs a good choice for workflow management systems. Workflows are case-based, i.e. every piece of work is executed for a specific case. In the control-flow dimension, a workflow process specifies how a case is routed, i.e. which tasks need to be executed and in what order. Modelling such a process in terms of a PN is rather straightforward: tasks map on transitions, routing conditions can be expressed by places, and cases are modelled by tokens. The workflow state corresponds to the net marking. The control-flow dimension of a workflow is usually expressed by WF-nets 3 which are classical PNs which satisfy some simple structural properties.
The original contribution of this paper is threefold: (i) an exploitation of time stream Petri nets (TSPNs)4,5 for workflow modelling, (b) a realization of TSPN analysis tools, in particular a DEVS-based discrete-event simulation framework, and (c) a development of a decentralized service-based enactment infrastructure for TSPNs which is capable of handling timing specifications at runtime.
TSPNs are more powerful than well-known time Petri nets (TPNs)6,7 often used for the specification of time-dependent systems. A basic enhancement with respect to TPNs concerns the ability of explicitly expressing timing constraints of tasks and then detecting constraint violations both at the single task (i.e. single transition firing) level and at task sequence level. TSPNs associate timing validity intervals to incoming arcs of transitions. This allows not only to model activity durations but also to express timing constraints on the availability of the resources needed for completing an activity. A weak synchronization model applies to arcs but, as in TPNs, a strong synchronization model is associated with transition firings. Transitions can be annotated with one of several firing rules which give great flexibility to the modeller.
Distributed enactment of workflows specified by TSPNs is achieved by extending the features of PN-Engine, 8 a control engine for the distributed execution of systems specified by PNs. The engine is founded on the service-oriented computing paradigm.9,10,11,12 A key feature of PN-Engine is the absence of a centralized coordination entity which allows net evolution to strictly adhere to PN local firing semantics, i.e. net dynamic behaviour is ‘responsibility’ of the single transitions. The approach notably differs from those described in other works3,13,14 which instead depend on a centralized engine which coordinates the distribution of activities among different sites. PN-Engine offers functionalities for deploying a workflow, i.e. making it operational and controlling its execution. PN-Engine was also adapted to support dynamically reconfigurable workflows. 8 Current PN-Engine implementation depends on Jini 15 service infrastructure.
The paper is structured as follows. Section 2 describes some related work. Section 3 reviews TSPN concepts whilst their exploitation for modelling workflows is discussed in section 4. Section 5 describes a wine-production process (WPP) model which is used as a running case study throughout the paper. Section 6 discusses some developed analysis tools and particularly a DEVS-based16,17,18 simulation framework. In this section too some experiments concerning the analysis of the proposed wine-production process model are reported. Section 7 discusses the PN-Engine architecture and its adaptation to handling TSPN timing requirements. Section 8 covers implementation aspects of timing constraints at runtime and deployment and enactment issues of the WPP case study. Finally, conclusions are drawn with directions which deserve further work.
2 Related work
The ability to express timing requirements during the specification phase of a workflow process opens up the possibility of carrying out qualitative and quantitative analysis that take into account timing information affecting the runtime behaviour of the process.
Simulation is a widely used technique for analysing a workflow model (e.g. for discovering errors in the process definition, finding unbalanced resource utilization and bottlenecks, etc.). Although an abundance of simulation tools exist, the applicability of these tools is diversified.19,20 The development of effective simulation tools is a challenging activity mainly for what is related to the adoption of a suitable formalism that allows a seamless weaving between the analysis and the enactment of a workflow. 21
Protos 22 is a process modelling and analysis tool based on PNs. Nevertheless, it also permits the specification of business processes without using formal semantics, e.g. for supporting conceptual modelling. Processes can be analysed with respect to data, user and logic perspective. Simulation is used to evaluate utilization rates, waiting times, throughput times and costs.
General-purpose simulation tools are also used in the domain of workflow systems.19,21 CPN Tools 23 allows editing, simulation and analysis of coloured Petri nets. A fast simulator efficiently handles both untimed and timed extended nets. Correctness of a developed model can be checked by existing PN techniques such as the generation of state spaces and the analysis of boundedness and liveness properties, which are all implemented in CPN Tools.
A technique for automatically extracting the simulation model of a running process has been proposed by Rozinat et al. 20 The approach is based on the YAWL infrastructure, 22 on a process mining tool and CPN Tools. The original process model along with resource information, process state and event log history is feed into the process mining tool which produces a refined model shaped for simulation by CPN Tools.
Other approaches for workflow modelling and analysis, which use timed extensions of PNs, are known in the literature. TPNs 6 allow the association of a time interval constraining the possible firing time of a transition. The usage of TPNs as workflow specification language has been discussed by Ling and Schmidt 24 where, however, timing information is considered only during analysis.
A timed version of WF-nets, named TCWF-nets and based on timing constraint Petri nets (TCPNs), 25 has been introduced by Li et al. 26 where it has been employed for schedulability and boundedness analysis of workflows. TCPNs extend TPNs by adding minimum, maximum, and duration timing constraints to places and/or transitions.
The R/NT_WF_Net formalism, proposed by Wang and Zeng, 27 admits two different types of places respectively modelling available resources and activities that are being executed. Each activity is associated with a timing interval corresponding to its possible durations. The usage of R/NT_WF_Net, though, is limited to modelling and timing analysis.
All of the above-mentioned approaches address specification and analysis issues but neglect aspects related to the interpretation of timing specifications during workflow enactment. The latter is a recognized important problem, however, which has been not adequately dealt with also in approaches not related to PNs.28,29,30 In the following we consider some examples of approaches to workflow simulation based on the DEVS 16 formalism.
A web-based workflow simulation system that relies on DEVS has been proposed by Hong et al. 31 A workflow model is specified as a DEVS model which in turn is transformed into an intermediate relational algebra representation suitable to be stored and processed by standard relational database systems. Workflow simulation is accomplished by a standalone Java application (DEVSim-Java) which accesses the intermediate relational representation using standard Java Database Connectivity (JDBC) API.
An environment for the distributed simulation of workflow models based on DEVS has been presented by Zacharewicz er al. 32 A business process model is first expressed in a custom description language and then automatically transformed into a G-DEVS (Generalized-DEVS) 33 model so as to be simulated over HLA. 34
An approach to runtime workflow simulation, where the enactment server is directly exploited also for simulation purposes, has been proposed by Choi et al. 35 and refined by Lee et al. 36 During simulation, worklist handlers (see also Section 7) are replaced by software entities, called participant simulators that locally reproduce the evolution of real participants. Time synchronization is handled by a synchronization manager module, which is also called a Mediator because it is also in charge of mediating the interactions among participant simulators and the enactment engine. The behaviours of the synchronization manager and that of the participant simulators are specified as DEVS models.
The approach described in this paper allows modelling, analysis and distributed enactment of workflows with timing constraints, where the TSPNs formalism is used in all of the phases of the process lifecycle. Workflow simulation relies on a mapping that transforms a TSPN model into an equivalent Parallel DEVS (PDEVS) 16 model which is then fed to an efficient agent-based simulation tool. 18 Although the DEVS formalism could be directly used for specifying a workflow model, its use would require the user to either to hand code basic workflow constructs or to resort to purposely designed reusable DEVS models which mimic them. In addition, the expression of timing constraints, their analysis and assessment would not be as natural as in TSPNs. Distributed enactment of TSPN workflow models depends on PN-Engine, 8 which is a service-oriented infrastructure for the distributed execution of PN-based systems.
3 TSPNs
TSPNs4,5 were originally introduced for modelling and analysis of multimedia/hypermedia systems. They are useful, more in general, for time-dependent systems where weak synchronization constraints may be adopted.
A TSPN is a tuple
–
–
–
–
–
–
–
3.1 TSPN semantics
The marking of a TSPN is a function

Synch rules and dynamic firing interval.
In the case
where
A transition
3.2 Notes on the synchronization rules
The TSPN synchronization rules (see also Figure 2) can be driven by (a) the latest arriving process (And, Pure-And, Weak-And, And-Master) where the last arc that reaches the lower bound of its temporal interval allows the firing of its related transition, (b) the earliest arriving process (Or, Strong-Or, Or-Master) where the first arc which reaches its lower bound permits the firing of its related transition, and (c) the arriving of a statically selected process (Master, Strong-Master, Weak-Master), i.e. the transition can only fire when its master arc reaches the lower bound of its associated temporal interval.

Summary of TSPN firing rules (
Differences between the And and Pure-And firing rules are useful to point out. When the temporal intervals overlap, they behave the same way: the transition can only fire in the intersection of the intervals. In the case some intervals are disjoint, at least one arc is violated when a process gets its minimum bound. In this situation, the And firing rule permits one single synchronization point which coincides with the lower bound of the latest arriving process. In other words, under the And firing rule a transition can always fire, but with the Pure-And the firing is impossible to occur when the intersection is void.
In the master scenario, Master and Or-Master are violated when the master arc is violated. In the case of a Strong-Master transition with a non-master arc already violated, there exists one single synchronization point which coincides with the lower bound of the dynamic interval of the master arc. Instead, a Weak-Master and And-Master can never be violated.
In any case, a transition can fire when it is both logically enabled (in the sense of classical PNs) and temporally ready (i.e. the lower bound of its dynamic temporal interval defined according to the adopted synchronization rule, has been reached). For simplicity, Figure 2 mirrors the absolute time model: the temporal validity intervals of the three arcs are absolutized with respect to the absolute time instants
A subtle point of TSPN semantics is concerned with what we call the ‘last time point problem’. The problem is summarized in the TSPN model in Figure 3. Transition

A critical timing situation.
The problem can be solved by ensuring that all actions which occur at a given time are eventually completed before an arc can conclude it is violated. This is easy to achieve in simulation but can be less obvious in exhaustive verification. 37
4 TSPN as a workflow specification language
The use of TSPNs in the context of workflow modelling extends existing approaches based on basic PNs so as to enable quantitative and qualitative analysis of workflow behaviour while imposing synchronization constraints during the enactment. This work argues that TSPNs are an effective tool in the domain of workflow systems for two main reasons. First of all, timing intervals on arcs allow us to naturally express time constraints on both activities and resource utilization. Second, TSPNs have the capability of supporting different transition firing rules which are able to mirror different timing requirements in workflow process specification. In the following, the interpretation of transition firing in a workflow system is discussed and the effectiveness of TSPNs highlighted.
4.1 A workflow-based semantics of TSPN transitions
In the domain of workflow systems, the case of a transition which is bound to an activity to be performed usually raises two main interpretations of transition firing. In the first scenario the firing corresponds to the completion of an activity which has begun at the time the transition was enabled. In the second case the firing is associated with an atomic event corresponding to the start or the end of an activity. In this last case an activity, although in the state of being executed, is directly modelled in the net status by the marking of a place (see, for instance, place

Simple TSPN models.
Since TSPNs rely on race semantics for solving conflicts among transition firings, the first interpretation raises some issues concerning the meaning of the pre-emption of an activity during its execution and about concurrent utilization of a resource modelled by a place which is shared among conflicting transitions. As a consequence, as a general guideline, this work assumes that time intervals on input arcs of conflicting transitions are used to constrain the start/end events of modelled activities. In all other situations, arc temporal intervals can either express start/end events or the duration of activities. In the latter case, the firing of a transition will correspond to an end/completion event.
Given a workflow, the same activity can be carried out in different scenarios during process evolution. For instance, the activity of rejecting a loan can be executed even if the right documentation is not submitted at the right time or if a customer does not have the right requirements. To deal with these issues, a label can be associated with a transition. Each label uniquely identifies the activity (or the activity start/end event) to perform and the same label can be attached to multiple transitions.
Some simple excerpts of TSPN workflow models are reported in Figure 4. In Figure 4(a) the token in place
4.2 Specification and operational support of time patterns
Although temporal constraints have an important role in the context of business process management, the support of the time prospective appears limited in existing process management systems.28,29,30,38,39,40 Different time patterns were recently proposed in the literature38,39 with the goal of systematic assessing and comparing timing issues. Time patterns can be used to analyse the expressiveness and effectiveness of an adopted modelling language and to evaluate the operational support to timing aspects offered by a workflow system.
With the exception of issues relevant to schedulability (e.g. the bank office is open on a weekday from 09:00 to 18:00 except for the legal holiday) and service-level agreement (e.g. a customer can contact the help desk up to five times every 24 hours), proposed patterns (time lag between activities, deadline, validity period, milestone and so forth)38,39
reduce to consider: (i) time constraints between two events, (ii) time-dependent variability, i.e. the control flow of the process will vary due to time aspects. In the following, a short list of the so-called reduced patterns is proposed along with their TSPN modelling. Where not differently stated, the Pure-And firing rule for transitions and the default time interval
4.2.1 Time lag between two events
This kind of pattern refers to a scenario where a time lag between two events needs to be respected. Let
In Figures 5 and 6 are shown two TSPN models dealing with the time lag problem. Models are achieved by decorating transition

Time lag between two events: property checking.

Time lag between two events: property enforcement.
Models in Figures 5 and 6 behave in a very different way from each other. In Figure 5 transition
In Figure 6 the use of the Master synchronization rule ensures that: (i) if a token appears in place
Decoration of Figure 5 does not modify the presets of transitions
By using the Master rule in Figure 6, the dynamic firing interval of transition
It is worthy of note that the time lag pattern could not be fully supported by using other time aware versions of PNs. For instance, by using TPNs,
6
the constraint
4.2.2 Negative time lag between two events
This pattern is the dual of the time lag pattern. Let
Figure 7 shows how to decorate transitions

Negative time lag between two events: property checking.
In Figure 8 the negative time pattern is modelled under the point of view of property enforcement. The same label

Negative time lag between two events: property enforcement.
The effect of removing
4.2.3 Time-dependent variability
This pattern allows us to deal with scenarios where the process control flow may vary during process evolution as a function of timing aspects. Let
Figure 9 shows the decoration of transitions

Time-dependent variability.
5 A wine-production process model
This section illustrates the use of TSPNs and of time patterns for workflow modelling by considering an example of a simplified wine-production process (WPP) in the context of a small winery. The aim of this winery is the production of wine made from vintages of local vineyards. The WPP is made of the following phases: Destemming and crushing, Enzyme treatment, Filtration, Ageing and Bottling and labelling.
The fulfillment of the above phases requires various resources most of which are of a physical nature, e.g. holding tanks, press machines, and so on. Two types of human resources, required by the production process, are identified: the Quality checker (QC), which is responsible for controlling and warranting the quality of the phases from the arrival of raw material to the wine fermentation and for the quality assessment at the end of the ageing phase, and the Production operator (PO), which is involved in all of the operations that require the intervention of a human operator. Moreover, the WPP must satisfy some timing requirements in order to ensure a good quality of the wine. For example, the ageing phase cannot last more than 5 months.
Figure 10 shows the TSPN model of the WPP. The gray part refers to net elements which are added to manage time constraints and to enforce time-based behaviours (see Section 4.2). Places with dashed borders are references to actual places having the same names and are used to increase model readability. We assume a time unit of 1 hour for timing interval specifications and the Pure-And firing rule for transitions where not differently stated. All of the activities involving acquisition of human resources are modelled by transitions equipped with the

The TSPN model for the wine-production workflow.
The process begins with the arrival of harvested grapes mirrored by tokens put into place GA. Tokens in places QC and PO correspond to the availability of the above-described human resources. It is assumed that work shifts of the human operators are managed outside the workflow management system. Marking of place GLS reflects the number of grape loads manageable by the winery. Two wine cells exist in the firm and each of them hosts some holding tanks used for the ageing phase. Tokens in places C1 and C2 reflect the number of available holding tanks.
Transitions TUG, TDC, and TFE correspond to the sequence of phases from grape unloading to enzyme treatment. In order to avoid must deterioration, the enzyme treatment must end no later than 20 hours since the delivery of the grapes. Such a constraint is enforced by resorting to the time lag pattern (see Section 4.2.1). Place PTC is added between transitions TUG and TFE and the time interval
After the enzyme treatment the must remains for 12 hours in some small controlled fermentation tanks (places from PF1 to PF4) suitable for must conditioning. After that, the must is gathered into another larger tank (place PGM) where it continues its fermentation. When a quantity of must equal to the contents of four conditioning tanks is collected, it can be filtered (transitions TFO, TSFO and TEFO) and then transferred into a wine cell where a free holding tank is available. The filtration alone is not enough in the case the fermentation lasts more than 50 hours. In this case, it could be necessary to correct some organoleptic properties of the must. This requires the intervention of the quality checker (transitions TFC, TSFC, TEFC). The subnet PETD–TC–TEET, which behaves as a modular counter, measures the time elapsed since the begin of the fermentation phase of the oldest must at hand. In particular, (i) a token is added in PEDT each time an enzyme treatment ends, (ii) TEET fires when the first out of four of such tokens is available, (iii) TC cleans up the remaining three successive tokens. The constraint on the fermentation phase is imposed by adopting the time-dependent variability pattern (see Section 4.2.3). Two outgoing arcs are added to place PEET which respectively end on transitions TFO and TFC. These transitions are equipped with the
The availability of must ready for ageing is mirrored by the presence of tokens in PMA1 and PMA2. The must cannot remain in an holding tank for a time greater than 5 months otherwise it will deteriorate (transitions TWW1 and TWW2). The ageing phase starts as soon as all the holdings tanks in a wine cell are filled. This phase lasts a period ranging from 3 to 4 months (transition TSEC1 and TSEC2). It is worth nothing that time intervals on arcs outgoing places PMA1 and PMA2 are expressed in months.
When the ageing completes, holding tanks are emptied and the wine is moved for bottling (transitions TSBL1 and TEBL). The bottler machine may overheat during its operation. In such a situation, an overheat alarm is issued and the bottler, after completing the current job, is stopped for 4 hours. Transition TOVA models the asynchronous overheat alarm.
Pausing the bottler is achieved by using the negative time lag pattern (see Section 4.2.2): transition TSBL2 shares the same activity and the same preset/postset of TSBL1 and the arcs POA-TSBL1 and POA-TSBL2 ensures that each time an overheat event occurs the begin of bottling and labelling activity is postponed.
The process ends when the bottled wine is moved into a warehouse.
6 Analysis of TSPN models
Some tools were developed for supporting property checking of TSPN models. A first tool enables model checking of TSPNs through a model transformation into the terms of Uppaal timed automata.41,42 The restriction is introduced by using natural numbers as bounds of time validity intervals. A TSPN model is turned into a collection of parallel processes corresponding to the active components of the model, namely transitions and input arcs of transitions. Clocks are associated with input arcs only. Transitions share and consult clocks of relevant input arcs. Cicirelli et al. 37 described a library of reusable Uppaal templates, among which one models the general timed behaviour of an input arc. The remaining templates are associated with transitions. Specifically, a distinct template was developed tailored to the requirements of a particular synchronization rule and a particular configuration (i.e. number) of the transition input arcs. The approach makes it possible to verify properties of general time-constrained models, e.g. of embedded real-time systems. 37 However, for large models, i.e. having a great number of transitions and of input arcs, model checking can be difficult to practice because of the very large and highly resource demanding (in memory space and time) state graph which Uppaal generates for property assessment. In these cases, a simulation tool can instead be used which although not a substitute of exhaustive verification, permits the modeller to investigate both the functional and temporal behaviour of a system.
The following summarizes a TSPN simulation tool which was achieved on top of ActorDEVS, 17 i.e. an efficient agent-based framework in Java which supports PDEVS16,18 modelling and simulation. A key point of the approach relates to conflict management of components 43 which is normally not allowed by standard PDEVS but is an essential feature for properly modelling and executing TSPN models. Towards this, only one imminent message at time is allowed to be processed by the simulation engine.
6.1 PDEVS concepts
A PDEVS model is specified as a collection of one or more components. There are two types of components: atomic (or behavioural) components, and coupled (or structural) components. A PDEVS atomic component is a structure
Informal semantics of the above definitions are as follows. At any time the component is in some state
After entering state
In practice, an atomic component receives its inputs from typed input ports and generates outputs through typed output ports. Ports are architectural elements which favour modular system design. A component refers only to its interface ports. It has no knowledge about the identity of cooperating partners. A coupled component (subnet) is a port interconnection of existing atomic or coupled (hierarchical) components. Each component can be equipped with its own simulator. ActorDEVS, though, purposely uses a single simulation structure which serves an entire PDEVS flattened model where is minimized the number of exchanged messages.
6.2 Mapping TSPN on to PDEVS
A TSPN model is managed as a flat PDEVS coupled component. Each transition is an atomic model. Places are realized as topological passive data structures which hold marking information and know ports (messages) of connected transitions. Each time a place changes its marking, a notify message with the new place marking is sent to all of its relevant transitions. Input arcs are associated with input places of transitions. Every input arc stores, among other things, its static firing time interval and its latest enabling time instant (such an instant is infinity when the arc is not enabled).
The transformation from TSPN to PDEVS is actually accomplished manually. However, it can easily be automated by a supporting tool.
As shown in Figure 11 TSPNTransition component is a specialization of AtomicDEVS which defines common behaviour for atomic components (see Figure 13). Phases are coded as integers. Time can be dense/discrete, absolute/relative. The chosen time model is witnessed by the use of corresponding classes. A transition is characterized by its preset/postset and by its synchronization rule (a value of enumerated type Syn). The Info class captures the data part of a notify message and holds such information as a place id, the marking of this place and an indication if such marking was generated by a withdraw or deposit operation (as described later in this section). Time advance service to an enabled and temporally ready transition (i.e. current time is within its dynamic firing interval) is provided by Uniform which proposes as firing time a value uniformly distributed within the dynamic firing interval of the transition. A monitor object, i.e. an instance of a derived class of Monitor, is informed about firing/violation events of transitions, along with current time when such events occur.

Class diagram of TSPN modelling in ActorDEVS.
Figure 14 recapitulates the public interface of TSPNTransition. As one can see, TSPNTransition implements the confluent function 16 which gets invoked at each collision between an internal event and an external one arriving at last time of stay in a phase, so as for it to coincide with the external transition function. In this way, even at the last time point in the current phase, a transition can be disabled and then forbidden to complete its firing by a conflicting fired transition. To facilitate modelling, time is supposed not to be reset following a self-loop edge (external transition triggered by a received event) in a phase. The modeller can easily override this default behaviour through the use of a transitory phase (see for an example the CHECK phase in Figure 12).

PDEVS model of a TSPN transition.

Signature of basic methods of the AtomicDEVS class.
Figure 12 portrays the dynamic behaviour of a TSPN transition as modelled in PDEVS. Thick arrows denote external transitions triggered by a bag of Notify() messages. Thin arrows express internal transitions which are triggered by the elapsed time event in current phase. Before accomplishing an internal transition, the lambda() function (dashed arrows in Figure 12) is executed which generates output events to partner components. More in particular, the lambda() function of a fired transition creates a bag of Notify() messages as a consequence of changing the marking of places during its firing process. When coming back from CHECK to FIRING as a consequence of the elapsed time internal event, the lambda() function is simply void. A bag of messages is received by the external/confluent function of a TSPNTransition component, as an Iterable object. The en() predicate returns true if the transition is logically enabled (i.e. a sufficient number of tokens are available in the transition preset) and not time violated. As part of the en() service, the dynamic firing interval of the transition is determined, on the basis of the enabledness and temporal interval of the input arcs and the synchronization rule associated with the transition.
The atomic firing process of a transition t occurs in two steps: first tokens are withdrawn from the preset of t, then tokens are deposited in the postset of t. A critical point is concerned with the detection of under firing transitions which lose their enabling during the first withdrawal step of the firing process of t, but are anyway enabled at the end of the firing process. Such transitions must correctly be handled as newly enabled transitions.
In order to realize the firing process, different notify messages are employed to separately carry out a withdraw marking and a deposit marking relevant to a given transition. In Figure 12, the arrival of a bag of Notify() messages in the FIRING phase, causes a self-loop external transition in the case the transition is persistent to current firing, i.e. it is enabled both during and at the end of the firing. As soon as a transition detects that it loses its enabling in a withdrawal step, but it is enabled in the deposit phase, it switches from FIRING to the CHECK transitory phase. From CHECK the transition can re-enter the FIRING phase if the transition finds itself ultimately enabled in the deposit step, otherwise it comes to the PASSIVE phase. It should be noted that due to interleaving of concurrent actions occurring at a same time, it is possible that an under CHECK transition can lose its enabling due to the firing process of another conflicting transition.
A TSPN model is configured by first creating the place objects and the transition components. For each transition the synchronization rule and the monitor object are furnished. Places are then added to the preset/postset of transitions (see the methods in Figure 14). After that input arc connections among places and transitions are established. Model bootstrap is finally ensured by defining the initial marking for each place which in turn generates the initial message bags for transitions.

Signature of public methods of the TSPNTransition class.
6.3 WPP workflow analysis
The wine production workflow was simulated using a dense time model in order to analyse some fundamental functional and temporal properties. The investigated functional properties are:
proper case termination;
avoidance of dangling tasks.
The temporal properties are:
fulfillment of the time constraint on the enzyme treatment phase;
checking the time constraint on the fermentation phase;
avoidance of wine waste during the ageing phase;
a pause of 4 hours for the bottler each time the overhead alarm is raised.
Moreover, an estimation of the time intervals needed for completing the enzyme treatment, the fermentation phase and the bottling is provided.
Proper case termination refers to the fact that for each grape load the process will eventually end either with a transfer of bottles into the warehouse or with the attainment of wasted wine. This property is satisfied if the initial marking of place GA is equal to the sum of tokens contained in BIW, PWW1, PWW2 at the simulation end.
Avoidance of dangling tasks means that each task contributes to process evolution. This property was checked by counting how many times each transition fires during the simulation. Obviously, for the modelled process, it is preferable that all transitions but TWW1 and TWW2 fire at least once.
The TSPN/DEVS model of the wine process was submitted to the simulator along with a monitor class specifically developed for counting transition firings, checking the marking of the net during its evolution, highlighting transition violations and gathering and processing transition fire times.
Several simulation experiments were carried out. Each experiment lasts until all of the model cases are completely handled (i.e. wine is produced and stored to warehouse).
Simulation results are reported in Table 1.
Simulation results.
Measuring the time interval during which place PEET is marked does not suffice for checking fulfillment of the constraint imposed on the fermentation phase. Two other properties have to be satisfied: firings of transition TEET and TC are always interleaved, transition TEET never violates its own timing constraints. A violation of TEET constraints would imply a delay in detecting the end of the enzyme treatment.
Experimental results confirm that, from the simulation point of view, the modelled process is temporally and functionally correct.
7 Enactment of TSPN models
Enactment of TSPNs models rests on the use of PN-Engine 8 architecture. PN-Engine is a software platform that offers functionalities for deploying a distributed process modelled as a PN, making it operational and controlling its execution. The platform is based on Jini 15 and JavaSpace. 44 Jini is used as the underlying service brokering infrastructure, borrowing the advantages of dynamic registration, service lookup, notification of remote events, distributed object access and platform independence enabled by Java. JavaSpace is a tuple-space 45 permitting information sharing among distributed services of a Jini system. Information within a space, i.e. entries, can be read/written/taken by competing services thus implicitly synchronizing to one another.
The architecture of PN-Engine is depicted in Figure 15.

PN-Engine architecture.
The core component, i.e. that controlling net instances’ enactment, is not a monolithic software entity, like in the WfMC reference model,1,46 but it is made up of a set of interacting services deployed over a distributed context. This architectural aspect is fundamental for achieving the decentralized execution of the control logic.
For each task of a process model, PN-Engine automatically creates and publishes an instance of a Jini service, named TransitionService. This service embeds the logic for evaluating the preconditions that need to be satisfied in order to begin task execution and for (indirectly) notifying its completion to other interested TransitionService. There are two main usage patterns of Jini services. In a first scenario, which is the only one supported by Web Services, clients interact with the service, which runs on a remote provider, by exchanging network messages. In a second scenario, the service code is transparently downloaded and locally executed by the client. In this case, interactions between client and service code are no longer mediated by the provider and network communications are avoided. The adoption of the latter usage pattern for the TransitionService is the key to achieving decentralized process enactment.
Real task executors which participate in the process, namely worklist handlers in the case of human resources and invoked applications in the other cases, need to download the TransitionService code relevant to the activities they are in charge of. Actually, TransitionService(s) are pieces of the enactment engine automatically deployed and running on the side of worklist handlers and invoked applications. Current version of PN-Engine relies on JavaSpace as the communication infrastructure enabling TransitionService(s) to share and manage (part of) process control data for coordinating their behaviours. With processes modelled as PNs, control data correspond to net marking which is reflected by PlaceEntry objects stored in the tuple space. For each place in the net, a PlaceEntry is written into the space. Initial marking is established as part of the deployment phase. Other data, relevant to transition status and configuration (indicating, e.g., the adopted firing rules), are managed as entries into the space. In particular, for each transition, a TransitionStatus and a TransitionConf object is considered.
During net evolution, the management of the above-described entries is responsibility of TransitionService(s) that are in charge of handling all of the aspects related to transition firings.
PN-Engine supports an implicit workflow partitioning because, being based on the service metaphor, TransitionService(s) can be operating on different cross-boundary organizations or departments. In this case, the presence of a single JavaSpace service may represent a performance bottleneck. Usually, activities handled by a given organization are relative to a specific part of the business process and are strictly correlated among them while they have low or no coupling with other activities. A good deployment strategy consists in resorting to a distinct JavaSpace service for storing place entries relevant to a set of high coupled transitions, e.g. those corresponding to a sub-process handled by a given organization or department. However, places that are shared by transitions whose activities are carried out by different organizations must be replicated in the respective spaces and their accesses/modifications must occur under transaction to ensure atomicity and consistency. PN-Engine handles this issue directly by exploiting the native transaction support offered by JavaSpace.
TransitionService(s) interact with worklist handlers and invoked applications by requiring them to implement a specific Java interface named TransitionListener. When a TransitionService realizes that the corresponding activity could be executed, it notifies this event to the listener which is in charge of performing the activity. When the execution of the activity is completed the service gets informed by the listener. This approach allows the net definition and deployment to be decoupled from the actual executors that carry out process activities.
Entities implementing the TransionListener interface get bound to TransitionService(s) through the mediation of a service named ActivityManagerService.
The NetManager service is used by who plays the role of the engine manager. This service offers functionalities for feeding a process description into the system, deploying it and controlling the execution of its instances.
The node which is responsible of providing all of the above-mentioned services is called PNEngineProvider. In particular, the TransitionService(s) relevant to a given net definition are dynamically created and published once a new process definition is setup by the NetManager.
The behaviour of a TransitionService actually is capable also of coping with the case where multiple instances of it exist, i.e. when more listeners are registered to a single transition. In this scenario only the first among these services which gets bound to a listener will actively participate in the transition firing, i.e. in the withdrawal and deposit phases. The remaining instances, instead, will only be informed about the transition firing. PN-Engine is able to deal with this situation making a distinction between active and passive TransitionService (see Figure 16). Obviously the firing ends when all listeners complete the execution of their activities. The TransitionStatus object associated with a transition gets updated each time a TransitionService completes its activity thus allowing us to determine when all activities have been terminated.

A transition having multiple listeners.
8 Handling timing requirements at runtime
In order to support TSPNs, PN-Engine was extended by introducing a new class, named TSPNTransitionImpl, that implements TransitionService functionalities. Such class handles all of the aspects related to the management of timing constraints. Figure 17 shows a statechart modelling the behaviour of an instance of TSPNTransitionImpl. At start-up, each transition service finds itself in the Disabled state where it waits for the arrival of events notifying a change in the marking of places in its preset. Whenever one such notification is received, the service checks the enabling status of its incoming arcs. When an arc becomes enabled, the occurrence time of the notification event is stored. As soon as all of the incoming arcs are enabled, the service computes the transition dynamic firing interval according to the transition synchronization rule. Then, it schedules a timer to expire at the absolute time corresponding to the lower bound of the dynamic firing interval and afterwards it switches to the Enabled macro state. Listeners are notified when such a state is entered.

Statechart modelling the behaviour of a TSPN-TransitionService.
While in the Enabled state, the transition service listens to events related to marking changes. There are two types of such messages: WithdrawalEvt and DepositEvt. The first type is related to the token withdrawal phase of another transition which establishes an intermediate marking. The service reacts to these events by replying to the sending service with a WithdrawalAck message. This must be done in order to ensure that the intermediate marking is taken into account by all of the interested transitions before the beginning of the deposit phase of the firing transition. The DepositEvt message type, instead, concerns a deposit phase and does not require any reply message. If a WithdrawalEvt or a DepositEvt causes the disabling of one incoming arc of the transition service, the service goes back to the Disabled state and aborts what it was doing in the Enabled macro state (as described in the following). The default sub-state of Enabled is Waiting, where the service waits for the expiration of the timer set upon entering Enabled. At timer expiration, which means that the transition is now fireable, the service moves to the Firing sub-state, where it schedules another timer to occur at the absolute time corresponding to the upper bound of the dynamic firing interval and afterwards it notifies all of its listeners that the corresponding activity may be started or completed (see Section 4.1). While in Firing, the service waits for an acknowledgement message from each of its listeners. As soon as all of these acknowledgements are received, the service switches to the Locking sub-state where it locks the places of its preset. As it succeeds in acquiring the lock, the service checks whether the transition is still enabled. This control is made because the transition may have been disabled in the meanwhile but the related events have not yet been received. If the transition is found to be still enabled, the lock ownership ensures that the withdrawal phase can safely begin, so the service moves to the Withdrawal state. In contrast, the lock is released and the service waits for the notifications not yet received. As said before, if the Enabled state is left because the transition has been disabled, some clean-up has to be done: listeners are notified by sending them an activity-revocation message, set timers are cancelled. While in the Enabled state, the timer expiration corresponding to the upper bound of the dynamic firing interval causes the Error state to be entered and clean-up operations to be done as above. Upon entering the Withdrawal state, tokens are removed from the transition preset, WithdrawalEvt messages are transmitted to relevant transition services and Commit messages are sent to transition listeners. On gathering all of the WithdrawalAck messages, the transition service switches to the Deposit state where it begins the deposit phase by requiring a lock on the postset places. After the lock is acquired, the marking of these places is first updated, then all of the owned locks are released, the relevant DepositEvt messages are sent and, finally, the Disabled state or the Enabled state is entered depending on the enabling status of the transition after its own firing. It is assumed that the time needed for solving conflicts among transitions and the time related to network delay and to the use of JavaSpace are negligible with respect to the time needed for executing the real coordinated activities.
8.1 Workflow deployment and execution
The proposed WPP model was executed on three Win platforms Pentium IV 3.4 GHz interconnected by a 1 GB Ethernet switch. One computing node was used as a service provider for the PN-Engine services, Jini and JavaSpace. Remaining nodes were used for hosting TransitionListener(s) which, in a real scenario, would be deployed accordingly to the actual placement of the resources within the winery context. Two Transition Listener(s) were considered respectively for the QC and the PO. Each listener looks up for the TransitionService(s) relevant to the transitions it has to listen to, then it registers upon them. This phase is carried out by using the ActivityManagerService (see Figure 18(a)) which assists with lookup and registration steps. A listener bound to a human resource simply acts as a notifier.

Graphical user interfaces.
When an enabling event is delivered, the relevant activity is highlighted in the operator’s GUI (see Figure 18(b)). A subsequent firing event causes the flashing of the field GUI associated with the activity. When this occurs, a start-event or completion-event requires to be managed and the human operator has to press the corresponding button in order to signal her/his readiness to accomplish the assignment. Owing to the race firing semantics, it may happen that a starting-event may be revoked due to a pre-emption. As a consequence, the human operator must wait for the arrival of a final notification confirming that she/he can put into effect the activity (commit message) or signaling that the operation has been revoked (abort message).
9 Conclusions
In this paper we have proposed an approach to modelling, analysis and execution of workflows with timing constraints using TSPNs. TSPNs have the capability of supporting various timing requirements in workflow process specification. Moreover, satisfying certain time constraints rather than others can be achieved by simply changing synchronization firing rules of modelled transitions. Property analysis can be based on model checking or on a DEVS centred simulation tool. Distributed enactment depends on PN-Engine, 8 a service-based enactment engine characterized by the absence of a centralized control entity.
On-going work is geared at:
identifying other time patterns38,39 where the various TSPN firing-rules can be best applied;
experimenting with race-with-memory semantics in order to specifically support patterns relevant to service-level agreement;
investigating techniques for managing dynamic reconfiguration of workflows 8 in the presence of time constraints;
implementing a data-exchange mechanism among TransitionListener(s), e.g. by attaching data to tokens in the space;
investigating error recovery policies and fault-tolerance issues during workflow execution; 47
experimenting with PN-Engine for the orchestration of composed services.
Footnotes
Funding
This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
Author biographies
). His current research interests include: software engineering of time-dependent and distributed systems, real-time systems, Petri nets, modelling and parallel simulation of complex systems, multi-agent systems, service-oriented computing. He is a member of the ACM and the IEEE.
