## 3 Results
### Case Study: Control of Laboratory Hybrid System
It was expected that this controller will be effective also in the 2 nd working point however with a worse performance (too long settling time). To switch between different control algorithms in individual working points, the proposed software for control of hybrid systems using Petri Nets can be used. For the 2 nd working point, a PID controller with parameter values \(P=0.83\); \(I=5\); \(D=0.005\) was designed. The closed-loop step response is shown in Figure 14 whereby a PWM step from 176 to 186 was realized in \(t=5\) s. The settling time is 1.1 s (considering a tolerance \(\pm 2\) rpm). This controller was tested also in the 1 st working point (for a step from 140 rpm to 146 rpm). It is obvious from the corresponding step response in Figure 15 that this controller does not provide a satisfactory performance. Figure 13: Block diagram of PID (proportional-integral-derivative) controller in a feedback loop. Hence, for the 1 st working point a different PID controller was designed with \(P=0.0001\); \(I=1\); \(D=0.01\). The closed-loop step response in Figure 16 shows that the controller works properly (the settling time is 1.3 s). When applied in the 2 nd working point, this controller again did not work properly, as expected (larger settling time achieved with a PID controller with smaller \(P\) and \(I\)). The achieved performance evaluated from the step response in Figure 17 is worse compared with the 1 st controller (\(P=0.83\); \(I=5\); \(D=0.005\)), the settling time 2.75 s is much larger than in case of the first controller (1.1 s). Figure 14: Step response (closed loop)—2 nd working point. Figure 15: Step response (closed loop)—1 st working point—with inappropriate controller. The analysis of achieved results revealed necessity to use different controllers in individual working points, or to design the controller using some advanced control design approach (robust, gain scheduled, switched). In case of switching between multiple controllers according to the working point it is possible to use the developed software module PN2 ARDUINO. Switching between controllers and setpoints is based on SYSEX messages. Arduino and other microcontrollers that support Firmata protocol can be used. Development and verification of this software module are the most interesting results of the presented research. A demonstration example of the proposed control method is in Figure 18. Consider the above-mentioned DC motor which must operate in two modes (working points). For effective setpoint  
Figure 16: Step response (closed loop)—1 st working point—under PID controller. Figure 17: Step response (closed loop)—2 nd working point—under inappropriate controller. tracking by the DC motor speed, controllers with different parameters must be used (a different controller for each mode). Switching between individual working points is carried out using a potentiometer connected to the analog input of the Arduino Uno microcontroller. Switching between controllers is provided by transitions _switch1_ and _switch2_ of Petri net according to the input value from the potentiometer. Input from the analog pin in Arduino is represented by a value ranging between 0 and 1023. The mean value (512) was used as a threshold. In the moment when the token in Petri net is moved to the places _setup1_ or _setup1_, a SYSEX message is sent. This message ensures the execution of a user-defined program code on the Arduino side, in this case the control algorithm. The (PID) algorithm for continuous-time control is independent of Firmata messaging, so it provides real-time control. The provided hybrid systems control case study is a basic example. Researchers in hybrid control design can use it for different and even more complicated scenarios. As already stated, hybrid systems for Industry 4.0 manufacturing processes are a combination of time-driven and event-driven dynamics.