Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train...

44
Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols Process Variables
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    232
  • download

    8

Transcript of Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train...

Page 1: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols1IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Train Communication Network

IEC 61375 - 2

Real Time Protocols

Process Variables

Page 2: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols2IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Real-Time Protocols

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic Process Data broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 3: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols3IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

TCN Data Traffic

Periodic Transmission

short and urgent data items carrying the trains's state

Since variables are refreshed periodically, there is no need for a retransmission protocol in case of transmission error.

Two traffics share the same bus:

periodicphase

periodicphase

event

sporadic phase

sporadic phase

time

Sporadic Transmission

infrequent, sometimes lengthy messages reporting events, for:

• System: initialisation, down-loading, ...

Since messages represent state changes, they may not get lost a protocol recovers transmission errors.

• Users: diagnostics, status

basic period basic period

Process Data Message Data

... motor current, axle speed, operator's commands,...

Page 4: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols4IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Application Sight Of Communication

R4

Traffic Store(Process Data

Base)

Periodical Tasks

R3R2R1

Message Data(destination-oriented)

Process Data(Broadcast)

E3E2E1

Event-driven Tasks

bus

SupervisoryData

bus controller

Message ServicesVariables Services

Queues

station

Page 5: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols5IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Principle of Cyclic Source-Addressed Broadcast

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic source-addressed broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 6: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols6IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Cyclic Data Transfer

1 2 3 4

Individual period

1 2 3 4 5 1 2 3 4 5 6

2 · Tpd

6

N participants

time [µs]read transfer

time [ms]

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).

The master polls addresses in a fixed sequence, according to its Poll List.

Address(4)

Data(4)

Address(5)

10 µs/km

Address

devicesbus

master

plant

1 2 3 4 5 6

Poll

List

Page 7: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols7IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Cyclic Operation

Their delivery delay (refresh rate) is deterministic and constant.

There is no need for error recovery since a fresh value will be transmitted in the next cycle.

Only states may be transmitted, not state changes.

To keep a low poll time, only small data items may be transmitted (<256 bits)

Cyclic operation is used to transmit the state variables of the train.Periodically transmitted state variables are called Periodic Data.

The bus is under control of a central master.

Periodic Data are transmitted at fixed intervals , whether they changed or not.

The cycle time is limited by the product of the number of data transmitted by the duration of each poll.(e.g. 100 µs /point, 100 points => 10 ms)

Page 8: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols8IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Optimizing Cyclical Operation

time

4a 8 16 1 4b 643

1 ms period(basic period)

2 ms period

2 4a

4 ms period

1 ms 1 ms

1 11

group withperiod 1ms

2

Solution: introduce subcycles for less urgent data:

Cyclic operation uses a fixed portion of the bus's time

The response time slows down accordingly

Cyclic polling need tools to configure the poll cycles.

Poll cycles should not be modified at run-time (source of non-determinism)

The poll period increases with the number of polled items

Page 9: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols9IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Subscription Principle

The application accesses them in the same way as a process database.

The bus becomes an on-line data base.

Each station monitors the bus and snoops the variables it is interested in .

Each station needs an associative memory to recognize its variables.

A device exports many process data (state variables) with different priorities. If there were only one poll type per device, a device should be polled at the frequency required by its highest-priority data. Rather than poll a device, the master polls the process data. Each device is subscribed as source or as sink for a number of process data. Only one device may be source of a certain process data (collision).

The replicated traffic stores can be considered as "caches" of the plant state.

Page 10: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols10IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Process Data Transmission

The device which sources that variable responds with a slave frame containing the value, all devices subscribed as sink receive that frame.

The bus master broadcasts the identifier of a variable to be transmitted: Phase1:

Phase 2:

devices(slaves)

BUS MASTER

BUS

subscribed devicessubscribed

devicesubscribed

device

source sink sinksink

variable value

Process Data are transmitted by source-addressed broadcast :

BUS

variable identifier

BUS MASTER devices

(slaves)source sink sink

subscribed devices

sink

subscribed device

subscribed device

Page 11: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols11IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Traffic Stores

Bus and applications interface through a shared memory, the traffic store.

The bus master scans the identifiers at its own pace.

The bus traffic and the application cycles are asynchronous to each other.

cyclic algorithms

cyclic algorithms

cyclic algorithms

cyclic algorithms

port address

application1

TrafficStores

Ports Ports Ports

application2

application4

sourceport

sinkport

port data

bus controller

bus controller

bus controller

sinkport

cyclic poll

bus controller

busmaster

application3

bus controller

bus

PeriodicList

Ports

Page 12: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols12IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Traffic Stores

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic Process Data broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 13: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols13IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

MVB Traffic Store Implementation

4096entries

port index

port index table

port control & status

ports odd page

ports even page

Page0 Page1PCS

123456789

...

0

9

unused = 0

1234

4095

0

255

4 octets 8 octets 8 octets

trashtrash

256 docks x 8 octets

= 2K octets

256 docksx 8 octets

= 2K octets

256 PCSx 4 octets

= 1K octets

4K portsx 1 octet

= 4K octets

dock2

dock4

dock8

12-bit port address

Page 14: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols14IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

MVB Traffic Store, Ports And Docks

The former contents of a Port is overwritten (buffered, not queued).

Traffic stores are divided into Ports, each Port corresponding to one identifier�

To provide simultaneous and consistent access by either application or bus, each Port is stored in two independent pages, written alternately.

The PCS performs additional functions like freshness supervision and interrupt generation.

The Port Index Table forms an associative memory, which indicates for each identifier if it is subscribed to that device, by pointing to the PCS.

A device has normally a small number of Ports (e.g. 256), but a supervisory device may have the full range of 4096 Ports.

Its Port Control and Status register indicates if a Port is source or sink.

A Port may be up to 1024 bit wide (256bits on the MVB)

A Port is divided into Docks of 32 bits for better memory usage.

Page 15: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols15IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Freshness Supervision

Process Data are not retransmitted explicitely in case of transmission error,they will be retransmitted anyhow at the next poll.

The application must tolerate an occasional loss of data.

To protect the application from using obsolete data, each Port in the traffic store has a freshness counter.

This counter is reset by writing to that Port. It is incremented regularly, either by the application processor (BAP) or by the bus controller (MVBC).

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.

Page 16: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols16IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Implementation of Port Control And Status (BAP controller)

TMPSRC SINK

Port ActiveSink

Port Active

Source

StoreCheck Octet

function code (size)

IE0IE1

EnableInterruptEvent 1

EnableInterrupt

3

IE3 IE2

STOTERR

SlaveTimeOut

TransferError

ValidPage

VP BNI

Bus NotIdle

T0T1

sink time supervision counter

T7

EnableInterruptEvent 0

T2T3T4T5T6

reserved

EnableInterrupt

2

unused

size in 16 bit words

The PCS depends both on the traffic store and on the bus controller

Page 17: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols17IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Traffic Store Access Restriction

page 1 becomes valid

t2t1

writer

reader 1

page0

page1

(slow) reader 2

page 0 becomes valid

time

• there may be only one writer for a port, but several readers

• a reader must read the whole port before the writer overwrites it again

• there may be no semaphores to guard access to a traffic store (real-time)

traffic store

startsends

error !

• therefore, the processor must read ports with interrupt off.

• this time is equal to the basic period in the worst case ( 1ms)

Page 18: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols18IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Process Variables And Datasets

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic Process Data broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 19: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols19IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Datasets

It is economical to transport several variables in the same frame as a dataset.

wheelspeed

airpressure

linevoltage

motorcurrent

analog variables

Dataset

binary variables

all door closedlights on heat onair condition on

bit offset

16 32 480 64 66 70

size

A variable is identified within a dataset by its offset and its size

A dataset is treated as a whole for communication and access.

Variables may be of different types, types can be mixed.

Page 20: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols20IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Variable Types

Data representation may be different according to the processor (e.g. Intel's Little-Endians and Motorola's Big-Endians)

However, there may be no ambiguity on the bus

Therefore, each transmitted variable has a defined type associated with it.

This type is agreed beforehand between the applications during configuration

To guarantee consistency, the type of the variable is part of the variable's name

TCN specifies a number of standard network variable types.

The format obeys to the Big-Endian convention (most significant first)

Page 21: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols21IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Predefined Variable Types

ANTIVALENT210= forced00 = network error

01 = ok 11 = data undefined

BITSETn (array of n boolean)

INTEGERn (2's complement) SB

UNSIGNEDn

FRACTIONALn SB 20

REAL32 (IEEE) exponent

mantissa

ARRAY n OF CHARACTER8 char 0char 1

SB

SB = sign bit

TIMEDATE48...

Application data types have been defined in ROSIN

BOOLEAN10 = FALSE1 = TRUE

Page 22: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols22IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Configuration Change And Errors

Reconfiguring the whole bus to include new variables is normally not allowed in a running project, since this can affect the time behaviour of all applications.

E.g. in the Train Bus, old coaches cannot be modified to consider new variables.

It also may be that a variable is invalid when produced, e.g. by a defective unit. The producer may not modify the structure of data sets to exclude failed data

Mechanisms are provided to protect against production and transmission errors:

Freshness Supervision at reception

Check Variable: production supervision

Dedicated variables (Lifesigns) let all devices monitor the other's health

Page 23: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols23IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Check Variable

TCN does not rely on a source freshness supervision

TCN relies on the invalidation of stale data at the source through a check variable:

Traffic Store

source port

Traffic Store

freshness checkset to 00 if

stale or wrong

valuecheckvalue

sink port

checkvalue

subscriber applicationpublisher application

Page 24: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols24IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Variable Extension And Invalidation

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, eachvariable can be supervised by a check variable, of type ANTIVALENT2:

0 1 0 1 1 1 0 0 0 1

check

0 0 0 0 0 0 0 0

1 1 1 1 1 1 1 1

0 0

1 1

correct variable

error

undefined

variable value

A variable and its check variable are treated indivisibly when reading or writingThe check variable may be located anywhere in the same data set.

Dataset

var_offsetchk_offset

10 = forced

00 = network error01 = ok

11 = data undefined

Page 25: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols25IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Example: Train Bus Frames Extension

40 octets 40 octets

1992 freefree 1992

Vehicle Status Traction Status Cab Commands48 octets

1992freelocomotive with attended cab

1992 freecoach (no cab, no traction)

1992 free 1992 freemotor coach(no cab)

1992 free freesteering coach with attended cab

free1992

1992 freefree 1992 1992freelocomotive with unattended cab

1992 free freeunattended steering coach

free

1995

1995

old vehicles understand the new vehicle's 1992 data and ignore 1995 variables. new vehicles understand the old vehicle's 1992 data and ignore undefined fields.

Page 26: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols26IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

PV_Name

dataset identifier

port address size variable offset type check offset

4 12 6 10 6 10

traffic store

port addresstraffic store

size bit_offset

type check_offset

n

n+2

n+4

this is how it look in memory,independently if the processor is little-endian or big-endian.

Each Process Variable is identified by a unique PV_Name

(DS-Name)

To each variable, the application associates a value location and a check locationSink variables have in addition the freshness argument

PV_Name

Page 27: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols27IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Scope Of The PV-name

applicationB

applicationA

1234 8

port

bus

offset

process data frame (dataset)

applicationC

3 1234 8

offsetdatasettrafficstore

1 1234 8

offsetdatasettrafficstore

1234

traffic store1 traffic store2 traffic store3 traffic store1

the port identifier and the offset within the port identifies a variable within a bus or within a traffic store

device x device y

Page 28: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols28IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Process Variables Instances

subscribersapplicationinstances

device device

device

traffic store instance

publisherapplication instance

bus instance

applications

There exist a number of (inconsistent) instances of the same Process Variable

bus

Page 29: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols29IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Software Structure For Process Variables

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data Communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic Process Data broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 30: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols30IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Application Access To Process Variables

Application Interfaceap_

Link Interfacelp_

Traffic Store

Application Process

buscontroller

bus

Link Process

APAAVA

PTA

ApplicationProgram

dataset witha variable, its check

variable and its freshness counter

applications access the traffic store directly, as a shared memory. (there may be only writer for a given port)

Page 31: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols31IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Several Applications, One Traffic Store

APAAVA

PTA

ApplicationProgram

bus

Link Process

APAAVA

PTA

ApplicationProgram

APAAVA

PTA

ApplicationProgram

TrafficStore

same process

buscontroller

several processes may access the traffic store in parallel

Page 32: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols32IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

One Application, Several Traffic Stores

Link 1

Bus 1 Bus 2

Application Interface ap_

Link Interface lp_

trafficstore

2

Link 2link

process 2linkprocess 1

APAAVA

PTA2

ApplicationProgram

PTA1

trafficstore

1

Page 33: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols33IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Access To Several Traffic Stores

traffic store

port index table 2

port index table 5page 1PCS

port

traffic store

descriptor

page 0 page 1PCS

var_offset

MVB

WTB

traffic storeindex

PV_Name typesize

page 0

Page 34: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols34IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Forcing

Port Index Table

substitute ports

odd ports

mask ports

even ports

get/put force bus

if a source variable is forced, its substitute value is copied to the bus and to every (local) application which reads it

if a sink variable is forced, its substitute value is read by local applications, remote appplications are not affected

Variables can be forced individually for debugging and commissioning

Page 35: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols35IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Forcing Operation

Mask Port

Substitute Port

port offset

1

1 0 1 0 1 0 1 0

Even Traffic Portx

Odd Traffic Port1 1 1 1 1 0 1 1

1 0

1

0

0

1 1 1 1 1 0 1 0x x x x x x x

x x x x x x x x

x x x x x x x x x x x x x xx x x x x

1 1 0 1 0

1 1 0 1 0 1 0 1 0 1 0

1 0 1 0 1 0

1 1 1 1 1 1 10 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 10

1234:6

1234:21

For each bit set to 0 in the Mask Port, the corresponding bit of the Substituteport is copied to the variable location

analog

binary

Page 36: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols36IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Application Interface For Process Variables

1. General Principles

2. Variables

3. Messages

1. Principle of Message Data communication

5. Software structure

2. Link Layer Interface

4. Transport protocol

3. Networking and Routing

1. Principle of cyclic Process Data broadcast2. Traffic Stores principle and implementation3. Process Variables and Datasets4. Software structure5. Application Layer Interface for Process Variables6. Networking

6. Application Interface

Page 37: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols37IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

AVA Procedures

apd_put_variable (pv_name, producer)apd_get_variable (pv_name, consumer, check)

individual access

apd_force_variable (pv_name, substitute)apd_unforce_variable (pv_name)apd_unforce_all

ap_put_cluster (pv_list)ap_get_cluster (pv_list)

cluster access

dataset access (link layer)ds_received (ds_name)ds_sent (ds_name)ds_subscribe_sent (ds_name, sent_ind)ds_subscribe_received (ds_name, received_ind)

apd_init

read a variablewrite a variable

force a variable to a valuerestore bus communicationsame for all variablesinitialize traffic store

read a cluster of variableswrite a cluster of variables

signals reception of datasetsignals emission of datasetcorresponding subscriptions

ap_put_set (pv_list)ap_get_set (pv_list)

pv-set accessread a set of variableswrite a set of variables

Page 38: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols38IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Individual Access

tra

ffic

sto

re

bus transfer ( triggered by master)

sink port

source port

apd_put_var

local p-instance

apd_force

publisherapplication

substitute local s-instance

subscriberapplication

substitute

apd_unforceapd_get_varlp_init

apd_forceapd_unforce

tra

ffic

sto

re

apd_put_variable apd_force_variableapd_get_variable apd_unforce_variable

sink port

Variable may be accessed individually, together with their check variableVariable may be forced individually to a certain value (for test purpose)

lp_init

Page 39: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols39IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Individual Access Procedures

struct STR_APD_PV_NAME(TYPE_APD_PV_NAME)

(pv_format)(ds_name)

size val-offset

prt_addrts_id

type chk-offset

struct STR_APD_PV_DESCRIPTOR(TYPE_APD_PV_DESCRIPTOR)

size val-offset

prt_addrts_id

type chk-offset

p_var(void *)p_chk

(void *)

(APD_PV_NAME)

data structures

TYPE_APD_RESULT apd_get_variable( const struct STR_PV_DESCRIPTOR* var, unsigned short* fresh)

example:

my_result = apd_get_variable( &apd_cpu1_b1, &frs_cpu1_t1)

TYPE_APD_RESULT apd_put_variable( const struct STR_PV_DESCRIPTOR* var)

points to variable

points to checker

procedures

Page 40: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols40IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Cluster Access Procedures

Traffic StoreTraffic Store

bus transfer

exportcluster list

localoutput

variable

publisherapplication

loc_adrPV

localinput

variable

subscriberapplication

sink port source port

apd_get_cluster

apd_get_set

APAAPA

It is fast and convenient to access groups of variables, from different ports.

loc_adrPV

importcluster list

apd_put_cluster

apd_put_set

Page 41: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols41IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

PV_Set

A PV_set groups variables of the same port

struct STR_APD_PV_DESCRIPTOR(TYPE_APD_PV_DESCRIPTOR)

size val-offset

prt_addrts_id

type chk-offset

p_var(void *)p_chk

(void *)

(APD_PV_NAME)

TYPE_APD_RESULT apd_get_set( const struct STR_PV_DESCRIPTOR* pvset, unsigned short* fresh, int nr_variables)

example:my_result = apd_get_set( &ads_cpu1_t1, &frs_cpu1_t1, 5)

TYPE_APD_RESULT apd_put_set( const struct STR_PV_DESCRIPTOR* pvset, int nr_variables)

procedures

data structures

array of pv_descriptors

Page 42: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols42IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Dataset Access Procedures

struct STR_APD_DS_NAME

(TYPE_APD_DS_NAME)

prt_addrts_id for refresh timer

To supervise their freshness, data sets are grouped in a time-out set

array of dataset identifiers

With the BAP, the set must be explicitely refreshed.

This operation is not needed anymore with the MVBC.

Page 43: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols43IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Synchronization

Ports of a traffic stores can be configured to raise an interrupt when addressed for sending or for receiving.

This feature is not intended to transmit Process Data by events, but tosynchronize applications, e.g. for time distribution.

The same mechanism is used for message data

To this purpose, an application subscribes a procedure to the bus, which will becalled when the port is written (or read).

apd_subscribeapd_desubscribeapd_pass_subscription

DS_NAMEDS_NAMEDS_NAME

Page 44: Real-Time Protocols 1 IEC Train Communication Network IEC 61375 - Clause 2 1999 December, HK Train Communication Network IEC 61375 - 2 Real Time Protocols.

Real-Time Protocols44IEC Train Communication Network IEC 61375 - Clause 21999 December, HK

Process Data Networking

gateway filters & forwards Process Data = application-dependentmarshalling

The total delay is the sum of 5 delays:

2 gateway delaysand 3 bus delays

All busses operate cyclically.

gateway

T1 frame

T2 frame

cyclic train bus process data frames

speed

stop

speed

stop

Vehicle Bus Vehicle Bus

Train Bus

cycl

ic p

olli

ng

cycl

ic p

olli

ng

from T1

from T2

gateway

import list

sink portssource ports

exportlist

import list

exportlist

sink ports source ports

sink portssource ports

sink ports source ports