01-Feb-2007 Dietrich Beck, GSI
LabVIEW DIM-InterfaceLabVIEW DIM-Interface
Motivation
Event and DIM Basics
Idea of LV-DIM Interface
Example
Performance
01-Feb-2007 Dietrich Beck, GSI
MotivationMotivation
• Large Distributed Systems: One would like to get rid of node names as much as possible.– nodes might change or are replaced– processes might migrate from node to node– where is myResource?
• Need to avoid central bottle-necks.– peer-to-peer connections required– management of many connections can be tedious
• Required– full bandwidth of Ethernet– short latency time
• Can't use protocols or TCP/IP implementation provided by NI
01-Feb-2007 Dietrich Beck, GSI
Bad Example: Bad Example: CS CS commands prior to 3.00commands prior to 3.00
LabVIEW message queue or notifier
Caller Callee
node1 node2
Client_node2 Server_node1
LabVIEW TCP/IP
or(!)
callee@node2 callee@node2
DIM TCP/IP
01-Feb-2007 Dietrich Beck, GSI
Event basicsEvent basics
• an entity waits for the next event, no polling!
• timeout handling is an important issue
publisher
subscriber subscriber subscriber
client client client
receiver
observer pattern: "one-to-many" command pattern: "many-to-one"
datacommand
example: radio, televisionadded in CS 3.0
example: typical human communicationsole possibility for CS < 3.0
01-Feb-2007 Dietrich Beck, GSI
DIMDIM• Distributed Information Management: www.cern.ch/dim
• Maintained at CERN and available via GPL. Thanks to C. Gaspar et al.
• originally developed at DELPHI@LEP/CERN around 1991
• available for a multitude of platforms and languages
• light-weight, aiming at high performance, based on TCP/IP
• today: "backbone" of control systems for LHC experiments
• concept: named services, peer-to-peer connections
DIM server A
DIM server B
DIM client 1
DIM client 2
service "i"
service "ii"
command "iii" DIM name server(negotiates connections)
01-Feb-2007 Dietrich Beck, GSI
Concept of "Named Services"Concept of "Named Services"
• A DIM service is identifier by its name.• A DIM service may exist only once within a DIM domain (If a DIM
server tries to declare a service that already exists, the server is excluded from DIM.).
• Once declared, a service has a fixed type and size (except command services).
• A DIM service can be removed and re-declared.• When subscribing to a service, the DIM client neither needs to know
the name of the DIM server nor the node name.• Once subscribed, DIM automatically (re-)connects the client to the
service or informs the client if the service is not available.• In mixed environments (little/big endian), DIM takes care about byte
and word swapping.
01-Feb-2007 Dietrich Beck, GSI
Example for a C/C++ ApplicationExample for a C/C++ Application
DIM dll/so, C. Gaspar, CERN
myApplication
• "serve by routine"– myApplication provides and registers callback functions to DIM
– DIM executes callback functions of myApplication
• "serve by buffer"– myApplication provides memory and registers addresses to DIM
– DIM writes/reads to/from memory of myApplication
uses • write/read memory
• uses callback functions
01-Feb-2007 Dietrich Beck, GSI
Using DIM with LabVIEWUsing DIM with LabVIEW
• Difficulties: – LabVIEW does not allow direct execution of code from external
applications (VI Server is not performing enough)– using shared memory would require polling
• Solution: DIMWrapper library written in C– provides callback functions for DIM– callback functions copy data received from DIM to a LabVIEW
message queue or notifier– LabVIEW applications receive data from DIM via message
queue or notifier
01-Feb-2007 Dietrich Beck, GSI
New (!) LabVIEW-DIM interfaceNew (!) LabVIEW-DIM interface
DIM dll/so, C. Gaspar, CERN (dedicated patch for LabVIEW)
DIM Wrapper dll/so, GSI LVEvent dll/so, GSI
LabVIEW runtime engine, NI
LabVIEW application
• "serve by routine" only using call back functions with DIM• uses "native" DIM libraries (no re-write)• client and server functionality for commands and services• DIMWrapper (and LVEvent dll) are required to make use of the DIM
callback functionality
01-Feb-2007 Dietrich Beck, GSI
DimWrapper
Example: Change for Example: Change for CS CS commandscommands
LabVIEW message queue or notifier
Caller Callee
node1 node2
Client_node2 Server_node1
LabVIEW TCP/IP
Caller Callee
node1 node2
old:
new:
or(!)
callee@node2 callee@node2
callee DIM TCP/IP
01-Feb-2007 Dietrich Beck, GSI
ConclusionConclusion
Pros
• LabVIEW-DIM interface provides excellent performance
• no longer care about node names
• based on robust and well established protocol
• using pre-compiled binaries (no re-implementation in LV)
Cons
• no longer pure LabVIEW
• requires experience with message queue or notifiers
• requires use of "typecasts"
Outlook
• DIM-XControls for LabVIEW 8.20 (tomorrow, D. Beck)
• DSC-IO server for LabVIEW 8.20 (tomorrow, H. Brand)
• slight changes of LVEvent library for LabVIEW 8.20 probable
Top Related