DTU 
 

 

02265: Advanced Topics in Software Engineering (f15)

Assignment 1 (due wk 7)
 
 

Note that you do not need to submit these assignments! You should have the solution to the assignments ready in the indicated week, so that details and problems can be discussed in that week. The official submissions concern the project deliverables only.

 

In this assignment, you will become accquainted with the most relevant parts of Eclipse, EMF and GMF. 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.

 

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

 

  1. Install Eclipse (version 4.4, Luna) on your computer with the necessary MBSE extensions. You will find the information on how to do that at the Eclipse installation page: http://www2.compute.dtu.dk/courses/02265/f15/project/eclipse-installation.shtml.

     

  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 double-clicking on it). Press the right mouse button on the top-level Petri net element and choose "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-ws-atse", and press "Run"
    4. After a while, a new Eclipse instance will start with an empty workspace (this is called the "runtime workbench", since it runs Eclipse including the projects you developped in the "original" workbench).

     

    In the runtime workbench started above, create a new empty project and create and edit a new Petri net diagram in this new project (New->Example...->PetriNet Diagram). Create a simple Petri net (like the ones shown in the lecture).

     

    Now try the simple simulator by right-clicking in the empty space in the Petri net diagram and chosing the "A Petri net editor in 15 minutes" menu, and there selecting "Simulate step". A transition of your Petri net is fired and the marking should change accordingly.

     

    Note: When tokens are added to a place by this 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 (later in the course, you will be provided with a project where this problem is fixed).

     

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

     

  3. Now extend the EMF 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. The actual EMF model is contained in file PetriNet.ecore in the folder model; but, you better use the graphical editor (Ecore Diagram Editor) to edit the model. You can open it by double-clicking on PetriNet.ecore_diagram.

     

    Note: If the file PetriNet.ecore cannot be opened properly, you have probably installed the wrong version of Ecore Tools (see Eclipse installation page).

     

    After you have made this change to the model. 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. The implementation of the simulator is discussed in the tutorial on Feb. 4, so that you get an idea of what needs to be changed.

     

  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).

     

  6. In the tutorial, it will also be discussed, how the graphical editor can be extened to show the arc weights as labels attached to the arcs, and how to add a constraint to the model, that guarantees that arc weights are positive.

     

  7. Now have a look at the four projects of this course and the projects they are based on (ePNK and ECNO).

     

Note: Students who know how to use EMF and GMF already from earlier courses (such as SE2 from e13 or before), might directly go to the installation of the other necessay extensions (see installation page) and should have a look at the projects and the underlying technologies.

 

 

Ekkart Kindler (), Jan 29, 2015 (last updated Feb. 2, 2015)