Industrial Automation Automation Industrielle Industrielle Automation 3 Industrial Communication Systems 3.2 Field bus operation Buses de terreno: modo de trabajo Bus de terrain: mode de travail Feldbus: Arbeitsweise Fieldbus - Operation 3.1 Field bus types 3.2 Field bus operation Data distribution Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 2 Objective of the field bus Distribute process variables to all interested parties: • source identification: requires a naming scheme • accurate process value and units • quality indication: {good, bad, substituted} • time indication: how long ago was the value produced • (description) source Industrial Automation 2013 value quality time description Field Bus Operation 3.2 - 3 Data format source value quality time description minimum In principle, the bus could transmit the process variable in clear text (even using XML..) However, this is quite expensive and only considered when the communication network offers some 100 Mbit/s and a powerful processor is available to parse the message More compact ways such as ASN.1 have been used in the past with 10 Mbit/s Ethernet ASN.1: (TLV) type length value Field busses are slower (50kbit/s ..12 Mbits/s) and thus more compact encodings are used. Industrial Automation 2013 Field Bus Operation 3.2 - 4 Datasets Field busses devices have a low data rate and transmit always the same variables. It is economical to group variables of a device in the same frame as a dataset. A dataset is treated as a whole for communication and access. A variable is identified within a dataset by its offset and its size Variables may be of different types, types can be mixed. dataset binary variables analog variables dataset identifier wheel speed 0 air pressure 16 bit offset Industrial Automation 2013 line voltage 32 size time stamp 48 64 66 70 all door closed lights on heat on air condition on Field Bus Operation 3.2 - 5 Dataset extension and quality To allow later extension, room is left in the datasets for additional variables. Since the type of these future data is unknown, unused fields are filled with '1". To signal that a variable is invalid, the producer overwrites the variable with "0". Since both an "all 1" and an "all 0" word can be a meaningful combination, each variable can be supervised by a check variable, of type ANTIVALENT2: dataset correct variable error undefined variable value check 0 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 chk_offset var_offset 00 = network error 01 = ok 10 = substituted 11 = data undefined A variable and its check variable are treated indivisibly when reading or writing The check variable may be located anywhere in the same data set. Industrial Automation 2013 Field Bus Operation 3.2 - 6 hierarchical or peer-to-peer communication PLC “master” central master / slave: hierarchical AP alternate master PLC AP all traffic passes by the master (PLC); adding an alternate master is difficult (it must be both master and slave) “slaves” input peer-to-peer: distributed PLCs may exchange data, share inputs and outputs allows redundancy and “distributed intelligence” devices talk directly to each other PLC PLC AP Industrial Automation 2013 “masters” AP input separate bus master from application master ! output PLC AP “slaves” output AP Application Field Bus Operation 3.2 - 7 Broadcasts A variable is read in 1..3 different places on avergage Broadcasting messages identified by their source (or contents) increases efficiency. application processor plant image application processor plant image … application processor instances … plant image = = distributed variable data base plant image bus Each device is subscribed as source or as sink for a number of process variables Only one device is source of a certain process variable (otherwise collision) The bus refreshes plant image in the background The replicated traffic memories can be considered as "caches" of the plant state (similar to caches in a multiprocessor system), representing part of the plant image. Each station snoops the bus and reads the variables it is interested in. Industrial Automation 2013 Field Bus Operation 3.2 - 8 Decoupling Application and Bus traffic decoupled (asynchronous): coupled (event-driven): application processor application processor events (interrupts) traffic memory (buffer) queues bus controller sending: application writes data into memory receiving: application reads data from memory the bus controller decides when to transmit bus and application are not synchronized Industrial Automation 2013 bus controller sending: application inserts data into queue and triggers transmission, bus controller fetches data from queue receiving: bus controller inserts data into queue and interrupts application to fetch them, application retrieves data Field Bus Operation 3.2 - 9 Traffic Memory: implementation Bus and Application are decoupled by shared memory, the Traffic Memory, (content addressed memory, CAM, also known as communication memory); process variables are directly accessible by application. Application Processor Traffic Memory Ports (holding a dataset) Associative memory an associative memory decodes the addresses of the subscribed datasets Bus Controller two pages ensure that read and write can occur at the same time (no semaphores !) bus Industrial Automation 2013 Field Bus Operation 3.2 - 10 Freshness supervision Applications tolerate an occasional loss of data, but no stale data, which are at best useless and at worst dangerous. Data must be checked if they are up-to-date, independently of a time-stamp (simple devices do not have time-stamping) To protect the application from using obsolete data, each port in the traffic memory contains a freshness counter. This counter is reset by the bus or the application writing to that port. It is incremented regularly, either by the application processor or by the bus controller. The application should always read the value of the counter before using the port data and compare it with its tolerance level. The freshness supervision is evaluated by each reader independently, some readers may be more tolerant than others. Bus error interrupts in case of severe disturbances are not directed to the application, but to the device management. Industrial Automation 2013 Field Bus Operation 3.2 - 11 Example of Process Variable application interface (program) Access of the application to variables in a traffic memory is simple: ap_put (variable_name, variable value) ap_get (variable_name, variable value, variable_status, variable_freshness) Rather than fetch and store individual variables, access is done by clusters (predefined groups of variables): ap_put_cluster (cluster_name) ap_get (cluster_name) The cluster is a table containing the names and values of several variables. The clusters can correspond to "segments" in the function block programming. Note: Usually, only one variable is allowed to raise an interrupt when received: the one carrying the current time (sent by the common clock) Industrial Automation 2013 Field Bus Operation 3.2 - 12 Transmission principle The previous operation modes made no assumption, how data are transmitted. The actual network can transmit data • cyclically (time-driven) or • on demand (event-driven), • or a combination of both. Industrial Automation 2013 Field Bus Operation 3.2 - 13 Cyclic versus Event-Driven transmission cyclic: send value strictly every xx milliseconds individual period misses the peak (Shannon-Nyquist!) always the same, why transmit ? time hysteresis event-driven: send when value change by more than x% of range how much hysteresis ? - coarse (bad accuracy) - fine (high frequency) Industrial Automation 2013 limit update frequency !, limit hysteresis nevertheless transmit: - every xx as “I’m alive” sign - when data is internally updated - upon quality change (failure) Field Bus Operation 3.2 - 14 Fieldbus: Cyclic Operation mode 3.1 Field bus types Classes Physical layer 3.2 Field bus operation Data distribution Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 15 Cyclic Data Transmission address Bus Master 1 2 3 4 5 devices (slaves) 6 Poll List plant The master polls the addresses in a fixed sequence, according to its poll list. Individual period 1 2 3 4 5 Individual period 6 1 2 3 4 5 N polls 6 1 2 3 4 5 6 time [ms] RTD address 10 µs/km (i) read transfer data (i) address (i+1) time [µs] The duration of each poll is the sum of the transmission time of address and data (bit-rate dependent) and of the reply delay of the signals (independent of bit-rate). 44 µs .. 296 µs Industrial Automation 2013 Field Bus Operation 3.2 - 16 Round-trip delay of master-slave exchange master closest data sink repeater T_m most remote data source repeater t_repeat t_repeat The round-trip delay limits the extension of the bus propagation delay (t_pd = 6 µs/km) T_m t_source t_mm t_ms access delay (t_repeat < 3 µs) T_s t_repeat t_sm T_m distance Industrial Automation 2013 Field Bus Operation 3.2 - 17 Cyclic operation principle Data are transmitted at fixed intervals, whether they changed or not. The delivery delay (refresh rate) is deterministic and constant. The bus is under control of a central master (or distributed time-triggered algorithm). No explicit error recovery needed since a fresh value will be transmitted in the next cycle. Only states may be transmitted, not state changes. Cycle time is limited by the product of the number of data transmitted and the duration of each poll (e.g. 100 µs / point x 100 points => 10 ms) To keep the poll time low, only small data items may be transmitted (< 256 bits) The bus capacity must be configured beforehand. Determinism gets lost if the cycles are modified at run-time. Cyclic operation is used to transmit the state variables of the process. These are called Process Data (or Periodic Data) Industrial Automation 2013 Field Bus Operation 3.2 - 18 Source-Addressed Broadcast Process Data are transmitted by source-addressed broadcast. Phase1: The bus master broadcasts the identifier of a variable to be transmitted: bus master device device sink source subscribed devices sink sink devices (slaves) bus variable identifier Phase 2: The device that sources that variable responds with a slave frame containing the value, all devices subscribed as sink receive that frame. bus. master subscribed device subscribed device sink source subscribed devices sink sink devices (slaves) bus variable value Industrial Automation 2013 Field Bus Operation 3.2 - 19 Optimizing Cyclic Operation Problem: Cyclic operation uses a fixed portion of the bus's time The poll period increases with the number of polled items The response time slows down accordingly Solution: introduce sub-cycles for less urgent periodic variables that are a power of 2 multiple of the base period: 2 ms period 1 2 4a 8 16 1 4b 4 ms period 1 2 3 64 1 4a time 1 ms period (basic period) 1 ms 1 ms group with period 1 ms The poll cycles should not be modified at run-time (non-determinism) A device exports many process data (state variables) with different priorities. If there is only one poll type per device, a device must be polled at the frequency required by its highest-priority data. To reduce bus load, the master polls the process data, not the devices Industrial Automation 2013 Field Bus Operation 3.2 - 20 Cyclic Transmission and Application cyclic poll cyclic algorithms cyclic algorithms cyclic algorithms cyclic algorithms application 1 application 2 application 3 application 4 bus master Periodic List source port Traffic Memory Ports Ports Ports sink port bus controller bus controller Ports sink port bus controller bus controller bus controller bus port address port data The bus traffic and the application cycles are asynchronous to each other. The bus master scans the identifiers at its own pace. Bus and applications are decoupled by a shared memory, the traffic memory, which acts as distributed database updated by the network. Industrial Automation 2013 Field Bus Operation 3.2 - 21 Application Of Cyclic Bus The principle of cyclic operation, combined with source-addressed broadcast, has been adopted by most modern field busses It is currently used for power plant control, rail vehicles, aircrafts, etc... Deterministic behavior, at expense of reduced bandwidth and geographical extension. The poll scan list located in the central master (which may be duplicated for availability purposes) determines the behavior of the bus. It is configured for a specific project by a single tool, which takes into account the applications’ requirements. This guarantees that no application can occupy more than its share of the bus bandwidth and gives control to the project leader. Industrial Automation 2013 Field Bus Operation 3.2 - 22 Example: delay requirement publisher application instance device subscribers application instances device device applications bus bus instance Worst-case delay for transmitting all time critical variables is the sum of: Source application cycle time 8 ms Individual period of the variable 16 ms Sink application cycle time 8 ms = 32 ms Industrial Automation 2013 Field Bus Operation 3.2 - 23 Example: traffic pattern in a locomotive % periodic time occupancy is proportional to surface total = 92% number of devices: 37 ( including 2 bus administrators) 30 frames of 128 bits 65 frames of 64 bits 37 of 16 bits 18 of 32 49 frames of 256 bits period 16 ms Industrial Automation 2013 32 ms 64 ms 128 256 1024 Field Bus Operation 3.2 - 24 Fieldbus: Event-driven operation 3.1 Field bus types 3.2 Field bus operation Data distribution Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 25 Event-driven Operation • Events cause a transmission only when an state change takes place. • Bus load is very low on average, but peaks under exceptional situations since transmissions are correlated by the process (christmas-tree effect). Multi-master bus: uses write-only transfers intelligent stations eventreporting station eventreporting station eventreporting station sensors/ actors plant Detection of an event is an intelligent process: • Not every change of a variable is an event, even for binary variables. • Often, a combination of changes builds an event. • Only the application can decide what is an event, since only the application programmer knows the meaning of the variables. Industrial Automation 2013 Field Bus Operation 3.2 - 26 Bus interface for event-driven operation application filter driver Application Processor • Each transmission on bus causes an interrupt. • Bus controller checks address and stores data in message queues. • Driver is responsible for removing messages of queue memory and prevent overflow. • Filter decides if message can be processed. message (circular) queues interrupt Bus Controller bus Industrial Automation 2013 Field Bus Operation 3.2 - 27 Response of Event-driven operation Caller Application Transport software Bus Transport software Called Application request interrupt indication confirm time Since events can occur anytime on any device, stations communicate by spontaneous transmission, leading to possible collisions Interruption of server device at any instant can disrupt a time-critical task. Buffering of events can cause unbounded delays Gateways introduce additional uncertainties Industrial Automation 2013 Field Bus Operation 3.2 - 28 Determinism and Medium Access In Busses Although the moment an event occurs is not predictable, the bus should transmit the event in a finite time to guarantee the reaction delay. Events are necessarily announced spontaneously The time required to transmit the event depends on the medium access (arbitration) procedure of the bus. Medium access control methods are either deterministic or not. Non-deterministic Collision (CSMA/CA) Industrial Automation 2013 Deterministic Central master, Token-passing (round-robin), Binary bisection (collision with winner) Field Bus Operation 3.2 - 29 Events and Determinism Deterministic medium access is necessary to guarantee delivery time bound but it is not sufficient since events messages are queued in the devices. events producers & consumers input and output queues bus acknowledgements data packets The average delivery time depends on the length of the queues, on the bus traffic and on the processing time at the destination. Often, the applications influence the event delay much more than the bus does. Real-time Control = Measurement + Transmission + Processing + Acting Industrial Automation 2013 Field Bus Operation 3.2 - 30 Events Pros and Cons In an event-driven control system, there is only a transmission or an operation when an event occurs. Advantages: Can treat a large number of events – but not all at the same time Supports a large number of stations System idle under steady - state conditions Better use of resources Uses write-only transfers, suitable for LANs with long propagation delays Suitable for standard (interrupt-driven) operating systems (Unix, Windows) Drawbacks: Requires intelligent stations (event building) Needs shared access to resources (arbitration) No upper limit to access time if some component is not deterministic Response time difficult to estimate, requires analysis Limited by congestion effects: process correlated events A background cyclic operation is needed to check liveliness Industrial Automation 2013 Field Bus Operation 3.2 - 31 Fieldbus: real-time communication model 3.1 Field bus types 3.2 Field bus operation Centralized - Decentralized Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 32 Mixed Data Traffic Process Data represent the state of the plant Message Data represent state changes of the plant short and urgent data items infrequent, sometimes long messages reporting events, for: • Users: set points, diagnostics, status • System: initialisation, down-loading, ... ... motor current, axle speed, operator's commands, emergency stops,... -> Periodic Transmission of Process Variables -> Sporadic Transmission of Process Variables and Messages Since variables are refreshed periodically, no retransmission protocol is needed to recover from transmission error. Since messages represent state changes, a protocol must recover lost data in case of transmission errors basic period basic period event time sporadic phase Industrial Automation 2013 periodic phase sporadic phase periodic phase Field Bus Operation 3.2 - 33 Mixing Traffic is a configuration issue Cyclic broadcast of source-addressed variables is the standard solution in field busses for process control. Cyclic transmission takes a large share of the bus bandwidth and should be reserved for really critical variables. The decision to declare a variable as cyclic or event-driven can be taken late in a project, but cannot be changed on-the-fly in an operating device. A message transmission scheme must exist alongside the cyclic transmission to carry not-critical variables and long messages such as diagnostics or network management An industrial communication system should provide both transmission kinds. Industrial Automation 2013 Field Bus Operation 3.2 - 34 Real-Time communication stack The real-time communication model uses two stacks, one for time-critical variables and one for messages time-critical process variables time-benign messages 7 Application 6 Presentation Remote Procedure Call 5 Session connection-oriented 4 Transport (connection-oriented) 3 Network (connectionless) 2" Logical Link Control medium access 2' Link (Medium Access) media 1 Physical implicit implicit Logical Link Control connectionless connectionless common Industrial Automation 2013 Management Interface Field Bus Operation 3.2 - 35 Application View Of Communication Periodic Tasks R1 R2 R3 Event-driven Tasks R4 E1 Variables Services (Broadcast) node E3 Message Services Traffic Memory Process Data E2 Queues Supervisory Data Message Data (unicast) bus controller bus Industrial Automation 2013 Field Bus Operation 3.2 - 36 Cyclic or Event-driven Operation For Real-time ? The operation mode of the communication exposes the main approach to conciliate real-time constrains and efficiency in a control systems. cyclic operation event-driven operation Data are transmitted at fixed intervals, whether they changed or not. Data are only transmitted when they change or upon explicit demand. Deterministic: delivery time is bound Non-deterministic: delivery time vary widely Worst Case is normal case Typical Case works most of the time All resources are pre-allocated (periodic, round-robin) Best use of resources (aperiodic, demand-driven, sporadic) object-oriented bus message-oriented bus Fieldbus Foundation, MVB, FIP, .. Profibus, CAN, LON, ARCnet Industrial Automation 2013 Field Bus Operation 3.2 - 37 Fieldbus: Time distribution 3.1 Field bus types 3.2 Field bus operation Data distribution Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 38 Time: TAI and UTC TAI (Temps Atomique International) is the scientific time scale. It is continuously incrementing and will never be reset or discontinued. It is the base of all other scales. UTC (Universal time coordinated) is the legal time. It is the base for the clocks of all countries. It indicates approximately 12:00:00 at solar noon in Greenwich at the Spring equinox (it was formerly called Greenwich Mean Time). The Bureau International des Poids et Mesures (BIPM), Paris, is responsible for the definition of UTC. Rate: UTC and TAI proceed at exactly the same rate; both were identical back in 1961. Leap Seconds: Since 1961, the earth rotation slightly slowed down, days became longer. When the difference between UTC and solar noon exceed 0,9 s, which happens after some years, the BIMP adjusts UTC by letting all clocks insert a leap second, so the last minute of a day lasts 61 seconds (the reverse case is also possible, but very unlikely). Leap seconds cannot be anticipated, since irregularities of the earth’s rotation are unpredictable. In 2011, UTC lagged behind TAI by 34 seconds: when TAI was 2011-02-04 12:00:00, UTC was 2011-02-04 11:59:26. One cannot deduce TAI time from UTC time without a table of all elapsed leap seconds, and UTC cannot be predicted for a given TAI, since the introduction of a leap second is a decision of the BIPM. The system of leap seconds is still subject to discussion and could be revised in the future – it could be abolished in 2015. Industrial Automation 2013 Field Bus Operation 3.2 - 39 Time-stamping and synchronisation In many applications, such as disturbance logging and sequence-of-events, the exact sampling time of a variable must be transmitted together with its value. For this purpose, the devices are equipped with a clock that records the creation date of a value (not the transmission time). To reconstruct events coming from several devices, clocks must be synchronized. considering transmission delays over the field bus (and in repeaters,....) A field bus provides means to synchronize clocks despite propagation delays and failures of individual nodes. t1 t2 processing input input input t3 t4 bus t1 val1 Industrial Automation 2013 Field Bus Operation 3.2 - 40 Syntonization vs Synchronization distinguish: 1) frequency synchronization (syntonization) 2) relative synchronization 3) absolute synchronization Industrial Automation 2013 Field Bus Operation 3.2 - 41 Example: Phasor information Phasor transmission over the European grid: a phase error of 0,01 radian is allowed, corresponding to +/- 26 µs in a 60 Hz grid or 31 µs in a 50 Hz grid. Industrial Automation 2013 Field Bus Operation 3.2 - 42 Time distribution In master-slave busses, the master distribute the time as a bus frame. The slave can compensate for the path delays. Time is relative to the master In demanding systems, time is distributed over separate lines as relative time (e.g. PPS = one pulse per second) or absolute time (IRIG-B), with accuracy of 1 µs. In data networks, a reference clock (e.g. GPS or atomic clock) distributes the time. A protocol evaluates the path delays to compensate them. • NTP (Network Time Protocol): about 1 ms is usually achieved. • IEEE 1588, all network devices collaborate to estimate the delays, an accuracy below 1 µs can be achieved without need for separate cables (but hardware support for time stamping required). (Telecom networks typically do not distribute time, they only distribute frequency) Industrial Automation 2013 Field Bus Operation 3.2 - 43 NTP (Network Time Protocol) principle client t1 network server time request t2 network delay time response t3 t4 time request (t 4 t1 ) (t3 t 2 ) 2 t’1 t’2 time response network delay t’4 t’3 distance time Measures delay end-to-end over the network (one calculation) Problem: asymmetry in the network delays, long network delays Industrial Automation 2013 Field Bus Operation 3.2 - 44 IEEE 1588 principle (PTP, Precision Time Protocol) Grand Master Clock residence time calculation peer delay calculation MC Pdelay-response TC Pdelay-request TC TC MC = master clock TC TC TC = transparent clock OC = ordinary clock OC OC OC OC Two calculations: residence time and peer delay All nodes measure delay to peer TC correct for residence time (HW support) Industrial Automation 2013 Field Bus Operation 3.2 - 45 IEEE 1588 – 1 step clocks time ordinary (slave) clock t1 peer delay calculation Pdelay_Req bridge bridge 1-step transparent clock 1-step transparent clock t2 t1 link delay t4 t3 Pdelay_Resp (contains t3 – t2) grand master clock Pdelay_Req t1 Pdelay_Req t2 Pdelay_Resp t3 t4 t2 Pdelay_Resp t3 t4 Sync residence time residence time calculation t5 residence time Sync t5 t6 Sync (contains all + ) distance Grandmaster sends the time spontaneously. Each device computes the path delay to its neighbour and its residence time and corrects the time message before forwarding it Industrial Automation 2013 Field Bus Operation 3.2 - 46 References To probe further • http://www.ines.zhaw.ch/fileadmin/user_upload/engineering/_Institute_und_Zentr en/INES/IEEE1588/Dokumente/IEEE_1588_Tutorial_engl_250705.pdf • http://blog.meinbergglobal.com/2013/11/22/ntp-vs-ptp-network-timingsmackdown/ • http://blog.meinbergglobal.com/2013/09/14/ieee-1588-accurate/ Industrial Automation 2013 Field Bus Operation 3.2 - 47 Fieldbus: Networking 3.1 Field bus types 3.2 Field bus operation Data distribution Cyclic Operation Event Driven Operation Real-time communication model Time distribution Networking 3.3 Standard field busses Industrial Automation 2013 Field Bus Operation 3.2 - 48 Networking field busses Networking field busses is not done through bridges or routers, because normally, transition from one bus to another is associated with: - data reduction (processing, sum building, alarm building, multiplexing) - data marshalling (different position in the frames) - data transformation (different formats on different busses) Only system management messages could be threaded through from end to end, but due to lack of standardization, data conversion is not avoidable today. Industrial Automation 2013 Field Bus Operation 3.2 - 49 Networking: Printing Example MPS = Master Printing System LS = Leitstand (section supervision) PM = Print Master SS =Section Steuerung (section control) MPS Production Plant-bus (Ethernet) Operator bus (Ethernet) Console, Section Supervision LS LS LS PM LS LS LS PM LS LS LS PM LS LS LS PM Printing Towers Section Busses (AF100) B C Section Control E D SSB SSC SSD SSE Line bus (AF100) Reelstand-Gateways RPB RPC RPD RPE Reelstand bus (Arcnet) Reelstands multiplicity of field busses with different tasks, often associated with units. main task of controllers: gateway, routing, filtering, processing data. most of the processing power of the controllers is used to route data Industrial Automation 2013 Field Bus Operation 3.2 - 50 Assessment What is the difference between a centralized and a decentralized industrial bus ? What is the principle of source-addressed broadcast ? What is the difference between a time-stamp and a freshness counter ? Why is an associative memory used for source-addressed broadcast ? What are the advantages / disadvantages of event-driven communication ? What are the advantages / disadvantages of cyclic communication ? How is time transmitted ? How are field busses networked ? Industrial Automation 2013 Field Bus Operation 3.2 - 51