First open the "CSPN-Examples\a very basic Petri Net" folder.

Here you can see the components of the netclass.
The net itself is stored inside the "a very basic Petri Net.MainPetriNet.vit".

The class has inherited from the "CSPN-NetControl" class. The name of the net is equivalent with the Objectname. The Possibility to instaniate a net twice, or more often exists. Here you simply have to change the objectname.

starting & control
For further advice create a CS-Object of the Net. Therefore you can use the ini.file, placed beside the class.
If you dont know how to create a CS-Object, check the CS-dokumentation first!!

Done? You should see the PetriNet Frontpanel now, already launched, with some controls, and 3 big buttons.

On the controls you can see the structure of this example:
Chickens are breeding eggs. On the control "eggs" these eggs do appear. If a egg carton and twelve eggs are available, the corresponding transition "switches" and produces a "full carton". If 20 full cartons have been produced, the egg-transporter will catch them and deliver theme to the consumers.

The buttons do specific tasks:

  • The left button "Shutdown Net" does a full cleanup...nothing from the net should be left, if pushed
  • The middle button keeps the control structures alive, and allows the user to edit the net "on the fly".
  • The right one does a pause to the net. All timers do a break and all Net-Objects stop communication. If pushed again the net will continue to work.

where to edit a net?
Now push the "Stop serving for editing" button, and change to the block diagram.

  • In the second frame of the sequenze(index 1), you can see the PetriNet. the other frames are not important for the net itself.
  • You can see 4 places (grey and green circles), 3 transitions (black boxes) and a timer object (the little blue clock).
  • Places and transitions do work, as expected in a normal petri-net. The greatest difference is, that transitions do switch immediately, if all switching conditions are met.
  • You can use a little vi(called, to give weights to the edges (the 12 and 20 inside the diagram). Default-value is one.
  • Also you can add start-markers and max-markers to each place, and wire controls to them, to see the marker-quantity on execution.
  • The green place is a boolean one. It has a capacity of one, so it can only have a marker or have non.
  • If no name is wired to the places and transitions, the connected control name is taken, or, if no control is connected, a name will be created dynamically.
  • Each place has the possibility to execute entry, periodic and exit tasks. On the place "eggs" a path to the periodic action is performed. The vi "a very basic" gets executed every second. Open it, and you will see, that there the "add marker" VI is used to add randomly markers to the place.
  • The timet object "T1" is used inside the example, to let the egg-transporter appear every 30 seconds. You can add a timing-condition to each transition by using the "timer conditions" input. Here you simply have to choose a timer (T1), a condition (<,>,=,<=,>=, set to) and a value.
I think thatŽs enough to give a first experience what you can do with a Petri Net. If you want to see and code hierarchical NetŽs, take a look at the other example.

-- AlexanderSchwinn - 06 Aug 2007
Topic revision: r4 - 2007-09-12, AlexanderSchwinn - This page was cached on 2024-06-13 - 10:30.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)