next up previous contents index
Next: 2.3.4 File formats Up: 2.3 Files, extensions, formats Previous: 2.3.2 File extensions

2.3.3 Entering nets

Subsections

In the editor nets can be entered with the command <R> <T> (see page [*]). Besides, if a net is requested as a file, you can switch to the terminal mode with <esc> and enter the net as described in this subsection.


Uncoloured nets

The uncoloured net of Example 2.1 models two terminals being shared by three programmers. Each programmer is either working at a terminal or pausing. Programmer 1 needs two terminals at the same time in order to work. The transitions model the logging in and out of the programmers.


Figure 2.1: Three programmers sharing two terminals (terminal.pnt)
\begin{figure}\fbox{\epsfbox{terminal.eps}}\end{figure}

In the following, the entering of this net will be described:

First of all, the net number (default value: 0) and the net name (16 characters maximum) are requested. It is recommendable to fill out both, because the net number and name appear at many points in the protocol and in the saved files, and may therefore help to prevent confusion.

Afterwards, the syntax for place-oriented entries is displayed:

Input syntax:
<nr>" " <tokens>" "[ <prelist> ] [ "," <postlist> ] "<cr>"
 <prelist> ::= { <nr> [ ":"<mult> ]" " }
<postlist> ::= { <nr> [ ":"<mult> ]" " }
P>

INA expects one line to describe each place. Each such line starts with the number of the place, followed by one blank and the number of tokens in the initial marking. If the place has pre-transitions, these are entered as elements of a list, each of the form <number> : <multiplicity> , and separated by blanks. The input of a simple multiplicity : <1> can be omitted, since this is set as default value. Of course, the list of pre-transitions can also be empty. If the place is to have post-transitions, then you have to enter a similar list, which is preceded by <,> . The end of a line describing a place is given by <cr> .

For Net 2.1 of the three programers sharing two terminals, you have to enter the following lines:

Input of Place/Transition Net nr: 1    Netname = 3_Prog_2Term    

0 2 4:2 5 6, 1:2 2 3
1 0 1, 4
2 0 2, 5
3 0 3, 6
4 1 4, 1
5 1 5, 2
6 1 6, 3

Q

The line 0 2 4:2 5 6, 1:2 2 3 describes place 0, which initially contains two tokens. Its pre-transitions are the transitions 4, 5, and 6, where the arc from transition 4 to place 0 has multiplicity two. The place 0 has the post-transitions 1, 2, and 3, where the arc from place 0 to transition 1 also has multiplicity two.

While entering a net, please keep in mind the general rules described in chapter 2.2 on page [*]: You can delete a symbol with <backspace> or <?> . For entering larger transition lists, it is recommendable to type in a ``smaller''-symbol < < > at the end of a list element followed by <cr> , in order to continue your entry on a new line.

If you have entered all places by their number, press <Q> at the prompt P> in order to quit this part of the input process.

Next, INA requests a name for every place you have entered (16 characters maximum). When entering <cr> , the name will be filled up with blanks if necessary. If the capacity firing rule is selected (see chapter 2.5.3 on page [*]), INA additionally requires the specification of a capacity for each place. The default value is <oo> , a hardware-dependent constant which signifies an infinite capacity.

Subsequently, the transitions are named in the same way. Should you be working with priorities (see chapter 2.5.4 on page [*]), these are requested thereafter. Their default value is zero.

If you have selected a time option (see chapter 2.5.2 on page [*]), an initial clock position is requested, according to the selected option and the net element to be evaluated.

Thereupon the input of the net is completed, and with <W> <F> , you can save the net into a file.

Coloured nets

The coloured net in Example 2.2 models the well-known problem of the dining philosophers: Five philosophers are sitting at a round table, on which five forks are placed. To change from the ``thinking'' state into the ``eating'' state, a philosopher needs to have the forks at both his right and left sides. After eating, both forks are laid down again, and the philosopher switches back into the ``thinking'' state.


Figure 2.2: Dining philosophers (dinner.cnt)
\begin{figure}\fbox{\epsfbox{dinner.eps}}\end{figure}

On the arcs of the net you can find the corresponding colour information.

The net is entered as follows:

After entering the number and name of the entire net, all places are defined by entering their number, name and colour set. Firstly, INA suggests a number which can either be confirmed with <cr> or overwritten. Subsequently, the name of the place (16 characters maximum), as well as the amount of colours are requested. Afterwards, the names of the colours and the initial marking of the place are asked for; under the capacity firing rule, the capacity is to be given as well.

Since the names of the colours of a place are frequently only slightly different, the preceding colour name is presented for editing, starting with the second colour. You can overwrite this suggestion: <space> moves the cursor to the right, <backspace> or <?> to the left.

For entering initial markings, two special values are provided: If you enter <z> (as zero) or <s> (as standard) on the first colour, then for all colours the number of tokens on the current place will be automatically set to zero or one, respectively.

In many cases, different nodes have the same colour sets. Therefore, starting with the second place, the entering of the node name is succeeded by the following menu:

Colour set to be
read from the terminal................................R
copied from an existing node..........................C
constructed as square CxC of a known colour set.......S
constructed as product CxC1 of known colour sets......P

The colour set can be copied from an already constructed node with <C> , constructed as the cartesian square $C\times C$ of an existing colour set C with <S> , constructed as the cartesian product $C\times C_1$ of two existing colour sets with <P> , or entered by hand with <R> , as already described.

The entering of places can be quit with <Q> upon request of a place number.

With net 2.2 of the five dining philosophers, the entry dialogue for the number, name, and places of the net looks like the following (condensed presentation):

Input of Coloured Petri Net nr: 2    Netname = Dinner          
Please, give first the places and the initial marking.

place nr.     1 name =     table
   number of colours: 5 
 colour    1: name = fork1              m0: 1
 colour    2: name = fork2              m0: 1
 colour    3: name = fork3              m0: 1
 colour    4: name = fork4              m0: 1
 colour    5: name = fork5              m0: 1

place nr.     2 name =     has_left        
Colour set to be
read from the terminal................................R
copied from an existing node..........................C
constructed as square CxC of a known colour set.......S
constructed as product CxC1 of known colour sets......P > R
   number of colours: 5 
 colour    1: name = phil1              m0: 0
 colour    2: name = phil2              m0: 0
 colour    3: name = phil3              m0: 0
 colour    4: name = phil4              m0: 0
 colour    5: name = phil5              m0: 0

place nr.     3 name =     has_right       
Colour set to be
.......................................................
copied from an existing node..........................C > C
place nr. 2.has_left
 colour    1: phil1              m0: 0
 colour    2: phil2              m0: 0
 colour    3: phil3              m0: 0
 colour    4: phil4              m0: 0
 colour    5: phil5              m0: 0

place nr.     4 name =     is_eating       
Colour set to be
.......................................................
copied from an existing node..........................C > C
place nr. 2.has_left
 colour    1: phil1              m0: 0
 colour    2: phil2              m0: 0
 colour    3: phil3              m0: 0
 colour    4: phil4              m0: 0
 colour    5: phil5              m0: 0

place nr.     Q

Thereafter, you can enter the transitions and arcs. For each transition, the number, name, colour set, and, if applicable, also the priority are requested, followed by its input- and output-arcs, respectively.

There are three modes for defining the arcs: (C)opy,(E)xpression, by (H)and. With <H> you can enter the arcs by hand. For every transition colour, the multiset of place colour numbers, which is given by the function next to the arc, is to be entered as a formal sum. The copy mode <C> is to be used, if there is already an arc which has been inscribed as desired. In this case, you only enter the nodes which are linked by that arc. In expression mode <E> , pre-defined functions can be used to inscribe the arc. The choice depends on the the number of colours of the transition and the place. The identity function is always offered.

In the following illustrations, an arc between transition t with ft colours and a place p with fp colours is considered. The arc inscription 3*(I+5)+1*(I+7) causes 4 tokens to flow through this arc during the firing of the transition t in the colour j (with $1\leq j \leq f_t$), namely three tokens with the place colour (I+5)(j) and one token with the place colour (I+7)(j), where (I+n)(j) is defined as follows: if fp=1, then (I+n)(j)=1 for every n, whereas for fp>1, (I+n)(j)=((j+n-1) mod fp)+1. In the case n=0 and fp=ft, this just gives the identity function.

If ft > fp and ft is divisible by fp without a remainder, then the functions <F> (for first component) and <S> (for second component) are offered. INA assumes the colour set of t to be a cartesian product of colour sets, where the colour set of p appears as the first (with <F> ) or the second (with <S> ) factor. For a transition colour number j, F(j) or S(j) is the colour of the first or second component of the colour j, respectively: F(j)=((j-1) div (ft div fp))+1) and S(j)=((j-1) mod fp)+1

If ft < fp and fp is divisible by ft without a remainder, then the functions <M> (for mine) and <H> (for his) are offered. INA assumes the colour set of p to be a cartesian product of colour sets, where the colour set of t appears as the first (with <M> ) or the second (with <H> ) factor. For a transition colour number j, M(j) or H(j) is the formal sum of the place colours, whose first or second component equals j and whose second or first component does not equal j, respectively.

In the case $f_p=f_t\cdot f_t$, the function <D> (for diagonal) is offered in addition. INA assumes the colour set of p to be the cartesian square of the colour set of t. For a transition colour number j, D(j) is the number of the corresponding diagonal element.

Further functions are not provided.

The entering of pre- or post-arcs is quit by answering the request for a place number with <Q> .

If you work with time allocation (see chapter 2.5.2 on page [*]), an initial clock position is requested, according to the selected option and the net element to be evaluated.

For net 2.2 of the five dining philosphers the entry dialogue for the transitions and arcs looks like the following (condensed presentation):

Give next the transitions and the arcs.
                  
transition nr.    1  name =    take_left       
Colour set to be
read from the terminal................................R
copied from an existing node..........................C
constructed as square CxC of a known colour set.......S
constructed as product CxC1 of known colour sets......P > C
place nr. 2.has_left
 colour    1: phil1              
 colour    2: phil2              
 colour    3: phil3              
 colour    4: phil4              
 colour    5: phil5              
Pre-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 1.take_left        REMOVES from
place nr.     1.table           
functions:  (I)dentity, 
expression: 1*(I+4)
place nr.     Q      

Post-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 1.take_left        SENDS to
place nr.     2.has_left        
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q


transition nr.     2 name =    take_right      
Colour set to be
.......................................................
copied from an existing node..........................C > C
.............Colour set C to be taken from a place? Y/N N
transition nr. 1.take_left
 colour    1: phil1              
 colour    2: phil2              
 colour    3: phil3              
 colour    4: phil4              
 colour    5: phil5              
Pre-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 2.take_right       REMOVES from
place nr.     1.table           
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q

Post-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 2.take_right       SENDS to
place nr.     3.has_right       
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q


transition nr.     3 name =    start_eat       
Colour set to be
.......................................................
copied from an existing node..........................C > C
.............Colour set C to be taken from a place? Y/N N
transition nr. 1.take_left
 colour    1: phil1              
 colour    2: phil2              
 colour    3: phil3              
 colour    4: phil4              
 colour    5: phil5              
Pre-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 3.start_eat        REMOVES from
place nr.     2.has_left        
functions:  (I)dentity, 
expression: 1*(I)
place nr.     3.has_right       
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q

Post-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 3.start_eat        SENDS to
place nr.     4.is_eating       
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q


transition nr.     4 name =    put_back        
Colour set to be
.......................................................
copied from an existing node..........................C > C
.............Colour set C to be taken from a place? Y/N N
transition nr. 1.take_left
 colour    1: phil1              
 colour    2: phil2              
 colour    3: phil3              
 colour    4: phil4              
 colour    5: phil5              
Pre-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 4.put_back         REMOVES from
place nr.     4.is_eating       
functions:  (I)dentity, 
expression: 1*(I)
place nr.     Q

Post-arc input mode: (C)opy , (E)xpression, by (H)and > E
Firing the transition 4.put_back         SENDS to
place nr.     1.table           
functions:  (I)dentity, 
expression: 1*(I)+ 1*(I+4)
place nr.     Q  


transition nr.     Q


next up previous contents index
Next: 2.3.4 File formats Up: 2.3 Files, extensions, formats Previous: 2.3.2 File extensions

© 1996-99 Prof. Peter H. Starke (starke@informatik.hu-berlin.de) und Stephan Roch (roch@...)

INA Manual Version 2.2 (last changed 1999-04-19)