next up previous contents
Next: Servo System Up: System Overview Previous: ZP ranger hardware   Contents

ZY ranger software

The ZY program is a DOS program. Like most DOS programs that are not provided with a linked-in real time kernel, it runs in a Foreground/Background mode, as shown in figure 2.2[10]. The application's main thread runs through an infinite loop, calling modules, checking for events from the hardware, checking for data in queues, etc (see figure 2.4). Asynchronous events are all handled by Interrupt Service Routines (ISR) which interrupt this main loop (and each other, depending on their relative priority) when an external hardware event occurs (such as a 1PPS signal from the Bancomm Real Time Clock). When the ISR is finished executing, the program flow of the background main thread (or another interrupted ISR) resumes exactly where it left off.

Figure 2.2: Foreground/background system.
\begin{figure}%% Background/foreground system diagram
\setlength{\unitlength...
...(265, 57){\Large Background loop code execution}
\end{picture}
\end{figure}

Thus, even if some event is made ready by the ISR, the main loop must execute through its preset course before it can get to it (this is in marked contrast with a real time system, where execution after an ISR always returns to the highest priority task that is ready to run, not necessarily the one that was interrupted). Because of this, ISRs in a Foreground/Background program tend to be longer, as they must perform all of the time critical operations necessary for the device they service themselves, rather than just doing the bare minimum and leaving the rest to a high priority task that they have made ready-to-run. All of this means that the ZY, though fast, is not a real time system. Worst case latencies are determined by how long it takes to execute through the main loop, and as soon as the main loop is modified, these times change. Setting priorities for the handling of events can be done only with some difficulty. On the other hand, provided real time performance is not really needed, this program model is simpler and can be quite effective. The ZY program consists of the following sub-systems (see figure 2.3):
Program I/O
A user can access the ZY through the I/O interfaces provided by DOS (console, file system) and through the TCP/IP network I/O interface provided by the FTP Software PC/TCP TCP/IP stack. The console (local keyboard and monitor) and the TCP/IP interfaces are mutually exclusive: The ZY must be started interactively from the DOS prompt with a command line switch (-c) present for it to revert to console I/O, as follows:
  C:\>zy -c.
When started with this option, the ZY will not read the TCP/IP socket interface. Thus, this option is only used for troubleshooting and testing purposes. The TCP/IP interface is the default, and is provided as TCP sockets at ports 5240 and 5241. While in both input modes (console and TCP/IP), the ZY can also read batch files of ZY commands through the INITZY command.
Command interface
Commands are issued to the ZY using ASCII strings that contain (among other things) a command name and parameters (see section 2.10). A complete command string is fed to a command/parameter object, which breaks the string down to its components and makes them available through the command/parameter object's interface. The command name is then run through a hash table, and if a match is found a pointer to a command handler specific to that command is returned. If no match is found, then the hash table returns a pointer to a default handler. Whichever handler is returned is then executed, with the command/parameter object as the handler's only parameter object (see figure 2.9).
Retroreflector collection
This is a collection of retroreflector objects, each one representing one actual retroreflector target. Each retroreflector object contains the data required to aim the laser to the retroreflector, collect data from the retroreflector, and calculate a correct range to the retroreflector. In addition, each retroreflector object has direct access to the hardware controllers, to enable it to do the job required of it.
Coordinate system
Coordinate objects exist for each retroreflector object. These objects contain the coordinate parameters necessary to transform from an outside coordinate system to the local polar coordinate system used by the ranger to illuminate the retroreflector. In addition, temporary coordinate objects can be created by any part of the program to perform coordinate transformations as needed. All of these objects draw on coordinate transformation code common to these objects, and on static data specific to each rangefinder.
Hardware controllers
The hardware controllers all consist of classes and associated ISRs that control the operation of the rangefinder's hardware, and through which all commands to the hardware must go and all data from the hardware is received. The main hardware controllers are:
LM628 Axis Controllers
The two servo axes of the Beam Steering Mirror system (see figure 2.1) are controlled by two of these objects, one per axis.
bc630AT Real Time Clock
The ZY has a Bancomm bc630AT Real Time Clock that is used for two distinct purposes: To maintain a Modified Julian Day (MJD) clock for the purpose of providing time stamps, and to generate a very accurate heart beat for functions that require precise timing (such as tracking a retroreflector). The Real Time Clock object sets up the bc630AT, starts the MJD clock, and provides an interface from which time stamps may be obtained.
Phase System
The phase system object is in many ways the heart of the ZY software. Its job is to trigger data acquisition, retrieve the resulting data and from this data calculate the phase displacement and magnitude of the returned signal. To do this, it makes use of two other hardware controller objects, the DAQ16 A/D controller, and the DMA16 DMA system controller. The DAQ16 object provides an interface to the A/D hardware used by the ZY. Through it, all aspects of the operation of the A/D hardware are controlled. The DMA16 object provides an interface to the embedded PC's 8237-5 DMA controller, and also sets up the DMA buffer used by the A/D hardware to store its samples.
PIA
The ZY has a Peripheral Interface Adapter (PIA) which is used for miscellaneous applications: driving relays to turn on or off hardware such as the power supplies, servo amplifiers, etc., reading front panel switch positions, reading the lock indicators on the oscillators, and so forth.

Figure 2.3: ZY Software System Block Diagram.
\begin{figure}%% ZY software system block diagram
\setlength{\unitlength}{1pt}...
...{\shortstack{\large Coordinate\\ \large system}}
\end{picture}
\end{figure}

Figure 2.4: ZY Main Loop Flowchart.
\begin{figure}
\setlength{\unitlength}{2em}
\begin{picture}(18.000000,29.00000...
...0}}
\put(4.0000,-11.0000){\vector(1,0){4.0000}}
\end{picture}
\end{figure}


next up previous contents
Next: Servo System Up: System Overview Previous: ZP ranger hardware   Contents
Ramon E. Creager 2002-03-11