the green bank telescope laser metrology software by ramón e. creager nrao
TRANSCRIPT
The Green Bank Telescope Laser Metrology Software
by
Ramón E. Creager
NRAO
Introduction
Metrology Software Components
• The ZY controls the laser rangefinder hardware
• The ZIY Service is the main Metrology process. It controls the actions of all of the ZY processes and serves as a connection point to all of the Metrology software
• The ZIY Client is a Win32 GUI program that provides the members of the Metrology Group with a convenient and powerful interface to the Metrology System
• SPAN (Status Panel) is a Win32 GUI program that displays at a glance the status of the Metrology System
• Rload is the ZY program loader.
The Metrology System is a distributed system that consists of 3 main programs, along with some lesser components:
Metrology Software Components
ZY ZY ZY ZY ZY
ZIY Service
ZIY Client ZIY Client
TCP
RPC
SPAN
TCP
SPAN
Inputs fromM&C
ServoElectronics
Embedded PC
A/DConverter
Oscillator
ZIY(ethernet)
100 MHzreference
OpticalAssembly
Azimuth drive
Elevation drive
Beam SteeringMirror
IRIG-B Detector
1.5 GHzamplifier
1 kHzamplifier
1500.001MHz
1 kHzreference
1 kHz signal
Laser780 nm, 1 mW
output
1 kHz signal
1500 MHz
Opticalisolator
Returnedsignal
Distantretroreflector
Local referenceretroreflector
ZY and ZP block diagram
The ZYControlPanel
The ZP unit
ZY Program Architecture
• DOS Application. Not a real time system.
• Foreground/background system
• Program operates a polling loop
• All time sensitive operations are handled by Interrupt Service Routines (ISR).
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
• Set up retroreflector collection
• Initialize the LM628 PID values
• Initialize phase system values
• ‘Home’ the servos
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
• ZY is a TCP server. One incoming connection is accepted. Any further requests while connected will be rejected
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
• Read any bytes in the TCP buffers.
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
• If bytes were present, they are loaded in the command buffer, which assembles complete commands from the input stream.
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
ZY Operation Startup &Initialization
Check forconnection request
Read Socket
Data Present?
Load commandbuffer
Command?
Execute commandhandler
Parse & look-upcommand
Monitor(Check state,run scheduler,refresh watch
dog)
No
Yes
No
Yes
• Checks the status of various systems
• Runs one command from the scheduler, if available
• Refreshes the watch dog timer
ZY Software Components
CommandHandlers
Command Parser& Hash Table
DOS&
Networking
Coordinatesystem
Retro-reflectorcollection
Hardware controllers
LM628Axis
Controllers
bc630ATReal Time
Clock
PhaseDetectionSystem
PIA
DAQ16
DMA16
ISR ISR ISR ISR
TCP Socket
File System
Hardware controllers: LM628 motion controllers, bc630AT clock controller, Phase Detection System (A/D and DMA controllers and phase computation), PIA (read switch positions, control state of servo amps, etc.)
To ranger hardware
ZY Software Components
CommandHandlers
Command Parser& Hash Table
DOS&
Networking
Coordinatesystem
Retro-reflectorcollection
Hardware controllers
LM628Axis
Controllers
bc630ATReal Time
Clock
PhaseDetectionSystem
PIA
DAQ16
DMA16
ISR ISR ISR ISR
TCP Socket
File System
Target system: Retro-reflector collection (database & functions), and coordinate transformation module
To ranger hardware
ZY Software Components
CommandHandlers
Command Parser& Hash Table
DOS&
Networking
Coordinatesystem
Retro-reflectorcollection
Hardware controllers
LM628Axis
Controllers
bc630ATReal Time
Clock
PhaseDetectionSystem
PIA
DAQ16
DMA16
ISR ISR ISR ISR
TCP Socket
File System
Program interface: TCP server sockets, command parser & hash table, command handlers, program main loop.
To ranger hardware
Servo System
• National Semiconductor LM628 12-bit DAC
• Heidenhain ROD 500 series, 100,000 counts per revolution incremental encoder (1 count = 13 arc seconds)
• 40 KHz pulse width modulation servo amplifier
• Inland Direct Drive DC Motor
Each axis of the ZY’s servo system includes:
Phase system
• Controls the oscillator system– Generates the reference and modulation signal that modulates
the laser and controls the mixing oscillator
• Data acquisition– Quatech DAQ16 100 KHz 16-bit A/D converter
– A/D conversion clock phase locked to the reference and modulation signal
– Data Acquisition directly to RAM using 16-bit DMA channel
• Digital Synchronous Phase Detection– Relatively insensitive to noise
– Fast. Algorithm is hand coded in 80x86 assembly language
Frequency generation
X15multiplier
100 MHzhigh stabilitystandard
Lasertransmitter
Phaselock
circuitry
Voltagecontrolled
crystaloscillator
PIN diodedetector
Coupler
Coupler
Mixer
Mixer
Control voltage
1 kHz reference
Mixer
1500.001 MHz
1500 MHz
1500 MHzreturn signal
1 kHz return signal
Retroreflector
DAQ-16 A/D Converter
8253 Counter Timer
1 kHzreturn signal
Counter 1: 1 kHz reference
Counter 0:external dataconversion clock
Counter 2:One shotexternal trigger
Phase System Software
Phase System
• The ZY software controls the data acquisition system by configuring the various components: counter timer, DMA controller, and A/D converter.
• Counter 0, data conversion clock, is obtained by dividing the base frequency of 8253 counter timer chip
• Counter 1, reference clock, is obtained by dividing counter 0
• Counter 2, data acquisition trigger, will provide a one-shot pulse on rising edge of counter 1, when armed to do so by the software.
• The DAQ-16 then performs a DMA assisted data acquisition sequence on the next cata conversion clock pulse after the trigger.
• When terminal count of DMA controller is reached, conversions stop. Data is now in memory, in DMA buffer.8237A-5 DMA Controller
DMA channel 5
A/D timing diagram
Phase CalculationOnce the data samples are obtained, a digital synchronous detection method is used to compute the phase of the fundamental harmonic of the returned signal, along with its amplitude. First, the Fourier cosine and sine components of the digitized return signal are calculated:
The signal amplitude and phase can then be calculated:
Phase Calculation OptimizationsWhen this method was chosen, our single board computers sported a 10 MHz 80286 processor with a 80287 numerical co-processor. To obtain the best possible performance from this hardware, we performed the following optimizations:
• Algorithm hand coded in x86 assembly language.
• Because the sampling clock is phase locked to the reference clock, the sample points are known in advance. Sine and cosine tables can thus be pre-calculated and used instead of the sin() and cos() functions.
• To minimize floating point operations, equations 1 and 2 were re-written as follows:
This reduces the number of floating point by a factor of m . In practice, this resulted in a significant improvement in performance of the code, as typical values for m usually exceed 100 cycles.
ServoElectronics
Embedded PC
A/DConverter
Oscillator
ZIY(ethernet)
100 MHzreference
OpticalAssembly
Azimuth drive
Elevation drive
Beam SteeringMirror
IRIG-B Detector
1.5 GHzamplifier
1 kHzamplifier
1500.001MHz
1 kHzreference
1 kHz signal
Laser780 nm, 1 mW
output
1 kHz signal
1500 MHz
Opticalisolator
Returnedsignal
Distantretroreflector
Local referenceretroreflector
Removal of Electronic Drift
ServoElectronics
Embedded PC
A/DConverter
Oscillator
ZIY(ethernet)
100 MHzreference
OpticalAssembly
Azimuth drive
Elevation drive
Beam SteeringMirror
IRIG-B Detector
1.5 GHzamplifier
1 kHzamplifier
1500.001MHz
1 kHzreference
1 kHz signal
Laser780 nm, 1 mW
output
1 kHz signal
1500 MHz
Opticalisolator
Returnedsignal
Distantretroreflector
Local referenceretroreflector
Removal of Electronic Drift
ServoElectronics
Embedded PC
A/DConverter
Oscillator
ZIY(ethernet)
100 MHzreference
OpticalAssembly
Azimuth drive
Elevation drive
Beam SteeringMirror
IRIG-B Detector
1.5 GHzamplifier
1 kHzamplifier
1500.001MHz
1 kHzreference
1 kHz signal
Laser780 nm, 1 mW
output
1 kHz signal
1500 MHz
Opticalisolator
Returnedsignal
Distantretroreflector
Local referenceretroreflector
Removal of Electronic Drift
Timing System
• The ZY uses an IRIG-B timing signal to synchronize its operations with other rangefinders and the ZIY.
• A Bancomm bc630AT Real Time Clock is responsible for decoding the IRIG-B.
• The ZY keeps time using an MJD clock which is maintained by an ISR that responds to the bc630AT’s 1PPS interrupt. Sub-second time data is obtained directly from the bc630AT.
• Time is encoded in a ‘double’ data type (a 64 bit floating point value). It is good to 0.5 millisecond. The integral portion is the MJD, and the fractional portion is the elapsed portion of the current day.
Retro-reflector Collection
• Retro-reflector objects (class CCube and derivatives) hold data and procedures needed by the ZY to correctly target and measure each retro-reflector:– Name of retro (all retros are specified by name)
– Location of retro
– Coordinate object for retro
– Composition and orientation and other calibration data of retro-reflector
– Procedure for ZY to illuminate retro with laser
• There is one retro-reflector object in the collection for each actual retro-reflector on the telescope
• Retro-reflector collection stores retro objects in EMS 4.0 memory
ZY Coordinate System
• Provides the azimuth and elevation encoder values to allow the servo system to illuminate a target with the laser beam
• Coordinate objects (class Coordinate) are contained in the retroreflector objects, one per retro
• Static portions of class Coordinate maintain the ZP’s location, orientation and calibration data
• Coordinate objects perform lazy evaluation of az/el values. No calculation is performed unless needed, and results are cached. Recalculation of az/el values for a retro-reflector occur only if one or more of the following values change:– Location of retro
– Location or orientation of ZP
– Calibration values of ZP
Finding a Target
• XYZ position of ZP
• Orientation of ZP
• ZP Calibration values • XYZ position of Target
Finding a Target
• XYZ position of ZP
• Orientation of ZP
• ZP Calibration values • XYZ position of Target
Finding a Target
• XYZ position of ZP
• Orientation of ZP
• ZP Calibration values • XYZ position of Target
Finding a Target
• XYZ position of ZP
• Orientation of ZP
• ZP Calibration values • XYZ position of Target
ZY Interface
• Most commands received from TCP Server socket
• Commands can also be read from files
• ASCII command and data interface (mostly)
• Asynchronous interface. Commands are executed as soon as possible; if ZY is busy, they are queued up.
• All commands can be scheduled for deferred execution. Start time, interval, iterations can all be specified. The execution of these commands can be cancelled at any time prior to their next execution time.
• There is a 0 to many relationship between requests and responses. That is, the ZY can generate a response even if no command is received, and can generate multiple responses to one received command.
ZY Interface
• Architecture independence. An ASCII interface sidesteps the issues of data representation in hardware (big/little endian, memory alignment, etc.)
• Simple. Using an ASCII interface allows command structure to be flexible, command delimiter cannot be confused with data, etc.
• Human readable. Command names are mnemonics for their function, and parameters are readable.
• Convenient. New commands can be tested using a readily available telnet terminal. The terminal can also be used to troubleshoot interactions between the ZY and its client.
Why ASCII?
ZY Interface
Command String Format:
Measuring a Range
• Initialize the ZY– Set the clock (STI)
– Initialize the Coordinate System (BP etc.)
– Initialize the retro collection (INI)
– Initialize the retros (COO)
– Turn on poser supplies (PS)
– Initialize the Servo Systems (AXIS, FLT, WMD, FHM etc.)
– Initialize the Phase System (CYC, SFQ, IFF etc.)
– Make sure the ZY is in Auto mode
Measuring a range using the ZY requires the following steps:
• Measure cube (CMEAS):– ZY obtains az/el values for
cube using coordinate system
– Illuminates target with laser
– Waits for servo system to settle
– Acquires the data
– Computes phase
– Computes distance
– Returns results
ZIY
• Windows NT 4.0 Service– No user intervention
• Client to ZY– One TCP client per ZY
– One thread per ZY client
– Exposes full functionality of ZY
• Provides the interface to the entire Metrology System– ONC RPC interface
– Architecture independent interface
– Server Callbacks
– Uses RPC++ library from M&C
ZIY RPC Interface
• Requirements of the interface– Architecture independent
– Asynchronous (either side can initiate communications)
– Fast
– Always remains responsive
• Implementation of interface– ONC RPC. Though a Sun “standard”, ONC RPC libraries exist for NT.
The ZIY uses the ONC RPC library ported to NT by Martin Gergeleit.
– The interface uses a Server Callback configuration.
– Interface thread does the minimum, placing requests in a queue and returning immediately.
Traditional RPC
Standard Synchronous RPC client/server model:
Client process
Server process
Client Execution blocked
Server busy
Network
request
service
reply
The Server Callback interface model
Asynchronous Server Callback RPC model:
Client process
Server process
Network
RPC Client task RPC Server task
RPC Client taskRPC Server taskRequest handler
task
request ack. request to return data ack.
TID: Matching returned data to request
TID = Transaction ID
Client process
Server process
Network
RPC Client task RPC Server task
RPC Client taskRPC Server taskRequest handler
task
request ack. (TID)request to return data
(with TID)ack.
request
TID
Request (with TID)
Data Flow in the Metrology System
ZIY Client(Win32 Application)
ZIY Service(NT Service)
ZY(TCP Server)
ZY ZY ZY ZY ZY
TCP Connection
Request Client(RPC Client)
Request Server(RPC Server)
TID Register ClientRequest
ZY TCP Client Collection
Request Queue Main ZIY Module Result Queue
Callback Client(RPC Client)
Callback Server(RPC Server)
ExcelDCOMMain Client Module
(GUI, etc.)
TID
DCOM Automation
Client
Result Queue
Data Queue
Status TCP ServerStatus Panel(TCP Client)
System Startup and Initialization
• The system is insensitive to the startup order of its components
• Software can be upgraded remotely
• Initialization files can be administered remotely
• The system can recover to a known state from a power outage without user intervention
• A ZY can easily be taken off-line for maintenance without disturbing the rest of the system
• A ZY that hangs re-starts itself automatically (15 second watch dog timer)
• The ZP instruments are interchangeable
ZY System Startup and Initialization
Boot DOS
rload.exe runs
zy.exe
ZY Ready
Anon. FTP Host
FTP: get zy.exe
zy.exe
FTP: get init files
init files
INIT Files:
ZYXXX.INI: ZY data
ZPXXX.INI: ZP calibration data
Metrology FTP File Hierarchy
ZYXXX.INI
ZPXXX.INI
ZIY Startup and Initialization
Main thread start
Read Registry anddatabases
Launch threads(one for each ZY,
RPC server,callback client, etc.)
Handle requestsfrom client
Terminate?
End
yes
no
ZY thread start
ICMP ping ZYhost
Response?
Connect toZY host
Success?delay
Handle ZYcommunications
Connectionclosed?
Quit?
ZY thread end
no yes no
yes
yes
yes
no
no
Status Panel
Tools, Technologies, Libraries, etc.
The Metrology System software development has made extensive use of various programming languages, libraries and APIs, hardware, programming tools, and documentation tools.
Hardware
• AMD 5x86 133 MHz CPU running MS-DOS 6.33
• 8259A Interrupt Controller
• 8237 DMA Controller
• 8253 Counter Timer
• 8255A I/O adapter
• LM628 Motion Controller
• Bancomm bc630AT RTC
• Quatech DAQ-16 A/D Converter
• Trenton Technology DP2GX Dual Pentium III 500 MHz Processor SBC running Windows NT 4.0
ZY ZIY
Programming Languages
• 80x86/80x87 Assembly Language
• C
• C++
• Visual Basic for Applications
Libraries and APIs
• Win32 API
• DOS API
• EMM 4.0 API
• TCP/IP
• ONC RPC (rpcgen, XDR, etc.)
• COM/DCOM
• OWL (Borland)
• M&C: RPC++ and others (NRAO)
• FFTW (MIT)
• STL
Programming Tools
• Borland assembler, compiler, linker, debugger, make
• NuMega BoundsChecker NT (memory use and API use debugger)
• Premia Codewright (editor)
• Microsoft SourceSafe (revision control)
Documentation Tools
• LaTeX
• Win/Win32 Help
• Premia DocWright (HTML)
• Even PowerPoint!