## 2 Materials & Methods  
The open-source PNEditor was selected as the basis for the newly developed software tool [25]. It is possible to model systems using basic Petri nets in this editor. The software program is implemented in Java programming language. It is published under an open source license. The primary benefit is well-structured code, simple architecture and developer direct support as well. It also contains the possibility of determining the boundedness of the Petri net and it can inspect P (place) invariants and T (transition) invariants. The disadvantage is that only basic Petri nets are supported. As part of presented research, support for timed Petri nets interpreted for control had to be added. The developed extension of this tool is called \"PetriNet editor + PetriNet engine\". The main aim of the proposed article is to present the developed software for control of discrete event systems verified on laboratory discrete event system. In the article two main questions of the control system design are discussed: should the Petri net logic be stored in the microcontroller or in a PC able to communicate with the microcontroller? Both approaches have their benefits and drawbacks. If the Petri net logic is stored in the microcontroller, the main benefit is independence of the control unit from the software application (a program running on a PC). The Petri net logic is modelled using a PC and subsequently translated to a program code loaded into the microcontroller. Afterwards, the PC and the microcontroller can be disconnected. Another benefit is the possibility of real-time control. Among the drawbacks are limited computational and memory resources of the microcontroller, need for repeated program compilation and upload to the microcontroller (mainly during the development phase). The proposed solution is depicted in Figure 1.  
When the Petri net control logic is stored on a PC in a specialised SW application, it is possible to control the system directly. Only the program with the communication protocol for communication between the PC and the microcontroller is stored in the microcontroller. This solution eliminates the need to recompile and reupload the program during the development. Another benefit consists in the elimination of restrictions on computing and storage resources because a PC has almost unlimited resources compared with a microcontroller. One of the main drawbacks is that the control system cannot respond in real time. The proposed solution is shown in Figure 2.  
Differences between the two approaches are specified in Table 1.  
Software module PN2 ARDUINO described in our article [26] is based on the second approach (Figure 2) so the Petri net runs on a personal computer. For communication between the SW application and microcontroller, the Firmata protocol [27] has been used. Firmata is a protocol designed for communication between a microcontroller and a computer (or a mobile device like smartphone, tablet, etc.). It is based on MIDI messages [28]. MIDI (musical instrument digital interface) message is made \begin{table}
\begin{tabular}{l l} \hline \hline
**Petri net Logic in PC** & **Petri Net Logic in Microcontroller** \\ \hline limited capability of real-time control & real-time control \\ \hline much more computation and memory resources available & limited computation and memory resources \\ \hline code in microcontroller does not need recompiling & during development repeated compiling is needed \\ \hline PC must be still online & independence of control unit \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of two concepts of system control using Petri nets [26]. Figure 1: Basic scheme of proposed solution—Petri net’s logic in microcontroller [26]. up of 8-bit status byte which is generally followed by one or two data bytes. Firmata protocol can be implemented in firmware of various microcontrollers; mostly Arduino-family microcontrollers are used. On the PC, a client library is needed.