You are on page 1of 6

2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

A new PLC stack for Distributed and


Synchronous Configurations

José Miguel Sanz, Víctor Reyes Alfredo Sanz, J. Guerreira


Dept. of Electronic Engineering Microchip Technology Zaragoza S.L.U.
EINA University of Zaragoza Av. Juan Pablo II, 35 Zaragoza, Spain
C/ Mª de Luna 3, Zaragoza, Spain Alfredo.Sanz@microchip.com
miguel.sanz.alcaine@gmail.com Javier.Guerreira@microchip.com
victor.reyes.roy@gmail.com

medium term period. In this kind of applications, the goal is to


retrieve the information of the devices every quarter or every
Abstract—This paper describes a new distributed and
synchronous motors control configuration based on a new Power hour. Moreover, it is important to assure that a command is
Line Communications (PLC) stack specially designed for these received by one or more devices in a limited time.
distributed and synchronous motors control configurations and
In the current industrial equipment, it is usual to find several
for industrial applications. We will also present a new motor
motors distributed physically over the equipment which must
control board using this PLC stack to control several motors in a
synchronous way. The PLC stack has been used extendedly on move in a synchronous way. Some typical cases would be the
smart energy applications, mainly on the remote management of motors of a robotic arm, the motors which work in a Computer
electrical meters by utility companies. In this paper we introduce Numerical Control (CNC) or the motors on the popular 3D
PLC in a new application, the distributed control of several printers. Another area where we find a great number of motors
motors on industrial equipment or electric vehicles (EVs). and actuators distributed in a machine and that have to operate
Keywords- distributed control system (DCS); Power Line in a synchronized way is in the EVs. From the synchronization
Communications; PLC; Communications Protocol. of the tractor wheels of the EVs to the window lifters or
indicators in modern EVs there are a large number of
subassemblies that must act synchronously. These motors and
I. INTRODUCTION actuators must work with a synchronization from tens of
WITHIN the last 10 years, some public protocol stack were microseconds to few milliseconds. In some cases, it is
developed by the community for the smart energy market. The necessary to transmit to the central control device some
electrical utilities are using these stacks to remotely manage internal information with similar grade of synchronization. In a
and control millions of electrical meters and several other typical case the central device sends, in a regular way, and
devices on the smart grid (SG). The Distribution System with constant periods, the position that motors must reach, and
Operators (DSOs) need to deal with complex network the motors inform the central device of the real position
configurations and with the maintenance issues because of the reached, the current consumption or the motor torque applied.
presence of heterogeneous communication networks. From this
Usually, in this kind of applications, it is frequent to find a
point of view, Software Defined Networking (SDN) was
centralized control of all the motors of the equipment. In this
proposed as a feasible solution for SG applications, as
case, a central controller based on single Multiple Process Unit
demonstrated in [1]-[4]. The use of PLC technology in other
(MPU) or Motor Control Unit (MCU) generates the control
areas is, nowadays, limited and new protocol stacks need to be
commands to all the motor drivers. In this configuration the
defined on new specific applications. Public protocols as
motor driver and the power supply are together with the
PoweRline Intelligent Metering Evolution (PRIME) [5] or G3
central controller and an individual connection is necessary
[6] are being used on smart energy applications as street
from every single motor driver to its respective motor. This is
lighting and remote SG management. These protocols have
known as a star topology and needs a great amount of cables
been designed to manage massive networks and to ensure the
and connectors in case motors are distributed over the
communication with the different devices of the networks in
equipment. This configuration increases the weight, the Bill of
Materials (BOM) and the manufacturing costs and decreases

978-1-5386-8086-5 / 19 / $ 31.00 © 2019 IEEE


50
2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

the reliability of the equipment. In order to reduce the cabling protocol has to transport. As shown in Table I, considering
issue, sometimes, a bus topology is used. In this bus topology various files that describe pieces to be printed in G-Code
the motor drivers are placed near the motor and connected to a format, the time in which the printing has to be made and the
single energy bus. From the central controller, a serial link bus number of G-Code commands that have to be sent, we can
transmits commands to the local controller based on a MCU estimate the necessary baud rate (Baud/s) and the average
and a motor driver. There is a local controller for every motor number of commands per second (Com/s) that we have to
or set of motors that are located physically close. For the serial transmit. We can see how 35Com/s is the worst case and in
link command bus, Controller Area Network (CAN) bus [7], order to keep a safe range we can use 40Coms/s as a limit of
Mbus, Profibus-DP [8] Ethernet [9] or 485 [10] are commonly what the communication system must provide.
used. However, this configuration needs a double cabling and
connectors which increases costs and decreases reliability. TABLE I. COMMUNICATION NEEDS IN A PLC-DSC
In this paper we propose a new alternative based on the use Printing Time (s) Num_lines_G-Cod Bytes/line Baud/s Com/s
of PLC to control several motors and actuators distributed 40.740 645.488 28 3.549 16
physically over the equipment which must move
synchronously. On this configuration the central controller and 10.620 102.937 28 2.171 10
the local controllers are connected through a PLC network 39.780 1.095.914 28 6.171 28
using the same cables used to send the power to the motors 54.180 1.900.855 28 7.859 35
and actuators. This has the advantage of avoiding the
additional serial control bus decreasing the weight, the BOM 65.880 464.997 28 1.581 7
and the manufacturing costs and increasing the reliability of
the equipment. The power bus of this configuration could be
indistinctly DC or AC and only the coupling of PLC node In the simplest case, if the total communication needs in a
needs to be adapted. PLC-DSC is proportional to the number of motors and
actuators that need to be controlled (Nm) then for each
command transmitted by the central controller, each of the
II. A NEW PLC STACK FOR DISTRIBUTED AND motors involved on the command must send a confirmation of
SYNCHRONOUS CONFIGURATIONS the execution of the order and information of its internal state.
We can name the proposed configuration a PLC Distributed We can assume that this produces similar traffic in the
and Synchronous Configuration (PLC-DSC). The proposed opposite direction for each motors or actuators. Table II
configuration is based on the use of PLC for the control of provides the total communication needs of this type, that we
several motors and actuators distributed physically over the can name symmetrical, of PLC-DSC.
equipment. On this configuration the central controller and the
To have a limit rate of 40Com/s the command and the
local controllers are connected through a PLC network using
response must be sent in less than 25ms. If we try to use
the same cables used to send the power to the motors and
communication for compatible physical layers, or at least
actuators. This has the advantage of avoiding the additional
similar, to the aforementioned protocols such as PRIME or
control bus decreasing the weight, the BOM, the
G3, we must take into account the structure of a frame and the
manufacturing costs and increasing the reliability of the
duration of the symbols that forms it.
equipment. The power buss of this configuration could be
indistinctly DC or AC and only the coupling of PLC node
needs to be adapted. TABLE II. COMMUNICATION NEEDS IN A SYMMETRICAL PLC-DSC

Baud/s Com/s Nm µs/Frame


On a PLC-DSC the more critical task is to assure that the
movement of the motors and actuators are executed in a 8.960 40 0 25.000
synchronous way. On most of this PLC-DSC the central 143.360 640 16 1.563
controller is implemented, on the application level, as an
interpreter of some command language that describes the task 53.760 240 6 4.167

that the system has to perform. In robotic arms, CNC and 3D


printers, the most commonly used interpreters of command
languages are GRBL or its most extended variant Marlin. Both Figure 1 shows the structure of a PHY frame of PRIME. To
interpret more or less complete variants of the G-Code [10] transmit a command of 28 bytes, a frame with D8PSK and
command language defined in ISO6983 [11]. Command convolutional coding of 2 symbols, a total duration of 11ms is
interpreters convert the description of movements of G-Code needed. Considering the total period of a command is 25ms we
commands into control commands to motors and actuators. only have time for one response frame.
This commands traffic defines the bandwidth that the PLC

51
2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

TABLE III. TYPICAL COMMUNICATION NEEDS IN A PLC-DSC


PREAMBLE A HEADER A PAYLOAD

PRIME G3
2.048ms 4.48ms Mx2.24ms
Response Request Response Request
2 symbols M symbols
Preamble 2.048 2.048 6.080 6.080

Fig. 1. Structure of PHY frame of PRIME [5] Header 4.480 4.480 8.340 8.340
Payload 4.480 34.844 2.780 15.290
Similarly, we can consider using a PHY layer similar to G3.
Symbols 2.240 2.240 695 695
Figure 2 shows the structure of a G3 PHY frame where the
preamble with 9.5 symbols lasts 6.08ms and the header (FCH) Nsp 2 16 4 22
with 3 symbols lasts 8.34ms. To transmit a command of 28 Msg duration 11.008 41.372 17.200 29.710
bytes, a frame with D8PSK and convolutional coding of 4 Resp time left 208.628 220.290
symbols, a total duration of 17.2ms is needed. Considering that
SF duration 250.000 250.000
the total period of a command is 25ms we do not have time for
any response frame. Num messages 19 1 13 1

Modulation 8DPSK&CC 8DPSK&CC 8DPSK&CC 8DPSK&CC


Nbpsc 3 3 3 3
Nsc 96 96 72 72
NBytesFrame 36 280 37 280
Baudrate 26.163 54.142 17.326 75.463
Fig. 2. Structure of PHY frame of G3 [6]
which most of the commands affect only two or three of the
As a consequence, we need to define a new message
motors or actuators and only these have to respond. In the case
structure more efficiently than transmitting the command and
of PRIME, we can also activate the response by using
responses consecutively.
automatic repeat request (ARQ) algorithm. This simplifies the
One way to improve it is to group together the transmission response at the application level as it is managed at the MAC
of commands into groups or super-frames. Table III shows the level.
result of grouping, whether we use PRIME or G3, 10
For a scenario with more motors or actuators in the PLC-
commands in a single request and the response of every motor
DSC or in which all nodes have to respond to each sequence of
in a single command. We can see what the duration, in
commands, a more efficient mechanism for the responses has
microseconds, of the preamble, header and payload is and how
to be defined. We can use an access mechanism per time slot
many symbols are required to transmit 28 bytes of a command
where each node accesses the medium in the time slot that it
and 280 bytes of 10 commands (Nsp). As a super-frame lasts
has reserved according to its address.
250ms and a request lasts 41ms you still have 208ms to send
19 responses in PRIME or 13 in G3.
III. ELECTRONIC CONTROL UNIT WITH PLC
All the above-mentioned has been calculated for an 8DPSK
with convolutional coding modulation of PRIME and G3 As an example of use of this new stack, a new electronic
specifications where the number of bits per subcarrier (Nbpsc) control unit (ECU) with PLC was developed oriented to
and the number of subcarrier (Nsc) are fixed parameters. control industrial equipment as CNC machines, robotic arms
or 3D printers controlled through a PLC-DSC. It contains a
In conclusion, the proposed MAC layer will transmit a basic ECU board that implements the direct control of a
beacon frame of 16 or 22 symbols of payload, depending on stepper motor and the PLC stack to communicate with the
the selected PRIME or G3 protocol, every 25ms including 10 other ECUs of the PLC-DSC as shown in Figure 3. In [12] a
G-Cod commands from the central control unit. After this similar ECU can be found but not including the PLC modem
beacon frame, nodes must send the response before the end of and using a SPI serial link.
the super-frame.
In case of PRIME protocol, a Carrier-Sense Multiple
Access (CSMA) algorithm is used for the contention to the
medium on the Shared-contention period (SCP) of the super-
frame. If we consider a typical scenario with 16 motors or
actuators in the PLC-DSC the time available for the response
is sufficient in both PRIME and G3 for the frequent case in

52
2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

extended shield designed includes two end stops inputs and


three high current 12V outputs, one for the heater and two for
the fans.
A motor driver and a magnetic sensor have been selected
to manage the turns of the motor. In one hand, the A4988 is a
complete micro stepping motor driver with a built-in translator
for easy operation with minimal control lines. It is designed to
operate bipolar stepper motors in full-, half- quarter-, eight-
and sixteenth-steps modes. In the other hand the AS5600
magnetic rotary position sensor with I2C communication has
been chosen. It has a high-resolution 12-bit analog output or
pulse-width modulation (PWM) output that being placed close
enough to the motor will be able to tell the SAMG55 MCU the
exact number of turns the motor has made.
The motor driver A4988 will provide the motor the power
control signals to move step by step according to the central
controller commands. Moreover, the AS5600 magnetic rotary
position sensor will provide the feedback position to the
central controller to assure the precision on the positioning of
the motor. A small neodymium disc magnet is attached to the
motor axis to provide the position information to the magnetic
rotary position sensor. As shown in Figure 4, the ECU is
placed on the rear of the motor and close enough to the magnet
to provide a correct value for the magnetic sensor.
This board is designed to work with the popular input
voltage of 12V and 1.5A of the Nema17 [13] motor but can
Fig. 3. Block diagram of the ECU
work up to 17V and 2A. The PL360 will implement the PHY
Besides this new ECU, a connector to an extended shield is layer of PLC protocol receiving and transmitting the
included to provide additional functionalities. commands through the power line channel. The PL360 has
been conceived to be easily managed through the ATSAMG55
The main board includes the PL360, a multi-protocol through a 4-line standard Serial Peripheral Interface (SPI). By
device implementing a very flexible architecture, which allows means of the SPI, the external microcontroller implements the
implementations of standard and customized PLC solutions. MAC layer of PLC protocol managing the PL360 by accessing
PL360 is bundled with an external Microchip MCU, this is the the internal peripheral registers.
ATSAMG55J19B. The SAMG55 is a series of Flash
microcontrollers based on the high-performance 32-bit ARM®
Cortex®-M4 RISC processor with FPU (Floating Point Unit).
It operates at a maximum speed of 120 MHz and features 512
Kbytes of Flash and up to 176 Kbytes of SRAM.
The peripheral set includes eight flexible communication
units comprising USARTs, SPIs and I2C-bus interfaces
(TWIs), two three-channel general-purpose 16-bit timers, two
I2S controllers, one-channel pulse density modulation, one 8-
channel 12-bit analog-to-digital converter (ADC), one real-
time timer (RTT) and one real-time clock (RTC), both located
in the ultra-low-power backup area.
This microcontroller controls the PL360 PLC modem, a
magnetic position sensor (AS5600) and a micro stepping
motor driver (A4988). Further an extended shield was
designed providing two thermistors to control two different
temperatures; heater, bed or ambient of a 3D printer. Also, the Fig. 4. ECU unit placed on the rear of the motor with a magnet on the motor
shaft

53
2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

This information of position is sent to the PLC channel Figure 6 shows an example of the filter necessary on the
through a designed coupling stage. The information is sent power supply of the PLC-DSC to limit the noise on the PLC
from the EMITs pins of the PL360 that have connected a 26 medium from the power supply and to assure a high
resistor to ensure that in case of short circuit system does not impedance on communication band.
break down.
Both transmission and reception stages were designed to
operate in the band of 150kHz to 500kHz and in search of a
constant impedance of 50 in the channel despite having none
or up to 15 motors connected. It has been considered that
Nema17 behaves as two 2.2mH parallel inductances in series
with a 1.04 resistor that are equivalent, for this operating
frequency, to 470k. Therefore, 15 motors behave as an
impedance of around 31k that will be in parallel with the
motor impedance.
Figure 5 provides the designed coupling stage. In the
reception stage, a single-pole low pass filter limits the noise
Fig. 6. Motor filter of the ECU
above 500kHz. After that, the Automatic Gain Control (AGC)
circuit, a resistor, controlled by the PL360 is used to attenuate
the incoming PLC signal in case its amplitude is high enough IV. CONCLUSIONS
to exceed the input dynamic range of the embedded ADC.
In this paper we propose a new PLC-DSC (PLC Distributed
In addition, the diode D3 provides protection in case of and Synchronous Configuration) where distributed motors are
overvoltage coming from the PLC medium. R20 provides controlled synchronously by a new PLC stack. This PLC stack
impedance matching with the ADC and C38 DC decoupling is oriented to industrial and automotive applications and is
capacitor. based on the PHY layer that is compatible with commercial
The transmission circuit is composed of a second order devices that also support PRIME or G3 PLC protocols.
serial band filter to limit the transmission out of the band, and Finally, as an example of use, we introduce a new motor
a second order parallel filter to match the impedance of the control board and its design considerations which uses this
connected line. Again, C40 and C41 blocking DC voltage and PLC communication stack.
D4 provides additional protection in case of overvoltage
coming from the PLC medium. REFERENCES
It is also important to take into consideration that the [1] "Characterization of IP-Based Communication for Smart Grid Using
Software-Defined Networking," S. Rinaldi, F. Bonafini, P. Ferrari, A.
stepper motor produces noise in the communication band that
Flammini, E. Sisinni, D. Di Cara, N. Panzavecchia, G. Tinè, A.
needs to be filtered by the motor filter to limit the noise on the Cataliotti, V. Cosentino, S. Guaiana, in IEEE Transactions on
PLC medium. Instrumentation and Measurement. vol. 67, no. 10, pp. 2410-2419, Oct.
2018. ISSN: 0018-9456
[2] "Are we ready for SDN? Implementation challenges for software-defined
networks", S. Sezer, S. Scott-Hayward, P.K. Chouhan, B. Fraser, D.
Lake, J. Finnegan, N. Viljoen, M. Miller, N. Rao, IEEE
Communications Magazine, vol.51, no.7, pp.36,43, July 2013.
[3] "Software-Defined Energy Communication Networks: From Substation
Automation to Future Smart Grids", A Cahn, J. Hoyos, M. Hulse, E.
Keller, in Proc. of the IEEE SmartGridComm., pp.558,563, 2013.
[4] "Software defined networking applied to the heterogeneous infrastructure
of Smart Grid", S. Rinaldi, P. Ferrari, D. Brandao, S. Sulis, 2015 IEEE
World Conference on Factory Communication
[5] PRIME-Spec_v1.4
https://www.prime-alliance.org/wp-content/uploads/2014/10/PRIME-
Spec_v1.4-20141031.pdf
[6] “G3-PLC specification for powerline communication: Overview, system
simulation and field trial results” ISPLC2010, March 2010 Rio de
Janeiro, Brazil
Fig. 5. Coupling stage of the ECU

54
2019 1st Global Power, Energy and Communication Conference (IEEE GPECOM2019), June 12-15, 2019, Cappadocia, Turkey

[7] “The Distributed Control System for Humanoid Robot BHBIP” Hui Wei,
Mei Shuai, Zhongyu Wang in 2012 International Conference on
Computer Distributed Control and Intelligent Enviromental Monitoring
[8] “Development of a distributed control system for plc-based applications”,
li-ling wang, hong-ying wei, in Proceedings of the Ninth International
Conference on Machine Learning and Cybernetics, Qingdao, 11-14 July
2010
[9] “BLDCM Fuzzy Sliding Mode Control Based on Network Control
System” Yan Xiaojuan, Liu Jinglin in 2010 2nd International
Conference on Advanced Computer Control, Volume: 5 Pages: 332 –
335 Year: 2010
[10] “The Study on Distributed Control System based on PLC” Dong Yulin,
Cui Wenchong in 2nd International Conference on Industrial and
Information Systems July 2010
[11] G-Code https://en.wikipedia.org/wiki/G-code .
[12] ISO 6983-1:2009; https://www.iso.org/standard/34608.html .
[13] NEMA17; https://reprap.org/wiki/NEMA_17_Stepper_motor
[14] Ustepper; https://github.com/uStepper/uStepper

55

You might also like