Remote Control of Test Equipment Using Distributed Objects

A talk by Timothy L. Tomkinson of COMPANY: Northrop Grumman at Tcl2008.

Typical test stand: operator PC, connected to:

  • Database
  • CompactPCI
  • VME
  • Ethernet
  • ControlPC

Control PC :

  • GPIB
  • RS-232
  • USB
  • ...

Custom Middleware: create custom client server applications. Need to know network programming on different platforms. (Steep learning curve on some platforms/languages). Need to define network protocol and message structures (separate code required to encapsulate and extract messages; tedious to maintain). Expensive.

Off the shelf solutions, ala CORBA (Common Object Request Broker Architecture). Platform-independent infrastructure for communication over a network. Messages are defined using a generic Interface Definition Language (IDL). IDL compiler generates client and server objects. Client object used to connect to server object and execute remote method calls. Method arguments, return values, and exceptions are encapsulated and extracted automatically according to IDL. ORB (Object Request Broker) provides main event loop processing and message dispatching. Very complicated, very expensive.

(... showed diagram of CORBA architecture ...)

Tcl Distributed Objects:

  • "Remote" class manages infrastructure
  • Target objected created on server
  • Introspection used to generate local object
  • Local methods and procedures replaced with remote method calls
  • Operations on local object transparently executed on target object

Advantages:

  • No IDL compiler (client and server objects created at runtime from a single incr Tcl class
  • No ORB (used tcllib comm package)
  • Transparency (itcl class does not need to be modified to run remotely); other than startup code (~2 lines), client app is not aware that local object is running remotely

Used Ffidl package to call shared libraries. Allows Tcl to write C functions (DLLs on Windows; .so on Unix). Eliminated the need to write Tcl extensions. Ported to VxWorks. Uses VxWorks symbol table and allows direct calls to kernel and user modules there. Wrapper class created for each library to provide object-oriented interface.

Layers:

  1. Hardware device
  2. Shared libraries/drivers
  3. Ffidl acts as bridge between Tcl and C
  4. Library wrappers provided OO interface to shared libraries
  5. Device drivers written in object-oriented Tcl
  6. Test scripts written in procedural Tcl

(... showed sample itcl code for device driver class ...) Command table contains method names vs command strings. Initialization code creates public methods for each command. Public methods call the same private method to write to device. Same concept used for query commands.

Server side code:

 % # start the server
 % package require Remote
 % Remote::config -port 5000 -local 0

Client side (sans comments that were on the slide--elided due to lack of time to copy them--MC):

 % package require Remote
 % set remote [Remote #auto $hostname 5000]
 % $remote send "package require PowerSupply"
 % set ps [$remote new PowerSupply]
 % $ps reset
 % $ps voltage 5.0

Conclusion:

CORBA paradigm very easy to implement in Tcl. Itcl provides all necessary object-oriented extensions. Tcl's introspection facility eliminates need for IDL files. Comm package provides robust remote procedure calls. Ffidl is perfect for controlling hardware. Tcl's portability allows seamless control across multiple platforms. Distributed object architecture provides rapid development. (Code can be tested and debugged on local PC. To deploy, only a few extra lines are needed.) ...