In this assignment, you will become accquainted with the ePNK and its features
for defining new Petri net types — basically without programming. To this
end, you will define a Petri net type, which will allows to mark some places
of the Petri net as input and one output places (a constraint could make sure that
there is exactly one of each kind in the end).
In addition to defining these module Petri net type, a simple action should
be implemented which allows to generate the Petri net that corresponds to linking 3
instance of the module in a chain (represented as a P/T-net which comes with the ePNK).
This way, you will also become familiar with some features for
accessing and manipulating nets with the ePNK and with some additional features
from EMF (Recording commands make it much easier to implement commands by
normal programming).
Note that you will find all the information that you need in the ePNK documentation (in particular Sections 3.1-3.5, and Sections 4.1, 4.5, and 4.6). For implementing
the action that generates the Petri net, a template project (with some code deleted)
is provided to you, which makes should make it easier and faster for you to get started:
atse-tutorial2-action-template.zip. You might also find
the information on the SE2 tutorial on the ePNK from some years ago helpful,
which can still be found at http://www2.imm.dtu.dk/courses/02162/e13/tutorials/assignment5.html.
The details are explained in the following sub-tasks step by step:
- If you did not yet install the ePNK yet, install it as described for tutorial 1: http://www2.compute.dtu.dk/courses/02265/f15/project/eclipse-installation.shtml.
Since you might want to see some of the models in the ePNK as reference or examples,
it is recommended that you import the following two ePNK projects to your workspace:
org.pnml.tools.epnk and org.pnml.tools.epnk.pntypes .
You can do this in the so-called Plug-ins view (you can open it via "Window -> Show View -> Others ...".
In this Plug-ins view, right-click on the respective plugins, and select "Import As -> Source Project".
- In the first step, a new Petri net type should be created. This type should allow us to define a Petri net
in which input and output places can be indicated by an attribute attached to the place.
For simplicity, the type for Petri net modules is not required to have any other
additional features. This is defined by an Ecore model which extends the PNML core model
(similar to the two net types discussed in Section 4.5.1 and 4.5.2 of the ePNK documentation).
So, you first need to create an empty EMF project and create an Ecore diagram which
models the features. Note that you need to extend some features of the PNML core model,
which you can refer to by creating so-called shortcuts (right-click in the canvas of
the diagram and select the respective elements from the PNML core model to which you
want to create a shortcut).
The model of such a Petri net type and some aspects of using the tools will be discussed in
the Tutorial on Feb. 10, 2015.
- Once you have the model defining the additional features, you need to generate the code,
do some minor manual changes in the code, and plug the newly defined type into the ePNK:
- Now, you should start the runtime workbench of Eclipse. Make sure that in the configuration of
the VM arguments for starting the runtime workbench you add "-XX:PermSize=256M -XX:MaxPermSize=256M"
(otherwise, the workbench might run out of memory).
Once the runtime workbench started, create a new PNML Document and check
whether you can create a new net of your type in it (see Sections 3.3 and 3.4 on how to use
these editors). Check whether you can add the input or output attributes for places in this
net.
- Optional: Add constraints (OCL or Java), which guarantee that arcs may connect places
to transitions or transitions to places only, and that there is at most one input and
one output place in each module. You could also experiment with constraints that guarantee
that input places have out-going arcs only and output places have ingoing arcs only.
You will find details on how to do that in Sections 4.5.1.4 and 4.5.3.3 of the ePNK documentation.
- Optional: You might also want to adjust the graphical representation, so that an input place
is shown with a dashed token on it, and an output place is marked with a cross. Section 4.6 of
the ePNK documentation gives an overview of how to do this.
- At last implement an action, which when chosen on a module Petri net, creates another
Petri net in the same file (PNML document), which is a P/T-system representing three
instances of the module connected with each other in a chain.
This action can be run as a so-called recording command, so that instantiating the
module net three times is basically a matter of programming. All the infrastructure
is made available (making some assumptions on the classes of your model of module nets)
in the project atse-tutorial2-action-template.zip. Import it to your workspace, and
have a look at the classes. The major part of the module instantiation is done in the class
ModuleGenerator , which in turn is invoked from
GenerateChainOfModulesCommand the correct number of times; the
missing code needs to be added by you to make this generation function properly.
Note that for now, the graphical arrangement of the net objects in the generated net
is not important.
- Test whether the generator is working properly (for different modules) and whether the instances
are connected correctly in a chain (merging the nets at the respective input output places).
- Optional: Have a look at how the
RecordingCommand is set up and used; using it is very
convenient when you are forced to use commands, but do not really want all the syntactic
sure for progamming them (see Tutorial 1).
The recording command basically records what your program is doing and automatically
creates the respective undo commands for you.
|