Clarifying and Extending IEC 60848 for Unambiguous GRAFCET Implementation in Embedded Systems
Angel Gaspar Gonzalez-Rodriguez, Elisabet Estevez-Estevez, Jose Vicente Muñoz-Diez, Pedro Jose Casanova-Pelaez, Joaquin Cañada-BagoThis work proposes guidelines for coding a grafcet on a microcontroller, following the specifications described in standard IEC 60848:2013. While previous works exist for coding a simple grafcet on platforms like Arduino or STM32, they overlook implementing timers, hierarchical structure, and other advanced resources included in the IEC 60848:2013. Throughout this study, procedures for implementing the majority of the resources described in the standard using pseudocode and C++ are presented. These resources include timers, stored actions, macrosteps, enclosures, and forcing orders, among others. Previously, it has been necessary to identify ambiguities, vagueness, inaccuracies, and the non-modular approach of the IEC 60848:2013 standard that impeded a proper and unequivocal implementation, proposing improvements and interpretations to make it more unequivocal and exportable. Examples are included to illustrate how to apply the proposed guidelines, and a template to assist in coding any grafcet is made available in a repository. As a result, this article provides designers with a complete set of tools and resources to unequivocally implement concurrent discrete-event processes. The implementation on several microcontrollers exhibits exceptional memory efficiency under scaled stress-testing conditions (100 steps and 25 timers): less than 2% of the RAM for STM32F411RE and ESP32, and less than a 1.5% increase in ROM when implementing the analysis of 100 transitions and the definition of 25 timers. This proves its scalability for complex discrete-event applications. Cycle times depend on whether there is access to macrostep expansions and enclosures but are around 80 microseconds for the STM32F411 and 20 microseconds for the ESP32.