Petri Net: nnNET1 Execution

Once the Petri Net is configured then the next step is to start it with some set of deposited tokens, in our case only one.

nnPetriFire() returns an integer which if non-zero indicates some transition was fire and the print_array() prints the update final place markings after transition firings.

Look at how economic and simple the code is for a sophisticate multi-tasking engine:

/* setup markings */
	array_zero(net.PetriNet.IMarks, net.PetriNet.place_num);
	net.PetriNet.IMarks[0] = 1.0; /* boot, all networking set up at boot */

	for (;;)
	{
		if (nnPetriFire(&net))
				print_array(net.PetriNet.IMarks, net.PetriNet.place_num);
	}

This entry was posted in C/C++, Documentation, Software. Bookmark the permalink.

Leave a Reply