The following examples serve to illustrate basic principles of mapping from commands of a programming language to NCES models.
Boolean
variable cell can be modeled by the net having two places p0
and p1 and two transitions ts
and tr as shown in the
Figure 1. Setting of the variable is modeled by transition ts and resetting by tr.
Figure
1. Model of a Boolean variable
implementing SET and RESET commands.
Figure 2. Model of a Boolean variable implementing also ASSIGNMENT of a value.
Consider
how a linear sequence of two commands (e.g. A; B) can be modeled in NCES.
Transitions t0, t1 correspond to the commands A and B .
Once t0
fires it forces to start the model of the command
Figure 3. Model of a two commands’ sequence.
Figure
4. Model of an assignment.
Conditional
choice of type IF X THEN Sequence A ELSE Sequence B can be modelled in NCES as
shown in Figure 5. Transition tA has incoming condition arc which
relays value of X, and tB has incoming condition arc marked with not
X. Since the conditions are orthogonal, only one of the transitions is able to
fire.
Figure
5. Model of a conditional choice
Since
every Boolean variable is modeled by two places (as was shown in Figure 1), we
do not need a specific model for getting negation of a Boolean variable.
As for AND, and OR operations, they can be modeled as shown in Figure 6,
a) and b) correspondingly. Both
models have two incoming event signals: compute
and reset. Computation of the result
takes one state transition.
a).
b).
Figure 6. Models of Boolean operations.
© 2003,
Martin
Luther University of Halle-Wittenberg, Automation Technology
Lab.
Recommended
browser: IE4.0 or higher
Document created and maintained by: Valeriy V. Vyatkin