1 Introduction

The development of appropriate models is crucial for the design, analysis and control of dynamic systems. The usefulness of a model depends on both its capacity to capture the relevant features of the system, and its capacity for mathematical analysis. These capacities of the model largely rely on the adopted modeling formalism, i.e. on the set of modeling principles and rules that are used to build the model. The task of modeling is often hindered by the lack of detailed system information.

This paper exploits the particular features of Flexible Nets (FNs), a modeling formalism introduced in Júlvez et al. (2018) to study Wilson disease, to model and analyze dynamic systems with uncertain parameters, to account for partially observable systems and, to compute the control actions that optimize a given control objective. Roughly speaking, a dynamic system can be seen as a set of state variables that are modified by means of processes (by process, we mean any event, operation or activity whose occurrence has the potential to change the state of the system). These two basic entities, state and process, are mutually related: on the one hand, the execution of the processes determines how the state changes; on the other hand, the state determines the speed of the processes. These relationships between state and processes are clear, for instance, in a chemical system where the state is given by the amount of molecules and the processes are the reactions taking place in the system. On the one hand, the occurrence of reactions produces a change in the amount of molecules that satisfies the stoichiometry of these reactions. On the other hand, the rate of the reactions depends on the amount of molecules. FNs capture these relationships between state and processes by means of two different nets: the event net and the intensity net.

Let us introduce some of the basic features of FNs by means of a simple chemical reaction network. Assume that the reaction network is composed of the following two reactions:

$$R_{1}:\emptyset \rightarrow\ A\hspace{3cm} R_{2}: A\rightarrow\ nB+4nC$$

Reaction R1 models the production of compound A (each occurrence of R1 increases the concentration of A, which is denoted [A], one unit), and reaction R2 models how A is decomposed into compounds B and C. The amounts which [B] and [C] are increased by the occurrence of R2 depend on n. Let us assume that n is uncertain, but known to be in the interval [20,22]. That is, each occurrence of R2 decreases [A] one unit, increases [B] n units, and increases [C] 4n units where n ∈ [20,22]. Let us further assume that the initial concentrations of [B] and [C] are 0, and the initial concentration of [A] is known to be in the interval [9.9,1.1].

The FN in Fig. 1 models the described reaction network. Namely, each chemical compound is a associated with a circle (which will be called a place), and each reaction is associated with a rectangle (which will be called a transition). The stoichiometry of the reactions is modeled by the equations associated with the dots labelled v1 and v2 (which will be called event handlers). The uncertain stoichiometry of R2 is accounted for by the inequalities associated with v2, i.e. a=v, 20vb≤ 22v and c= 4b; and the uncertain initial concentration [A] is captured by the inequalities associated with A, i.e. 9.9≤m0[A]≤ 1.1.

Fig. 1
figure 1

FN modeling a simple chemical reaction network

The event net of an FN is a graph with three different types of vertices: places, transitions and event handlers. While places and transitions are used to model the state and the processes of the system, respectively, event handlers are used to determine the quantities by which the state is changed when given processes occur. Each place is associated with a state variable, and the value of that variable at a given instant is called marking, or number of tokens, in that place. Similarly, each transition is associated with a process, and the number of times the process has taken place is the number of actions in the transition. Each event handler connects a set of transitions to a set of places, and is associated with a set of linear inequalities that relates actions to marking. Given a number of actions in the connected transitions, any solution of the set of linear inequalities can be used to update the number of tokens in the connected places. Thus, the amount by which the marking changes is allowed to be nondeterministic. This feature of event nets allows the model to account for the different system evolutions that can arise as a consequence of uncertainty in the system. In Fig. 1, the event net is composed of the places, transitions, event handlers and arcs and edges in green.

Let us further assume that the rate of reaction R1 is uncertain, but constrained to the interval [4.5,5.5], i.e. the number of reactions that occur per time unit is in [4.5,5.5], and the rate R2 satisfies 0.9[A] ≤ rate(R2) ≤ 1.1[A], i.e. it is proportional to [A] with an uncertainty of 10%. These reaction rates are modeled in the FN by the inequality associated with R1 and the inequality associated with the dot labelled s1 (which will be denoted intensity handler).

Similarly to event nets, an intensity net is a graph with three different types of vertices: places, transitions and intensity handlers. Places and transitions have the same role as in event nets. Each intensity handler connects a set of places to a set of transitions, and is associated with a set of linear inequalities that relates the number of tokens with the speed of the transitions, i.e. of the processes modeled by the transitions. The intensity, or speed, of a transition determines the rate at which actions are created in the transition. As in event nets, any solution of the inequalities can be used to determine the speed of transition, thus, linear inequalities can be used to model uncertainties in the dynamics of the system. In Fig. 1, the intensity net is composed by the places, transitions, intensity handlers and arcs and edges in blue.

An FN is the result of combining an event net and an intensity net, i.e. an FN is a graph with four types of vertices: places, transitions, event handlers and intensity handlers. While the intensity net establishes the speeds at which actions are generated as a function of the marking, the event net specifies how the generated actions are executed and how a new marking is computed. Thus, although FNs are inspired by Petri nets (Murata 1989), their structure is different, since in addition to places and transitions, FNs have handlers which are connected to places and transitions by arcs and edges. FNs offer both high modeling power and appealing analysis possibilities that aim to make use of all the information provided by the available uncertain parameters. Namely, FNs can accommodate uncertainties in the initial marking, in the marking change produced by the firing of the transitions, in the default speeds of transitions, and in the speed of transitions produced by the marking.

A number of different formalisms can be found in the literature that can, to some extend, incorporate uncertain parameters in their models. Depending on the domain of their state variables, these formalisms can be roughly classified as those whose variables are integer numbers, and those whose variables are real numbers (hybrid approaches combine both types of variables).

In the discrete domain, extensions of the most popular modeling formalisms exist that can handle uncertain parameters. For instance, in the Petri nets arena, uncertain knowledge of the marking is particularly well handled by fuzzy (Looney 1988) and possibilistic Petri nets (Cardoso et al. 1999), uncertainty in the firing of transitions can be accounted for by labeled (Cabasino et al. 2010) and interpreted (Ramirez-Trevino et al. 2003) Petri nets, and uncertain firing times can be modeled by time Petri nets (Merlin and Faber 1976) and stochastic Petri nets (Ajmone Marsan et al. 1995). Other discrete formalisms that include extensions to account for uncertain parameters are probabilistic Boolean networks (Shmulevich et al. 2002), which are an extension of Boolean networks (Wang et al. 2012), and influence diagrams (Detwarasiti and Shachter 2005), which are generalizations of Bayesian networks (Needham et al. 2007) that can solve decision problems under uncertainty. Stochastic extensions of timed automata (Alur and Dill 1994) also exist in which delays and discrete choices are made randomly (Bertrand et al. 2014). In a similar vein, stochastic extensions of process algebras (Priami et al. 2001; Ciocchetta and Hillston 2008) have been proposed to describe components with uncertain behaviour (Clark et al. 2007).

A major difference of the above mentioned approaches with respect to FNs is that the state variables of FNs are real numbers. This implies that genuinely discrete systems cannot be modeled by FNs. Nevertheless, the use of real variables facilitates, in general, the use of more efficient analysis methods since the state explosion problem inherent to large discrete systems is avoided, and linear programming techniques can be applied. Moreover, large discrete populations can be approximated reasonably well in many cases by means of real variables (Bortolussi et al. 2013). With respect to the existing stochastic approaches and extensions, it should be said that they offer the possibility to perform useful statistical analyses, which usually require information about the probability distributions of the system, and often involve a significant computational cost. In contrast, FNs do not require information about probability distributions, just about the intervals in which the uncertain parameters lay. This results in efficient analysis techniques based on linear programming.

The most popular modeling approaches in the continuous domain are based on differential equations (Braun et al. 1983; Tyson et al. 2011; van den Berg et al. 2008). In particular, the relaxation of the integrality constraint in a discrete formalism usually leads to models that are governed by differential equations. For instance, the evolution of continuous Petri nets (Silva et al. 2011), which can be seen as a relaxation of Petri nets (Murata 1989), is determined by a set of ordinary differential equations. Another popular modeling formalism that can graphically represent systems in different domains and that can be easily converted to state space representation is bond graphs (Borutzky 2010). However, it should be emphasised that a potential difficulty in the design of models based on differential equations is that exhaustive and accurate information about the system dynamics is required, i.e. uncertain parameters cannot be easily handled. Note that the time trajectory of a system modeled by ordinary differential equations is continuous and deterministic. On the other hand, constraint-based models, which are popular in systems biology (Varma and Palsson 1994; Orth et al. 2011), can incorporate uncertain dynamic information but their analysis capabilities are limited to the steady state.

An important feature of FNs is that they can bridge the gap between deterministic models and constraint-based models by allowing the incorporation of uncertain parameters. Thus, on the one hand and similarly to continuous Petri nets which are deterministic (Jiménez et al. 2004), FNs can model positive linear systems; on the other hand and similarly to constraint-based models (Varma and Palsson 1994), FNs can model systems with uncertain initial state and uncertain process speeds. In contrast to Petri nets, the timing of transitions and the marking changes in places are explicitly separated in FNs: the timing is handled by the intensity handlers, and the marking changes by the event handlers. This can lead to a clearer and more concise graphical representation of the system. Moreover, efficient computational methods exist to analyse the transient state of FNs.

The rest of the paper is organized as follows: Section 2 introduces event nets and shows how a partially observable system can be modeled. Intensity nets are presented in Section 3. The combination of these nets leads to FNs, which are defined in Section 4. Section 5 shows how FNs can handle systems with uncertain parameters and analyze them. Section 6 concludes the paper.

2 Event nets

In the following, the reader is assumed to be familiar with Petri nets (see Murata1989 for a gentle introduction).

2.1 Definition and state equations

This section introduces event nets, which can be denoted as TVP nets, i.e. actions in transitions T produce and consume tokens in places P through event handlers V. Event handlers connect places and transitions, and determine the marking changes according to the actions in the transitions. In contrast to Petri nets, the net elements that produce changes in the marking are the event handlers, and such changes are allowed to be nondeterministic.

Definition 1 (Event net)

An event net is a tuple \({{\mathcal {N}}}_{V}=(P,T,V,E_{V},A,B)\) where (P, T, V, EV) is a tripartite graph determining the net structure and (A, B) are matrices determining the potential evolutions of the marking.

The set of vertices of the net is partitioned into three sets:

  • P = {p1,…,pi,…} is a set of |P| places.

  • T = {t1,…,tj,…} is a set of |T| transitions.

  • V = {v1,…,vk,…} is a set of |V | event handlers.

The places, depicted as circles, model the different types of components or elements in the system, e.g. resources, products, items, etc. The transitions, depicted as rectangles, model the different types of operations, activities or processes in the system. Such operations require time to be performed and have the potential to change, i.e. produce and consume, the amount of components, i.e. the marking. The event handlers, depicted as dots, model the different ways in which the transitions can change the marking.

The vertices of the net are connected by the edges in EV. Each pair of vertices can be connected by at most one edge. The set EV is partitioned into two sets \({E_{V}^{P}}\) and \({E_{V}^{T}}\), where \({E_{V}^{P}}\) is a set of directed edges connecting places to event handlers and vice versa, and \({E_{V}^{T}}\) is a set of undirected edges connecting transitions and event handlers. For simplicity, directed edges are referred as arcs, and undirected edges as edges. More formally:

  • Every \(e\in {E_{V}^{P}}\) is either an arc e = (pi,vk) from a place pi to a handler vk, or an arc e = (vk,pi) from a handler vk to a place pi.

  • Every \(e\in {E_{V}^{T}}\) is an edge e = {tj,vk} connecting a transition tj and a handler vk.

Notice that direct connections among places and transitions are not allowed. The following notation is used:

  • pvk denotes the input places of vk, i.e. \(^{p}v_{k}=\{p_{i}|(p_{i},v_{k})\in {E_{V}^{P}}\}\)

  • \({v_{k}^{p}}\) denotes the output places of vk, i.e. \({v_{k}^{p}}=\{p_{i}|(v_{k},p_{i})\in {E_{V}^{P}}\}\)

  • vpi denotes the input handlers of pi, i.e. \(^{v}p_{i}=\{v_{k}|(v_{k},p_{i})\in {E_{V}^{P}}\}\)

  • \({p_{i}^{v}}\) denotes the output handlers of pi, i.e. \({p_{i}^{v}}=\{v_{k}|(p_{i},v_{k})\in {E_{V}^{P}}\}\)

  • tvk denotes the transitions connected to vk, i.e. \(^{t}v_{k}=\{t_{j}|\{t_{j},v_{k}\}\in {E_{V}^{T}}\}\)

  • \({t_{j}^{v}}\) denotes the handlers connected to tj, i.e. \({t_{j}^{v}}=\{v_{k}|\{t_{j},v_{k}\}\in {E_{V}^{T}}\}\)

Example 1

The event net in Fig. 2a has three places, P = {p1,p2,p3}, one transition, T = {t1}, and two event handlers V = {v1,v2}. The set of arcs is \({E_{V}^{P}}=\{(p_{1},v_{1}), (v_{1},p_{2}), (p_{1}, v_{2}), (v_{2},p_{3})\}\), and the set of edges is \({E_{V}^{T}}=\{\{t_{1},v_{2}\}\}\). The set of all arcs and edges is \(E_{V}={E_{V}^{P}}\cup {E_{V}^{T}}\). As examples for the introduced notation, the set of output handlers of p1 is \({p_{1}^{v}}=\{v_{1},v_{2}\}\), the set of transitions connected to v2 is tv2 = {t1}, and the set of input handlers of p3 is vp3 = {v2}.

Fig. 2
figure 2

a Event net. b Potential state evolutions with discrete firings of the event handlers (the components of the vectors correspond to the variables (m[p1] m[p2] m[p3] aT[t1]))

In an event net, each place contains a number of tokens (or marking), and each transition contains a number of actions that represent the potential of the system to carry out the associated process. In contrast to tokens, actions require time to be produced (the production rate of actions is determined by the intensity net, see Section 3). The state of an event net accounts not only for the marking and the number of actions, but also for the marking changes and the execution of actions:

Definition 2 (State)

The state of an event net \({{\mathcal {N}}}_{V}\) is given by the tuple (σ, aT,aEm, m), where:

  • \(\sigma \in \mathbb {R}^{|T|}_{\geq 0}\) is a vector indexed by T where σ[tj] is the number of actions produced in tj.

  • \(a_{T}\in \mathbb {R}^{|T|}_{\geq 0}\) is a vector indexed by T where aT[tj] is the number of actions available in tj.

  • \(a_{E}\in \mathbb {R}^{|{E_{V}^{T}}|}_{\geq 0}\) is a vector indexed by \({E_{V}^{T}}\) where aE[{tj,vk}] is the number of actions of tj executed by vk.

  • \({\Delta }m\in \mathbb {R}^{|{E_{V}^{P}}|}_{\geq 0}\) is a vector indexed by \({E_{V}^{P}}\) where Δm[(pi,vk)] is the number of tokens in pi consumed by vk, and Δm[(vk,pi)] is the number of tokens in pi produced by vk.

  • \(m\in \mathbb {R}^{|P|}_{\geq 0}\) is the marking, i.e. a vector indexed by P where m[pi] is the number of tokens in pi.

Thus, every net element (except for the event handlers) is associated with at least one nonnegative real variable. Since actions need time to be produced, at the initial state it holds σ = 0, aT = 0 and aE = 0. Notice that dealing with real state variables instead of discrete ones allows the model to incorporate real quantities and to approximate large discrete quantities as in continuous Petri nets (Silva et al. 2011). In any case, the state variables can be constrained to the nonnegative integers if required, see Section 2.2.

Each event handler vkV is associated with a set of linear inequalities that relate the number of actions executed in the connected transitions to the marking changes in the connected places. The coefficients of such a set of inequalities can be expressed by two matrices (Ak,Bk) of real numbers and the same number of rows that are associated with each handler vkV. The number of actions executed by vk, af, and the produced marking changes, Δmf, is given by AkΔmfBkaf. The columns of Ak are indexed by the arcs connecting vk to places. The columns of Bk are indexed by the edges connecting transitions to vk. Matrix A(B) is obtained by arranging all the matrices Ak(Bk) diagonally.

Example 2

The inequalities associated with the event handlers of the net in Fig. 2a are: v1:a=b and \(v_{2}{:}\left \{\begin {array}{cc}a{=}x\\ x{\leq } b{\leq } 2x \end {array}\right .\), where ’a’, ’b’ and ’x’ are used to label arcs and edges. More precisely, in v1:a=b, ’a’ denotes the number of tokens in p1 consumed by v1, and ’b’ denotes the number of tokens in p2 produced by v1. In the inequalities associated with v2, ’a’ and ’b’ denote the number of tokens in p1 consumed by v2 and the number of tokens in p3 in produced by v2 respectively, and ’x’ denotes the number of actions in t1 executed by v2. The equality v1:a=b means that the number of tokens in p1 consumed by v1 is equal to the number of tokens in p2 produced by v1. In other words, for every token in p1 consumed by v1, a token is produced in p2 by v1, this can be interpreted as tokens moving from p1 to p2 through v1.

The equation a=x associated with v2 means that the number of tokens in p1 consumed by v2 is equal to the number of actions in t1 executed by v2, e.g. if one action is executed then one token is consumed. Moreover, the inequality xb≤ 2x means that the execution of one action in t1 by v2, i.e. x = 1, produces a nondeterministic quantity b ∈ [1,2] of tokens in p3 (each execution of an action can produce a different amount b ∈ [1,2] of tokens in p3).

Notice that v1 is not connected to any transition. This means that no process is required to move a token from p1 to p2. For the sake of mathematical notation, it can be assumed that v1 is connected to a fake transition, tfake, that has no effect on the model. The matrices A1, B1, A2 and B2 that capture the inequalities associated with the event handlers are:

$$ A_{1}{=} \left( \begin{array}{cc} 1 & -1\\ -1 & 1 \end{array}\right) ; B_{1}{=} \left( \begin{array}{l} 0\\ 0 \end{array}\right) ; A_{2}{=} \left( \begin{array}{cccc} 1 & 0\\ -1 & 0\\ 0 & -1\\ 0 & 1 \end{array}\right) ; B_{2}{=} \left( \begin{array}{ll} 1\\ -1\\ -1\\ 2 \end{array}\right) $$

where the indices of the columns of A1 are ordered as (p1,v1), (v1,p2); the index of the column of B1 is {tfake,v1}; the indices of the columns of A2 are ordered as (p1,v2), (v2,p3); and the index of B2 is {t1,v2}. Thus, the number of actions executed and marking changes produced by v2 are related by:

$$ \left( \begin{array}{cc} 1 & 0\\ -1 & 0\\ 0 & -1\\ 0 & 1 \end{array}\right) \left( \begin{array}{cc} {\Delta}m[(p_{1},v_{2})]\\ {\Delta}m[(v_{2},p_{3})] \end{array}\right) {\leq} \left( \begin{array}{cc} 1\\ -1\\ -1\\ 2 \end{array}\right) \left( \begin{array}{cc} a_{E}[\{t_{1},v_{2}\}] \end{array}\right) $$

Matrices A1 and A2(B1 and B2) can be arranged diagonally to obtain A(B):

$$ A= \left( \begin{array}{cccc} 1 & -1 & 0 & 0\\ -1 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & -1 & 0\\ 0 & 0 & 0 & -1\\ 0 & 0 & 0 & 1 \end{array}\right) ;\ \ B= \left( \begin{array}{cc} 0 & 0 \\ 0 & 0 \\ 0 & 1 \\ 0 & -1 \\ 0 & -1 \\ 0 & 2 \end{array}\right) $$

where the indices of the columns of A are (p1,v1), (v1,p2), (p1,v2), (v2,p3); and the indices of the columns of B are {tfake,v1}, {t1,v2}.

Notice that the number of actions produced in a transition (by the intensity net), σ, is equal to the number of actions that have been executed by the connected event handlers, aE, plus the number of actions still available, aT, hence, it holds:

$$ \sigma[t_{j}]=a_{T}[t_{j}]+\sum\limits_{v_{k}\in {t_{j}^{v}}} a_{E}[\{t_{j},v_{k}\}]\ \ \forall\ t_{j}\in T $$
(1)

Similarly, the number of tokens in a place pi is equal to the initial number of tokens, which is denoted m0[pi], minus the number of tokens consumed plus the number of tokens produced by the connected event handlers:

$$ m[p_{i}]{=}m_0[p_{i}] {-} \sum\limits_{v_{k}\in {p_{i}^{v}}} {\Delta}m[(p_{i},v_{k})] {+}{\sum}_{v_{k}\in^{v}p_{i}} {\Delta}m[(v_{k},p_{i})]\ \ \forall\ p_{i}\in P $$
(2)

The event net establishes how the state evolves as event handlers are enabled and fire.

Definition 3 (Enabling)

Event handler vk is enabled at (σ, aT,aEm, m) if a vector \(a_{f}\in \mathbb {R}_{\geq 0}^{|^{t}v_{k}|}\) indexed by the edges of vk, and a vector \({\Delta }m_{f}\in \mathbb {R}_{\geq 0}^{|^{p}v_{k}|+|{v_{k}^{p}}|}\) indexed by the arcs of vk exist such that:

$$ \begin{array}{@{}rcl@{}} a_{f}[\{t_{j},v_{k}\}] &\leq& a_{T}[t_{j}]\ \ \ \forall\ t_{j}\in ^{t}v_{k} \end{array} $$
(3)
$$ \begin{array}{@{}rcl@{}} A_{k} {\Delta}m_{f} &\leq& B_{k} a_{f} \end{array} $$
(4)
$$ \begin{array}{@{}rcl@{}} {\Delta}m_{f}[(p_{i},v_{k})] &\leq& m[p_{i}]\ \ \ \forall\ p_{i}\in ^{p}v_{k} \end{array} $$
(5)
$$ \begin{array}{@{}rcl@{}} \mathbf{1}a_{f} + \mathbf{1}{\Delta}m_{f} & >& 0 \end{array} $$
(6)

Inequality (3) guarantees that enough actions are available, (4) makes use of the matrices Ak and Bk to relate the number of executed actions to the marking changes, (5) guarantees that enough tokens are available in the input places to be consumed, (6) guarantees that the overall state change is not null. Notice that the inequalities (4) allow the modeling of uncertainty in the marking changes produced by the execution of actions.

Definition 4 (Firing)

An event handler vk enabled at (σ, aT,aEm, m) can fire. The firing of vk leads instantaneously to a new state \((\sigma ,a_{T}^{\prime },a_{E}^{\prime },{\Delta }m^{\prime },m^{\prime })\) where only the variables associated with edges, arcs, places and transitions connected to vk are updated as follows:

$$ \begin{array}{@{}rcl@{}} a_{T}^{\prime}[t_{j}] & =& a_{T}[t_{j}] - a_{f}[\{t_{j},v_{k}\}]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \forall \ t_{j}{\in} ^{t}v_{k}\\ a_{E}^{\prime}[\{t_{j},v_{k}\}] &=& a_{E}[\{t_{j},v_{k}\}] + a_{f}[\{t_{j},v_{k}\}]~~~~~~~~~~~~~~~~~~~~~~~~~ \forall \ t_{j}{\in} ^{t}v_{k}\\ {\Delta}m^{\prime}[(p_{i}, v_{k})] & =& {\Delta}m[(p_{i}, v_{k})] + {\Delta}m_{f}[(p_{i}, v_{k})]~~~~~~~~~~~~~~~~~ \forall \ p_{i}{\in} ^{p}v_{k}\\ {\Delta}m^{\prime}[(v_{k}, p_{i})] & =& {\Delta}m[(v_{k}, p_{i})] + {\Delta}m_{f}[(v_{k}, p_{i})]~~~~~~~~~~~~~~~~~ \forall \ p_{i}{\in} {v_{k}^{p}}\\ m^{\prime}[p_{i}]&=&m[p_{i}]{-}{\Delta}m_{f}[(p_{i}, v_{k})]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \forall \ p_{i}{\in} ^{p}v_{k}\\ m^{\prime}[p_{i}]&=&m[p_{i}]{+} {\Delta}m_{f}[(v_{k}, p_{i})]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \forall \ p_{i}{\in} {v_{k}^{p}} \end{array} $$

where af and Δmf satisfy (3), (4), (5) and (6).

Notice that an enabled handler is not forced to fire, and that the state reached by the firing of an event handler is allowed to be nondeterministic (see inequality (4)). Moreover, the firing does not force the execution of a minimum number of actions nor the consumption or production of a minimum number of tokens. In fact, the equations in Definition 4 are trivially satisfied with af = 0 and Δmf = 0. Thus, such equations also hold for every non-enabled handler with af = 0 and Δmf = 0.

The overall change in the state produced by several firings is the result of adding the changes produced by each firing. This leads to a set of equations that are satisfied by the states that can be reached from the initial state.

Proposition 1 (State equations)

Let the state of an event net \({{\mathcal {N}}}_{V}\) be (σ, σ,0,0,m0), i.e. σ actions are available and no event handler has fired. Every state (σ, aT,aEm, m) reachable from (σ, σ,0,0,m0) belongs to \(SE_{{{\mathcal {N}}}_{V}}(\sigma ,m_0)\) where:

$$ \begin{array}{ll} SE_{{{\mathcal{N}}}_{V}}(\sigma,m_0) = \{(&\sigma,a_{T},a_{E},{\Delta}m,m)| \\ & \sigma = a_{T} + Y_{\sigma} a_{E}\\ & A {\Delta}m \leq B a_{E}\\ & m = m_0 + Z_{m} {\Delta}m\} \end{array} $$
(7)

where Yσ and Zm are determined by the net structure:

  • Yσ is a matrix with rows indexed by T, columns indexed by \({E_{V}^{T}}\), and such that \(Y_{\sigma }[t_{j},\{t_{j},v_{k}\}]=1\ \forall \ \{t_{j},v_{k}\}\in {E_{V}^{T}}\) and the rest of the elements in Yσ are 0,

  • Zm is a matrix with rows indexed by P, columns indexed by \({E_{V}^{P}}\), and such that \(Z_{m}[p_{i},(p_{i},v_{k})]=-1\ \forall \ (p_{i},v_{k}) \in {E_{V}^{P}}\), \(Z_{m}[p_{i},(v_{k},p_{i})]=1\ \forall \ (v_{k},p_{i}) \in {E_{V}^{P}}\) and the rest of the elements in Zm are 0,

and aT, aE, Δm and m are nonnegative variables.

Proof

Let us show that equations (7) necessarily hold for every state (σ, aT,aEm, m) reachable from (σ, σ,0,0,m0). Equation σ = aT + YσaE in (7) states that the number of actions produced, σ, is equal to the number of actions executed, aE, plus the number of actions available, aT. This is equivalent to (1) expressed in matrix form, and thus necessarily holds. Equation AΔmBaE in (7) is the matrix form of (4) and accounts for all the actions executed and all the marking changes produced by the firing of all the event handlers. That is, it captures all the cumulative marking changes, Δm, produced by all the executed actions, aE, and, hence, must necessarily hold. Finally, equation m = m0 + ZmΔm in (7) which updates the number of tokens, m, in all the places according to the cumulative marking changes, Δm, is the matrix form of (2) and, hence, must also hold. □

Roughly speaking, the role of matrix Yσ is to distribute the actions in transitions among the handlers connected to them, see (1). The role of Zm is to collect and add the marking changes produced by the firings, see (2).

Example 3

Equation σ = aT + YσaE for the event net in Fig. 2a assuming again that v1 is connected to a fake transition is:

$$ \left( \begin{array}{cc} \sigma[t_{1}]\\ \sigma[t_{fake}] \end{array}\right) = \left( \begin{array}{cc} a_{T}[t_{1}]\\ a_{T}[t_{fake}] \end{array}\right) + \left( \begin{array}{cc} 1 & 0\\ 0 & 1 \end{array}\right) \left( \begin{array}{cc} a_{E}[\{t_{1},v_{2}\}]\\ a_{E}[\{t_{fake},v_{1}\}] \end{array}\right) $$

and equation m = m0 + ZmΔm is:

$$ \left( \begin{array}{cc} m[p_{1}]\\ m[p_{2}]\\ m[p_{3}] \end{array}\right) = \left( \begin{array}{cc} m_0[p_{1}]\\ m_0[p_{2}]\\ m_0[p_{3}] \end{array}\right) + \left( \begin{array}{cccc} -1 & 0 & -1 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0& 1 \end{array}\right) \left( \begin{array}{cc} {\Delta}m[(p_{1},v_{1})]\\ {\Delta}m[(v_{1},p_{2})]\\ {\Delta}m[(p_{1},v_{2})]\\ {\Delta}m[(v_{2},p_{3})] \end{array}\right) $$

Let us assume that the marking of the net in Fig. 2a is m[p1]= 2, m[p2]= 0, m[p3]= 0, that one action was produced in t1, i.e. σ[t1]= 1, and it is available, i.e, aT[t1]= 1, and no event handler has fired. This corresponds to the state (σ[t1]= 1, aT[t1]= 1, aE[{t1,v2}]= 0, (Δm[(p1,v1)]= 0,Δm[(v1,p2)]= 0,Δm[(p1,v2)]= 0, Δm[(v2,p3)]= 0), (m[p1]= 2,m[p2]= 0,m[p3]= 0)). At this state, both event handlers, v1 and v2, are enabled and can fire. If v2 fires in an amount of 1, i.e. x= 1, then: aT[t1] and m[p1] are decreased by 1; aE[{t1,v2}] and Δm[(p1,v2)] are increased by one; and Δm[(v2,p3)] and m[p3] are increased by a nondeterministic quantity in the interval [1,2] (the value of σ[t1] remains unaltered as no actions are produced).

The graph in Fig. 2b shows the potential evolutions of the net under the assumption that event handlers fire in discrete amounts, i.e. all markings and actions are integers. The components of the vectors of states in the graph correspond to the variables (m[p1] m[p2] m[p3] aT[t1]). The arcs are labeled with the event handler that is fired. Remark that while the firing of v1 produces a deterministic change (one token consumed from p1 and one token produced in p2), the state change produced by the firing of v2 is nondeterministic (either one or two tokens can be produced in p3).

Notice that equations (7) account for the cumulative effect, and not the sequence, of the firings. In particular, the availability of tokens and actions consumed by the sequence of firings is not checked. This can lead to spurious solutions (Silva et al. 1998) in the state equations. Hence, equations (7) represent a necessary condition for the reachability of (σ, aT,aEm, m).

In order to account for linear relationships among the values of the initial marking, m0 is assumed to be a vector constrained as:

$$ J_{m}m_0\leq K_{m} $$
(8)

where Jm and Km are real matrices of appropriate size. Note that the inequalities (8) can be used to account for the uncertain initial marking of a place, e.g. 10 ≤ m0[p1] ≤ 12, or to express linear constraints among markings, e.g. m0[p1] + m0[p2] = 5 and m0[p4] = 2m0[p3]. Equations (7) can be easily modified to take into account the relationships expressed by (8):

$$ \begin{array}{ll} SE_{{{\mathcal{N}}}_{V}}(\sigma,J_{m},K_{m}) = \{(&\sigma,a_{T},a_{E},{\Delta}m,m)| \\ & \sigma = a_{T} + Y_{\sigma} a_{E}\\ & A {\Delta}m \leq B a_{E}\\ & m = m_0 + Z_{m} {\Delta}m\\ & J_{m}m_0\leq K_{m}\} \end{array} $$
(9)

Although event handlers are not forced to fire, it is useful in some cases to consider only those states in which all the actions of given transitions have been executed. Let \(T_{F}\subseteq T\) be the set of transitions whose actions must have been executed, i.e. the number of available actions of tjTF must be 0. In order to constrain (9) to such a set of states, the following equation can be added:

$$ a_{T}[t_{j}] = 0\ \ \forall\ t_{j}\in T_{F} $$
(10)

2.2 Partial observability

In an event net, the marking change produced by the execution of an action is allowed to be nondeterministic. This is the case when there are several event handlers connected to a transition, or if the connected event handler has appropriate inequalities associated with it. The nondeterministic effect of the execution of actions can be used to develop nondeterministic models and, in particular, to model partially observable systems. The state equations (9) account for all the states that can be reached after the firing of event handlers. In the context of partial observability, these equations characterize the set of states that are consistent with a given observation of a partially observable system. The following example shows how a partially observable system can be modeled by an event net.

For the sake of this example, let us assume that the event handlers of the net in Fig. 3a only fire in discrete amounts and that only the sequence of transitions whose actions are executed is observable. For clarity, the equations of event handlers that make all their labels equal are omitted, e.g. the equations of v1 are a=b and a=x, and they are therefore omitted (this same omission is made in the nets of the rest of the paper).

Fig. 3
figure 3

a Event net modeling a partially observable system. b Potential evolutions of the marking with discrete firings

Thus, the observation of t1 corresponds to the firing of v1; the firing of v2 is unobservable (silent event) because it is not connected to a transition; the observation of t2 corresponds either to the firing of v3 or v4 because both handlers use the actions in t2 (in other words, t2 models events that cannot be distinguished by an observer); the observation of t3 corresponds to the firing of v5.

The graph in Fig. 3b shows the potential evolutions of the net with m0 = (1 0 0 0 0 0) and σ = (2 1 1), the components of the vectors in the graph correspond to the marking of places (p1p2p3p4p5p6). Initially, only v1 can fire and, hence, the execution of actions in t1 is the only event that can be observed. The observation of t1 means that a token was consumed from p1 and a token was produced in p2. Since p2 is the input place of v2 whose firing cannot be observed, a token in p2 can remain in p2 or move silently to p3. Thus, the set of markings consistent with the observation of t1 is {(0 1 0 0 0 0),(0 0 1 0 0 0)}, see second row of the graph. Assume that t2 is now observed, i.e. either v3 or v4 has fired. If the marking was (0 0 1 0 0 0), then v3 (the only enabled handler) has fired and that leads to marking (0 0 0 1 0 0). Otherwise, v4 has fired and that leads either to (0 0 0 0 1 0) or (0 0 0 0 2 0) because one firing of v4 can produce one or two tokens in p5. Thus, the set of markings consistent with the observation of the sequence of events t1 and t2 is {(0 0 0 0 1 0),(0 0 0 0 2 0),(0 0 0 1 0 0)}, see third row of the graph. Assume that t3 is now observed, i.e. v5 has fired. Notice that the firing of v5 requires two tokens in p5, thus, after the observation of t1 and t2, (0 0 0 0 2 0) is the only consistent marking at which v5 can fire. Consequently, the only sequence of markings consistent with the observation of t1, t2 and t3 is (1 0 0 0 0 0), (0 1 0 0 0 0), (0 0 0 0 2 0) and (0 0 0 0 0 1).

Notice that the state equations (7) can be used straightforwardly to compute the set of consistent markings with a given observation. For instance, for the observation of t1, t2 and t3 discussed above, the marking m = (0 0 0 0 0 1) is the only solution of:

$$ \sigma = a_{T} + Y_{\sigma} a_{E};\ A {\Delta}m \leq B a_{E};\ m = m_0 + Z_{m} {\Delta}m;\ \sigma=(2\ 1\ 1);\ a_{T}=(1\ 0\ 0) $$

where σ = (2 1 1) and aT = (1 0 0) are the number of actions available at the beginning and at the end respectively. That is, each transition was observed once, i.e. σaT = (1 1 1).

3 Intensity nets

3.1 Definition and state equations

This section introduces intensity nets, which can be denoted as PST nets, i.e. tokens in places P produce and consume intensities in transitions T through intensity handlers S. The intensity of a transition tj is the speed at which actions are produced in tj. In other words, the number of actions produced at t is given by the integral over time of the intensity of tj. Intensity nets and event nets operate in a similar fashion. In fact, the changes in the intensities are produced by tokens in the intensity net in the same way that changes in the marking are produced by actions in the event net.

Definition 5 (Intensity net)

An intensity net is a tuple \({{\mathcal {N}}}_{S}=(P,T,S,E_{S},C,D)\) where (P, T, S, ES) is a tripartite graph determining the net structure and (C, D) are matrices determining the potential intensity changes produced by the marking.

The set of vertices of the net is partitioned into three sets, P is the set of places, T is the set of transitions, and:

  • S = {s1,…,sl,…} is a set of |S| intensity handlers.

Places and transitions model the same system features as in the event net. The intensity handlers are depicted as dots and model the different ways in which the tokens can generate intensities in the transitions.

The vertices of the net are connected by the edges in ES. Each pair of vertices can be connected by at most one edge. The set ES is partitioned into two sets \({E_{S}^{T}}\) and \({E_{S}^{P}}\), where \({E_{S}^{T}}\) is a set of directed edges (or simply arcs) connecting transitions to intensity handlers and vice versa, and \({E_{S}^{P}}\) is a set of undirected edges (or simply edges) connecting places and intensity handlers. Thus, although both event handlers and intensity handlers are represented as dots, they can be easily distinguished by the arcs and edges that connect them to transitions and places. More formally:

  • Every \(e\in {E_{S}^{T}}\) is either an arc e = (tj,sl) from a transition tj to a handler sl, or an arc e = (sl,tj) from a handler sl to a transition tj.

  • Every \(e\in {E_{S}^{P}}\) is an edge e = {pi,sl} connecting a place pi and a handler sl.

As in the event net, connections among places and transitions are not allowed. The following notation is used:

  • tsl denotes the input transitions of sl, i.e. \(^{t}s_{l}=\{t_{j}|(t_{j},s_{l})\in {E_{S}^{T}}\}\)

  • \({s_{l}^{t}}\) denotes the output transitions of sl, i.e. \({s_{l}^{t}}=\{t_{j}|(s_{l},t_{j})\in {E_{S}^{T}}\}\)

  • stj denotes the input handlers of tj, i.e. \(^{s}t_{j}=\{s_{l}|(s_{l},t_{j})\in {E_{S}^{T}}\}\)

  • \({t_{j}^{s}}\) denotes the output handlers of tj, i.e. \({t_{j}^{s}}=\{s_{l}|(t_{j},s_{l})\in {E_{S}^{T}}\}\)

  • psl denotes the places connected to sl, i.e. \(^{p}s_{l}=\{p_{i}|\{p_{i},s_{l}\}\in {E_{S}^{P}}\}\)

  • \({p_{i}^{s}}\) denotes the handlers connected to pi, i.e. \({p_{i}^{s}}=\{s_{l}|\{p_{i},s_{l}\}\in {E_{S}^{P}}\}\)

As in the event net, the places in the intensity net contain tokens. These tokens can be used by the intensity handlers to produce intensities. A token is active if it is being used by an intensity handler, otherwise it is idle. While idle tokens are associated with places, active tokens are associated with edges. An intensity handler determines how much intensity is produced in its arcs as a function of the number of active tokens in its edges.

The state of the net is given by the variables associated with the net elements. Formally:

Definition 6 (State)

The state of an intensity net \({{\mathcal {N}}}_{S}\) is given by the tuple (m, μP,μEλ, λ), where:

  • \(m\in \mathbb {R}^{|P|}_{\geq 0}\) is the marking, i.e. a vector indexed by P where m[pi] is the number of tokens in pi,

  • \(\mu _{P}\in \mathbb {R}^{|P|}_{\geq 0}\) is a vector indexed by P where μP[pi] is the number of idle tokens in pi,

  • \(\mu _{E}\in \mathbb {R}^{|{E_{S}^{P}}|}_{\geq 0}\) is a vector indexed by \({E_{S}^{P}}\) where μE[{pi,sl}] is the number of active tokens of pi being used by sl,

  • \({\Delta }\lambda \in \mathbb {R}^{|{E_{S}^{T}}|}_{\geq 0}\) is a vector indexed by \({E_{S}^{T}}\) where Δλ[(tj,sl)] is a decrease of intensity in tj produced by sl, and Δλ[(sl,tj)] is an increase of intensity in tj produced by sl,

  • \(\lambda \in \mathbb {R}^{|T|}_{\geq 0}\) is a vector indexed by T where λ[tj] is the intensity in tj.

The number of tokens in a place pi is equal to the number of its idle tokens plus the number of its active tokens:

$$ m[p_{i}]=\mu_{P}[p_{i}]+\sum\limits_{s_{l} \in {p_{i}^{s}}} \mu_{E}[\{p_{i},s_{l}\}]\ \ \forall\ p_{i}\in P $$
(11)

An intensity handler is said to be working when it is producing intensities. When an intensity handler slS starts working, the number of idle tokens in psl decreases, the number of active tokens in its edges increases (such tokens start being used by the handler), and intensities are produced in its arcs. Conversely, when an intensity handler sl stops working, the number of idle tokens in psl increases (i.e. they are released by the handler), the number of active tokens becomes 0, and no intensities are produced in its arcs. Thus (in contrast to the firing of event handlers whose firing cannot be reversed once it has occurred) intensity handlers are allowed to start and stop working (or to increase and decrease their working rates), thus allocating tokens as active tokens and releasing them as idle tokens over time.

The relation between the number of active tokens and the intensities produced are given by a set of inequalities associated with each intensity handler slS. The coefficients of these inequalities can be captured by two matrices (Cl,Dl) of real numbers and same number of rows. The columns of Cl are indexed by the arcs connecting sl to transitions. The columns of Dl are indexed by the edges connecting places to sl. Matrix C(D) is obtained by arranging all the matrices Cl(Dl) diagonally.

Each transition tj is assigned a default (or nominal) intensity λ0[tj]. Thus, the intensity λ[tj] in a transition tj is equal to λ0[tj] plus the positive changes in intensity minus the negative changes in intensity:

$$ \lambda[t_{j}]=\lambda_{0}[t_{j}] {-} \sum\limits_{s_{l}\in {t_{j}^{s}}} {\Delta}\lambda[(t_{j},s_{l})] {+}\sum\limits_{s_{l}\in ^{s}t_{j}} {\Delta}\lambda[(s_{l},t_{j})]\ \ \forall\ t_{j}\in T $$
(12)

The number of active tokens, \(\mu _{w}\in \mathbb {R}_{\geq 0}^{|^{p}s_{l}|}\) indexed by the edges of sl, being used by an intensity handler sl, and the intensities, \({\Delta }\lambda _{w}\in \mathbb {R}_{\geq 0}^{|^{t}s_{l}|+|{s_{l}^{t}}|}\) indexed by the arcs of sl, produced by sl are related by the matrices Cl and Dl as follows:

$$ C_{l} {\Delta}\lambda_{w} \leq D_{l} \mu_{w} $$
(13)

If 1μw + 1Δλw > 0, then sl is said to be working. Similarly to event handlers, intensity handlers are not forced to work. When a number of intensity handlers work simultaneously, they share the tokens in places and collaborate in the production of intensities. In a similar way to (4), the inequalities (13) allow the modeling of uncertainty in the intensity changes produced by the active tokens.

Similarly to (7), the state equations of the intensity net determine the potential states of the net for a given marking m and default intensities λ0:

Proposition 2 (State equations)

Let the state of an intensity net \({{\mathcal {N}}}_{S}\) be (m, m,0,0,λ0), i.e. m idle tokens are available and no intensity handler is working. Every state (m, μP,μEλ, λ) reachable from (m, m,0,0,λ0) belongs to \(SE_{{{\mathcal {N}}}_{S}}(m,\lambda _{0})\) where:

$$ \begin{array}{ll} SE_{{{\mathcal{N}}}_{S}}(m,\lambda_{0}) = \{(&m,\mu_{P},\mu_{E},{\Delta}\lambda,\lambda)| \\ & m = \mu_{P} + Y_{m} \mu_{E}\\ & C {\Delta}\lambda \leq D \mu_{E}\\ & \lambda = \lambda_{0} + Z_{\lambda} {\Delta}\lambda\} \end{array} $$
(14)

where Ym and Zλ are matrices determined by the net structure:

  • Ym is a matrix with rows indexed by P, columns indexed by \({E_{S}^{P}}\), and such that \(Y_{m}[p_{i},\{p_{i},s_{l}\}]=1\ \forall \{p_{i},s_{l}\}\in {E_{S}^{P}}\) and the rest of the elements in Ym are 0,

  • Zλ is a matrix with rows indexed by T, columns indexed by \({E_{S}^{T}}\), and such that \(Z_{\lambda }[t_{j},(t_{j},s_{l})]=-1\ \forall (t_{j},s_{l}) \in {E_{S}^{T}}\), \(Z_{\lambda }[t_{j},(s_{l},t_{j})]=1\ \forall (s_{l},t_{j}) \in {E_{S}^{T}}\) and the rest of the elements in Zλ are 0,

and μP, μE, Δλ and λ are nonnegative variables.

Similarly to (7), the equations m=μP + YmμE, CΔλDμE, λ=λ0 + ZλΔλ in (14) are the matrix forms of (11), (13) and (12) respectively, and thus, must hold at every state (m, μP,μEλ, λ) reachable from (m, m,0,0,λ0). As in (7), equations (14) account for the cumulative intensities produced by the handlers, and hence, \(SE_{{{\mathcal {N}}}_{S}}(m,\lambda _{0})\) can contain spurious solutions.

As in (8), inequalities can be considered to model linear relationships among the values of the default intensities, λ0. Let us assume that λ0 is a vector constrained as:

$$ J_{\lambda}\lambda_{0}\leq K_{\lambda} $$
(15)

where Jλ and Kλ are real matrices of appropriate size. Similarly to (8), the inequalities (15) can be used to model the uncertain default intensity of a transition, or to establish linear constraints among default intensities of transitions. Equations (14) can be easily modified to take into account the relationships expressed by (15):

$$ \begin{array}{ll} SE_{{{\mathcal{N}}}_{S}}(m,J_{\lambda},K_{\lambda}) = \{(&m,\mu_{P},\mu_{E},{\Delta}\lambda,\lambda)| \\ & m = \mu_{P} + Y_{m} \mu_{E}\\ & C {\Delta}\lambda \leq D \mu_{E}\\ & \lambda = \lambda_{0} + Z_{\lambda} {\Delta}\lambda\\ & J_{\lambda}\lambda_{0}\leq K_{\lambda}\} \end{array} $$
(16)

Although intensity handlers are not forced to work, it is useful in some cases to consider only those states in which all the tokens of given places are active. Let \(P_{F}\subseteq P\) be the set of places whose tokens must be active, i.e. the number of idle tokens of piPF must be 0. In order to constrain (16) to such a set of states, the following equation can be added:

$$ \mu_{P}[p_{i}] = 0\ \ \forall\ p_{i}\in P_{F} $$
(17)

3.2 Modeling capabilities

Figure 4 shows some of the modeling capabilities of intensity nets. The default intensity, λ0[t], of a transition, t, can be written next to the transition, see Fig. 4b (default intensities equal to 0 are omitted in the figures). As in the event nets, labels are associated with arcs and edges to represent amounts of produced/consumed intensities and number of active tokens.

Fig. 4
figure 4

Modeling capabilities of intensity nets

The intensity net in Fig. 4a has one place p1, one transition t1 and one intensity handler s1. The inequality associated with s1 establishes that the intensity Δλ[(s1,t1)] produced in the arc (s1,t1) by s1 must satisfy 2μE[{p1,s1}]≤Δλ[(s1,t1)]≤ 3μE[{p1,s1}] where μE[{p1,s1}] is the number of active tokens in {p1,s1} (notice that given that m[p1]= 2, the number of active tokens is upper bounded by 2). The actual value of Δλ[(s1,t1)] is selected nondeterministically in this interval. Since the default intensity of t1 is 0 and (s1,t1) is the only arc connected to t1, it holds λ[t1]=Δλ[(s1,t1)] what establishes the rate at which actions will be produced in t1.

The intensity handler s1 in Fig. 4b makes use of the active tokens in p1 to decrease the intensity in t1 and increase the intensity in t2. This can be seen as an intensity transfer from one transition to the other. According to the equations associated with s1, which can be rewritten as μE[{p1,s1}] = Δλ[(t1,s1)] = Δλ[(s1,t2)], the amount of this transfer is equal to the number of active tokens, μE[{p1,s1}], which in this case is at most 2 given that m[p1] = 2. Thus, if there is one active token, i.e. μE[{p1,s1}] = 1, according to the state equations (14) the resulting intensities will be λ[t1] = λ0[t1] −Δλ[(t1,s1)] = λ0[t1] − μE[{p1,s1}] = 5 − 1 = 4 and λ[t2] = λ0[t2] + Δλ[(s1,t2)] = λ0[t2] + μE[{p1,s1}] = 0 + 1 = 1.

The net in Fig. 4c shows how the intensity of one transition, t1, can be used to produce intensity in other transitions, t2 and t3. For this net, the state equations (14) become λ[t1] = λ0[t1]−Δλ[(t1,s1)]−Δλ[(t1,s2)], λ[t2] = λ0[t2]+Δλ[(s1,t2)], λ[t3] = λ0[t3]+Δλ[(s2,t3)], Δλ[(t1,s1)] = Δλ[(s1,t2)], Δλ[(t1,s2)] = Δλ[(s2,t3)]. Given that λ0[t1] = 6 and λ0[t2] = λ0[t3] = 0, these state equations reduce to λ[t1]+λ[t2]+λ[t3] = 6 what summarizes the potential intensities of the net.

The net in Fig. 4d models a choice in place p1, i.e. each token in p1 can be used either to produce an intensity within the interval [1,2] in t1, or synchronize with a token in p2 to produce an intensity within the interval [3,5] in t2.

4 Flexible nets

This section introduces Flexible Nets (FNs), which can be denoted as PHT nets, i.e. places P and transitions T are connected by event and intensity handlers. Roughly, an FN consists of an event net and an intensity net that have the same set of places and the same set of transitions.

Definition 7 (Flexible net)

A Flexible Net (FN) is a tuple \(\mathcal {N}\) = (P, T, V, EV,A, B, S, ES,C, D) where (P, T, V, EV,A, B) is an event net and (P, T, S, ES,C, D) is an intensity net.

In an FN, the event net determines the way actions produce marking changes, and the intensity net determines the way tokens produce intensity changes. The inequalities associated with handlers allow the modeler to cover a range of relationships between “actions and tokens” and “tokens and intensities”. Thus, handlers can be seen as a flexible layer between places and transitions that offers the possibility to model uncertainties in both the way actions produce marking changes, and the way tokens produce intensity changes.

The FN in Fig. 5 is composed of the event net in Fig. 2a and the intensity net in Fig. 4a. While the event net determines the marking changes produced by the firing of event handlers, the intensity net establishes the rate at which actions are created in t1. Notice that the firing of v2 implies the execution of actions in t1, i.e. actions need to be produced in t1 so that v2 can fire. On the other hand, v1 is not connected to any transitions and, thus, it can fire when there is a positive marking in p1. It should be noted that this is not equivalent to an immediate transition in Petri nets, since the firing of t2 is not forced to happen as soon as the marking of p1 is positive, its firing can occur at any time at which the marking of p1 is positive.

Fig. 5
figure 5

FN resulting of combining the event net in Fig. 2a and the intensity net in Fig. 4a

In order to compute the number of actions produced in transitions, the number of actions produced in the intensity arcs will be computed first. Let Δσ(τ) denote the number of actions produced in the intensity arcs until time τσ[e](τ) with \(e\in {E_{S}^{T}}\) denotes the number of actions produced in e). The value of Δσ(τ) is defined as the integral of Δλ over time:

$$ {\Delta}\sigma(\tau)={\int}_{0}^{\tau} \! {\Delta}\lambda(s) \mathrm{d}s $$
(18)

The overall number of actions, σ[tj](τ), produced in a transition tj can be computed by integrating λ[tj], or equivalently, by making use of Zλ, see (14), and Δσ(τ):

$$ \sigma(\tau) = \lambda_{0}\tau + Z_{\lambda} {\Delta}\sigma(\tau)\\ $$
(19)

In addition to the state variables of the event and intensity net, Δσ is included in the tuple of variables defining the state of the FN.

Definition 8 (State)

The state x of an FN is given by the tuple x = (m, μP,μEλ, λ, Δσ, σ, aT,aEm).

All the state variables are time dependent. For the sake of clarity, the time dependency will be omitted when it is clear from the context, e.g. m(τ) is shortened to m. At time 0 it holds Δσ = 0, σ = 0, aT = 0, aE = 0, Δm = 0, i.e. the initial state can be written as: (m, μP,μEλ, λ,0,0,0,0,0).

By making use of \(SE_{{{\mathcal {N}}}_{V}}(\sigma ,J_{m},K_{m})\) in (9), \(SE_{{{\mathcal {N}}}_{S}}(m,J_{\lambda },K_{\lambda })\) in (16), (18) and (19), it is possible to write a set of equations that any potential state at time τ must satisfy.

Proposition 3 (State equations)

Let \({{\mathcal {N}}}\) be an FN with initial marking m0 satisfying Jmm0Km, and default intensities λ0 satisfying Jλλ0Kλ. Every state (m, μP, μEλ, λσ, σ, aT,aEm) reachable at time τ belongs to \(SE_{{{\mathcal {N}}}}(\tau ,J_{m},K_{m},J_{\lambda },K_{\lambda })\) where:

$$ \begin{array}{ll} SE_{{{\mathcal{N}}}}&(\tau,J_{m},K_{m},J_{\lambda},K_{\lambda}) = \{(m,\mu_{P},\mu_{E},{\Delta}\lambda,\lambda,{\Delta}\sigma,\sigma,a_{T},a_{E},{\Delta}m)| \\ & m = \mu_{P} + Y_{m} \mu_{E};\ C {\Delta}\lambda \leq D \mu_{E};\ \lambda = \lambda_{0} + Z_{\lambda} {\Delta}\lambda; J_{\lambda}\lambda_{0}\leq K_{\lambda}\\ & {\Delta}\sigma=\displaystyle{\int}_{0}^{\tau} \! {\Delta}\lambda(s) \mathrm{d}s;\ \sigma = \lambda_{0}\tau + Z_{\lambda} {\Delta}\sigma\\ & \sigma = a_{T} + Y_{\sigma} a_{E};\ A {\Delta}m \leq B a_{E};\ m = m_0 + Z_{m} {\Delta}m;\ J_{m}m_0\leq K_{m} \} \end{array} $$
(20)

where every variable is nonnegative.

This way, an FN is a continuous time model where time, denoted as τ, is the independent variable and all the state variables are nonnegative reals.

Equations (20) can be interpreted as follows: at a given time τ, some of the produced actions (σ) are available (aT), and the rest (aE) were executed before τ. The executed actions produced marking changes (Δm) which resulted in the marking m in places at τ. Some of the tokens in m are active (μE) and the rest are idle (μP). Active tokens produce intensity changes (Δλ) which result in overall intensities (λ) in transitions at τ. The integral of the intensity changes and overall intensities over time after τ will produce more actions (σ), i.e. σ is produced as time elapses. This behavior repeats over time: when a new marking is reached, intensities are updated, which can lead to the production and execution of new actions, which consequently results in a new marking.

As in the event and intensity nets, constraints (10) and (17) can be added to (20) to force the execution of actions and the activity of places.

5 Exploiting uncertainty

The state equations (20) account for all the potential states of the net at time τ. In order to facilitate the analysis of FNs, a set of necessary reachability conditions was developed (Júlvez et al. 2018). These conditions consist of linear and quadratic inequalities that all the solutions of (20) must satisfy during the interval [0,τ]. In order to obtain a time trajectory of the state, i.e. values of the state at different time instants τ1, τ2, τ3, …, two methods are considered:

  1. 1.

    The first method consists of developing a unique set of necessary reachability conditions that combines the reachability conditions of each interval [0,τ1], [τ1,τ2],[τ2,τ3],…, in such a way that all the states that satisfy the constraints at the end of a given interval are taken as potential initial states for the next interval (see Júlvez et al. 2018 for details). Once this set of constraints is obtained, a particular trajectory of the FN can be computed by adding an objective function to such a set of constraints, and by solving the resulting programming problem.

  2. 2.

    The second method follows a model predictive control (MPC) (Kouvaritakis and Cannon 2016) approach. According to this approach, the programming problem described in the first method is solved over the intervals [0,τ1],[τ1,τ2],…,[τn− 1,τn] where τn is the prediction horizon. Then, the state obtained at τ1 is taken as the initial state and a programming problem over the intervals [τ1,τ2],[τ2,τ3],…,[τn,τn+ 1] is defined and solved. This procedure can be repeated with the subsequent intervals.

It should be noted that solving convex quadratic programming problems is required by both methods above. Given that the computational complexity required to solve such problems is polynomial, the proposed computational methods can be applied to large FNs. The following subsections present some of the modeling, analysis and control capabilities of FNs by modeling a linear system with uncertain parameters, a resource allocation system and a system with control actions.

5.1 Linear system with uncertain parameters

The FN in Fig. 6 models a linear system with uncertain dynamics. More precisely, if we assume that all the tokens are forced to be active and all the actions to be executed, the rate at which the marking changes can be expressed as:

$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{1}] & =& -q - hm[p_{1}] + m[p_{2}] + 2 \end{array} $$
(21)
$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{2}] & =& q - m[p_{2}] \end{array} $$
(22)
$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{3}] & =& hm[p_{1}] - 2 \end{array} $$
(23)

where q and h are uncertain parameters but known to be in the intervals: q ∈ [1.0,1.5], h ∈ [0.9,1.1]. Thus, any potential time trajectory of the system will satisfy (21) with values of q and h within the given intervals. The uncertain parameter q is modeled by the default intensity of t1, and h is modeled by the inequalities of s3. Notice that the FN in Fig. 6 combines transitions with constant speed, e.g. t4, transitions whose speed is proportional to the marking of a place, e.g. t2, and uncertain parameters.

Fig. 6
figure 6

FN with uncertain dynamics modeled by the default intensity of t1 and the inequalities of s3

Let the initial marking be m0[p1]= 4, m0[p2]= 0, and m0[p3]= 0. Figure 7 shows the time trajectories of the marking and the intensities of t1 and t3 under different objective functions (notice that the intensity of t2 is equal to m[p2], and the intensity of t4 is constant and equal to 2). The trajectories have been obtained by an MPC approach with a sample time (or interval) of 0.1 time units and a prediction horizon of one sample time. This means that initially, i.e. at time 0.0, the programming problem (Júlvez et al. 2018) is defined and solved over the time interval [0.0, 0.1]. The solution of the problem is taken as the state of the system at time 0.1. Then, the programming problem is defined and solved over the interval [0.1, 0.2], and the procedure is repeated.

The trajectory in Fig. 7a is obtained by the objective function “minm[p3]”, i.e. the goal is to minimize the marking of p3 at the end of each interval. In the plots, \(\bar {\lambda }[t_{j}]\) denotes the average intensity of tj during each interval. For such an objective, the solution of the programming problem sets the uncertain parameters to λ0[t1]= 1.5 and 0.9a=r (which results in λ[t3]= 0.9m[p1]). This setting minimizes the flow directed from p1 to the branch composed of v3 and v4. As expected, the intensity of t1 and t2 (t3 and t4) is the same at steady state.

Fig. 7
figure 7

Time evolution of the FN in Fig. 6 when m[p3] is minimized (a) and maximized (b)

The trajectory in Fig. 7b is obtained by the objective function “maxm[p3]”. For such an objective, the solution of the programming problem sets λ0[t1]= 1.0 and r= 1.1a (which results in λ[t3] = 1.1m[p1]). This setting maximizes the flow directed from p1 to the branch composed of v3 and v4.

5.2 Resource allocation

The FNs in Fig. 8 models a dynamic system in which shared resources can be allocated to different production lines. Such a net shows how the tokens of a given place can activate different processes (those places have several intensity edges) and can cooperate with active tokens of other places. Namely, there are two types of resources, pa and pb, and three production lines, t1, t2 and t3. The production line associated with t1(t2) uses the raw material modeled by the tokens in p1(p3) and produces items modeled by the tokens in p2(p4). The production line associated with t3 produces tokens in p5 and it is assumed that it requires no raw material (or equivalently, this raw material is inexhaustible). In order to operate, the production line associated with t1(t3) requires the allocation of resources of type pa(pb). The speed of these production lines, t1 and t3, is proportional to the number of tokens allocated to them. The operation of production line t2 requires the cooperation of both resources, pa and pb, i.e. tokens of both resources must synchronize in equal amounts to make t2 work. The speed of t2 is equal to the number of tokens of pa (or pb) allocated to this production line.

Fig. 8
figure 8

FN modeling a resource allocation system with three production lines and two shared resources

While the event handlers, v1, v2 and v3 determine the relationship between the input and output material of the production lines, the intensity handlers specify the speed of these lines according to the number of active tokens assigned to each line. In particular, the intensity edges {pa,s1} and {pa,s2} model the fact that the active tokens of pa can be used either by s1 or s2. In a similar way, the fact that the active tokens of pb can be used either by s2 or s3 is modeled by the intensity edges {pb,s2} and {pb,s3}. This way, s2 is the intensity handler responsible for the synchronization of resources for t2. The actions of all transitions are forced to be executed in order to model the active tokens to make the production lines work. Note that the graphical representation of the system by an FN is reasonably clear and compact. If the system were modeled by a classical Petri net, each transition would have to be split into several transitions that would each model the acquisition and release of the resources and the speed of the production lines. This would lead to a more complex graphical notation and, potentially, to more involved analysis methods.

Let the initial marking of the net be m0[p1]= 3, m0[p2]= 0, m0[p3]= 2, m0[p4]= 0, m0[p5]= 0, m0[pa]= 2 and m0[pb]= 1, i.e. there are two copies of resource type pa and one copy of resource type pb. Assume that the goal is to compute how the resources must be allocated over time so that the objective function \(\bar {m}[p_{2}]{+}0.5\bar {m}[p_{4}]{+}0.25\bar {m}[p_{5}]\), where \(\bar {m}[p_{i}]\) denotes the average marking of pi, is maximized. In words, this objective function implies that the goal is to maximize the production of all items giving priority to the products of type p2, then p4 and finally p5.

This resource allocation problem can be solved by a single programming problem (see first method in Section 5) that makes use of the reachability constraints in Júlvez et al. (2018) and the mentioned objective function. More precisely, in order to obtain time trajectories, 90 intervals, each of 0.05 time units, will be considered.

The time trajectories of the marking and the allocated resources are shown in Fig. 9a and b respectively. Four time periods with different resource allocations (or operation modes) can be distinguished in these figures. The first period, from time 0 to 1.25, allocates the two tokens of pa to s1. This gives a high yield in the production of the items in p2 which has the highest priority. Given that the two tokens of pa are used by s1 during this first period, the token in pb cannot be used by s2, and hence it is used by s3 to produce the items in p5, which has the lowest priority. During the second time period, from time 1.25 to 1.75, one token of pa is used by s1, and the other token of pa is synchronized by s2 with the token of pb to operate t2 and produce the items in p4, which has medium priority. As a result, the speed of t1(t2)(t3) is 1(1)(0) during the second time period. At time 1.75, the marking of p1 becomes 0, and hence, the active token of pa allocated to s1 is released and becomes idle. Thus, during the third period, from time 1.75 to 3.25, only t2 is working. At time 3.25, the marking of p3 becomes 0, and hence the two tokens of pa become idle. During the fourth period, from time 3.25 onward, only the token of pb is active, and is employed by s3 to operate t3.

Fig. 9
figure 9

Time trajectories of the marking (a) of the net in Fig. 8, and of the number of resources allocated to the transitions (b)

5.3 Control actions

Control actions can be modeled in FNs by means of default intensities. This section demonstrates the ability of FNs to model and solve a control problem in which the control action is dynamically constrained.

Figure 10a depicts a net with three places and four transitions. All the tokens are forced to be active, and all the actions are forced to be executed. The initial marking is m0[p1]=m0[p2]= 0 and m0[p3]= 9. The default intensities of t1, t2 and t3 are 0. The default intensity of t4, λ0[t4], models the only control action that can be applied to the system, and is constrained to the interval [0,1.5]. Given that the equations associated with s4 are s4:y=x;z= 2x, each intensity unit in t4 increases the intensity in t1, λ[t1], by one unit and decreases the intensity in t2, λ[t2], by two units. This way, the same control action is used for the intensities of t1 and t2. Thus, the intensities in transitions satisfy λ[t1]=m[p1] + λ0[t4], λ[t2]=m[p2] − 2λ0[t4], λ[t3]=m[p3]. Notice that the input action λ0[t4] is not only statically constrained by λ0[t4]≤ 1.5, but also dynamically constrained by λ0[t4]≤ 0.5m[p2] (if this constraint is violated then λ[t2] becomes negative).

Fig. 10
figure 10

a FN with control action modeled by λ0[t4]. b Time evolution of the marking. c Time evolution of the average intensities during each interval, \(\bar {\lambda }[t_{1}]\), \(\bar {\lambda }[t_{2}]\), \(\bar {\lambda }[t_{3}]\), and control action λ0[t4]

The evolution of the system can be described by the following differential equations:

$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{1}] & =& \lambda[t_{3}]-\lambda[t_{1}] = m[p_{3}] - m[p_{1}] - \lambda_{0}[t_{4}] \end{array} $$
(24)
$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{2}] & =& \lambda[t_{1}]-\lambda[t_{2}] = m[p_{1}] - m[p_{2}] + 3\lambda_{0}[t_{4}] \end{array} $$
(25)
$$ \begin{array}{@{}rcl@{}} \dot{m}[p_{3}] & =& \lambda[t_{2}]-\lambda[t_{3}] = m[p_{2}] - 2\lambda_{0}[t_{4}] - m[p_{3}] \end{array} $$
(26)

where all the variables are nonnegative and λ0[t4]≤ 1.5.

Consider the objective function min (m[p1] − 1)2 + (m[p2] − 4)2. Notice that in this system the invariant m[p1] + m[p2] + m[p3] = 9 holds, then, the control objective is to drive the system to a marking that is as close as possible to the target marking (1,4,4). Figure 10b and c show the trajectories obtained by MPC with a sample time of 0.1 time units and a prediction horizon of one step. Initially, the value of λ0[t4] is low as it is constrained by m[p2], which initially is 0. Then, λ0[t4] increases so that m[p2] increases and m[p1] decreases. At time 1.0, λ0[t4] hits the constraint 1.5 where it is kept constant for 0.4 time units. Then, λ0[t4] decreases in order to approach further the target marking. At steady state, the average intensities of t1, t2 and t3 are the same and equal to 2.73, and the value of the control action is λ0[t4] = 0.81. The steady state marking reached is (1.93,4.35,2.73). It is important to note that the target marking (1,4,4) cannot be an achievable steady state marking with the proposed single control action.

All the trajectories in this paper have been obtained by the tool fnyzer (https://bitbucket.org/Julvez/fnyzer.git). This tool makes use of the modeling language Pyomo (Hart et al. 2017; Hart et al. 2011) and solvers, such as Gurobi (Gurobi Optimization 2015) and CPLEX (IBM ILOG CPLEX Optimizer 2010), to solve the programming problems associated with the FNs. The CPU time (Intel i7, 2.00 GHz, 8 GiB, Ubuntu 14.04 LTS) to solve one step of the MPC approach for the FNs in Figs. 6 and 10 was 1.81s and 5.93s respectively. The CPU time to solve the only programming problem associated with Fig. 8 was 1.27s.

6 Conclusions

FNs consist of two nets, an event net and an intensity net, that make an explicit distinction between the parts of the system involved in updating the marking in places, i.e. the event net, and the parts of the system involved in the determination of the speeds of transitions, i.e. the intensity net. Both the event and the intensity net are tripartite graphs in which places and transitions are connected by event and intensity handlers, respectively. This way, handlers act as an intermediate layer between places and transitions, which results in a significant modeling power. For instance, a transition in an event net can consume tokens from different sets of places, and a place in an intensity net can regulate the speed of different transitions. The tripartite net structure of event and intensity nets has demonstrated to be useful to model partial observability and resource allocation.

Different types of system uncertainties can be accommodated by FNs through sets of linear inequalities associated with places, transitions, event handlers and intensity handlers. Namely, these inequalities allow the modeling of uncertainty in: a) the initial marking (8); b) the default intensities (15); c) the marking change produced by the execution of actions (4); and d) the intensity change produced by the active tokens (13). FNs account for the potential system trajectories arising as a result of uncertainties by means of a set of constraints that represent necessary reachability conditions. The combination of these constraints with an objective function can be used to obtain a system trajectory that optimizes a given criterion. This approach was successfully used to compute trajectory bounds, for instance, in the presented linear system with uncertain parameters, or to obtain a control law in a system whose control action is modeled by a transition with uncertain default intensity.