SlideShare a Scribd company logo
1 of 17
© Feri Handoyo
IMPLEMENT
XML/JSON DATA
EXCHANGEINPLC
DESIGN & IMPLEMENTATION REALTIME PLC
COMMUNICATION USING APPLICATION LAYER FORMAT
RUN
TCP/IP (DATA LAYER)
DATA CONSUMER
TCP/IP (CONTROL SYSTEMS LAYER)
© Feri Handoyo
page 2
Background
• Data centric project to aggregate real time process control information
into a dedicated data server.The data can later be used as part of
automation of the data exchange in the move towards Industry 4.0.
• Avoid the use of additional layer in the IT space (i.e. custom application to
act as data exchange such as OPC to XML converter).This means less
software application to maintain.
• Decision is to implement the gateway functionality in a PLC.The main
advantage is connection to process control is easy (all kind of protocols
available between PLCs) and it will be just additional PLC nodes in the
system.
© Feri Handoyo
page 3
Objectives
• A data gateway PLC to consolidate data from control systems (other PLCs)
• The gateway PLC communicates to Data Consumer in real time over
TCP/IP using object style data structure (XML or JSON). Data Exchange is
2 way:
• From PLC: Process Control Data
• To PLC: Production Instructions (e.g. Schedule, Recipe)
• The data structure must be configurable, must allow nested objects and
must support arrays or nested objects.
© Feri Handoyo
page 4
TheProblems
• PLC memory limitation (up to 40MB)
• String intensive application to construct send and interpret received telegrams
• PLC CPU power limitation
• Limited CPU power to process up to 5 level deep nested objects and can be
repeated for up to 200 times at each level. Nested loop calls may crash some
PLC brands due to running out of stack.
• Delay in processing outgoing telegrams if PLC cannot generate structure
in timely fashion.
• Even longer delay or error in processing incoming telegrams if PLC cannot
identify (deserialize) correctly.
• How to efficiently manage changes to the data structure.
• Using a traditional PLC (not the PC based PLC).
© Feri Handoyo
page 5
DataStructure(Example)
• A configuration file (.xml) is defined in Data Consumer.This file contains
the definition of data types and telegram types.
• A user defined data type called DataType1 can be defined as:
<type name=“DataType1">
<comment>Description about DataType1</comment>
<elements>
<element name=“GroupName" type=“string” length="100" repeat="1">
<element name=“CountProcessValues" type=“integer” length=“4" repeat="1">
<element name=“ProcessValue" type=“TypeProcessValue” length=“184" repeat=" CountProcessValues">
</elements>
</type>
• In example above, an element called ProcessValue is a nested object of
typeTypeProcessValue. Additionally it will be repeatable (array) by the
value of the integer element CountProcessValues.
© Feri Handoyo
page 6
DataStructure(Example–cont’d)
• User defined typeTypeProcessValue will have similar structure:
<type name=“TypeProcessValue ">
<comment>ProcessValue in PLC</comment>
<elements>
<element name=“VariableName" type=“string” length=“48" repeat="1">
<element name=“VariableValueString" type=“string” length="100" repeat="1">
<element name=“VariableValueReal" type=“real” length=“4" repeat="1">
<element name=“VariableValueDateTime" type=“datetime” length=“16" repeat="1">
<element name=“UnitOfMeasurement" type=“string” length=“16" repeat="1">
</elements>
</type>
• In example above, PLC values may be string, real or timestamp. Realtime
data will need to be mapped to the target element.
• User definedTelegrams are also defined in similar manner.
© Feri Handoyo
page 7
DataStructure(Example–cont’d)
• User defined telegrams ReadWritePLCTags may be defined as:
<telegram name=“ReadWritePLCTags ">
<comment>Telegrams to read or write PLCTags</comment>
<elements>
<element name=“Definition" type=“GenericDef” length=“64" repeat=“1">
<element name=“GroupData" type=“DataType1” length=“288" repeat=“12">
</elements>
</type>
• In example above, the GenericDef contains basic telegram data used for
Telegram Name, Quality Check, Handshake, Message ID and time stamp.
• In this example, element GroupData of type DataType1 is created and
repeated 10 times. Assuming a fixed value of 15 is used for each group
(CountProcessValues =15),Total length of each transaction for this
telegram=12x((15x184) +104)=34368 bytes.
© Feri Handoyo
page 8
DataStructure(Example–cont’d)
• Assuming a fixed value of 15 is used for each group (element
CountProcessValues =15), the telegram ReadWritePLCTags will have to be
instantiated for exchange as:
VariableName
VariableValueString
VariableValueReal
VariableValueDateTime
UnitOfMeasurement
CountProcessValues
GroupName
© Feri Handoyo
page 9
Prompts
• How to manage large number of strings and unused space (reserved
element length)
• How to build reliableTCP socket interface with multi thread support and
efficient buffering for data exchange (some telegrams can grow more than
1.5MB in each transmission).
• How to manage the flexible telegram structure in PLC? Especially for the
large telegrams.
• How can we efficiently map process values and include in sent telegrams
on the fly? How can we efficiently extract values from telegram fields into
process values on the fly?
• Nice to have: how can we process the config XML file directly and pass it
to a format that PLC can understand, by simply selecting the file and hit a
button (macro or script).
© Feri Handoyo
page 10
Solution
String Map
Data Model
Reserve string for
what is used. Do not
use array fixed strings.
Embed Cross
Reference in telegram
body for fast and
accurate update.
Variable Map
Data Model
PLC variables are
consolidated into a
centralized area.
Addressing is simple
equation that will
point to the correct
tag.
Embed the Cross
reference in telegram
body for fast and
accurate update.
Telegram
Vessels
Recursively and
asynchronously
generate telegram
vessels based on
loaded XML config.
Embed cross
references to strings
and process values in
telegram body.
Sending is a simple
copy of a vessel with
payload intoTCP
buffer.
Auto Config
Tool
Custom built tool
allows loading XML
file as-is and format
into model that PLC
cand use.
Config function block
in PLC accepts this
data and generate
telegram vessels.
TCP Buffers
Use the same
structure as String
Map Data Model to
allow directly reflect
references to
incoming telegrams.
Rotating buffers to
avoid collision.
© Feri Handoyo
String Map
Data Model
Reserve string for
what is used. Do not
use array fixed strings.
Embed Cross
Reference in telegram
body for fast and
accurate update.
page 11
Solution(StringMapDataModel)
• A PLC variable of string data type to contain ALL strings that will be used
in telegrams.
• Only unique strings are stored and each only occupy used length.
• Reference book with location of each string.
• Telegrams andTypes share common strings.They are replaced with a 4
bytes integer reference as opposed to the complete string length.
• EachTelegram has information only for dynamic strings.
• To send telegram, only update dynamic fields.
• To process incoming telegram, simply superimpose the reference book
on the data inTCP buffer and extract strings out.
© Feri Handoyo
page 12
Solution(VariableMapDataModel)
• Similar approach to the string data model, a PLC variable of variable
data type to contain ALL data mapping that will be used in telegrams.
• Reference book with location of each variable with a simple formula to
derive each tag location into a 4 bytes address.
• EachTelegram has information for variable mapping in its body.
• To send telegram, variable values are always pointed in its fields. Simply
copy data from the source into telegram vessel at specified location.
• To process incoming telegram, simply superimpose the reference book
on the data inTCP buffer and they will point to target variables.
Variable Map
Data Model
PLC variables are
consolidated into a
centralized area.
Addressing is simple
equation that will
point to the correct
tag.
Embed the Cross
reference in telegram
body for fast and
accurate update.
© Feri Handoyo
Telegram
Vessels
Recursively and
asynchronously
generate telegram
vessels based on
loaded XML config.
Embed cross
references to strings
and process values in
telegram body.
Sending is a simple
copy of a vessel with
payload intoTCP
buffer.
page 13
Solution(TelegramVessels)
• EachTelegram will be recursively exploded in PLC memory.The process
may have to be spread across multiple PLC scan to avoid stack overflow.
• A PLC function block will have custom stack. It will continue the iteration
at every call based on the stack values.
• A flag in each telegram vessel indicates if it is ready for use.
• Actual vessels are created only for outgoing telegrams with all the
references to string and variable maps.To send a telegram, simply copy
the vessel intoTCP buffer area and include strings and variables
referenced in its body.
• To process incoming telegram, superimpose telegram reference table
onto theTCP buffer and read the values directly out to target variables.
© Feri Handoyo
TCP Buffers
Use the same
structure as String
Map Data Model to
allow directly reflect
references to
incoming telegrams.
Rotating buffers to
avoid collision.
page 14
Solution(TCPBuffers)
• Implement a reliable Socket Interfaces (client and server).
• RotatingTCP Buffer to avoid collision. PLC locks a buffer area for read to
prevent new arrival to the same area.
• TCP buffer has the same structure as String Map Data Model.
Superimpose the lookup reference with template data makes telegram
processing faster.
© Feri Handoyo
Auto Config
Tool
Custom built tool
allows loading XML
file as-is and format
into model that PLC
cand use.
Config function block
in PLC accepts this
data and generate
telegram vessels.
page 15
Solution(AutoConfigTool)
• A configuration tool is developed to parameterize the PLC.
• It allows using the same XML file as is used in Data Consumer.A click of a
button or running of script will translate the XML into format that PLC
can process.
• Receiving Function Block in PLC performs the actual build.
© Feri Handoyo
page 16
Summary
The solution has been implemented successfully on Rockwell PLC and working in
progress to adapt to SiemensTIA, Schneider and GE PLCs.
This can be used for all kind of industries to map their data to a data aggregator with
high level interface.This opens the pathway to data exchange automation as part of
Industry 4.0 initiatives.
Points to consider:
- No need of additional data exchange box (e.g. OPC, etc) and no need to have custom
software built to translate process data into supported interface.
- PLC-PLC data map is easy, many options available
- Opens possibility to include other equipments (VSD, analysers, etc)
THANK
YOU
Feri Handoyo

More Related Content

Similar to Real-Time PLC Data Exchange Using XML/JSON

U5CSS3 (1).pdf
U5CSS3 (1).pdfU5CSS3 (1).pdf
U5CSS3 (1).pdfchelsi33
 
SCALE - Stream processing and Open Data, a match made in Heaven
SCALE - Stream processing and Open Data, a match made in HeavenSCALE - Stream processing and Open Data, a match made in Heaven
SCALE - Stream processing and Open Data, a match made in HeavenNicolas Fränkel
 
In datacenter performance analysis of a tensor processing unit
In datacenter performance analysis of a tensor processing unitIn datacenter performance analysis of a tensor processing unit
In datacenter performance analysis of a tensor processing unitJinwon Lee
 
Computer network coe351- part2- final
Computer network coe351- part2- finalComputer network coe351- part2- final
Computer network coe351- part2- finalTaymoor Nazmy
 
JUG SF - Introduction to data streaming
JUG SF - Introduction to data streamingJUG SF - Introduction to data streaming
JUG SF - Introduction to data streamingNicolas Fränkel
 
JUG Tirana - Introduction to data streaming
JUG Tirana - Introduction to data streamingJUG Tirana - Introduction to data streaming
JUG Tirana - Introduction to data streamingNicolas Fränkel
 
Transport layer interface
Transport layer interface Transport layer interface
Transport layer interface CEC Landran
 
Scalable multiprocessors
Scalable multiprocessorsScalable multiprocessors
Scalable multiprocessorsKomal Divate
 
vJUG - Introduction to data streaming
vJUG - Introduction to data streamingvJUG - Introduction to data streaming
vJUG - Introduction to data streamingNicolas Fränkel
 
Mobile computing unit-5
Mobile computing unit-5Mobile computing unit-5
Mobile computing unit-5Ramesh Babu
 
MANET Routing Protocols , a case study
MANET Routing Protocols , a case studyMANET Routing Protocols , a case study
MANET Routing Protocols , a case studyRehan Hattab
 
ETE405-lec9.ppt
ETE405-lec9.pptETE405-lec9.ppt
ETE405-lec9.pptmashiur
 
Hyper Transport Technology
Hyper Transport TechnologyHyper Transport Technology
Hyper Transport Technologynayakslideshare
 

Similar to Real-Time PLC Data Exchange Using XML/JSON (20)

Week10 transport
Week10 transportWeek10 transport
Week10 transport
 
U5CSS3 (1).pdf
U5CSS3 (1).pdfU5CSS3 (1).pdf
U5CSS3 (1).pdf
 
Mule TCP Component
Mule TCP ComponentMule TCP Component
Mule TCP Component
 
Rtp
RtpRtp
Rtp
 
SCALE - Stream processing and Open Data, a match made in Heaven
SCALE - Stream processing and Open Data, a match made in HeavenSCALE - Stream processing and Open Data, a match made in Heaven
SCALE - Stream processing and Open Data, a match made in Heaven
 
In datacenter performance analysis of a tensor processing unit
In datacenter performance analysis of a tensor processing unitIn datacenter performance analysis of a tensor processing unit
In datacenter performance analysis of a tensor processing unit
 
60
6060
60
 
Computer network coe351- part2- final
Computer network coe351- part2- finalComputer network coe351- part2- final
Computer network coe351- part2- final
 
TCP/IP Protocols
TCP/IP ProtocolsTCP/IP Protocols
TCP/IP Protocols
 
networking IPv4.pdf
networking IPv4.pdfnetworking IPv4.pdf
networking IPv4.pdf
 
JUG SF - Introduction to data streaming
JUG SF - Introduction to data streamingJUG SF - Introduction to data streaming
JUG SF - Introduction to data streaming
 
JUG Tirana - Introduction to data streaming
JUG Tirana - Introduction to data streamingJUG Tirana - Introduction to data streaming
JUG Tirana - Introduction to data streaming
 
Transport layer interface
Transport layer interface Transport layer interface
Transport layer interface
 
lect13_programmable_dp.pptx
lect13_programmable_dp.pptxlect13_programmable_dp.pptx
lect13_programmable_dp.pptx
 
Scalable multiprocessors
Scalable multiprocessorsScalable multiprocessors
Scalable multiprocessors
 
vJUG - Introduction to data streaming
vJUG - Introduction to data streamingvJUG - Introduction to data streaming
vJUG - Introduction to data streaming
 
Mobile computing unit-5
Mobile computing unit-5Mobile computing unit-5
Mobile computing unit-5
 
MANET Routing Protocols , a case study
MANET Routing Protocols , a case studyMANET Routing Protocols , a case study
MANET Routing Protocols , a case study
 
ETE405-lec9.ppt
ETE405-lec9.pptETE405-lec9.ppt
ETE405-lec9.ppt
 
Hyper Transport Technology
Hyper Transport TechnologyHyper Transport Technology
Hyper Transport Technology
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 

Real-Time PLC Data Exchange Using XML/JSON

  • 1. © Feri Handoyo IMPLEMENT XML/JSON DATA EXCHANGEINPLC DESIGN & IMPLEMENTATION REALTIME PLC COMMUNICATION USING APPLICATION LAYER FORMAT RUN TCP/IP (DATA LAYER) DATA CONSUMER TCP/IP (CONTROL SYSTEMS LAYER)
  • 2. © Feri Handoyo page 2 Background • Data centric project to aggregate real time process control information into a dedicated data server.The data can later be used as part of automation of the data exchange in the move towards Industry 4.0. • Avoid the use of additional layer in the IT space (i.e. custom application to act as data exchange such as OPC to XML converter).This means less software application to maintain. • Decision is to implement the gateway functionality in a PLC.The main advantage is connection to process control is easy (all kind of protocols available between PLCs) and it will be just additional PLC nodes in the system.
  • 3. © Feri Handoyo page 3 Objectives • A data gateway PLC to consolidate data from control systems (other PLCs) • The gateway PLC communicates to Data Consumer in real time over TCP/IP using object style data structure (XML or JSON). Data Exchange is 2 way: • From PLC: Process Control Data • To PLC: Production Instructions (e.g. Schedule, Recipe) • The data structure must be configurable, must allow nested objects and must support arrays or nested objects.
  • 4. © Feri Handoyo page 4 TheProblems • PLC memory limitation (up to 40MB) • String intensive application to construct send and interpret received telegrams • PLC CPU power limitation • Limited CPU power to process up to 5 level deep nested objects and can be repeated for up to 200 times at each level. Nested loop calls may crash some PLC brands due to running out of stack. • Delay in processing outgoing telegrams if PLC cannot generate structure in timely fashion. • Even longer delay or error in processing incoming telegrams if PLC cannot identify (deserialize) correctly. • How to efficiently manage changes to the data structure. • Using a traditional PLC (not the PC based PLC).
  • 5. © Feri Handoyo page 5 DataStructure(Example) • A configuration file (.xml) is defined in Data Consumer.This file contains the definition of data types and telegram types. • A user defined data type called DataType1 can be defined as: <type name=“DataType1"> <comment>Description about DataType1</comment> <elements> <element name=“GroupName" type=“string” length="100" repeat="1"> <element name=“CountProcessValues" type=“integer” length=“4" repeat="1"> <element name=“ProcessValue" type=“TypeProcessValue” length=“184" repeat=" CountProcessValues"> </elements> </type> • In example above, an element called ProcessValue is a nested object of typeTypeProcessValue. Additionally it will be repeatable (array) by the value of the integer element CountProcessValues.
  • 6. © Feri Handoyo page 6 DataStructure(Example–cont’d) • User defined typeTypeProcessValue will have similar structure: <type name=“TypeProcessValue "> <comment>ProcessValue in PLC</comment> <elements> <element name=“VariableName" type=“string” length=“48" repeat="1"> <element name=“VariableValueString" type=“string” length="100" repeat="1"> <element name=“VariableValueReal" type=“real” length=“4" repeat="1"> <element name=“VariableValueDateTime" type=“datetime” length=“16" repeat="1"> <element name=“UnitOfMeasurement" type=“string” length=“16" repeat="1"> </elements> </type> • In example above, PLC values may be string, real or timestamp. Realtime data will need to be mapped to the target element. • User definedTelegrams are also defined in similar manner.
  • 7. © Feri Handoyo page 7 DataStructure(Example–cont’d) • User defined telegrams ReadWritePLCTags may be defined as: <telegram name=“ReadWritePLCTags "> <comment>Telegrams to read or write PLCTags</comment> <elements> <element name=“Definition" type=“GenericDef” length=“64" repeat=“1"> <element name=“GroupData" type=“DataType1” length=“288" repeat=“12"> </elements> </type> • In example above, the GenericDef contains basic telegram data used for Telegram Name, Quality Check, Handshake, Message ID and time stamp. • In this example, element GroupData of type DataType1 is created and repeated 10 times. Assuming a fixed value of 15 is used for each group (CountProcessValues =15),Total length of each transaction for this telegram=12x((15x184) +104)=34368 bytes.
  • 8. © Feri Handoyo page 8 DataStructure(Example–cont’d) • Assuming a fixed value of 15 is used for each group (element CountProcessValues =15), the telegram ReadWritePLCTags will have to be instantiated for exchange as: VariableName VariableValueString VariableValueReal VariableValueDateTime UnitOfMeasurement CountProcessValues GroupName
  • 9. © Feri Handoyo page 9 Prompts • How to manage large number of strings and unused space (reserved element length) • How to build reliableTCP socket interface with multi thread support and efficient buffering for data exchange (some telegrams can grow more than 1.5MB in each transmission). • How to manage the flexible telegram structure in PLC? Especially for the large telegrams. • How can we efficiently map process values and include in sent telegrams on the fly? How can we efficiently extract values from telegram fields into process values on the fly? • Nice to have: how can we process the config XML file directly and pass it to a format that PLC can understand, by simply selecting the file and hit a button (macro or script).
  • 10. © Feri Handoyo page 10 Solution String Map Data Model Reserve string for what is used. Do not use array fixed strings. Embed Cross Reference in telegram body for fast and accurate update. Variable Map Data Model PLC variables are consolidated into a centralized area. Addressing is simple equation that will point to the correct tag. Embed the Cross reference in telegram body for fast and accurate update. Telegram Vessels Recursively and asynchronously generate telegram vessels based on loaded XML config. Embed cross references to strings and process values in telegram body. Sending is a simple copy of a vessel with payload intoTCP buffer. Auto Config Tool Custom built tool allows loading XML file as-is and format into model that PLC cand use. Config function block in PLC accepts this data and generate telegram vessels. TCP Buffers Use the same structure as String Map Data Model to allow directly reflect references to incoming telegrams. Rotating buffers to avoid collision.
  • 11. © Feri Handoyo String Map Data Model Reserve string for what is used. Do not use array fixed strings. Embed Cross Reference in telegram body for fast and accurate update. page 11 Solution(StringMapDataModel) • A PLC variable of string data type to contain ALL strings that will be used in telegrams. • Only unique strings are stored and each only occupy used length. • Reference book with location of each string. • Telegrams andTypes share common strings.They are replaced with a 4 bytes integer reference as opposed to the complete string length. • EachTelegram has information only for dynamic strings. • To send telegram, only update dynamic fields. • To process incoming telegram, simply superimpose the reference book on the data inTCP buffer and extract strings out.
  • 12. © Feri Handoyo page 12 Solution(VariableMapDataModel) • Similar approach to the string data model, a PLC variable of variable data type to contain ALL data mapping that will be used in telegrams. • Reference book with location of each variable with a simple formula to derive each tag location into a 4 bytes address. • EachTelegram has information for variable mapping in its body. • To send telegram, variable values are always pointed in its fields. Simply copy data from the source into telegram vessel at specified location. • To process incoming telegram, simply superimpose the reference book on the data inTCP buffer and they will point to target variables. Variable Map Data Model PLC variables are consolidated into a centralized area. Addressing is simple equation that will point to the correct tag. Embed the Cross reference in telegram body for fast and accurate update.
  • 13. © Feri Handoyo Telegram Vessels Recursively and asynchronously generate telegram vessels based on loaded XML config. Embed cross references to strings and process values in telegram body. Sending is a simple copy of a vessel with payload intoTCP buffer. page 13 Solution(TelegramVessels) • EachTelegram will be recursively exploded in PLC memory.The process may have to be spread across multiple PLC scan to avoid stack overflow. • A PLC function block will have custom stack. It will continue the iteration at every call based on the stack values. • A flag in each telegram vessel indicates if it is ready for use. • Actual vessels are created only for outgoing telegrams with all the references to string and variable maps.To send a telegram, simply copy the vessel intoTCP buffer area and include strings and variables referenced in its body. • To process incoming telegram, superimpose telegram reference table onto theTCP buffer and read the values directly out to target variables.
  • 14. © Feri Handoyo TCP Buffers Use the same structure as String Map Data Model to allow directly reflect references to incoming telegrams. Rotating buffers to avoid collision. page 14 Solution(TCPBuffers) • Implement a reliable Socket Interfaces (client and server). • RotatingTCP Buffer to avoid collision. PLC locks a buffer area for read to prevent new arrival to the same area. • TCP buffer has the same structure as String Map Data Model. Superimpose the lookup reference with template data makes telegram processing faster.
  • 15. © Feri Handoyo Auto Config Tool Custom built tool allows loading XML file as-is and format into model that PLC cand use. Config function block in PLC accepts this data and generate telegram vessels. page 15 Solution(AutoConfigTool) • A configuration tool is developed to parameterize the PLC. • It allows using the same XML file as is used in Data Consumer.A click of a button or running of script will translate the XML into format that PLC can process. • Receiving Function Block in PLC performs the actual build.
  • 16. © Feri Handoyo page 16 Summary The solution has been implemented successfully on Rockwell PLC and working in progress to adapt to SiemensTIA, Schneider and GE PLCs. This can be used for all kind of industries to map their data to a data aggregator with high level interface.This opens the pathway to data exchange automation as part of Industry 4.0 initiatives. Points to consider: - No need of additional data exchange box (e.g. OPC, etc) and no need to have custom software built to translate process data into supported interface. - PLC-PLC data map is easy, many options available - Opens possibility to include other equipments (VSD, analysers, etc)