• Keine Ergebnisse gefunden

6   The Petri Net Library

6.1   Implementation of the Petri Net Elements

6.1.2   Places

is deleted automatically on the textual level. Additionally, the connector dimensions of 3 and 3 are decremented by one and the index of the input connector of 3 in the connect equation of 4 and 3 is decremented by one

connect(P4.outTransition[1], T3.inPlaces[1]);

If the type-1-conflict is resolved by priorities, the corresponding priorities of the transitions are given by the indices of the connections, i.e. the transition connected to the place with the index 1 has also the priority 1, the transition connected to the place with the index 2 has also the priority 2 etc. Otherwise, if the probabilistic enabling type is chosen, the corresponding probabilities for the transitions have to be entered as a vector (numbers separated by commas within braces). Thereby, the first vector element corresponds to the connection with the index 1, the second to the connection with the index 2 etc. The usage of these parameter vectors is also described in Example 6.2. The input of enabling probabilities as vectors in the place model, and not at the corresponding arcs, is necessary due to the fact that properties cannot be assigned to connections according to the Modelica Specification 3.2 (Modelica Association 2010).

The parameters can also be set by modification equations within brackets after the component name, an example is given below.

If the parameters are set graphically, the modification equations on the textual level are generated automatically and vice versa. Furthermore, for parameters which do not appear in the modification equations the default values are applied.

Example 6.2

Place 1 is connected to the transitions 1, 2, and 3 and the connection to 1 is indexed by 1, the connection to 2 is indexed by 2, and the connection to 3 is indexed by 3. Thus, the corresponding connect-equations are

connect(P1.outTransition[1], T1.inPlaces[1]);

connect(P1.outTransition[2], T2.inPlaces[1]);

N scalar settings1.N positive

integers (d)

Amount of levels for stochastic simulation Section 5.5

restart condition

expressions false

Boolean condition expressions

Condition for resetting the marking to

reStartTokens/Marks; this could may be a global condition

reStartTokens/

reStartMarks scalar 0

non negative integers (d)/

real values (c)

When the reStart

condition is fulfilled, the marking is set to

reStartTokens/Marks

Discrete.PD PD(startTokens=15, minTokens=8, maxTokens=117, enablingType=2,enablingProbIn={0.5,0.25,0.25}, enablingProbOut={0.7,0.3});

Continuous.PC PC(startMarks=17.8,minMarks=0.9,maxMarks=57.9);

connect(P1.outTransition[3], T3.inPlaces[1]);

The enabling probabilities 0.3 for 1, 0.25 for 2, and 0.45 for 3 have to be entered by the parameter vector

enablingProbOut={0.3,0.25,0.45}.

Figure 6.8: The input of parameter vectors (Example 6.2)

The discrete place model has to perform the processes output enabling (D2), input enabling (D3), enabling of continuous transitions (C4), and recalculation of tokens and marks, respectively (D5). The continuous place model also performs the processes D2, D3, and D5 and, in addition, the input and output speeds (C1), marks (C2), and decreasing factors (C7) are calculated by it. These processes are detailed hereafter.

OUTPUT AND INPUT ENABLING PROCESSES (D2, D3,C4)

If a discrete or continuous place has a type-1-conflict (Definition 4.67) which involves two or more discrete transitions, it has to be resolved either by priorities or probabilities. Thereby, the priorities are reflected by the indices of the connections while the probabilities have to be entered as parameter vectors. Additionally, type-3-conflicts which involve at least one discrete and one continuous transition have to be resolved by the rule that discrete transitions take priority over continuous ones. Furthermore, type-4-conflicts which involve discrete places and at least two continuous transitions have to be resolved by priorities which are also reflected by the corresponding connection indices.

All these conflicts are resolved in the place models by an algorithmic procedure part of the blocks enablingOutDis, enablingInDis, enablingOutCon, and enablingInCon which are contained in the sub-package Blocks. The blocks for discrete and continuous

P1

T1

T2

T3 [1]; 0.3

[2]; 0.25

[3]; 0.45

places are almost the same except the data types of some input arguments and the block enablingOutDis solves also type-4-conflicts. The differentiation is necessary due to the fact that data types of block inputs cannot be variable according to the Modelica Specification 3.2 (Modelica Association 2010).

The enabling process of the places is performed when at least one delay of a connected active transition is passed, i.e. the input connector variable active switches from false to true. This is realized by a when equation (see Section 3.1.2). The algorithmic procedure inside a when equation is only executed at an event instant, thus, exactly at the time when the delay of at least one connected transition is passed. The algorithmic procedure in the block enablingOutDis has to be executed additionally when connected continuous transitions become active or are no longer active, i.e. the connector variable active of at least one continuous output transition switches from false to true or vice versa which is determined with the build-in function change (see Section 3.1.6).

The information which transition is enabled by which places is reported via the connector variable enable to the connected transitions to determine if the transitions are firable.

TOKEN/MARKS RECALCULATION PROCESS AND CALCULATION OF

INPUT AND OUTPUT SPEEDS (D5, C1,C2)

Besides the enabling process, the current marking is calculated in the place model. Thereby, it has to be distinguished between the discrete and continuous model. The token numbers of discrete places only change by firing discrete transitions, i.e. only at the corresponding event instants, while the marking of continuous places can change continuously over time as well as discretely.

The discrete marking is recalculated when one or more discrete input or output transitions fire. At that time, the Boolean variable tokeninout switches from false to true and the discrete marking is recalculated by means of Definition 4.13: the arc weight sum of all firing input transitions is added to the predecessor value of the current token number (pre(t)) and the arc weight sum of all firing output transitions is deducted.

Additionally, the tokens are reset to the user-defined value reStartTokens when the user-defined condition reStart becomes true. This is very useful for resetting the values of several places, simultaneously when a global condition becomes true.

The marking of a continuous place can change continuously as well as discretely (Definition 4.61). This has been implemented by the following construct:

The continuous mark change is performed by a differential equation while the discrete mark change is performed by the reinit-operator within a discrete equation (see Section 3.1.6).

This operator causes a re-initialization of the continuous marking every time when at least one connected discrete transition fires. Additionally, the marking is re-initialized by user-defined value reStartMarks when the user-defined condition reStart becomes true.

DECREASING FACTOR CALCULATION (C7)

The continuous place model comprises an additional process, called decreasing factor calculation (C7). The decreasing factors are used to resolve type-2-conflicts (Definition 4.67) by which the input or output speed is not sufficient for firing all transitions at the respective speed. The input and output decreasing factors are calculated in the block decreasingFactor by an algorithmic procedure according to Definition 4.50. A block has to be used due to the fact that no events are generated within functions according to the Modelica Specification 3.2 (Modelica Association 2010). The decreasing factors are reported to the connected transitions via the connector variable decreasingFactor to calculate the instantaneous speed. In this context, an algebraic loop concerning continuous-time variables may arise which is solved by the Modelica-tool (see Section 3.1.7).

when tokenInOut or pre(reStart) then

t = if tokenInOut then pre(t)+firingSumIn-firingSumOut else reStartTokens;

end when;

der(t) = conMarkChange;

when disMarksInOut then

reinit(t, t + disMarkChange);

end when;

when reStart then

reinit(t,reStartMarks);

end when;