Content uploaded by Tomasz Królikowski
Author content
All content in this area was uploaded by Tomasz Królikowski on Oct 21, 2019
Content may be subject to copyright.
ScienceDirect
Available online at www.sciencedirect.com
Procedia Computer Science 159 (2019) 2560–2569
1877-0509 © 2019 The Authors. Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
10.1016/j.procs.2019.09.431
10.1016/j.procs.2019.09.431 1877-0509
© 2019 The Authors. Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
Available online at www.sciencedirect.com
ScienceDirect
Procedia Computer Science 00 (2019) 000–000
www.elsevier.com/locate/procedia
1877-0509 © 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
23rd International Conference on Knowledge-Based and Intelligent Information & Engineering
Systems
Finite State Machine Based Modelling of Discrete Control
Algorithm in LAD Diagram Language With Use of New Generation
Engineering Software
Wojciech Zająca, Grzegorz Andrzejewskia,
Kazimierz Krzywickia, Tomasz Królikowskib,
*
aFaculty of Technology, The Jacob of Paradies University, ul. Teatralna 25, 66-400 Gorzow Wielkopolski, Poland
bFaculty of Technology and Education, University of Technology, ul. Sniadeckich 2, 75-453 Koszalin, Poland
Abstract
In the paper there is described a process of modeling the discrete control system for a chemical reactor. In the design of the
control algorithm there was used Finite State Machine methodology as one of the more effective for modeling complex control
tasks. There were identified input and output signals of the process, the dependencies and operating rules and the system
operation was described. The modeled algorithm was implemented in LAD diagram language with use of novel control
engineering software - TIA Portal by Siemens. The implementation process is described and discussed, implementation results
are shown and a conclusion is drawn.
© 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
Keywords: industrial process control; parameterised discrete control; embedded systems; process modelling; FSM; LD;
* Corresponding author. Tel.: +48 601959023; fax: +48 94 342-59-63.
E-mail address: Tomasz.krolikowski@tu.koszalin.pl
Available online at www.sciencedirect.com
ScienceDirect
Procedia Computer Science 00 (2019) 000–000
www.elsevier.com/locate/procedia
1877-0509 © 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
23rd International Conference on Knowledge-Based and Intelligent Information & Engineering
Systems
Finite State Machine Based Modelling of Discrete Control
Algorithm in LAD Diagram Language With Use of New Generation
Engineering Software
Wojciech Zająca, Grzegorz Andrzejewskia,
Kazimierz Krzywickia, Tomasz Królikowskib,*
aFaculty of Technology, The Jacob of Paradies University, ul. Teatralna 25, 66-400 Gorzow Wielkopolski, Poland
bFaculty of Technology and Education, University of Technology, ul. Sniadeckich 2, 75-453 Koszalin, Poland
Abstract
In the paper there is described a process of modeling the discrete control system for a chemical reactor. In the design of the
control algorithm there was used Finite State Machine methodology as one of the more effective for modeling complex control
tasks. There were identified input and output signals of the process, the dependencies and operating rules and the system
operation was described. The modeled algorithm was implemented in LAD diagram language with use of novel control
engineering software - TIA Portal by Siemens. The implementation process is described and discussed, implementation results
are shown and a conclusion is drawn.
© 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
Keywords: industrial process control; parameterised discrete control; embedded systems; process modelling; FSM; LD;
* Corresponding author. Tel.: +48 601959023; fax: +48 94 342-59-63.
E-mail address: Tomasz.krolikowski@tu.koszalin.pl
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
1. Introduction
The dynamic development of embedded systems and automatic control of industrial processes causes that these
systems are becoming larger, more complex and complicated [1-2]. Increasingly, they consist of many (even several
dozens) executive units connected together in a logical way creating a distributed embedded system. Furthermore,
the complexity of implemented control processes and sensors and actuators used is also increasing. This is due to the
fact that more and more factories operate in accordance with the Industry 4.0 concept creating intelligent
manufacturing solutions. However, the design and implementation of such systems is complex, complicated, time-
consuming and expensive [2]. Therefore, it seems reasonable to look for methods that support the design and
implementation of such systems.
This paper proposes a modeling method of discrete control algorithm in LAD language based on FSM
description, which allows to systematize and simplify the design and implementation of industrial process control
systems. In addition, this method increases the reliability of the system by imposing certain FSM states in which it
can operate.
Section I contains the general introduction and state of art, Section II proposes FSM Model of Control Algorithm,
Section III provides the implementation and research results, Section IV concludes the paper.
1.1. Control Process Modeling
There are many methods and models that help design and implement embedded systems [15-20]. Often,
behavioral models are used to present and investigate relationships between some objects. Furthermore, due to their
properties, they are used in the Model Driven Design (MDD) methods [3-4]. Through specific model
transformations, effects are obtained, for example, in the form of generated code fragments or the entire
implementation that commonly would have to be done manually by the designer. These models have different
properties and applications. One of the most important features when designing complex industrial process control
systems is the simplicity and readability of the description model. Despite the existence of different models of
formal specifications, the most commonly used high-level synthesis models are: FSM (Finite State Machine) [5-7]
and related: FSMD (Finite State Machine with Datapath) [8], state diagrams (including UML) [9] and Petri nets
(including interpreted, hierarchical, colored, etc.) [10-12]. In [5] authors propose design methods targeted on logic
synthesis of both Mealy and Moore FSMs, where their logic circuits can be implemented using ASIC, as well as
CPLD or FPGA. A code generation tool for embedded automotive systems based on finite state machines was
described in [13]. In [14] authors propose core concepts of PLC-statecharts as an adaptation of UML-statechart
dedicated for integrative use with IEC 61131.
In this article, we focused on the FSM model, because it is one of the main and simplest methods for describing
the behavior of objects. Therefore, it is suitable for describing the control process and it is possible to carry out a
synthesis process to the LAD language.
1.2. FSM Model Description
The Finite State Machine [5-7] model is a mathematical formation allowing to model the behavior of processes
that can be described by discrete values of parameters. It describes the state of an object by specifying the values of
particular system variables at certain moments or intervals of time (states), and by defining the table of changes of
system variables in subsequent discrete states (the transition table).
A Moore FSM can be represented as a:
(1)
where:
• S={s1,…,si} is non-empty and finite set of internal states;
• X={x1,…,xj} is a finite and non-empty set of inputs;
Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569 2561
Available online at www.sciencedirect.com
ScienceDirect
Procedia Computer Science 00 (2019) 000–000
www.elsevier.com/locate/procedia
1877-0509 © 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
23rd International Conference on Knowledge-Based and Intelligent Information & Engineering
Systems
Finite State Machine Based Modelling of Discrete Control
Algorithm in LAD Diagram Language With Use of New Generation
Engineering Software
Wojciech Zająca, Grzegorz Andrzejewskia,
Kazimierz Krzywickia, Tomasz Królikowskib,*
aFaculty of Technology, The Jacob of Paradies University, ul. Teatralna 25, 66-400 Gorzow Wielkopolski, Poland
bFaculty of Technology and Education, University of Technology, ul. Sniadeckich 2, 75-453 Koszalin, Poland
Abstract
In the paper there is described a process of modeling the discrete control system for a chemical reactor. In the design of the
control algorithm there was used Finite State Machine methodology as one of the more effective for modeling complex control
tasks. There were identified input and output signals of the process, the dependencies and operating rules and the system
operation was described. The modeled algorithm was implemented in LAD diagram language with use of novel control
engineering software - TIA Portal by Siemens. The implementation process is described and discussed, implementation results
are shown and a conclusion is drawn.
© 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
Keywords: industrial process control; parameterised discrete control; embedded systems; process modelling; FSM; LD;
* Corresponding author. Tel.: +48 601959023; fax: +48 94 342-59-63.
E-mail address: Tomasz.krolikowski@tu.koszalin.pl
Available online at www.sciencedirect.com
ScienceDirect
Procedia Computer Science 00 (2019) 000–000
www.elsevier.com/locate/procedia
1877-0509 © 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
23rd International Conference on Knowledge-Based and Intelligent Information & Engineering
Systems
Finite State Machine Based Modelling of Discrete Control
Algorithm in LAD Diagram Language With Use of New Generation
Engineering Software
Wojciech Zająca, Grzegorz Andrzejewskia,
Kazimierz Krzywickia, Tomasz Królikowskib,*
aFaculty of Technology, The Jacob of Paradies University, ul. Teatralna 25, 66-400 Gorzow Wielkopolski, Poland
bFaculty of Technology and Education, University of Technology, ul. Sniadeckich 2, 75-453 Koszalin, Poland
Abstract
In the paper there is described a process of modeling the discrete control system for a chemical reactor. In the design of the
control algorithm there was used Finite State Machine methodology as one of the more effective for modeling complex control
tasks. There were identified input and output signals of the process, the dependencies and operating rules and the system
operation was described. The modeled algorithm was implemented in LAD diagram language with use of novel control
engineering software - TIA Portal by Siemens. The implementation process is described and discussed, implementation results
are shown and a conclusion is drawn.
© 2019 The Author(s). Published by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0/)
Peer-review under responsibility of KES International.
Keywords: industrial process control; parameterised discrete control; embedded systems; process modelling; FSM; LD;
* Corresponding author. Tel.: +48 601959023; fax: +48 94 342-59-63.
E-mail address: Tomasz.krolikowski@tu.koszalin.pl
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
1. Introduction
The dynamic development of embedded systems and automatic control of industrial processes causes that these
systems are becoming larger, more complex and complicated [1-2]. Increasingly, they consist of many (even several
dozens) executive units connected together in a logical way creating a distributed embedded system. Furthermore,
the complexity of implemented control processes and sensors and actuators used is also increasing. This is due to the
fact that more and more factories operate in accordance with the Industry 4.0 concept creating intelligent
manufacturing solutions. However, the design and implementation of such systems is complex, complicated, time-
consuming and expensive [2]. Therefore, it seems reasonable to look for methods that support the design and
implementation of such systems.
This paper proposes a modeling method of discrete control algorithm in LAD language based on FSM
description, which allows to systematize and simplify the design and implementation of industrial process control
systems. In addition, this method increases the reliability of the system by imposing certain FSM states in which it
can operate.
Section I contains the general introduction and state of art, Section II proposes FSM Model of Control Algorithm,
Section III provides the implementation and research results, Section IV concludes the paper.
1.1. Control Process Modeling
There are many methods and models that help design and implement embedded systems [15-20]. Often,
behavioral models are used to present and investigate relationships between some objects. Furthermore, due to their
properties, they are used in the Model Driven Design (MDD) methods [3-4]. Through specific model
transformations, effects are obtained, for example, in the form of generated code fragments or the entire
implementation that commonly would have to be done manually by the designer. These models have different
properties and applications. One of the most important features when designing complex industrial process control
systems is the simplicity and readability of the description model. Despite the existence of different models of
formal specifications, the most commonly used high-level synthesis models are: FSM (Finite State Machine) [5-7]
and related: FSMD (Finite State Machine with Datapath) [8], state diagrams (including UML) [9] and Petri nets
(including interpreted, hierarchical, colored, etc.) [10-12]. In [5] authors propose design methods targeted on logic
synthesis of both Mealy and Moore FSMs, where their logic circuits can be implemented using ASIC, as well as
CPLD or FPGA. A code generation tool for embedded automotive systems based on finite state machines was
described in [13]. In [14] authors propose core concepts of PLC-statecharts as an adaptation of UML-statechart
dedicated for integrative use with IEC 61131.
In this article, we focused on the FSM model, because it is one of the main and simplest methods for describing
the behavior of objects. Therefore, it is suitable for describing the control process and it is possible to carry out a
synthesis process to the LAD language.
1.2. FSM Model Description
The Finite State Machine [5-7] model is a mathematical formation allowing to model the behavior of processes
that can be described by discrete values of parameters. It describes the state of an object by specifying the values of
particular system variables at certain moments or intervals of time (states), and by defining the table of changes of
system variables in subsequent discrete states (the transition table).
A Moore FSM can be represented as a:
(1)
where:
• S={s1,…,si} is non-empty and finite set of internal states;
• X={x1,…,xj} is a finite and non-empty set of inputs;
2562 Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
• Y={y1,…,yk} is a finite set of outputs;
•
is the function of transition:
: × →
;
• is the function of outputs: : → ;
• ,∈ is the initial state of the automata.
1.3. FSM-based Modeling of control processes
All tables should There are many ways for representing a Moore FSM [5]. In this paper, we use classic, graph
representation of the FSM. Identifying and describing the components of equation (1) is necessary for modelling the
Finite Automaton operation algorithm. Figure 1 presents an example of process described by the FSM algorithm.
Transitions (arcs) between individual states are only possible when the given state (S) is active, and the transition
condition specified in the arc is met. Furthermore, changing the state of the automate causes changes in values of
discrete output variable.
a) b)
Fig. 1. Example of process described by the FSM: a) single-pass logic algorithm, b) cyclic algorithm.
Let us have a Moore FSM determined by one of graphs presented in Figure 1. The graph starts with S1 state with
y1 output active and all other outputs deactivated. Transition from S1 to S2 will take place (or "fire") only if the S1
state will be active and the x1 signal will be driven high - in other words activation of x1 input causes FSM to change
the state from S1 to S2. In S2 state outputs y2 and y3 are active, and all other outputs, along with previously active x1,
are deactivated. The subsequent transitions between states are:
• S2 to S3 when x2 is active then in S3 the y4, y5 outputs are active;
• S3 to S4 when x3 is low (the tilde symbol is used as a logic negation) then in S4, the y6 output is active;
• S4 to S5 when x4 is active.
Finally, the S5 state will cause the machine to reset all outputs and stop the operation.
s1
s3
s4
s5
Control
sequence
entry point
y1
x1
s2
y
2
, y3
x2
y
4
, y5
~x3
y6
x4
s2
s3
s4
s
5=
s
1
Control sequence entry point
y
1
y
2
, y
3
x1
x
2
~x
3
x4
y6
y
4
, y5
Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569 2563
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
• Y={y1,…,yk} is a finite set of outputs;
• is the function of transition: : × → ;
• is the function of outputs: : → ;
• ,∈ is the initial state of the automata.
1.3. FSM-based Modeling of control processes
All tables should There are many ways for representing a Moore FSM [5]. In this paper, we use classic, graph
representation of the FSM. Identifying and describing the components of equation (1) is necessary for modelling the
Finite Automaton operation algorithm. Figure 1 presents an example of process described by the FSM algorithm.
Transitions (arcs) between individual states are only possible when the given state (S) is active, and the transition
condition specified in the arc is met. Furthermore, changing the state of the automate causes changes in values of
discrete output variable.
a) b)
Fig. 1. Example of process described by the FSM: a) single-pass logic algorithm, b) cyclic algorithm.
Let us have a Moore FSM determined by one of graphs presented in Figure 1. The graph starts with S1 state with
y1 output active and all other outputs deactivated. Transition from S1 to S2 will take place (or "fire") only if the S1
state will be active and the x1 signal will be driven high - in other words activation of x1 input causes FSM to change
the state from S1 to S2. In S2 state outputs y2 and y3 are active, and all other outputs, along with previously active x1,
are deactivated. The subsequent transitions between states are:
• S2 to S3 when x2 is active then in S3 the y4, y5 outputs are active;
• S3 to S4 when x3 is low (the tilde symbol is used as a logic negation) then in S4, the y6 output is active;
• S4 to S5 when x4 is active.
Finally, the S5 state will cause the machine to reset all outputs and stop the operation.
s1
s3
s4
s5
Control
sequence
entry point
y1
x1
s2
y2, y3
x2
y4, y5
~x3
y6
x4
s2
s3
s4
s5=s1
Control sequence entry point
y1
y2, y3
x1
x2
~x3
x4
y6
y4, y5
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
2. FSM Based Control Algorithm
2.1. Control Object
As a n object to control there was taken example of chemical reactor. The purpose of this machine is to process
some prefabricated liquid substance by thermal treatment. The operation of the processor is cycle-based and
comprises five steps: filling the reactor tank with the prefabricated liquid with two speeds, heating it up, waiting for
reaction to complete, dispensing the product to three operators and cleaning the tank. The structure of the control
object is presented in Figure 2.
The system operates as follows (Figure 3). In the initial state of operation S1 the liquid tank is empty, all the
valves are closed, both of the pumps are off, and the System Ready Indicator is active. To start the system operation
the operator initiates Operation Enabled signal. In this state (S2) the System Ready Indicator is deactivated,
Operation Indicator is activated and both Low Flow Pump and High Flow Pump are enabled.
When the liquid level exceeds the Empty sensor, the Heater is turned on (S3 state). The fast filling mode ends up
when the liquid enables Nearly Full sensor. Since this moment the filling is continued slowly, with Low Flow Pump
only (S4 state). When the Full sensor produces a positive signal, the pump is stopped, and the heating is continued
until the Temp. Sensor indicates that the temperature of 60º Celsius is reached (S5 state). Then the Heater is turned
off and chemical reaction takes place for 25 seconds (S6 state). After that the system enables the Product Ready
Indicator and the Master Output Valve to allow three operators to take the product from the tank into their containers
by using manually operated Output Valves 1 to 3 (S7 state).
When the product level falls down bellow Nearly Empty sensor, the system turns on the Low-Level Warning
indicator (S8). When the Empty sensor activates, the Operation Indicator is deactivated, Master Output Valve is
closed, the Cleaning Indicator is activated, and the Rinsing Sprinkler and Cleaning Valve are enabled (S9 state).
After 10 seconds of operation the Rinsing Sprinkler is deactivated (S10 state). After 15 seconds the Cleaning Valve
is closed, Cleaning Indicator is turned off and System Ready signal is activated, which turns the system back to the
initial S1 state.
Fig. 2. Control Object Structure.
The control system identifies a number of input, internal and output signals. The input signals are:
• Full, indicating the liquid in the tank is at the maximal level allowed,
• Nearly Full, indicating the liquid level is close to but below the maximal level,
Full
Nearly Full
Nearly Empty
Empty
Temp. Sensor
Heater
Output Valve 1
Output Valve 2
Output Valve 3
High Flow Pump
Low Flow Pump
Operation Enabled Switch
Master Output Valve
Operation Indicator
Rinsing Sprinkler
Product Ready Indicator
Low Level Warning
Cleaning Indicator
Cleaning Valve
System Ready Indicator
2564 Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
•
Nearly Empty, indicating that the liquid level in the tank is close to zero; additionally, it indicates that heater
is covered with the liquid and it is safe to turn it on,
• Empty, indicating that there is no liquid or product in tank,
• Temp. Sensor, providing information from A/D input converter, related to liquid or product temperature,
• Operation Enable Switch, used by system operator to start the operation
Fig. 3. FSM graph of discrete control system operation.
In the system there are following output signals:
• System Ready Indicator, to signal that the system is in the initial state and it is ready to start to operate,
• Operation Indicator, to signal that the system is in the operation mode,
• Product Ready Indicator, to signal the operators that the product is ready,
• Low Level Warning, to signal the operators that the tank will soon run out of the product,
• Cleaning Indicator, indicating that the system is in cleaning mode,
• High Flow Pump, to control operation of the high-yielding pump
• Low Flow Pump, to control operation of low-yielding pump,
• Rinsing Sprinkler, to control operation of the sprinkler used in tank cleaning process,
• Heater, to control the operation of liquid heater,
• Cleaning Valve, to control operation of the valve used to empty the tank from cleaning remains,
• Master Output Valve, to control operation of the main valve of the system.
There are three internal Boolean signals used in control process:
• Temp60, indicating that the liquid temperature has reached required level,
• Time25s, indicating that the time required for reaction to take place has elapsed,
• Time10s, indicating that the time of sprinkling has elapsed,
• Time25s, indicating that the time of emptying the tank of the rinsing remains has elapsed,
• Operation Enable Memory, retaining information whether the process was started,
• Temp. Converted, containing the temperature in a form of a real number, calculated from the value produced
by input D/A converter.
S1
System Read y Indicator
S2
Low Flow Pump
High Fl
ow Pump
Operation Indicator
Low Flow Pump
High Flow Pump
Heating
Operation Indicator
S3
Operation Ena bled
~Empty
Nearly Full
Low Flow Pump
Heating
Operation Indicator
S4
Heating
Operation Indicator
S5
Full
Operation Indicator
S6
Master Outp ut Valve
Operation Indicator
Product Read y Indicator
S7
Master Output Value
Operation Indicator
Product Read y Indicator
Low Level Warning
S8
Cleaning Valve
Rinsing Sprinkler
Cleaning Indicator
S9
Cleaning Valve
Cleaning Indicator
S10
Temp60
Time25s
Nearly Empty
Empty
Time10s
Time15s
Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569 2565
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
• Nearly Empty, indicating that the liquid level in the tank is close to zero; additionally, it indicates that heater
is covered with the liquid and it is safe to turn it on,
• Empty, indicating that there is no liquid or product in tank,
• Temp. Sensor, providing information from A/D input converter, related to liquid or product temperature,
• Operation Enable Switch, used by system operator to start the operation
Fig. 3. FSM graph of discrete control system operation.
In the system there are following output signals:
• System Ready Indicator, to signal that the system is in the initial state and it is ready to start to operate,
• Operation Indicator, to signal that the system is in the operation mode,
• Product Ready Indicator, to signal the operators that the product is ready,
• Low Level Warning, to signal the operators that the tank will soon run out of the product,
• Cleaning Indicator, indicating that the system is in cleaning mode,
• High Flow Pump, to control operation of the high-yielding pump
• Low Flow Pump, to control operation of low-yielding pump,
• Rinsing Sprinkler, to control operation of the sprinkler used in tank cleaning process,
• Heater, to control the operation of liquid heater,
• Cleaning Valve, to control operation of the valve used to empty the tank from cleaning remains,
• Master Output Valve, to control operation of the main valve of the system.
There are three internal Boolean signals used in control process:
• Temp60, indicating that the liquid temperature has reached required level,
• Time25s, indicating that the time required for reaction to take place has elapsed,
• Time10s, indicating that the time of sprinkling has elapsed,
• Time25s, indicating that the time of emptying the tank of the rinsing remains has elapsed,
• Operation Enable Memory, retaining information whether the process was started,
• Temp. Converted, containing the temperature in a form of a real number, calculated from the value produced
by input D/A converter.
S1
System Read y Indicator
S2
Low Flow Pump
High Flow Pump
Operation Indicator
Low Flow Pump
High Flow Pump
Heating
Operation Indicator
S3
Operation Ena bled
~Empty
Nearly Full
Low Flow Pump
Heating
Operation Indicator
S4
Heating
Operation Indicator
S5
Full
Operation Indicator
S6
Master Outp ut Valve
Operation Indicator
Product Read y Indicator
S7
Master Output Value
Operation Indicator
Product Read y Indicator
Low Level Warning
S8
Cleaning Valve
Rinsing Sprinkler
Cleaning Indicator
S9
Cleaning Valve
Cleaning Indicator
S10
Temp60
Time25s
Nearly Empty
Empty
Time10s
Time15s
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
Table 1. Output signals values in subsequent FSM states of modeled control process.
Output signals
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10
S11=S1
Low Flow Pump
0
1
1
1
0
0
0
0
0
0
0
High Flow Pump
0
1
1
0
0
0
0
0
0
0
0
Heating
0
0
1
1
1
0
0
0
0
0
0
Master Output Valve
0
0
0
0
0
0
1
1
0
0
0
Cleaning Valve
0
0
0
0
0
0
0
0
1
1
0
Low Level Warning
0
0
0
0
0
0
0
1
0
0
0
System Ready Indicator
1
0
0
0
0
0
0
0
0
0
1
Operation Indicator
0
1
1
1
1
1
1
1
0
0
0
Product Ready Indicator
0
0
0
0
0
0
0
0
0
0
1
Cleaning Indicator
0
0
0
0
0
0
0
0
1
1
0
Cleaning Sprinkler
0
0
0
0
0
0
1
1
0
0
0
2.2. FSM Model of Control Algorithm
Control Algorithms can be modeled in a number of ways. In case of simple control tasks, the direct programming
in LAD language is very efficient and fast. As the complexity of the problem grows, it is more difficult to produce
the satisfactory solution quickly, despite all mechanisms of modern engineering software designed to take as much
of work from the engineer as possible. But in many cases the common and typical approach leads to creation of
programs that at some point of operation prove to contain errors. There is promoted a solution to problem solving
and program designing known as Win-Win, where engineers seek for acceptable compromises, but again, in
industrial automation systems usually there is no place for any program malfunction, as it can lead to significant
damage and loss. Therefore, engineers seek for solutions allowing to design control algorithms with no compromises
and uncertainty.
Finite State Machine modeling is a technique that proved to be one of very efficient ones in this field.
To efficiently design the FSM model of a process it is necessary to identify states that the modeled system can be,
to determine input and output signals and to assign those to states and transitions.
In Figure 3 there is presented the FSM graph of control for the example system. As the system is designed to
operate in cycles, the graph forms a circle.
In the S1 state the only one active signal is System Ready Indicator. The event that makes the system to change
the state to S2 is Operation Enable input signal. When the signal is detected by control system, the machine changes
the state to S2, where both High and Low Flow Pump are activated, and Operation Indicator is on. When the signal
from Empty sensor becomes inactive (as the liquid fills up the tank), the Heating output is activated, as the heater is
covered by liquid (S3). The heater is activated as soon as possible to save time necessary to achieve required
temperature. When the control system acquires the signal from Nearly Full sensor, it slows down the process of
filing by turning off High Flow Pump and leaving Low Flow Pump on (S4). When the Full signal comes, the system
turns of the pump and keeps heating up the tank (S5) until the sensor of temperature signals the required value of 60º
Celsius (S6).
The system remains in this state for required time of 25 seconds and after this time it signals to the operators that
the reaction product is ready and opens the master valve to let them to use the product (S7). When the tank becomes
nearly empty, the system turns on the Low-Level Warning (S8) to inform operators in advance to not to plan any
vast usage of the product. When the tank runs out of product, the system switches to cleaning mode, by starting the
Rinsing Sprinkler, turning on Cleaning Indicator and opening Cleaning Valve (S9). After 10 seconds the sprinkler is
turned off (S10) and after another 15 seconds the Cleaning Valve is closed, Cleaning Indicator is turned off and the
system returns to the initial state S1.
Table 1 presents values of the output signals in the subsequent S1 to S10 states of FSM model.
3. LAD Language Implementation
In this chapter there are presented results of implementation of the control algorithm shown in Fig. 3. The
algorithm was implemented in Step7 in TIA Portal engineering software by Siemens. The algorithm was
implemented and tested on S7-1200 PLC (CPU 1214C). The system input, internal and output data table is presented
2566 Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
in Fig. 4. It contains all the signals described in section 2.1. In addition, there is presented one project-specific
variable (Tag), State token (line 26). It is used to identify the state the system is in at the given moment.
Fig. 4. A set of control system data - Tag table.
The project uses Siemens-specific LAD program feature - a startup program block (Fig. 5). The block is executed
once, at the beginning of the whole program execution cycle. It is used to set the State token variable to 1. This step
ensures proper execution of program in case that the PLC is stopped for some reason and then started without
resetting the variables.
Fig. 5. Startup program block.
Fig. 6 presents Network 2 responsible for implementation of functionality of the S1 state. If the State Token is 1
and Operation Enabled Switch to provide the positive signal, system sets the Operation Enabled Memory and
changes the State Token to 2. Additionally, when the Operation Enabled Memory variable changes state to 1,
program deactivates the System Ready Indicator.
Fig. 6. Network 1 implementing S1 State functionality.
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
Fig. 7. Networks 2 to 4 implementing functionality of S2 to S4.
Fig. 7 shows Network 2, 3 and 4, implementing functionality of S2 to S4 states, as described in section 2.2. Fig.
8. presents Network 5 responsible for functionality of S5 state and Network 6, which contains two branches. First
one is responsible for conversion of the INT value obtained from D/A converter to REAL type value, which is then
scaled from 215 range to 0-100 range. The other branch compares the normalized value to the required level of 60ºC.
Fig. 8. Networks 5 and 6 implementing functionality of S5 state and handling the A/D converter readout.
Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569 2567
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
in Fig. 4. It contains all the signals described in section 2.1. In addition, there is presented one project-specific
variable (Tag), State token (line 26). It is used to identify the state the system is in at the given moment.
Fig. 4. A set of control system data - Tag table.
The project uses Siemens-specific LAD program feature - a startup program block (Fig. 5). The block is executed
once, at the beginning of the whole program execution cycle. It is used to set the State token variable to 1. This step
ensures proper execution of program in case that the PLC is stopped for some reason and then started without
resetting the variables.
Fig. 5. Startup program block.
Fig. 6 presents Network 2 responsible for implementation of functionality of the S1 state. If the State Token is 1
and Operation Enabled Switch to provide the positive signal, system sets the Operation Enabled Memory and
changes the State Token to 2. Additionally, when the Operation Enabled Memory variable changes state to 1,
program deactivates the System Ready Indicator.
Fig. 6. Network 1 implementing S1 State functionality.
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
Fig. 7. Networks 2 to 4 implementing functionality of S2 to S4.
Fig. 7 shows Network 2, 3 and 4, implementing functionality of S2 to S4 states, as described in section 2.2. Fig.
8. presents Network 5 responsible for functionality of S5 state and Network 6, which contains two branches. First
one is responsible for conversion of the INT value obtained from D/A converter to REAL type value, which is then
scaled from 215 range to 0-100 range. The other branch compares the normalized value to the required level of 60ºC.
Fig. 8. Networks 5 and 6 implementing functionality of S5 state and handling the A/D converter readout.
2568 Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
Fig. 9. Networks 7 to 11 implementing functionality of S6 to S10 states and Network 12 responsible for returning the system to the S1 state.
Wojciech Zając et al. / Procedia Computer Science 159 (2019) 2560–2569 2569
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
Fig. 9. Networks 7 to 11 implementing functionality of S6 to S10 states and Network 12 responsible for returning the system to the S1 state.
Zając W., Andrzejewski G., Krzywicki K., Królikowski T./ Procedia Computer Science 00 (2019) 000–000
4. Conclusion and future work
Implementation example showed that new generation engineering software allows to model efficiently examples
of discrete control algorithms described by FSM specification. Implemented algorithm was tested for unexpected
changes in input signal and it proved to work efficiently and safely. The algorithm implementation produces clear
and understandable code which is easy to maintain and develop.
Future work will be to apply the FSM modeling method to more complex control problems with concurrent tasks
and crossed dependencies. It would be interesting to examine deeper the debugging mechanisms of presented
software.
References
[1] Kopetz, H. (2011). “Real-time systems: design principles for distributed embedded applications”. Springer Science & Business Media.
[2] Barkalov, A., Titarenko, L., Andrzejewski, G., Krzywicki, K., & Kolopienczyk, M. (2017). „Fault detection variants of the CloudBus protocol
for IoT distributed embedded systems”. Advances in Electrical and Computer Engineering, 17 (2): 3-11.
[3] Riccobene, E., Scandurra, P., Rosti, A., & Bocchio, S. (2006). “A model-driven design environment for embedded systems”. In 2006 43rd
ACM/IEEE Design Automation Conference (pp. 915-918). IEEE.
[4] Liebel, G., Marko, N., Tichy, M., Leitner, A., & Hansson, J. (2018). “Model-based engineering in the embedded systems domain: an
industrial survey on the state-of-practice”. Software & Systems Modeling, 17 (1): 91-113.
[5] Barkalov, A., and Titarenko, L. (2009). “Logic synthesis for FSM-based control units” (Vol. 53). Berlin: Springer.
[6] Conway, J. H. (2012). “Regular algebra and finite machines”. Courier Corporation.
[7] Barkalov, A., Titarenko, L., Mielcarek, K., Krzywicki, K. & Zajac, W. (2019). ”Decreasing number of LUTs for Moore FSMs”. In 2019
MIXDES-26th International Conference" Mixed Design of Integrated Circuits and Systems. IEEE.
[8] Babakov, R. M., & Barkalov, A. A. (2016). “Algebraic interpretation of a microprogram finite-state machine with datapath of transitions”.
Cybernetics and Systems Analysis, 52 (2): 191-198.
[9] Coyle, F. P., & Thornton, M. A. (2005). “From UML to HDL: a model driven architectural approach to hardware-software co-design”. In
Information systems: new generations conference (ISNG) (1): 88-93.
[10] Gomes, L., Moutinho, F., Pereira, F., Ribeiro, J., Costa, A., & Barros, J. P. (2014). “Extending input-output place-transition Petri nets for
distributed controller systems development”. In 2014 International Conference on Mechatronics and Control (ICMC) (pp. 1099-1104). IEEE.
[11] Adamski, M. A., Karatkevich, A., & Wegrzyn, M. (2005). „Design of embedded control systems” (Vol. 267). Heidelberg: Springer.
[12] Grobelna, I., Wiśniewski, R., Grobelny, M., & Wiśniewska, M. (2016). „Design and verification of real-life processes with application of
Petri nets”. IEEE Transactions on Systems, Man, and Cybernetics: Systems, 47 (11): 2856-2869.
[13] Lindlar, F., & Zimmermann, A. (2008). “A code generation tool for embedded automotive systems based on finite state machines”. In 2008
6th IEEE International Conference on Industrial Informatics (pp. 1539-1544). IEEE.
[14] Witsch, D., & Vogel-Heuser, B. (2011). “PLC-statecharts: An approach to integrate UML-statecharts in open-loop control engineering–
aspects on behavioral semantics and model-checking”. IFAC Proceedings Volumes, 44 (1): 7866-7872.
[15] P. Stepien, B. Balasz, T. Szatkiewicz, T. Krolikowski. (2006) „Application of Artificial Intelligence Algorithms for the Modeling of the
Surfaces of Abrasive Grains” 4th International Industrial Simulation Conference 2006, ISC 2006: 265-277.
[16] B. Balasz, T. Krolikowski. (2007) “Advanced kinematic-geometrical model of grinding processes” 5th International Industrial Simulation
Conference 2007, ISC 2007: 137-141.
[17] S.V. Konstantinov, A.I. Diveev, G.I. Balandina, A.A. Baryshnikov (2019) “Comparative Research of Random Search Algorithms and
Evolutionary Algorithms for the Optimal Control Problem of the Mobile Robot” Procedia Computer Science 150: 462–470
[18] P. Grachev, I. Lobanov, I. Smetannikov., A. Filchenkov (2017) “Neural network for synthesizing deterministic finite automata” Procedia
Computer Science 119: 73–82.
[19] Khaled M. Khalil, M. Abdel-Aziz, Taymour T. Nazmy, Abdel-Badeeh M. Salem (2015) “MLIMAS: A Framework for Machine Learning in
Interactive Multi-Agent Systems” Procedia Computer Science 65: 827 – 835.
[20] Siddhartha Pratim Dasa, Anjan Kumar Talukdarb, Kandarpa Kumar Sarma (2015) “Sign Language Recognition using Facial Expression”
Procedia Computer Science 58: 210 – 216.