![Page 1: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/1.jpg)
Implementing the LonTalk Protocol
for Intelligent Distributed Control
Harold Rabbie Ph.D.Embedded Systems Conference
http://www.lonworks.org.cn
![Page 2: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/2.jpg)
Con
trol
Net
wor
k Pr
otoc
ol S
peci
ficat
ion
MA
RC
H 1
998
EL
EC
TR
ON
IC IN
DU
STR
IES
AL
LIA
NC
EE
NG
INE
ER
ING
DE
PAR
TM
EN
T
EIA
Elec
tron
ic In
dust
ries
Alli
ance
EIA
STA
ND
AR
D
EIA
-709
.1
![Page 3: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/3.jpg)
3
What is the LonTalk Protocol?
A mechanism for intelligent devices to exchange sense and control informationDeveloped by Echelon Corp.Standard: EIA-709.1 Electronic Industries Alliance Control Network Specification
Global Engineering Documents 1-800-854-7179LonMark Interoperability Association http://www.lonmark.org/PRESS/spec_3_0.PDF
![Page 4: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/4.jpg)
4
Design Goals for the LonTalk Protocol
Media independenceWide range of physical environments
Supports very large networksHandful of nodes to thousands of nodes
Low installed costLow-cost simple nodesMulti-drop, not point-to-point
Very widely applicableLarge volumes lead to low cost
![Page 5: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/5.jpg)
5
More Design Goals for the LonTalk Protocol
No central controller neededBut not precluded, eitherNo single point of failure
Inherently peer-to-peerBut can support master-slave
Protocol subsets not needed, or permittedMaximum interoperabilityVendor independence
![Page 6: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/6.jpg)
6
Examples of Media that Support the LonTalk Protocol
Twisted pair wireFiber opticsCoaxial cableLonTalk over IPCompanion physical layer standards
EIA-709.2 and EIA-709.3
Transceiver vendor list at http://www.echelon.com/products/contacts/tcvr.htm
Radio frequencyPower lineInfrared
![Page 7: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/7.jpg)
7
Some Applications of the LonTalk Protocol
Heating, ventilation and air-conditioningIndustrial and process controlUtility demand-side managementMedical and scientific instrumentationSecurity and home automationEntertainment networks
![Page 8: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/8.jpg)
8
Support for Large Networks
Very large address space32,385 nodes per domain 248 domains
Multiple channelsSubnets and routers Router Router
Router
Repeater
Channel 1
Channel 2
Channel 3Channel 4
![Page 9: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/9.jpg)
9
Scalability of LonTalk Implementations I
High volume, low cost nodes
TransceiverControl &
protocol chip
Sensor/actuator
Sensor/actuator
Memory
Transceiver
Sensor/actuator
~$5 ~$10 ~$15
Control & protocol chip
Control & protocol chip
![Page 10: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/10.jpg)
10
Scalability of LonTalk Implementations II
Higher-capability nodes
Transceiver
Sensor/actuator
Memory
Link-layer protocol chip
Microcontroller
Transceiver
Network interface
Computer
![Page 11: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/11.jpg)
11
Seven-Layer ISO-Model Protocol Stack
Application
Presentation
SessionTransportTransaction
NetworkMedia Access Control
Link
Physical
7
6
5
4
3
2
1
Net
wor
k M
anag
emen
t
![Page 12: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/12.jpg)
12
LonTalk Network Management Protocol
Defined protocol for device configurationSet application-level configuration parametersRead device self-documentation dataSet media access layer parameters⌧Priority, timing factors
Set transport layer parameters⌧Service type, retry count, transaction timers
Load an updated application into EEPROM
![Page 13: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/13.jpg)
13
LonTalk Protocol Implementation Choices
General-purpose microprocessorUpper protocol layers in user softwareHardware implements at least the link layer
Neuron Chip microcontrollerLayers 2-6 in embedded hardware and firmwareApp Layer in on-chip application CPUor App Layer in separate host CPU
![Page 14: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/14.jpg)
14
Node Cost Considerations
Neuron Chip
COST
7 app
6
5
4
3
2
1 phys
Neuron Chip
XCVR
Neuron Chip
XCVR
μP or PC
μP or PC
H/W Assist
XCVR
![Page 15: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/15.jpg)
15
LonTalk ImplementationsNeuron Chip - the “Gold Standard”
Over 5,000,000 installed devicesManufactured by Cypress and Toshiba
Portable ANSI C implementationAdept Systems, Boca Raton, FL
Orion Stack, L-chipLoytec Electronics, Vienna, Austria
Process Network Computer ChipToshiba, JavaSoft
![Page 16: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/16.jpg)
16
Adept Systems
MC68360 microprocessorUpper layers in portable ANSI COn-chip link layer hardware
Manchester encodingPacket framingCRC generation/detection
Contact: 1-561-487-6894
Serial Comm.Processor
Protocol Stack
ApplicationLayer
Transceiver
MC68360
![Page 17: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/17.jpg)
17
Loytec Electronics
VENUS - Vienna Embedded Networking Utility SuiteLink, MAC and Network layers in FPGAParallel interface to hostPortable upper layers in ANSI C
LonWorks Driver Chip
Layers 4-6
ApplicationLayer
Transceiver
Host
![Page 18: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/18.jpg)
18
Toshiba Process Network Computer Chip
MIPS RISC coreRunning Java OS
LonTalk Link Layer H/WLonTalk stack in Java
10-base-T Link Layer H/WTCP/IP stack in Java
Supports LonTalk over IPLonTalk Comm.
LonTalk Stack
Java Application
LonTalk XCVR
TCP/IP Stack
Ethernet Comm.
Ethernet XCVRPNC
![Page 19: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/19.jpg)
19
765432
1
Cypress / ToshibaNeuron Chip
Application CPUEmbedded I/O hardwareUser program
Network CPULayers 3-6
Media Access Control CPULink layer hardwareTransceiver options
NeuronChip
Transceiver
Sensor or Actuator
![Page 20: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/20.jpg)
20
Interoperability is Primary
Implementations include all defined layersNo advantage in implementing a subset
Application layer interoperabilityLonMark Interoperability Association⌧http://www.lonmark.org
Industry-specific working groups⌧HVAC, industrial, security, lighting, etc.
Application-layer object definitions for higher-level interoperability
![Page 21: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/21.jpg)
21
Node Cost is Also Primary
Widest possible adoptionHigh volume silicon lowest costNeuron Chip currently under $3.00
Generic control networking solutionIndustry-specific extensions
Transceivers with price/performance tradeoffsPackaging and wiring specificationsApplication objects for functional interoperability
![Page 22: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/22.jpg)
22
Why Define All Protocol Layers?
It guarantees interoperability across device manufacturersIt greatly simplifies node design
Developer writes to high-level API
In a $5 device, memory is not “free”1-2KB of EEPROM1-2KB RAM10-16KB ROM with system firmware
![Page 23: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/23.jpg)
23
Temperature Sensor Example
LonMark-compliant deviceImplemented with Neuron 3120 Chip
External A/D converterExternal Transceiver
TM
PN31
20A
20U
A/D Transceiver
![Page 24: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/24.jpg)
24
Memory Budget for Temperature Sensor
EEPROM Usage 344 bytesSystem Data & Parameters 69 bytesNetwork Configuration Data 117 bytesApplication EEPROM Variables 7 bytesApplication Code 91 bytesSelf-Identification Data 60 bytes
RAM Usage 841 bytesSystem Data & Parameters 457 bytesProtocol Buffers 382 bytesApplication RAM Variables 2 bytes
System firmware in on-chip ROM does all the hard stuff
![Page 25: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/25.jpg)
25
This is Not a Toy Device!Sensor sample rate, calibration, and offset settable over networkDevice is self-identifying
Documentation may be read over the network
Domain, subnet, and node address settable over the networkData destination settable over the network
One, many or all other nodes may receive the temperature reading
![Page 26: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/26.jpg)
26
User Code Architecture of Temperature Sensor
Declare configuration parameters for sample rate, calibration, and offsetDeclare output Network Variable for temperature measurementExecutable code:
On reset, start the A/D converterWhen A/D conversion is done, scale reading and propagate to output network variable.
![Page 27: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/27.jpg)
27
Neuron C Code for Temperature Sensor
#include <stdlib.h>#include "a2d.h"
// Declare node-level self-documentation
#pragma set_node_sd_string "&3.0@1Temp Snsr"
// Declare sensor output network variable
network output sd_string("@1|1") SNVT_temp nvoValue;
// Declare sensor configuration parameters
config network input sd_string("&0,5,0\x80,26") SNVT_temp nciOffset;config network input sd_string("&0,1,0\x80,31") SNVT_muldiv nciGain;config network input int nciSampleRate;
// Reset task - initialize A/D converter
when( reset ) {a2d_enable(nciSampleRate);a2d_mux(0);
}
// A/D conversion complete task - propagate network variable
when( a2d_done() ) { // fixed point linear scalingnvoValue = muldiv(a2d_read(), nciGain.multiplier, nciGain.divisor) + nciOffset;
}
![Page 28: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/28.jpg)
28
Network Variables - NVs
Application layer abstraction for data sharing
Multiple addressable data entities per deviceImplicitly addressed updates delivered via bound connections
Output NV
Output NV
Node 1 Node 2
Input NV
Input NV
Input NV
Output NV
Node 3
![Page 29: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/29.jpg)
29
Application Layer API for NVsOutput network variables
Function_nv_update(int index, void *pValue, int len);
Event handler_nv_completes(int index, boolean status);
Input network variablesEvent handler_nv_update_occurs(int index, void *pValue, int len);
Function_nv_poll(int index);
![Page 30: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/30.jpg)
30
Top-Down View of LonTalk
High-level network abstraction permits very small, simple application programsAll layers of protocol may be configured at installation time via network management protocolApplication may override implicit configuration
At the cost of program size and complexity
![Page 31: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/31.jpg)
31
Starting at the Bottom…..
1 Physical Layer
Physical Layer TransceiversInterface between digital processing and analog networking mediumDirect ModeSpecial-Purpose Mode
![Page 32: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/32.jpg)
32
Direct Mode Transceivers
Serial interface to Link Layer H/WDifferential Manchester encodingSimple external hardware, e.g.
EIA-709.3 free topology TP (78kbps)
EIA-485 bus topology twisted pairDirect connection to twisted pairFSK Radio (4.9kbps)
Direct Mode Bit Rates (kbps)
2,5001,250
625312.5156783919.59.84.92.41.20.6
![Page 33: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/33.jpg)
33
Differential Direct Mode
Transmitted Data
Received Data
Transmit Enable
Optional Collision Detect“Transceiver”
Analog interfaceProgrammable hysteresis, glitch filtering
Only passive external componentsTransformer for electrical isolationor Protection components for direct connect
![Page 34: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/34.jpg)
34
Single-Ended Direct ModeUsed with active external transceivers
e.g. EIA-709.3, RS-485, FSK radios
Simple digital interface
Transmitted DataReceived Data
Transmit EnableCollision Detect
TransceiverSleep
Optional
Analog World
![Page 35: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/35.jpg)
35
Special-Purpose Mode Transceivers
Digital handshaking interface to MAC layerTransceiver provides data encoding and
modulation, controls bit ratePossible features include⌧Error detection and correction⌧Collision detection and resolution⌧Tunneling over foreign protocols
Example: EIA-709.2 power line
![Page 36: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/36.jpg)
36
Special-Purpose Mode Transceiver Interface
Digital handshaking interfaceIntelligent transceiversDefined protocols for data, control, and status exchange
Transmitted Data & CtrlReceived Data & Status
TransceiverOptional Sleep
Analog World
Bit ClockFrame Clock
![Page 37: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/37.jpg)
37
Up to the Next Layer
Link sub-layerBit encodingPacket framingPacket error detection
Media access control sub-layerSharing the bandwidth among transmittersPeer-to-peer, multi-drop, priority access, collision avoidance
Media AccessLink2
![Page 38: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/38.jpg)
38
Differential Manchester Encoding for Direct Mode
Self-clocking serial bit streamMid-bit transition indicates a “0”
Polarity insensitive: avoids wiring problemsZero average DC level
May be transformer-coupled
0 0 1 1 0
![Page 39: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/39.jpg)
39
Packet FramingPreamble is a sequence of 1 bitsByte sync is a single 0 bitFollowed by up to 256 bytes of L2 data
Most significant bit first
Packet ends with Manchester code violation2.5 bit timeswith no transition
1 1 1 1 1 1 0
L2 packetpreamble
byte sync
![Page 40: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/40.jpg)
40
Protocol Overhead
Each layer adds its own header to the information in the packet
ApplicationData
Layer 6Layer 5Layer 4Layer 3Layer 2
In a control protocol, the application data is often small
e.g. on/off = 1 bit
![Page 41: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/41.jpg)
41
Layer 2 Header/Trailer
Layer 2 header is first byte of packetCRC is last two bytes of L2 packet
CCITT CRC-16 algorithm
Preamble & byte sync
CRC Code violation
L2 header
Layer 2 packet length
PriorityAlternate pathDelta backlog
Layer 3 PDU1 1 6 16
PDU = Protocol Data UnitPDU = Protocol Data Unit
![Page 42: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/42.jpg)
42
Priority Bit in Layer 2 Header
Transmitter may use priority media access algorithmPriority slot assignment of transmitting node is a MAC layer parameterPriority bit in packet ensures that routers forward the packet using the priority media access algorithm
![Page 43: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/43.jpg)
43
Alternate Path Bit in Layer 2 Header
Transaction layer sets this bit for the last two retries of an acknowledged or request messageInforms an intelligent transceiver when to use a fallback mechanism
Example: Noisy power line communicationsQuiet line: use faster data encodingNoisy line: use slower, more reliable encoding if previous attempts failed
![Page 44: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/44.jpg)
44
Delta Backlog Field in Layer 2 Header
This field informs the other nodes on the channel of the expected number of packets caused by the transmission of this packetValue is non-zero when sending acknowledged or request messagesFor multicast, set to (group size - 1)For broadcast, set to number of nodes in destination subnet
![Page 45: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/45.jpg)
45
Media Access Algorithms Used by Other Protocols
Algorithms with no possibility of collision use bandwidth inefficientlyResponse time increases with node countMaster-slave polling
Single point of failure
Time division multiplexingToken passing
Recovery of lost token takes time
![Page 46: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/46.jpg)
46
Carrier Sense Multiple Access (CSMA)
Used by multi-drop EthernetSender waits for random number of time slots before trying to transmitIf another node is already transmitting, sender backs off until next cycleEfficient use of bandwidth when traffic is low
Previous packet Randomization slots
![Page 47: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/47.jpg)
47
Pure CSMA Chokes Under Load
At high offered traffic, less gets throughExample: 16 randomization slots
Offered traffic
Del
iver
ed tr
affic
Col
lisio
n ra
te
0
1
2
3
0 2 4 6 8 10 12 14 160%
100%
![Page 48: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/48.jpg)
48
Modified p-Persistent CSMA
Number of randomization slots is increased as traffic increasesDelta backlog field in Layer 2 header updates offered traffic estimate on receiving nodes
Details of the algorithm in protocol specification document
![Page 49: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/49.jpg)
49
Maximum Collision Rate is Limited
In practice, never more than 4% collisionsDelivered traffic increases with offered traffic
Offered traffic
Del
iver
ed tr
affic
Col
lisio
n ra
te
0
100%
4%
100%
![Page 50: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/50.jpg)
50
Priority Channel Access
Media bandwidth dedicated to priority messagesEach node that requires priority access is allocated a unique slot number on its channel
Previous packet
Randomization slots
2 3 41
β1β2
Priority slots
![Page 51: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/51.jpg)
51
Media Access Algorithm for Transmitter
Wait for end of previous packet
Y
N
N
Transmit this packet
YTry again
Wait for all priority slots to go by
Randomly pick a slot in current window
Prioritypacket?
Wait for this node’s priority slot
Channel busy?
Start
Wait β1 time
![Page 52: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/52.jpg)
52
Number of Priority Slots
Priority slots provide dedicated bandwidth for important messagesIf all packets use priority slots, there are no collisionsThe more slots there are, the wider Beta 2 time must beMore slots worse overall bandwidth utilization
![Page 53: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/53.jpg)
53
Factors Influencing Beta 1 Time
Media propagation delays186,000 miles/second isn’t just a good idea, it’s the LAWPhysical-layer repeaters
Transceiver turnaround delaysDissipation of transmitter energy before receiver can operate
Node response timeSlowest node on channel determines minimum Beta 1 time
![Page 54: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/54.jpg)
54
Factors Influencing Beta 2 Time
All nodes must have a consistent view of slot timingTransmit/receive clock accuracy
Usually requires 200 ppm crystal oscillator
Node response time jitterJitter of slowest node on channel determines Beta 2 slot width
Beta 2 width increases with number of priority slots
![Page 55: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/55.jpg)
55
Optional Collision Detection
Transceiver optionally signals transmitter when collision is detectedMAC layer immediately ceases transmission and reschedulesDifficult to do in a low-cost, high speed transceiverIf Cdet is not implemented, transaction layer will recover from errors
![Page 56: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/56.jpg)
56
LonTalk Media Access Summary
Efficient use of available bandwidthAdaptive CSMA algorithm limits packet collision ratePriority access mechanism for alarms etc.Media independent
TP, RF, CX, FO, PL, IR etc.
LonMark Interoperability Guidelines define a set of standard channels
![Page 57: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/57.jpg)
57
Protocol Layer 3
Message addressingUnicast - single nodeMulti-cast - group of nodesBroadcast - subnet-wide or domain-wide
Routing between subnetsConfigured routersLearning routersRepeaters
3 Network
![Page 58: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/58.jpg)
58
Logical Addressing Hierarchy
NetworkNetwork
Domain
248+224+28+1 domain IDs
248+224+28+1 domain IDs
DomainDomainDomain
SubnetSubnet SubnetSubnet SubnetSubnet SubnetSubnet255 subnet IDs
per domain255 subnet IDs
per domain
NodeNode
NodeNode NodeNode NodeNode
NodeNode
NodeNode
NodeNode
127 node IDs per subnet
127 node IDs per subnet
256 group IDs per domain
Group
Group
256 group IDs per domain
Node may belong to multiple groups
![Page 59: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/59.jpg)
59
LonTalk Address Rules
A configured device may belong to one or more domains
It sends and receives messages only in these domains, except
A device can also receive a message outside of its domain if:
It is not configured in any domain and the destination address mode is broadcastOr the destination address specifies the device’s unique ID
![Page 60: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/60.jpg)
60
Layer 3 header (4-16 bytes)
Protocol versionEnclosed PDU formatDestination address formatDomain lengthSource subnet IDa/b indicatorSource node IDDestination addressDomain ID
Layer 3 Protocol Data Unit
Enclosed PDU2 2 2 8 1 7 8-56 0-482
PDU = Protocol Data UnitPDU = Protocol Data Unit
![Page 61: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/61.jpg)
61
Network Layer Fields
Protocol versionCurrently at version 0No revisions have been needed, or are planned
Selectable domain ID length0 = 0 bytes (the null domain)1 = 1 byte2 = 3 bytes3 = 6 bytes
8
24
48
![Page 62: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/62.jpg)
62
Using Domain IDs
Domain ID identifies subsystemApplication node may be configured in one or more domainsUse 0 or 1 byte domain IDs for closed subsystems
Shorter packets
Use unique domain IDs on open mediaExample: power line
![Page 63: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/63.jpg)
63
Using Subnet and Node IDs
The destination subnet ID is used for routing the packet in multi-channel networksThe destination node ID identifies the node within its subnetThe receiving node uses the source subnet and node IDs to address any acknowledgement and response messages
![Page 64: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/64.jpg)
64
Multicast and Broadcast Destination Addressing
Address format 0 = Broadcast to SubnetDestination address field is the subnet ID8 bits (1-255)If destination subnet is 0, it means all subnets in the domain
Address format 1 = Multicast (group)Destination address field is the group ID8 bits (0-255)
8
8
![Page 65: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/65.jpg)
65
Address format 2 = Unicast (subnet/node)Destination address is subnet and node IDs
Format 2a: 16 bits
Format 2b: 24 bits, used for group ACK’s and responses
Unicast Destination Addressing
8 1 7subnet 1 node
8 1 7 8 8subnet 1 node group source group
member ID
![Page 66: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/66.jpg)
66
Addressing Messages and Network Variables
This network variable update is sent using unicast addressing
Output NV
Output NV
Node 1
Input NV
Output NV
Node 2
Input NV
Input NV
Node 3This network variable update is sent using multicast (group) addressing
![Page 67: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/67.jpg)
67
Unique ID Destination Addressing
Address format 3Destination address is subnet ID and device unique IDSubnet ID used for routing
Used to configure nodes that are not yet configured in any domainNot used for application messages
Logical rather than physical addressing allows easy device replacement
8 48subnet unique ID
![Page 68: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/68.jpg)
68
Address Recognition for a Configured Device
Y
N
Unique ID mode?
One of my domains?
Start My unique ID?
N
N
Y
Broadcast modeBroadcast mode Multicast modeMulticast mode Unicast modeUnicast mode
My subnet or subnet 0?
One of my groups?
My subnet and node?
N NN
Y Y YPass the packet to the next layer
Pass the packet to the next layer
Y
![Page 69: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/69.jpg)
69
Routing in Multi-Channel Networks
Channels connected via Routers or RepeatersRepeaters forward all
valid packets
Routers forward packets selectively based on destination
Router Router
Router
Repeater
Channel 1
Channel 2
Channel 3Channel 4
![Page 70: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/70.jpg)
70
Architecture of a Router
Routing LayerMedia Access Control
Link
Physical
Routing LayerMedia Access Control
Link
Physical
Left Channel Right Channel
Forwarded Layer 2 PacketsRouter intelligently connects two channels
![Page 71: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/71.jpg)
71
Half-Router Algorithm
Receive layer 2 packet from channelIf multicast, check forwarding bit for destination groupElse check forwarding bit for destination subnetIs forwarding bit set?
Yes - forward packet to other side of routerNo - discard this packet
![Page 72: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/72.jpg)
72
Router Data Structures
Subnet forwarding tableOne table per domain
Group forwarding tableOne table per domain
Tables may be updated over the network by network management messagesLearning routers build subnet forwarding table by examining source subnet IDs
255 bits
256 bits
![Page 73: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/73.jpg)
73
Protocol Layer 4
Transaction control sub-layerPacket orderingDuplicate detection
Authentication sub-layerTransport sub-layer
Acknowledged service⌧Unicast and multi-cast
Unacknowledged service⌧Repeated option
TransportTransactio
n
4
![Page 74: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/74.jpg)
74
Layer 3 headerEnclosed PDU format
Layer 4 Packet Types
Enclosed PDU2 2 2 2
ApplicationApplicationTransactionTransactionAck’d Msg
Repeated
ACK
Reminder
Reminder/Msg
SessionSessionRequest Msg
Response Msg
Reminder
Reminder/Msg
AuthenticationAuthenticationChallenge
ReplyUnack’d Msg
![Page 75: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/75.jpg)
75
Protocol Data Unit Format
0 = Transaction PDU (Layer 4)Acknowledged, ACK, Repeated, Reminder
1 = Session PDU (Layer 5)Request, Response, Reminder
2 = Authentication PDU (Layer 4)Challenge, Reply
3 = Application PDU (Layer 6)Unacknowledged
![Page 76: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/76.jpg)
76
Transaction Protocol Data Unit (PDU format 0)
Authenticated?Transaction PDU typeTransaction number
TPDU header (1 byte)
Enclosed PDU1 3 4
Transaction Protocol Data Unit
![Page 77: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/77.jpg)
77
Transactions
Preservation of orderingTransmitter completes one transaction before issuing the nextTransaction ID is incremented by transmitter (modulo 16)
Duplicate detection and rejectionReceiver checks incoming transaction ID and source address for duplicatesApplication layer receives only one message
![Page 78: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/78.jpg)
78
How Do Duplicates Occur?
Unacknowledged/Repeated transactionsDuplicate-generating topologiesLost acknowledgements
Transmitter
Routers Receiver
Transmitter ReceiverAck’d
ACKXAck’d (retry)
ACK
![Page 79: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/79.jpg)
79
Transaction Protocol Data Unit (TPDU) Types
Type 0: Acknowledged messageType 1: Unacknowledged/Repeated messageType 2: AcknowledgementType 4: ReminderType 5: Reminder with message
![Page 80: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/80.jpg)
80
Unacknowledged/Repeated Message
Transaction PDU type 1Enclosed PDU is Application Protocol Data UnitDelivered with unicast, multicast, or broadcast addressing
APDUTPDU header
Transaction Protocol Data Unit(1 byte)
![Page 81: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/81.jpg)
81
Unacknowledged/Repeated Service
Transmitter sends application data in an Unacknowledged/Repeated packetTransmitter repeats the transmission a configurable number of timesRepetition interval is configurableReceivers’ duplicate detection ensures that application data is received at most one time
![Page 82: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/82.jpg)
82
Acknowledged Message
Transaction PDU type 0Enclosed PDU is Application Protocol Data UnitDelivered with unicast or multicast addressing
APDUTPDU header
Transaction Protocol Data Unit(1 byte)
![Page 83: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/83.jpg)
83
Acknowledgement Packet
Transaction PDU Type 2Enclosed PDU is null
No data associated with ACK
Delivered with unicast addressingAddress type 2a if acknowledging a unicast messageAddress type 2b if acknowledging a multicast message⌧Includes group member number
TPDU header
TPDU(1 byte)
![Page 84: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/84.jpg)
84
Unicast Acknowledged Service
Transmitter sends application data in an Acknowledged packetReceiver sends back an acknowledgement (ACK)If transmitter receives ACK, the transaction has succeededIf no ACK received within a configurable time, the transmitter retries the transactionIf no ACK received after configurable number of retries, the transaction has failed
![Page 85: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/85.jpg)
85
Multicast Acknowledged Service
Transmitter sends application data addressed to the group in an Acknowledged packetEach receiver sends back an acknowledgement (ACK)⌧ACK also contains the group member number of the
receiver (format 2b)
If transmitter receives ACKs from all receivers, the transaction has succeededIf some ACKs are missing, the transmitter sends one or more Reminders
![Page 86: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/86.jpg)
86
Reminder/Message Packet
Transaction PDU type 5Enclosed PDU is a bit map of group members who have already acknowledged, plus the application data
Used for groups with 16 or fewer members
Reminder List APDUTPDU header
Transaction Protocol Data Unit
Reminder list length
(1 byte)
1-2(1 or 2 bytes)(1 byte)
![Page 87: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/87.jpg)
87
Reminder Packet
Transaction PDU type 4Enclosed PDU is a bit map of group members who have already acknowledgedFor groups with more than 16 members
Followed by a separate Ack’d packet with the Application PDU
3-8 Reminder ListTPDU header
Transaction Protocol Data Unit
(1 byte) (3-8 bytes)(1 byte)
![Page 88: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/88.jpg)
88
Example of Multicast Acknowledged TransactionGroup size is 7⌧Including transmitter
Transmitter sends Ack’dpacket with App data
ACKs from members 1 and 4 collide and are lostACKs received OK from members 0, 2, 3, 5
0 1 2 3
4 5
0 1 2 3
4 5X
X0 1 2 3
4 5
APDUL4 hdr
![Page 89: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/89.jpg)
89
Multicast Reminder Message
Transmitter sends Reminder/Msg packet⌧Reminder list (0, 2, 3, 5)
Only members 1 and 4 send ACKsTransaction complete
0 1 2 3
4 5
APDU1 0 1 1 0 1 0 0 0L4 hdr
0 1 2 3
4 5
1
4
![Page 90: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/90.jpg)
90
Comparison of Protocol Services
Unacknowledged (not repeated) serviceFastest protocol service
No transaction processing involvedNo Layer 4 header in packet
Useful when the application can tolerate occasional loss of a packetExample: sampled analog data
![Page 91: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/91.jpg)
91
Acknowledged ServiceUseful when transmitter must know if a message got through
Transmitter’s application should handle transaction failure events that may occur
Sending an acknowledged message to a group of N nodes causes N+1 packets on the network
Less efficient use of bandwidth for large groups
![Page 92: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/92.jpg)
92
Unacknowledged/Repeated Service
More efficient for large groupsNo need to know the size of the groupFailure probability example:
Collision rate is 4%Repeated service with 4 retriesProbability that at least one packet will get through = 1-0.044 = 99.999744%Only 4 packets instead of N+1
![Page 93: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/93.jpg)
93
AuthenticationAllows the receiver of a message to know that the transmitter is genuineImpervious to record/replay attack & data forgeryExample: Bank vault system
Transmitter
Receiver
Intruder
$
![Page 94: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/94.jpg)
94
Authentication Algorithm
Transmitter and receiver share a secret 48-bit Key KTransmitter sends a Transaction PDU with application data, and the authenticate bit setReceiver sends back a 64-bit random number Challenge CTransmitter computes a one-way function R=f(C,K,D) of the Challenge C, the Key K, and the Data DTransmitter returns result in the Reply RReceiver also computes f(C,K,D) and compares to RReceiver always ACKs even if authentication fails, to prevent brute force attacksIntruder only sees C, R & D; cannot deduce K, or forge D
![Page 95: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/95.jpg)
95
Authentication PDUs(PDU format 2)
Challenge - AuthPDU type 0
Reply - AuthPDU type 2
Transaction ID
64Random Number C
422
Type = 0Address format (1-3)
8
Group ID if group addressing mode
Transaction ID
64Function Result f(C,K,D)
422
Type = 2Address format (1-3)
8
![Page 96: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/96.jpg)
96
Transaction Layer Parameters
Service typeAck’d, Unack’d/Repeated, Unack’d, Auth’d
Transmitter’s transaction timerTime to wait before retrying or repeating
Transmitter’s retry or repeat countReceiver’s transaction timer
For duplicate detection
Network management protocol to configure all of these
![Page 97: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/97.jpg)
97
Protocol Layer 5
Session layerRequest/response protocolRemote procedure callNetwork variable pollingApplication-level response dataMay be authenticated
5 Session
![Page 98: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/98.jpg)
98
Session Protocol Data Unit (PDU format 1)
Authenticated?Session PDU typeTransaction number
SPDU header Enclosed PDU1 3 4
Type 0: Request messageType 2: Response messageType 4: ReminderType 5: Reminder with message
![Page 99: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/99.jpg)
99
Request Message
Session PDU type 0Enclosed PDU is Application Protocol Data UnitDelivered with unicast, multicast or broadcast addressing
APDUSPDU header
Session Protocol Data Unit
![Page 100: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/100.jpg)
100
Response Message
Session PDU type 2Enclosed PDU is Application Protocol Data UnitDelivered with unicast addressing to sender of request
APDUSPDU header
Session Protocol Data Unit
![Page 101: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/101.jpg)
101
Reminder/Message Packet
Session PDU type 4Enclosed PDU is a bit map of group members who have already responded, plus the application data
Used for groups with 16 or fewer members
Reminder List APDUSPDU header 1-2
Session Protocol Data Unit
Reminder list length
(1 byte) (1 or 2 bytes)(1 byte)
![Page 102: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/102.jpg)
102
Reminder Packet
Session PDU type 4Enclosed PDU is a bit map of group members who have already respondedFor groups with more than 16 members
Followed by a separate Request packet with the Application PDU
3-8 Reminder ListSPDU header
Session Protocol Data Unit
(1 byte) (3-8 bytes)(1 byte)
![Page 103: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/103.jpg)
103
Request/Response Service
Unicast and multicast addressingSame retry/reminder mechanism as acknowledged service
Response generated by application layerApp layer may receive duplicate requests
Broadcast addressingFirst response from any addressed node successfully completes the transaction
![Page 104: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/104.jpg)
104
APDU header 1 7 Application Message Data
0Message code
APDU header 1 14 Network Variable Data
1DirectionSelector
1
The Application Protocol Data Unit
6 Presentation
![Page 105: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/105.jpg)
105
Application Message Codes*
Hex 00 - 4F: application messagesDelivered to application layer
Hex 50 - 5F: network diagnostic messagesHandled by network diagnostic layer
Hex 60 - 7F: network management messages
Mostly handled by network management layer
* For other than response messages
![Page 106: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/106.jpg)
106
Application Messages
Interpretation of message code and data fields is up to the applicationMaximum data field length 227 bytes
With worst-case protocol overheadFor more data, use higher-level LonTalk file transfer protocol
![Page 107: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/107.jpg)
107
Sending Application Messages
Buffer Management APIAllocate / cancel output bufferPriority / non-priority buffer pools
Message parametersDestination addressService type⌧Unack’d, Ack’d, Unack’d/Repeated, Request, Auth’n
Application receives completion eventLayer 4 success/failure indication
![Page 108: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/108.jpg)
108
Receiving Application Messages
Buffer Management APIFree input buffer
Received message parametersSource and destination addressService type⌧Unack’d, Ack’d, Unack’d/Repeated, Request
Authentication requested but failed?Priority
![Page 109: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/109.jpg)
109
Request/Response MessagingTransmitter sends request msgReceivers receive request
Receivers send response msgsTransmitter receives responses
Retries if necessary
Transaction complete
0 1 2
0 1 2
![Page 110: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/110.jpg)
110
Receiving a Request and Sending a Response
Incoming message with Request service type
Retry/reminder bit set if a duplicate request
Buffer management APIAllocate / cancel response bufferPriority / non-priority buffer pools
Addressing of response is always implicitResponse returned to sender of request
![Page 111: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/111.jpg)
111
Application Messages vs.Network Variables
Application messages are addressed to the node as a whole
Command-driven model
Network variables provide multiple addressable entities per node
Shared data modelHigher-level semantics
![Page 112: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/112.jpg)
112
Network Variables - NVs
Application layer abstraction for data sharing
Multiple addressable data entities per deviceImplicitly addressed updates delivered via bound connections
Output NV
Output NV
Node 1 Node 2
Input NV
Input NV
Input NV
Output NV
Node 3
![Page 113: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/113.jpg)
113
Network Variable APDU
Selector mechanism provides associative addressingBound connections may have multiple input and multiple output NVs
APDU header 1 14 Network Variable Data
11 = output, 0 = inputNV Selector
1(1-31 bytes)
![Page 114: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/114.jpg)
114
Network Variable Update Message
Service typeUnacknowledgedUnack’d / RepeatedAcknowledgedAck’d with authentication
Receiving node(s) compare selector in message with selectors of their input NVsIf there’s a match, NV is updated with value from message
1 14 Network Variable Data
10 = inputNV Selector
1(1-31 bytes)
![Page 115: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/115.jpg)
115
Network Variable Poll Request Message
Service typeRequestRequest with authentication
Receiving node(s) compare selector in message with selectors of their output NVs
1 14
11 = outputNV Selector
1
![Page 116: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/116.jpg)
116
Network Variable Poll Response Message
If the selectors match, the value of the network variable is returned in a response messageOtherwise a null response is returned
1 14 Network Variable Data
10 = inputNV Selector
1(1-31 bytes)
![Page 117: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/117.jpg)
117
Application Layer API for NVsOutput network variables
Function_nv_update(int index, void *pValue, int len);
Event handler_nv_completes(int index, boolean status);
Input network variablesEvent handler_nv_update_occurs(int index, void *pValue, int len);
Function_nv_poll(int index);
![Page 118: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/118.jpg)
118
Standard Network Variable Types (SNVTs)
Network Variables provide a convenient way to share dataStandard Network Variable Types provide a consistent meaning for shared dataPhysical quantities
Mass, length, time, temperature, voltage etc.
Fixed and floating point representationsEnumeration states or modesStructured types
![Page 119: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/119.jpg)
119
Examples of Standard Network Variable Types
Temperature: -273.17 .. +327.66 degrees C (0.01 deg C)
Time Stamp:typedef struct {
uint16 year; // 0..3000uint8 month; // 1..12uint8 day; // 1..31uint8 hour; // 0..23uint8 minute; // 0..59uint8 second; // 0..59
} SNVT_time_stamp;
For latest SNVT list, see http://www.lonmark.org/PRESS/Snvt853.zip
![Page 120: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/120.jpg)
120
LonTalk File Transfer Protocol
For transferring more than a single packetWindowed application message protocol
Supports single transmitter/multiple receiversSequential or random access files
Unack’d Unack’d Unack’d Unack’d Unack’d RequestSender
ResponseWindow
Receiver(s)
![Page 121: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/121.jpg)
121
Network Management Layer
Implicit addressing mechanismsNode address assignmentConfiguration of protocol parametersApplication downloadingConfiguration of routersNetwork variable binding
7
6
5
4
3
2
1Net
wor
k M
anag
emen
t
![Page 122: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/122.jpg)
122
Implicit Addressing
How to make a complete temperature sensor in 91 bytes of application code?Application code doesn’t need to concern itself with configuring protocol parameters and device addressingNetwork configuration data structures, and mechanisms to access them, are defined as part of the standard
![Page 123: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/123.jpg)
123
Packet Structure
Each protocol layer adds its own header to the information in the packet
ApplicationData
Layer 6Layer 5Layer 4Layer 3Layer 2
Device’s network image contains all the information necessary to send and receive packets
![Page 124: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/124.jpg)
124
Managing the Device’s Network Image
Network Management Protocol is defined to Query and Update any portion of the Network ImageFor maximum flexibility, use a Network Management Tool with rich GUISelf-installing device may modify its own network image
At the cost of code size and complexity
![Page 125: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/125.jpg)
125
Data Structures For Node Addressing
Every LonTalk device contains a network configuration image
Domain TableAddress Table⌧Destination addresses⌧Group membership
Network Variable Configuration TableConfiguration Structure
Tables in writeable non-volatile memoryMay be updated over the network by network management messages
![Page 126: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/126.jpg)
126
Explicit Addressing
Application may specify destination address and layer 4 parameters
At the cost of code size and complexity
Usually used in complex devicese.g. graphical PC-based devices used for network management and user interfacing
For low-cost sensor/actuator nodes, implicit addressing is easiest and cheapest
XXXXXX
![Page 127: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/127.jpg)
127
Example: Network Variable Update Message
Transmitter needs to specify:
Preamble, beta1, beta2Priority, delta backlogSource, dest addressTransaction type
NV selectorApplication data
1234567
LonTalk Packet
![Page 128: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/128.jpg)
128
The Network Variable Configuration Table
One 3-byte entry for each network variableSpecifies network variable selector
Layer 6 header for outgoing messagesNV recognition for incoming messages
Specifies implicit address for outgoing NV messages
Output NV updatesInput NV polls
![Page 129: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/129.jpg)
129
Network Variable Configuration Table Entry
PriorityDirection
0=in, 1=out
NV SelectorTurnaround
1 if bound to NV on same node
Service Type0 = Ack’d, 1=Rept’d, 2=Unack’d
AuthenticatedAddress Table Index
For output NVs and polled input NVs
1
1
14
1
2
1
4 Points to address table entry
Layer 6 header
![Page 130: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/130.jpg)
130
The Address Table
Up to 15 entries, each 5 bytes longMay specify group membership for incoming address recognitionMay specify destination address and layer 4 parameters for outgoing messages
Pointed to by output or polled NV table entryWhen application sends a message, it may specify which address table entry to use
![Page 131: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/131.jpg)
131
Transaction Layer Timing Parameters
All address table entries contain two bytes to specify layer 4 timing parametersRepeat timer*
For unack’d/repeated service
Retry/repeat countReceive timer*
For incoming duplicate detection
Transmit transaction timer*For ack’d & request svc
4
4
4
4
* For encoding, see spec.
![Page 132: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/132.jpg)
132
Used to send to or receive messages from a group
Group size (2-64)
Domain reference (0-1)
My member ID (0-63)
Transaction layer params
Group ID (0-255)
Address Table Entry: Group Membership
= MSB of this byte must be a “1”
7
1
7
16
8
May be 0 for unack’d groupsPoints to domain table entry
![Page 133: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/133.jpg)
133
Address Table Entry: Unicast Addressing
Used to send messages to a single node
Type = 1
Domain reference (0-1)
Destination node ID (1-127)
Transaction layer parameters
Destination subnet ID (1-255)
8
1
7
16
8
Points to domain table entry
![Page 134: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/134.jpg)
134
Address Table Entry: Broadcast Addressing
Used to send messages to a whole subnet or domain
Type = 3
Domain reference (0-1)
Delta backlog (0-63)
Transaction layer parameters
Destination subnet ID (1-255)Subnet 0 means domain-wide
8
1
7
16
8
Points to domain table entry
![Page 135: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/135.jpg)
135
The Domain Table
Up to two 15-byte entries, one for each domain to which the node belongsSpecifies this node’s subnet and node IDs within the domainSpecifies the domain ID itselfSpecifies the authentication key to be used in this domainMasters of
their Domain
![Page 136: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/136.jpg)
136
Domain Table Entry
Domain ID
My subnet ID (1-255)
My node ID (1-127)
Domain ID length0, 1, 3, or 6
Authentication key
8
0, 8, 24 or 48 bits
48 bits
7
= MSB of this byte must be a “1”
8
![Page 137: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/137.jpg)
137
Configuration Structure
Physical layer parametersTransceiver typeCommunications bit rateSpecial-purpose transceiver parameters
Media access layer parametersPreamble length, beta1, beta2 etc.Number of channel prioritiesPriority assignment of this node on its channel
![Page 138: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/138.jpg)
138
LonTalk Network Management Messages
Complete set of request/response messages defined for managing the network configuration of the deviceQuery/Update Network Variable Configuration tableQuery/Update Address tableQuery/Update Domain tableQuery/Update Configuration Structure
![Page 139: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/139.jpg)
139
More Network Management Messages
Query node’s self-documentation dataAllows network management tool to read node’s external interface
Download application programProtocol defined for Neuron Chip implementations
Router configuration messagesQuery/Update routing tables, change routing algorithm
![Page 140: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/140.jpg)
140
Bootstrapping the Network Configuration
How do you tell a node what its address is?
If it doesn’t yet have an addressUnique ID addressing mode
Service PinHardware mechanism to cause the node to broadcast a message containing its unique ID
Broadcast a query request to nodesResponse message contains the unique IDInstall message to cause node to “wink”
![Page 141: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/141.jpg)
141
Network Diagnostic Messages
Query node’s statusCRC errors detectedBuffer overrunsTransaction layer errors
Query node’s traffic statisticsPackets received with valid CRCPackets received addressed to this nodePackets transmitted
Proxy addressing
![Page 142: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/142.jpg)
142
LonTalk Protocol Summary
Application
Presentation
SessionTransportTransaction
NetworkMedia Access Control
Link
Physical
7
6
5
4
3
2
1
Net
wor
k M
anag
emen
t
![Page 143: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/143.jpg)
143
Services Defined at Each Layer
Designed for cost-sensitive implementationPhysical layer
Media independent
Media access control sub-layerModified CSMA with collision avoidance and priority access
Addressing layerSupports very large networks, multiple channelsLow-cost routers for multiple subnets
![Page 144: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/144.jpg)
144
Transport and Session Layer Services
Reliable transport servicesDuplicate detection and rejectionUnicast and multicast acknowledgedUnacknowledged/repeated service
AuthenticationSecurity applications
Session layer request/response protocolUnicast and multicastAuthentication option
![Page 145: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/145.jpg)
145
Presentation Layer Services
Application MessagesDatagrams addressed to nodeFile transfer protocol for large data objects
Network VariablesMultiple addressable entities per deviceShared data-driven modelFlexible variable binding semanticsStandard Network Variable Types for interoperability
![Page 146: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/146.jpg)
146
Network Management and Diagnostic Protocols
Complete access to all protocol parameters via defined management servicesWide range of installation and maintenance scenarios
From self-installed to PC-based tools
Diagnostic protocol for network troubleshooting
![Page 147: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/147.jpg)
147
Cost Effectiveness of LonTalk Implementations
High volume low cost nodes
Transceiver
Control & protocol chip
Sensor/actuator
Sensor/actuator
Memory
Transceiver
Sensor/actuator
~$5 ~$10 ~$15
Control & protocol chip
Control & protocol chip
![Page 148: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/148.jpg)
148
Functionality of LonTalk Implementations
Higher-capability nodes
Transceiver
Sensor/actuator
Memory
Link-layer protocol chip
Microcontroller
Transceiver
Network interface
Computer
![Page 149: Implementing the LonTalk Protocol for Intelligent](https://reader030.vdocuments.site/reader030/viewer/2022020702/61fa551efefe8f020c21b574/html5/thumbnails/149.jpg)
Control Network Protocol Specification
EIA-709.1
MARCH 1998
ELECTRONIC INDUSTRIES ALLIANCEENGINEERING DEPARTMENT
EIASTANDARD
EIAElectronic Industries Alliance