[ 02265: Course on Advanced Topics in Software Engineering (f11) ]

   

Assignment 1 (due wk 6)
 

In this assignment, you will become acquainted with the relevant parts of Eclipse. To this end, you will install Eclipse and the Petri net editor example from the lecture, and you will slightly extend the Petri net example.

 

Note: Students who know how to do this already from earlier courses, might directly want to have a look at the ePNK project or the CASETool project from SE2.

 

The details are explained in the following sub-tasks step by step:

 

  1. Install Eclipse (version 3.6, Helios) on your computer and install the EMF and GMF add-ons. You will find some information on how to do that here.

     

  2. Download the Petri net editor example from here and import the two projects into your workspace by selecting "File -> Import… -> General -> Existing projects into workspace", and select the archive file (make sure to chose "select archive file") in wizard that popped up.

     

    Now, you will find two projects in your workspace. Ignore the errors in project "APetriNetEditorIn15Minutes.simulator" for a moment (the reason is that this project has some dependencies to projects that are not yet generated).

     

    In order to resolve these problems, generate the projects ".edit" and ".diagram": The ".edit" project can be generated once you opened the file "PetriNet.gemodel" in the models directory (by doubl-clicking on it). Press the right mouse button on the top-level Petri net element and chose "Generate edit code". For generating the diagram code, right-click on the file "PetriNet.gmfgen" and chose "generate diagram code".

     

    The errors in the project "APetriNetEditorIn15Minutes.simulator" should be gone now.

     

    Now you can start the run-time workbench by

    1. Select "Run -> Run Configurations…"
    2. Right-click "Eclipse Applications" and select "New"
    3. Enter a name like "Petri Net Example", change the location to "${workspace_loc}-runtime", and press "Run"
    4. After a while, a new Eclipse instance started with an empty workspace (this is called the "runtime workbench", since it runs Eclipse including the projects you developped in the "original" workbench).
    In this runtime workbench, create a new empty project and create and edit a new Petri net diagram in this new project (New->Example...->PetriNet diagram).

     

    Also try the simple simulator by right-clicking in the empty space in the Petri net diagram and chosisng the "A Petri net editor in 15 minutes" menu. Note that when tokens are added to a place by the simulator, the size of the place changes since the token is positioned automatically; it would need some programming to fix this problem - but this is not of our concern in this course (I might make a fix to this available later in this course).

     

    If this works fine, close the runtime-workspace again.

     

  3. Now extend the model for Petri nets so that arcs have an attribute resp. label which is a positive integer (called the arc weight). The meaning is that, instead of producing or consuming one token when the transition fires, now this number of tokens are produced resp. consumed by this arc when the transition fires.

     

    Regenerate the code (don't forget to regenerate the model code, and the gen-models before you generate code from them).

     

    Check your "new" editor in the runtime workbench.

     

  4. Adapt the Petri net simulator so that it takes the arc weights properly into account and check in the runtime workbench whether it works correctly.

     

  5. Up to now, the simulator fires an arbitray transition (actually the first one) that is enabled. Think of a way, to allow the user to select and fire a specific transition (if it is enabled).

     


 

Ekkart Kindler (), Feb. 1, 2011.