=Paper= {{Paper |id=Vol-2739/paper_9 |storemode=property |title=DINASORE: A Dynamic Intelligent Reconfiguration Tool for Cyber-Physical Production Systems |pdfUrl=https://ceur-ws.org/Vol-2739/paper_9.pdf |volume=Vol-2739 |authors=Eliseu Moura Pereira,João Pedro Correia dos Reis,Gil Gonçalves |dblpUrl=https://dblp.org/rec/conf/sam-iot/PereiraRG20 }} ==DINASORE: A Dynamic Intelligent Reconfiguration Tool for Cyber-Physical Production Systems== https://ceur-ws.org/Vol-2739/paper_9.pdf
DINASORE: A Dynamic Intelligent Reconfiguration
   Tool for Cyber-Physical Production Systems
                                                Eliseu Pereira, João Reis, Gil Gonçalves

                                        SYSTEC - Research Center for Systems and Tecnologies
                                             Faculty of Engineering, University of Porto
                                           Rua Dr. Roberto Frias, 4200-465 Porto, Portugal
                                                Email: {eliseu, jpcreis, gil}@fe.up.pt


   Abstract—The nowadays industrial digital revolution demands                Resource Planning (ERP). On the other hand, it is possible to
for software driven solutions where reconfiguration is one of the             explore new ways of data sharing among shop-floor entities
key enablers to achieve smart manufacturing by easy deployment                (horizontal integration) promoting a distributed control system
and code reuse. Despite existing several tools and platforms that
allow for software reconfiguration at the digital twin / edge                 for continuous monitoring and process optimization.
level, it is most of the times difficult to make use of state of                 With a change in paradigm from closed programmable
the art algorithms developed in the most popular programming                  logic controller (PLC) implementations to industrial PCs that
languages due to software incompatibility. This paper presents                allow a more flexible information sharing and storage, new
a novel framework named Dynamic INtelligent Architecture for                  opportunities taking advantage of this transparency can be
Software MOdular REconfiguration (DINASORE) that imple-
ments the industrial standard IEC 61499 based in Function                     explored. From multi-agent systems to artificial intelligence
Blocks (FB) in Python language for Cyber-Physical Production                  applications, democratizing data storage and sharing is key for
Systems’ implementation. It adopts the 4DIAC-IDE as graphical                 the new advances in manufacturing systems, where machine
user interface (GUI) to ease the design and deployment of                     learning is one of the key enablers of industry 4.0. This way,
FBs to quickly and on-demand reconfigure target equipment.                    applications like artificial vision to detect production defects,
The proposed framework provides data integration to third
party platforms through the use of OPC-UA. The test scenarios                 predict when and why a certain component will fail or even
demonstrate that the proposed framework 1) is flexible and                    explore new energy efficiency solutions are some examples
reliable for different applications and 2) the CPU and memory                 of the well established importance of artificial intelligence in
workload linearly increases for a large amount of FBs.                        manufacturing.
   Index Terms—Cyber-Physical Systems, IEC 61499, Smart                          Albeit not specific for manufacturing applications, there are
Manufacturing, Machine Learning
                                                                              several platforms developed in order to ease the development
                                                                              of such intelligent systems in a modular fashion, where the
                         I. I NTRODUCTION
                                                                              main idea is to accelerate the implementation of an end-to-
   One of the key aspects of the nowadays fourth indus-                       end solution without the need to know the technical details
trial revolution is the digitization of shop-floor entities like              of certain techniques. Some examples of this modular design
processes, equipment and components to increase their in-                     and execution are Rapidminer Studio [3], Microsoft Azure
teroperability with users and information systems. In order                   Machine Learning Studio [4], Cloud AI from Google Cloud
to achieve digitization, an increased effort of standardization               [5]. All these platforms have a strong graphical user interface
is required to create uniformed interfaces that promote a                     (GUI) based in components that, through drag and drop, a
transparent communication among a set of heterogeneous                        complex machine learning system is possible to be built.
entities. This standardization is often attained with the concept                However, the use of such platforms in industrial applica-
of digital twin (DT), and is often seen as a wrapper used                     tions, mainly at the level of control systems, is not straight-
to integrate any device or process into a network, where                      forward. On the one hand, some of these are Cloud-based solu-
information can be easily accessed and shared [1]. In industry                tions, which is still an obstacle for specific industries nowadays
4.0 context, a Cyber-Physical Production System (CPPS) is                     due to the industry’s policy, restricting the data access only to
a distributed system of networked digital twins representing                  local network components. On the other hand, these modular
industrial processes, controllers, components, and any sort of                designs do not implement any industrial standard, such as IEC
information technology (IT) software. These CPPSs should                      61499 adopted in 2005 and based in the function block (FB)
allow for dynamic reconfigurability, software reusability and                 definition that abstracts both software and hardware modules
an external service orchestration [2]. On the one hand, by                    suitable for manufacturing requirements.
improving the accessibility via DTs, users can have a better                     Based on this, the present paper proposes a framework
grasp of the holistic shop-floor dynamics through the inte-                   called DINASORE for the execution of digital twins in
gration with information systems (vertical integration) such                  Cyber-Physical Production Systems that is able to support
as Manufacturing Execution Systems (MES) or Enterprise                        the latest advances in machine learning. DINASORE stands



Copyright © 2020 for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).

                                                                         63
for Dynamic INtelligent Architecture for Software MOdular                due to its easiness of system design and execution for dis-
REconfiguration and is compliant with the 4DIAC platform                 tributed environments.
[6] that implements the standard IEC 61499 [7]. The proposed                There is already a great motivation in using these ap-
framework is a Python environment for any system (embedded               proaches, mainly the development of CPPSs using the IEC
or not) that is able to run Python 3.6, or above, for the execu-         61499 standard, as can be seen in literature. A use case that
tion of function blocks (FBs) developed in Python language.              implements such an approach is presented in aluminum cold
The same way FORTE is used together with 4DIAC for the                   rolling mill plant demonstrator where the authors design and
low level interaction and execution of C/C++ applications in             test an event-driven process based on IEC 61499 standard
industrial equipment, DINASORE is a similar implementation               using OPC-UA [11]. Another similar use case that used the
but for Python FBs, which makes possible the use of important            same philosophy is about Oil&Gas production where the
machine learning packages such as TensorFlow, PyTorch,                   authors have implemented a CPPS to deal with the complexity
Keras and Theano.                                                        of equipment data on existing production processes, based on
   From this perspective, with DINASORE it is possible to                IEC 61499 and OPC-UA [12].
develop a distributed control system for industrial applications
which is machine learning-enabled. This framework allows to                 In [13] the authors implement a CPPS based in FORTE, and
overcome the difficulty to use and develop state of the art algo-        deployed the configuration system into a couple of Raspberry
rithms due to the C/C++ (FORTE) requirement. Therefore, all              Pi 3 Model B that mimics an industrial process composed of
the latest developments in the Python community, from deep               a human-machine interface, a handling system and a conveyor
learning to optimization, can be used in industrial applications         belt. Further, the authors have integrated the OPC-UA into a
with DINASORE. It is capable of online-reconfiguration of                more complex system [14], with the aforementioned scenario,
Python FBs, where an easy to understand Python FB template               plus a stack station. The major difference from the proposed
is provided for customized developments. On top of that, and             framework is the use of FORTE and OPC-UA data model
due to industrial requirements, each DINASORE environment                through a Service Interface Function Block (SIFB). In the case
has an embedded Open Platform Communications - Unified                   of DINASORE there is no SIFB since OPC-UA is embedded
Architecture (OPC-UA) server with a data model to facilitate             in specific FBs and automatically provides data in a OPC-UA
the integration with third-party platforms. The OPC-UA data              server with no effort to the final user.
model abstracts the concepts of equipment and device for                    Regarding the technologies used to support the development
fully industrial integration with other devices or information           of CPPS based on the IEC 61499, there are a set of plat-
systems. In sum, the main contributions and differentiation of           forms already available that can be used. Some examples are
this work lie in:                                                        the Archimedes [15], FBDK [16] and FUBER [17] in Java
  1) A Python implementation of a digital twin that is inte-             language (Archimedes also supports C++); FBBeam [18] in
     grated with 4DIAC and compliant with IEC 61499;                     Erlang; FORTE and nxtIECRT in C++; ISaGRAF [19] using
  2) A Python template to build FBs compliant with DINA-                 IEC 61131-3 standard; Icaru-FB [20] and RTFM-RT in C [21].
     SORE;                                                               Demonstrating the relevance of OPC-UA in such approaches,
  3) OPC-UA data availability using an OPC-UA server;                    there’s a work that presents an implementation of a Service
   The remainder of the present work is organized in five more           Interface Function Block (SIFB) for OPC-UA communications
sections. A literature review is made in Section II, and the             in 4DIAC [22]. For a more comprehensive understanding of
DINASORE implementation explained in Section III, from its               these platforms, there’s also a small review about the topic
architecture to the Python template definition to develop new            [23].
FBs. The following section presents the test case scenarios                 Some effort has been applied to the integration of UML
defined and the main results obtained. Finally, Section V will           with the IEC 61499, where a case scenario composed by
discuss the results obtained and draw some conclusions and               a distributing and sorting process using FESTO FMS-200
future work for the current implementation.                              FORTE platform was built resulting in a CPPS [24]. Portability
                                                                         among NxtStudio, FBDK and 4DIAC platforms was also
                     II. R ELATED W ORK                                  already explored [25] to have a cross-platform implementation
   One of the most widely used platforms for component-based             of a CPPS, and increase the integration capabilities when
design and execution of distributed control systems is 4DIAC             building a CPPS.
[6], an Eclispe-based IDE that implements the standard IEC                  Regarding all the works previously presented, the DINA-
61499 [7] based in function blocks (FBs). This platform has              SORE framework presents an additional, but important, step
a vast set of functionalities, from FB design, system design             towards the implementation of the IEC 61499 standard using
based on a pipeline of FBs, to the deployment of this system             Python language, and consequently, the use of state of the
in a distributed environment. From CNC applications [8],                 art machine learning algorithms in CPPSs. Together with the
Distributed Time-Critical Systems (DTCSs) such as aerospace              OPC-UA for vertical integration, DINASORE can be seen as
applications [9], to Smart Grids [10], the use of 4DIAC for the          a powerful framework that can accelerate and strengthen the
implementation of IEC 61499 is becoming well established                 next generation of smart industry.




                                                                    64
                      III. I MPLEMENTATION                                 3) Service Interface Function Blocks (SIFBs): It allows
   Similar to FORTE (4DIAC-RTE) portable implementation                        to specify how FBs should interface in terms of both
in C++ of IEC 61499, DINASORE1 shares the same phi-                            events and data connectors to other FBs that execute
losophy but in Python language. With all the latest artificial                 (mainly) in different physical platforms (Machine-2-
intelligence advances and current implementations in Python,                   Machine communication).
DINASORE can be seen as a tool that enables advanced                       Additionally, the developer has the autonomy to implement
machine learning systems to execute as close to shop-floor               their own FBs and integrate them in both 4DIAC-IDE and
equipment as possible. The further integration with OPC-UA               DINASORE runtime environment. The main type of FBs
for sharing a simple and intuitive data model allows for each            adopted in the DINASORE is the Basic Function Block (BFB),
digital twin DINASORE implementation easy to integrate with              characterized by two files, an XML metadata file containing
most information systems.                                                the FB structural information and a Python file implementing
                                                                         the code functionalities.
A. 4DIAC-IDE
   The graphical user interface (GUI) integrated with the DI-            B. DINASORE
NASORE is the 4DIAC-IDE, which enables drawing and de-                      The main goal of DINASORE is to serve a gateway to
ploying distributed configurations, based in FBs. The 4DIAC-             machine learning into distributed control systems based on
IDE uses the Eclipse Project as a core development framework,            IEC 61499. As we believe the future design and deployment
providing a GUI based in a desktop application, with the                 of CPPSs will definitely pass through the use of block-based
typical Eclipse IDE appearance. The process of development               technologies, such as 4DIAC-IDE and IEC 61499 as depicted
of a new CPPS based in FBs has as main steps: 1) the                     in the related work, DINASORE can be seen as a key comple-
definition of CPPS network configuration, specifying for each            mentary technology to enrich the area of CPPS with artificial
device its IP address and port used for 4DIAC communica-                 intelligence algorithms. Although integrated with 4DIAC-IDE,
tion, 2) the drawing of the FB pipeline, drag&dropping FBs               DINASORE is not designed in its root to execute in embedded
and linking them through specific connections, modeling the              systems, complying with real-time constraints as FORTE. The
required software architecture, 3) the mapping of specific FB            idea behind using Python language is to enable the latest
to devices, and 4) the deployment of the FB pipeline to the              advances in machine learning to integrate at the edge level
corresponding DINASORE devices. Therefore, the 4DIAC-                    with existing shop-floor equipment, without the need for cloud
IDE GUI has several views directed to the user to implement              based processing. With the embedded implementation of OPC-
different steps, e.g. the network configuration, the development         UA in the DINASORE function blocks (FBs), any external
and the deployment views. After the development and deploy-              data is automatically provided in a OPC-UA server for further
ment of the FB pipeline, 4DIAC-IDE enables to monitoring                 system integration.
(watch) the whole system for real-time visualization of the                 As for DINASORE implementation, there’s the need to
current state of each data and event inputs and outputs in               classify the used execution model type framing the technology
the configuration. Additionally, the 4DIAC-IDE allows the                into the IEC 61499 guidelines. One of the most well known
interaction with the actual pipeline, triggering events, stopping        categorization of Execution Control Chart (ECC) execution
the configuration, or cleaning the actual DINASORE runtime               model was proposed by Ferrarini in [26], where 7 differ-
environment resources.                                                   ent classes were defined, from A0 to A6, exploring two
   The standard IEC 61499 defines several rules at the industry          dimensions, namely scan order and multitasking. The scan
level, including the composition and structure of FBs, which             order refers to execution models that can have either fixed
is the graphical representation of a set of functionalities. Each        (predefined order), or dynamically (order calculated on-the-
FB contains events and variables to communicate with other               fly) FB execution during the ECC, while the multitasking
FBs, where each event allows to trigger the execution of a               dimension refers to no controlled ways of multitasking, where
certain FB, while each variable stores the data (e.g. sensor             FBs execute in a multi-threading fashion; done by time slice
measurements, algorithm outputs). The 4DIAC-IDE uses FBs                 allocation to each FB execution (preemptive scheduling) and
as elementary components that connect among themselves,                  done by FB slice, where each FB executes at a time (non-
using both events and variables forming a functional pipeline.           preemptive scheduling).
Considering that, there are three types of FBs defined by IEC               Additionally, there’s a small and brief survey of run-time
61499, namely:                                                           environment (RTE) platforms for IEC 61499 where 4 types of
   1) Basic Function Blocks (BFBs): In simplistic terms, they            execution models are introduced [23]: 1) Buffered Sequential
       are state machines that according to specific events are          Execution Model (BSEM) [27]; 2) Cyclic Buffered Execution
       able to execute the corresponding algorithms;                     Model (CBEM) [16]; [26]; 3) Non-Preemptive Multithreaded
   2) Composite Function Blocks (CFBs): It is a composition              Resource (NPMTR) [28]; 4) Preemptive Multithreaded Re-
       of BFBs making up a network of FBs to model more                  source (PMTR) [23]. For a more formal definition of the
       complex system behaviors;                                         BSEM, CBEM and NPMTR please refer to [29]. Despite the
                                                                         authors in the survey present a table that integrates RTE plat-
  1 Available Online: github.com/DIGI2-FEUP/dinasore                     forms with Ferrarini model and execution models, there’s not




                                                                    65
a one-to-one correspondence of Ferrarini model to execution                have a thread-object per FB with all threads executing using
models. This happens because there are some categories in                  a time slice scheduling and the execution order for all FBs
the Ferrarini model without a corresponding execution model.               is dynamically calculated by the received event inputs. Since
This way, it is important to first fill this gap in terms of formal        Python language is used together with threading package, once
definition, and only then use it to frame the DINASORE.                    we have multiple FBs thread-objects executing at the same
Hence, the complete set of Ferrarini categories is presented in            time, a time slice scheduling strategy is used. This package
the following list, with the corresponding execution models:               uses an implementation called Global Interpreter Lock (GIL)
   • A0: The execution of each FB is calculated on-the-                    that manages the execution time per thread, being around 5ms.
     fly depending on the input events of each one. One                    This way, this implementation is not truly multithreaded (A1),
     formalized execution model that meets this category is                but A2 using a similar approach as BS-PMTR.
     the BSEM;                                                                The DINASORE execution model implementation, Fig-
   • A1: The execution of each FB as a thread-object is made               ure 1, uses a producer-consumer pattern, where each FB
     in parallel, like in a multi-threading fashion. We name               performs in a different thread, which is both producer and
     this execution model as Multithreaded Resource (MTR);                 consumer. The data transmitted between FBs addresses both
   • A2: To each of the executing FBs as a thread-object                   events and variables, where the FB object stores the input
     is given a small time slice of execution, where the                   events in a queue and the variables in register attributes. Thus,
     allocation of time slice to FB is dynamically done. The               each FB object has an internal queue for the input events,
     most similar execution model is PMTR, briefly defined                 waiting until it receives an input event in the data struc-
     in [23]. However, due a dynamic scan order, we name                   ture, reading after the variables’ actual value, and processing
     this execution model as Buffered Sequential-Preemptive                the event’s functionality. After completing the functionality
     Multithreaded Resource (BS-PMTR);                                     execution, the FB object pushes the corresponding output
   • A3: Each FB as a thread-object should execute one at a                events in the queue of the following connected FBs. The same
     time, and executed dynamically as soon as a notification              thing happens to the variables where the FB updates their
     is created. One formalized execution model that meets                 output variables and consequentially the input variables of the
     this category is the NPMTR. However, due a dynamic                    following linked FBs. The actual value of each FB event and
     scan order, we name this execution model as Buffered                  variable is available through the monitoring/communication
     Sequential-Non-Preemptive Multithreaded Resource (BS-                 interfaces, i.e., using the OPC-UA server or 4DIAC-IDE watch
     NPMTR);                                                               option.
   • A4: The execution of each FB is predefined beforehand.
     One formalized execution model that meets this category
     is CBEM;
   • A5: To each of the active (that requires execution due to
     an event input) FBs as a thread-object is given a small
     time slice of execution according to a fixed order that
     follows a list or active FBs. This can be viewed as a
     PMTR, however, due to fixed scan order, we name this
     execution model as Cyclic Buffered-Preemptive Multi-
     threaded Resource (CB-PMTR);
   • A6: Each FB as a thread-object should execute one at a
     time according to a fixed order that follows a list or active
     FBs. This can be viewed as a special case of the NPMTR,
     however, due to fixed scan order, we name this execution
     model as Cyclic Buffered-Non-Preemptive Multithreaded
     Resource (CB-NPMTR);

                           TABLE I
AGGREGATION OF F ERRARINI MODEL [26] WITH EXISTING [23] AND NEW
              EXECUTION MODELS FOR IEC 61499.

                         Multitasking Implementation
            Not Used    Not Controlled Time Slice       FB Slice                             Fig. 1. DINASORE Architecture.
 Dynamic     BSEM           MTR          BS-PMTR       BS-NPMTR
  Order       (A0)           (A1)           (A2)          (A3)
  Fixed      CBEM
                              x
                                         CB-PMTR       CB-NPMTR              The FB thread-object requires two external files to execute
  Order       (A4)                          (A5)          (A6)             that compose the FB itself. The first file is XML-based and
                                                                           contains the meta-information about the FB, e.g. the FB type,
                                                                           the FB class and the FB structure composed by input/output
  As for the DINASORE, the closest category is A2, where we                events and variables, and their details, including the data type




                                                                      66
and the OPC-UA role (variable, method or none). Besides the                  structure allowing the aggregation of sensors and ac-
DINASORE usage, the metadata file enables the 4DIAC-IDE                      tuators, using events as relational connections;
to render the FB with their events and variables in the GUI.              3) The service type maps to FBs as a method and when
The second file composing the FB is a Python script encoding                 an event is received, its execution is triggered. This is
the FB functionalities, which requires the implementation of                 suitable for machine learning algorithms (e.g., Random
a class, assuming the Object-Oriented (OO) paradigm. That                    Forest, SVM) or statistical operations (e.g., moving
class requires the implementation of the schedule method,                    average, moving standard deviation);
which receives as arguments the event name and respective                 4) The start-point type represents protocols interfaces that
value, triggering the FB execution, with the current input                   receive data, e.g. subscribing a MQTT topic or request-
variable values. Then, according to the event received, the                  ing TCP/IP data;
method selects the functionality to execute. After executing              5) The endpoint type provides data through the defined
the functionality, the schedule method returns a list of output              interface, e.g. publishing in a MQTT topic and replying
events and variables. Both schedule method arguments and                     to a TCP/IP request.
output variables should follow the order specified in the
                                                                           Those representations make the development of new FBs
metadata file.
                                                                        easier by providing templates and specific behaviors to max-
   Concerning the need for external communication between
                                                                        imize the effectiveness of the Python code written in each
the DINASORE and other applications, e.g. 4DIAC-IDE and
                                                                        FB. The (1) device, (2) equipment, and (4) start-point scripts
third party information systems, there are two different and
                                                                        adopt a loop template, which enables a cyclic execution of
independent communication interfaces integrated in the DI-
                                                                        the FB. The (3) service and (5) endpoint types use the typical
NASORE, 1) the 4DIAC interface, which uses TCP/IP, and
                                                                        asynchronous approach executing when triggered.
2) the OPC-UA interface, which uses a data model XML
file as a reconfiguration file. These two interfaces allow the             Both OPC-UA and TPC/IP (4DIAC-IDE) interfaces are
reconfiguration of the current runtime workflows and the                essential to DINASORE operation, enabling different features
monitoring of each FB. The 4DIAC interface communicates                 and capabilities. The 4DIAC communication interface allows
with the 4DIAC-IDE using a TCP/IP connection, where the                 the combination with a graphical user interface (GUI) for
DINASORE interface executes a TCP server, receiving the                 the development of workflows based on FBs. The OPC-UA
commands from the 4DIAC-IDE enabling the creation, stop,                Data Model, besides enabling the workflow reconfiguration,
and deletion of the configuration workflow and the runtime              the primary purpose is to monitor the execution of a specific
configuration monitorization. The interaction between 4DIAC-            pipeline monitoring using the OPC-UA industrial protocol and
IDE and DINASORE for the configuration creation starts with             the storage of the device configuration in an XML format. The
several messages instantiating every FB (Create FB); each               configuration storage transforms the DINASORE in a more
message contains the FB type and instance name. Then the                reliable and fault-tolerant platform, enabling the memorization
4DIAC-IDE sends the commands to create the connections                  of the current state of the workflow, being tolerant of power
(events and variables) between FBs (Create Connection and               cuts restarting the runtime environment in the previous state.
Write Connection), and finally the IDE requests the start of the        The Data Model XML file updates every time, when the
FB threads (Start Configuration). After starting the workflow,          DINASORE receives commands from the 4DIAC-IDE, for the
the DINASORE enables the monitoring of each FB variable                 creation, stop, and removal of configuration workflows.
and event, through the watch option (the Create Watch mes-
sage to activate the subscription; the Read Watch message to
request the variable/event current value; and the Delete Watch                          IV. T EST C ASE S CENARIOS
message to unsubscribe). Additionally, the DINASORE allows
from the 4DIAC-IDE to stop and reset (Stop Configuration)                  The DINASORE evaluation focuses on the validation of
the configuration workflow, terminating the respective working          the tool in different scenarios. Those scenarios point out the
threads and the remote trigger of an event (Trigger Event),             platform advantages and disadvantages, besides establishing
performing a FB functionality in the DINASORE.                          the most suitable applications, like sensing, control, or data
   As an alternative, the DINASORE can use the OPC-UA                   processing. The first scenario focuses on the use of machine
Data Model as reconfiguration channel. This way, the DI-                learning (ML) algorithms, in particular classification methods,
NASORE stores the configuration locally in the Data Model               for the detection of collisions in a real mini-robotic arm based
XML file, where registers all the used FBs, and their respec-           in servo motors. The second example consists of a typical
tive connections (events and variables). The FB XML meta-               distributed control architecture composed of two components
information classifies each FB in different sets, grouping them         (gripper and robotic arm) that have to synchronize between
in 1) devices, 2) equipment, 3) services, 4) endpoints, and 5)          them to perform the required operation. The third case shows
start-points:                                                           the simulation of a manufacturing production line. Based on
   1) The device abstraction represents sensors, like sensors           the simulation scenario, several experiments with increasing
       integrated using Modbus protocol;                                amounts of FBs allow to assess the scalability of the frame-
   2) The equipment representation uses a more complex                  work in terms of processing and memory usage.




                                                                   67
A. Collision detection based on servo motors analysis                     stop events when in overload, sent to the robotic arm control
   The main goal of the collision detection implementation is             component. The robotic arm control component (green FB,
to transform a typical robotic arm into a collaborative one.              using the device template), in a different Raspberry Pi, reads
That scenario uses a robotic arm based in servo motors that               from a text file, the sequence of motor positions to perform,
provide load metrics able to infer about possible collisions              and sends them sequentially through the serial port to the
with obstacles. Based on this, the process 1) monitors each               embedded controller. The robotic arm performs, in a cycle,
servo motor, 2) detects when one servo motor is in overload,              the list of instructions until it receives a stop event from the
and 3) stops the robotic arm if it collides with an obstacle. The         monitoring component; then, it freezes, waiting to receive a
network architecture contains two devices, both Raspberry’s               continue event from the user, using the 4DIAC-IDE, to restart
Pi: 1) responsible for monitoring the servo motors and check              the operation.
the motors overload (Figure 2 rose FBs), and 2) controlling the           B. UR5 Collaborative Robotic Arm and Gripper Control
robotic arm, sending instructions to perform a particular task,
                                                                             The synchronized control between a Universal Robots 5
and waiting to receive an overload alert to stop its execution
                                                                          (UR5) robotic arm and a 3D printed gripper requires the
(Figure 2 green FB).
                                                                          usage of a CPPS composed of two Raspberry Pi, similar
                                                                          to the previous scenario. Considering that architecture, one
                                                                          component controls the servo motor that opens and closes the
                                                                          gripper (Figure 3 blue FBs), and the other sends commands
                                                                          to the UR5 robotic arm (Figure 3 purple FBs). The operation
                                                                          performed by both devices consists in 1) catch one object at
                                                                          position A, 2) go with the piece to position B, 3) go back to
                                                                          position A, 4) leave the object in position A, 5) go without
                                                                          the item to position B, 6) go without the object to position A,
                                                                          and restarts the cycle.
                Fig. 2. Collaborative Robot Workflow.

   The servo motors sensing component uses as hardware an
Arduino Uno board (ATMega328P microcontroller), which
collects data of the voltage and current for each motor, using
a potential divider to measure the voltage and an amplifier
to obtain the current. The Root Mean Squared (RMS) uses
the last 250 samples to calculate the voltage and current
RMS value, which allows the computation of the real and
apparent power. This data processing is performed at the
microcontroller level, transmitting the eight features (4 metrics
of 2 servo motors) through the serial port to the Raspberry
Pi, which uses a FB, implementing the device template, to
read and parse the data. After parsing the data and calculating
the respective lag features (moving average and standard
deviation) for the last 10 samples, the overall features (total of                  Fig. 3. UR5 Robotic Arm and Gripper Workflow.
24 variables) feed a classification method. The model predicts
if the robotic arm is performing with regular efforts (output at             The UR5 robotic arm uses an API to send commands
zero) or in overload/collision situations (output at one). The            through a TCP/IP communication channel with the physical
classification model training uses an offline dataset, collected          controller, which enables the continuous flow of instructions
from the serial port, containing the robotic arm performing               (X, Y, Z positions and Rx, Ry, Rz rotations) to the UR5 robotic
different operations with and without collisions. Several classi-         arm. The FB, using the service template, wraps the API func-
fication algorithms, including Support Vector Machine (SVM),              tion to move the robotic arm to a specific location (X, Y, and
Random Forrest (RF), and Artificial Neural Networks (ANN),                Z) with the rotation of the joints (Rx, Ry, and Rz). The gripper
were validated using the precision, the recall, and the f1-score          developed to pick up objects contains three different parts 1)
as performance metrics. The more accurate model was the                   a Raspberry Pi, 2) a servo motor that opens and closes the
RF, exported to perform online on the second pipeline FB, that            gripper, and 3) a 3D printed Polylactic Acid (PLA) casing. The
implements the service template. The model output predictions             movement of the servo motor opens and closes the 3D printed
generate a stop event sent, through multicast sockets, to the             fingers, according to the instruction sent from the Raspberry
second Raspberry Pi, which controls the robotic arm. The                  Pi interface using the General Purpose Input/Output (GPIO).
communication between the two Raspberry Pis, due to the                   Thus, a FB, adopting the service template, encapsulates the
usage of UDP multicast sockets, adopts a paradigm producer-               control of GPIO pins using an input variable to establish the
subscriber, where the collision detection component produces              operation to perform (open or close). The communication in




                                                                     68
the CPPS uses multicast sockets to send events between FBs                 D. Performance Evaluation
that are in different devices (different colors), as used in the              The manufacturing line simulation scenario serves as a basis
previous scenario.                                                         for performance and workload evaluation for the DINASORE
C. Manufacturing Applications                                              framework. By using a series of three FBs that represent a
                                                                           station it is possible to assess the CPU and memory usage
   The simulation of a manufacturing production line addresses
                                                                           with a varying number of FBs. The htop monitoring tool
several challenges, like the material tracking on the shop-
                                                                           (linux) was used enabling the profiling of each process in the
floor or equipment sensorization. Regarding the flow of ma-
                                                                           operating system. Typically, the memory usage has a constant
terials along the production line, the developed simulation
                                                                           value for the same input parameters; however, the CPU usage
includes each station of the process, with its attributes, like the
                                                                           has high variability, which requires more samples to obtain an
current manufactured material and the respective transporter,
                                                                           accurate estimation. The higher number of collected samples
the sensors associated, and the operation time. The simulated
                                                                           for the same scenario, generates a more substantial variability,
representation mainly serves as an advantage for the process
                                                                           computed in the form of standard deviation. Figure 5 considers
industries, which have a sequential set of productive steps, be-
                                                                           both metrics, representing the collected samples for the mem-
ing able to simulate different layouts to optimize productivity.
                                                                           ory and the average and standard deviation for the processing
                                                                           usage.




                   Fig. 4. Manufacturing Scenario.
                                                                                         Fig. 5. DINASORE Performance Results.
   Figure 4 presents partially the FB pipeline of the simulation
implementation, where each simulated station uses three FBs                   The main property to evaluate on the DINASORE is how
to model its behavior. The main FB, that adopts the equip-                 an increasing number of FBs influences the framework usage
ment template, represents a station and implements a state                 of computational resources. This kind of test requires a large
machine with the following states: 1) unscheduled, waiting                 number of FBs (up to 200) focusing on the DINASORE
for new material to produce; 2) standby, arrives a material                management of the runtime environment. The hardware spec-
and transporter associated and waits to start the operation; 3)            ifications of the host machine are 16GB of RAM and an
productive, working in the operation of the station; and 4)                Intel Core i7 processor, with 12 cores and a frequency of
error, a stochastic state to simulate an extra time producing              2.20GHz. The analysis of the results indicates a growing trend
the material. The additional two FBs, implemented using the                in both metrics with an increasing number of FBs. That trend
service template, allow to simulate the production time and                follows the natural behavior of computational systems: more
error time (if any). All the series of three FBs represent                 complexity causes more resources consumed, with the CPU
the entire production line with its characteristic sequential U            curve following a rate of approximately 18 FBs per 1% of CPU
shape and bifurcations. Additionally, this approach enables                usage. Those values prove the reliability and scalability of the
the integration of real components with in this simulation                 developed solutions, considering the target hardware, which
environment, turning the pipeline more accurate.                           varies from low computational power devices (e.g., Raspberry




                                                                      69
Pi) to high performance machines (e.g., servers). Such experi-                        [6] T. Strasser, M. Rooker, G. Ebenhofer, A. Zoitl, C. Sunder, A. Valentini,
ments’ main intention is solely to validate the performance of                            and A. Martel, “Framework for distributed industrial automation and
                                                                                          control (4diac),” in 2008 6th IEEE International Conference on Indus-
DINASORE, not considering CPU and memory usage in terms                                   trial Informatics, July 2008, pp. 283–288.
of FB functionality (e.g., training a deep neural network).                           [7] G. Cengic, O. Ljungkrantz, and K. Akesson, “Formal modeling of
                                                                                          function block applications running in iec 61499 execution runtime,”
                           V. C ONCLUSION                                                 in 2006 IEEE Conference on Emerging Technologies and Factory
                                                                                          Automation, Sep. 2006, pp. 1269–1276.
   Looking in perspective, the DINASORE framework enables                             [8] M. Minhat, V. Vyatkin, X. Xu, S. Wong, and Z. Al-Bayaa, “A novel open
                                                                                          cnc architecture based on step-nc data model and iec 61499 function
the deployment of powerful Python algorithms for CPPSs,                                   blocks,” Robotics and Computer-Integrated Manufacturing, vol. 25,
following industrial standards globally adopted, like the IEC                             no. 3, pp. 560–569, 2009.
61499 and OPC-UA protocol. The proposed framework in-                                 [9] C. C. Insaurralde, “Modeling standard for distributed control systems:
                                                                                          Iec 61499 from industrial automation to aerospace,” in 2016 IEEE/AIAA
creases the flexibility of the traditionally closed and hard to                           35th Digital Avionics Systems Conference (DASC). IEEE, 2016, pp.
re-configure industrial systems, being a step forward the high-                           1–8.
mix low-volume paradigm. The validation scenarios prove                              [10] F. Andrén, T. Strasser, and W. Kastner, “Model-driven engineering
                                                                                          applied to smart grid automation using iec 61850 and iec 61499,” in
the flexibility and reliability of the DINASORE, giving the                               2014 Power Systems Computation Conference. IEEE, 2014, pp. 1–7.
necessary freedom to developers for a multitude of different                         [11] T. Terzimehic, M. Wenger, A. Zoitl, A. Bayha, K. Becker, T. Müller,
application implementations, like sensor integration, equip-                              and H. Schauerte, “Towards an industry 4.0 compliant control software
                                                                                          architecture using iec 61499 & opc ua,” in 2017 22nd IEEE International
ment control, data processing, or communication protocols.                                Conference on Emerging Technologies and Factory Automation (ETFA).
The performance evaluation demonstrates the scalability in a                              IEEE, 2017, pp. 1–4.
DINASORE runtime environment with an increasing amount                               [12] M. V. Garcı́a, E. Irisarri, F. Pérez, M. Marcos, and E. Estévez, “En-
                                                                                          gineering tool to develop cpps based on iec-61499 and opc ua for
of FBs. Nevertheless, the DINASORE transforms a heavy-                                    oil&gas process,” in 2017 IEEE 13th International Workshop on Factory
weight local application into a distributed solution performing                           Communication Systems (WFCS). IEEE, 2017, pp. 1–9.
in a clusters of devices. Considering that, the platform provides                    [13] M. V. Garcı́a, F. Pérez, I. Calvo, and G. Morán, “Building industrial
                                                                                          cps with the iec 61499 standard on low-cost hardware platforms,”
capabilities to scale up the solutions for a larger amount of de-                         in Proceedings of the 2014 IEEE Emerging Technology and Factory
vices, isolating the applications into FBs, and communication                             Automation (ETFA). IEEE, 2014, pp. 1–4.
through popular IoT protocols, like MQTT or OPC-UA.                                  [14] M. V. Garcı́a, F. Pérez, I. Calvo, and G. Moran, “Developing cpps within
                                                                                          iec-61499 based on low cost devices,” in 2015 IEEE World Conference
   As for the future work, and assuming that DINASORE                                     on Factory Communication Systems (WFCS). IEEE, 2015, pp. 1–4.
enables the use of computation-intensive machine learning                            [15] K. Thramboulidis and A. Zoupas, “Real-time java in control and automa-
solutions, the exploration of speculative computation con-                                tion: a model driven development approach,” in 2005 IEEE Conference
                                                                                          on Emerging Technologies and Factory Automation, vol. 1. IEEE, 2005,
cept, as implemented in [30] for FB-based systems, will be                                pp. 8–pp.
explored. The central idea is to implement this concept as                           [16] V. Vyatkin and J. Chouinard, “On comparisons of the isagraf implemen-
a background process in DINASORE so the execution can                                     tation of iec 61499 with fbdk and other implementations,” in 2008 6th
                                                                                          IEEE International Conference on Industrial Informatics. IEEE, 2008,
be accelerated transparently. An additional objective is the                              pp. 289–294.
continuous implementation of new methods using the FB                                [17] G. Cengic, O. Ljungkrantz, and K. Akesson, “Formal modeling of
structure to easily experiment with them in different industrial                          function block applications running in iec 61499 execution runtime,”
                                                                                          in 2006 IEEE Conference on Emerging Technologies and Factory
applications due to the FB portability between systems.                                   Automation. IEEE, 2006, pp. 1269–1276.
                                                                                     [18] L. Prenzel and J. Provost, “Fbbeam: An erlang-based iec˜ 61499 imple-
                         ACKNOWLEDGMENT                                                   mentation,” in IEEE International Conference on Industrial Informatics
                                                                                          (INDIN’19), 2019.
   INDTECH 4.0 - New technologies for intelligent manufac-                           [19] J. H. Christensen, T. Strasser, A. Valentini, V. Vyatkin, A. Zoitl,
turing. Support on behalf of IS for Technological Research                                J. Chouinard, H. Mayer, and A. Kopitar, “The iec 61499 function block
and Development (SI à Investigação e Desenvolvimento Tec-                              standard: Software tools and runtime platforms,” ISA Automation Week,
                                                                                          vol. 2012, 2012.
nológico). POCI-01-0247-FEDER-026653                                                [20] L. I. Pinto, C. D. Vasconcellos, R. S. U. Rosso, and G. H. Negri, “Icaru-
                                                                                          fb: An iec 61499 compliant multiplatform software infrastructure,” IEEE
                             R EFERENCES                                                  Transactions on Industrial Informatics, vol. 12, no. 3, pp. 1074–1083,
                                                                                          2016.
 [1] G. Gonçalves, J. Reis, R. Pinto, M. Alves, and J. Correia, “A step             [21] P. Lindgren, M. Lindner, A. Lindner, D. Pereira, and L. M. Pinho, “Rtfm-
     forward on intelligent factories: A smart sensor-oriented approach,”                 core: Language and implementation,” in 2015 IEEE 10th Conference on
     in Proceedings of the 2014 IEEE Emerging Technology and Factory                      Industrial Electronics and Applications (ICIEA). IEEE, 2015, pp. 990–
     Automation (ETFA). IEEE, 2014, pp. 1–8.                                              995.
 [2] S. Wang, J. Wan, D. Li, and C. Zhang, “Implementing smart factory of            [22] S. Kožár and P. Kadera, “Integration of iec 61499 with opc ua,” in
     industrie 4.0: an outlook,” International Journal of Distributed Sensor              2016 IEEE 21st International Conference on Emerging Technologies
     Networks, vol. 12, no. 1, p. 3159805, 2016.                                          and Factory Automation (ETFA). IEEE, 2016, pp. 1–7.
 [3] O. Rittho, R. Klinkenberg, S. Fischer, I. Mierswa, and S. Felske, “Yale:        [23] L. Prenzel, A. Zoitl, and J. Provost, “Iec 61499 runtime environments:
     Yet another learning environment,” in LLWA 01-Tagungsband der GI-                    A state of the art comparison,” in 17th International Conference on
     Workshop-Woche Lernen-Lehren-Wissen-Adaptivität, no. 763. Citeseer,                 Computer Aided Systems Theory (EUROCAST 2019), 2019.
     2001, pp. 84–92.                                                                [24] E. X. Castellanos, C. A. Garcia, C. Rosero, C. Sanchez, and M. V.
 [4] M. Corporation. (2018) Microsoft azure machine learning studio.                      Garcia, “Enabling an automation architecture of cpps based on uml
     [Online]. Available: https://azure.microsoft.com/pt-pt/services/machine-             combined with iec-61499,” in 2017 17th International Conference on
     learning-studio/                                                                     Control, Automation and Systems (ICCAS). IEEE, 2017, pp. 471–476.
 [5] G. AI. (2017) Google cloud ai. [Online]. Available:                             [25] A. Hopsu, U. D. Atmojo, and V. Vyatkin, “On portability of iec 61499
     https://cloud.google.com/products/ai/                                                compliant structures and systems,” in 2019 IEEE 28th International




                                                                                70
     Symposium on Industrial Electronics (ISIE). IEEE, 2019, pp. 1306–
     1311.
[26] L. Ferrarini and C. Veber, “Implementation approaches for the execution
     model of iec 61499 applications,” in 2nd IEEE International Conference
     on Industrial Informatics, 2004. INDIN’04. 2004. IEEE, 2004, pp. 612–
     617.
[27] G. Cengic and K. Akesson, “Definition of the execution model used
     in the fuber iec 61499 runtime environment.[in:] industrial informatics,
     2008. indin 2008,” in 6th IEEE International Conference on, 2008, p.
     301.
[28] C. Sunder, A. Zoitl, J. H. Christensen, V. Vyatkin, R. W. Brennan,
     A. Valentini, L. Ferrarini, T. Strasser, J. L. Martinez-Lastra, and
     F. Auinger, “Usability and interoperability of iec 61499 based distributed
     automation systems,” in 2006 4th IEEE International Conference on
     Industrial Informatics. IEEE, 2006, pp. 31–37.
[29] G. Cengic and K. Akesson, “On formal analysis of iec 61499 appli-
     cations, part b: Execution semantics,” IEEE Transactions on Industrial
     Informatics, vol. 6, no. 2, pp. 145–154, 2010.
[30] D. Drozdov, V. Dubinin, and V. Vyatkin, “Speculative computation in
     iec 61499 function blocks execution—modeling and simulation,” in 2016
     IEEE 14th International Conference on Industrial Informatics (INDIN).
     IEEE, 2016, pp. 748–755.




                                                                                  71