Enhanced Machine Controller Antenna Range (EMCAR)

HTML Document Revision 1.1, Date: 2016-01-16

(EMCAR Screenshot)

References

1. http://www.linuxcnc.org/

2. http://www.w1ghz.org/antbook/contents.htm

3. “Antenna Handbook,” Y.T.Lo / S.W.Lee, Chapter 32, “Measurement of Antenna Radiation Characteristics on Far-Field Ranges,” E.S. Gillespie, 1993, Van Nostrand Reinhold

4. IEEE Standard Definitions of Terms for Antennas, IEEE Std. 145-1982, IEEE, New York, NY

5. ANSI/IEEE Standard Test Procedures for Antennas, ANSI/IEEE Std. 149-1979, IEEE, New York, John Wiley distributors.

6. “Linux Programming Unleashed.” Wall, Watson, and Whitis, 1999, Sams

7. Sourceforge download site for EMCAR, http://sourceforge.net/project/platformdownload.php?group_id=218196


Introductory Notes

EMCAR is the Enhanced Machine Controller-based Antenna Range. This set of codes and documentation is intended to assist the interested party in setting up an automated antenna measurement capability (i.e. Antenna Range) using non-specialized hardware and free software.

This measurement capability may be of interest to antenna experimenters, science and engineering educators, researchers, amateur radio operators, Wi-Fi antenna enthusiasts, and others. The EMCAR system can be implemented without spending a lot of money. As such, the system serves to establish a fundamental capability for the measurement of antenna radiation patterns--rather than to push the state-of-the-art in antenna measurements. We'll save that for the next release!

The system is based on the LinuxCNC motion controller to take advantage of the excellent work done by its development team. LinuxCNC provides a real-time motion control solution that achieves a high degree of mechanical position accuracy and precision; the performance may be further enhanced using backlash compensation, if required.

The LinuxCNC system enables interfacing to several types of motor control circuits from industrial CNC machine tool motor drives to small homebrew motor controls. These motor controls may include a closed-loop servo motors with encoder feedback, as described herein, or open-loop stepper motor systems. Since the LinuxCNC system is used in production CNC machining applications, its accuracy and reliability are proven and thus suitable for use in the antenna measurement application where these characteristics are required.

The LinuxCNC application is programmed for CNC operations through the G-Code language, this open standard is documented in RS274. One feature of LinuxCNC's G-Code interpreter is it enables calls to external programs via M-word commands; this interface is employed in the EMCAR application for the initialization and subsequent access to an external RF measurement subsystem. This forms the heart of the EMCAR system.

Combining the proven LinuxCNC application with a custom RF measurement application yields all the computer controls needed for measurement of antennas in a variety of coordinate systems. Each mechanical axis may defined as either linear or rotational; so, planar or polar measurements of antenna data are possible. The development EMCAR system is directed toward traditional far-field antenna measurements. This introductory implementation employs a single-axis rotational system (i.e. an Azimuth-Only system).

The measurement sequence is programmed using the native language, G-Code, and the measured antenna data are stored in the user's own format. Since the G-Code offers complete flexibility in motion control, the user is in complete control of their measurement sequence. The possibility of measuring on irregular grids, using variable measurement increments, or measurements made through a trajectory, are thus enabled. Mechanical repeatability of an established measurement sequence (I.e. a G-Code program) is also assured--similar, in as much as one might expect a CNC-machined part to be made accurately, time after time.

The initial EMCAR development system employs a client/server model using TCP/IP socket programming, enabling the system to be potentially spread over a network. The benefit of this will be the ability to employ wireless data connections between the computer running the LinuxCNC (motion control) application and the RF measurement subsystem and computer, if needed. (There should be no problem meeting the far-field criteria for antenna measurements.) This is an improvement over traditional systems that required massive cabling between measurement components, both in terms of ease of use and in materials costs. Remote display of the EMCAR application may be made using normal X-Windows protocols over the network.

All this flexibility does come at some cost, however. Presently, the system requires stopping at each measurement point while the measurement data are triggered and recorded. Perhaps, with some help from the gurus of LinuxCNC and the HAL, the measurements can be made "on-the-fly" in the future? In any case, the EMCAR system offers an elegant and simple means of programming an antenna measurement acquisition for making automated measurements of antenna radiation data.

The EMCAR system features a real-time display of the measured data, thus providing feedback on the progress and results of the measurement. This feature is implemented using gnuplot under program control.

The hope is that this project will find use in both the amateur and professional arenas of antenna development. The cost of entry for this system is low, thus enabling private individuals, small businesses, educators, and poorly funded research organizations to focus on RF and microwave equipment, rather than motion control and antenna data presentation software.

Of course, there is still a place for the full-up, turnkey, antenna measurement solutions that are offered by our favorite vendors--they will provide product support, and added-value services with their product solutions. But, the EMCAR solution is about doing more with less, doing it yourself, and learning something along the way. So, enjoy!

A more in-depth description of the system, complete with references, a working measurement configuration, and measured data are described in the following pages. Finally, a request is made for the participation of "real" computer programmer to enhance or re-write the codes used in this initial project to make the application more robust, maintainable, and upgradeable for future enhancements.

Antenna Measurement Requirements

It is desired to measure antenna radiation data using standard coordinate systems and to present the data using commonly used formats to enable broad use of the data. While this statement appears somewhat broad, it does point us in some specific direction for setting up the EMCAR system. To get right to the point, a target measurement coordinate system is selected for the initial EMCAR system.

Coordinate System and Units

We choose a spherical coordinate system, based on IEEE Std. 149-1979, depicted below. And we expect to present recorded antenna data in units of Degrees and Decibels.

(Spherical coordinate system)
Illustration 1: Coordinate System for Antenna Measurements



An Initial Single-Axis Measurement System

Development of the EMCAR system employs the use of a single-axis antenna positioning system. A block diagram of the development system is shown below, for reference.

(Antenna range block diagram)
Illustration 2: Antenna Measurement System Block Diagram




Process of Procedure

In order to get the system up and running, the following steps, at a minimum, are suggested. Alternate approaches will also work; for example, there are more than one way to install a working LinuxCNC system. The final outcome, no matter how it is reached, should be a working LinuxCNC system. The process starts by installing the LinuxCNC system, as described below.

LinuxCNC Installation and Configuration

Installing LinuxCNC

The installation process for the LinuxCNC system has been made quite simple by the developers and maintainers through the use of an LinuxCNC LiveCD. The ISO image for the LinuxCNC LiveCD is found at the URL: http://www.linuxcnc.org .


Important Note Regarding Latency

Before committing to the installation of the Ubuntu/LinuxCNC system one should perform a latency test on the target machine to establish if the real-time performance is sufficient, or not.

Some computers are problematic and consistently generate real-time latencies on the order of several 10s or 100s of microseconds; laptop computers are especially subject to this problem. High latencies will render the real-time performance of a motion control system nearly useless and thus present a barrier to the successful implementation of the EMCAR system.

A test suite of programs is available for testing the real-time performance; these are referenced in the LinuxCNC web pages and wiki site (and so are not reproduced here).

Configuring LinuxCNC

This process will depend entirely on the type of motor driver and feedback device is use in the target system. That is, whether a servo system or, perhaps, a stepper motor driven system is employed. The development system employs a servo-motor with gear reduction and encoder feedback. The motor drive circuit is a home-made PWM controller; this circuit is controlled via LinuxCNC using the PC's parallel printer port.

For general information on LinuxCNC, refer to the main web site at http://www.linuxcnc.org/.

For more specific information, such as computer requirements, supported motion control hardware, configuration and use information see:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?LinuxCNCKnowledgeBase

The specific motor control used in the EMCAR development system is described at the URL:http://emergent.unpythonic.net/projects/01142347802 and http://emergent.unpythonic.net/projects/01148303608.

Physical wiring connections between the motor, encoder, and computer running LinuxCNC are shown at the above web site. These connections are employed for the development EMCAR, similar as is shown on the web site, though only a single channel is presently used. However, the circuit provides two channels of PWM control and two channels of encoder feedback. Thanks to Jeff for sharing his PCB design, in addition to his work on the LinuxCNC!

The power supply used is a simple 12V battery or DC power supply, as appropriate.

Note that this relatively low power circuit can be easily replaced by a commercial PWM driver circuit to offer vastly higher motor drive capacity. Remember, the LinuxCNC system is controlling large machine tools on a regular basis; it is the motor and driver circuit combination that will set the load capacity of a specific motion control system.

Once the electrical connections are made, the configuration of LinuxCNC is completed with a configuration (.ini) file that is tailored to the mechanical system's characteristics. This file describes the limits on acceleration and velocity, it sets the PID loop parameters, user GUI interface preference, encoder feedback, and practically all critical features of the system. (The soft limits placed on a rotation axis will even prevent your RF cable from being wrapped around the positioner!)

One may expect to spend some time in tuning the PID parameters to achieve the desired system response—without sending the system into oscillation. Tuning hints are available on the LinuxCNC web site and elsewhere on the internet, of course.

One additional file describes the hardware connections to the computer via the Hardware Abstraction Layer (HAL). Example configuration files, (.ini file) and HAL (.hal file), are provided for the case of the EMCAR development system, below.

/home/bob/EMC_Antenna_Range/1st_submit/LinuxCNC/configs/emcar-servo/etch.ini

/home/bob/EMC_Antenna_Range/1st_submit/LinuxCNC/configs/emcar-servo/etch.hal

Depending on the motor/driver and feedback device used, the above configuration files may, or may not, be of any use. However, additional configuration examples are available within the LinuxCNC distribution, itself, and on the web at the LinuxCNC site. In addition, the LinuxCNC mailing list is active with LinuxCNC users who are quite knowledgeable, experienced, (and busy) and generally quite willing to help their users.

Aside

The present thinking on this project is that once the user finds the ease with which one can make antenna measurements using LinuxCNC, he or she may decide they need a little CNC machine to make antenna parts! Or, they may need a CNC mini-mill that serves to make printed-circuit boards (without chemicals) by using Eagle (http://cadsoft.de/) and the excellent pcb-gcode program (http://groups.yahoo.com/group/pcb-gcode/). The PWM motor driver circuit employed in the development EMCAR system was made using these (free) tools.

LinuxCNC Configuration Summary

To summarize the steps needed to get LinuxCNC up and running:

1. Download and burn a copy of the LinuxCNC LiveCD. Boot the LiveCD and try the Ubuntu and LinuxCNC systems on the target computer. Also, test the real-time performance of the target computer. Install the LiveCD with LinuxCNC included on the target computer system; this produces a working Ubuntu distribution of the Linux operating system with an LinuxCNC icon (Chips) on the Desktop.

2. Build or purchase a working motor control circuit(s) and motorized platform suitable for mounting an Antenna Under Test (AUT). If the motor driver is a servo type system, we also implemented high resolution position feedback, or encoders.

3. Select and modify a configuration file for use with the new system from those available, either on the web or from the LinuxCNC distribution CD. Make entries in the .ini file for each axis in the system and adjust the .hal file to accommodate any special connection to the parallel port.

4. Tune up the control system to establish the PID loop parameters required for stable and accurate operation in each of the available axes. Recall that in the EMCAR development system presented, only a single axis is employed.

5. Saved and backed-up the configuration files.

These steps yielded a working LinuxCNC system that will accept and run standard G-Code programs and is, therefor, suitable for use in the EMCAR system for making antenna radiation pattern measurements.

RF/Microwave Subsystem

A stable and functional RF/Microwave Subsystem, henceforth referred to as the RF subsystem, is required in order to establish a stimulus and response measurement at each desired data point. Several possibilities exist for the RF subsystem, including Scalar and Vector Network Analyzers (VNA), a generic signal source or transmitter used with a linear detector, logarithmic detector, or a specialized receiver can be used. Or, perhaps, a new Precision Network Analyzer (PNA) could form the basis of the RF subsystem.

In any of the cases listed above a computer program must be written to trigger and record the antenna data when requested by the EMCAR system controller (I.e. the LinuxCNC process running the user's G-Code program). A working example program is provided as a proof-of-concept for the EMCAR system and it represents one of the author's measurement setups. A description of the RF subsystem employed in the EMCAR development system follows.

RF Subsystem Example

For the development system, an amplitude-only measurement system is presented. Please note, however, that this framework for making antenna measurements is fully capable of making amplitude and phase measurements versus either angle, or linear axis translation, or any combination thereof.

The RF subsystem employs a VNA with internal frequency source, the network analyzer is the HP8754A with the HP8748A Test Set. The VNA provides an analog output of the ratioed data (i.e. Measurement channel / Reference channel) that is calibrated in units of decibels per volt (dB/V); this output is used in conjunction with an inexpensive analog to digital (A/D) converter to provide digital data to the measurement computer. The A/D converter may be either of the Dataq models, DI-194 or DI-194RS. Both of these units provide four (4) channels of A/D data for a price of about $0 to $30. The units are connected to a standard RS-232 interface on the measurement computer, thus completing the required data path to get the RF data to the measurement system computer.

This generic A/D process can easily be adapted to other types of detector systems. For example, the logarithmic detectors based on the Analog Devices AD8307, AD8313, or similar devices, could be used in place of the scalar or vector network analyzer. Similarly, an amateur radio operator might substitute a meter output from his or her radio as an input to the A/D to obtain relative signal strength--depending on the features of the specific radio, of course.

Depending on the network analyzer, the data might simply be read in digital form directly from the machine for the greatest accuracy and resolution. Network analyzers of this type might include the HP8510 , the HP8753, HP8756, HP8757, among others. Scalar and vector machines from all manufacturers are considered fair game for inclusion in the EMCAR system.

Having established an RF link between the transmitter and receiver, as required, some software is required to enable the measurement to proceed at the required time. This is discussed in the next section.

Client/Server Measurement Model

An orderly measurement process requires synchronization of the RF measurement with the position control system provided by the LinuxCNC. In the EMCAR system this is achieved using a client/server model for the RF measurement process. A measurement server is established as the measurement process is initiated and then repeatedly called by a client process to initiate a new data record. Communications between these processes is handled using standard Unix/POSIX Interprocess Communications Protocols (IPC), via TCP/IP sockets; these may allow the processes to run over a network and on different computers separated by vast distances, as needed.

As an antenna measurement is initiated, the first external call from the G-Code program establishes a measurement server application for the RF measurement process. In the development EMCAR system, this server application opens the A/D device for measurements, opens a default data file, vna.dat, and returns status to the calling program.

A similar scenario is envisioned for the case where digital data is acquired directly from the RF instrumentation; in this case the user would write a new version of the measurement server application to address (no pun intended) the data interface of their specific instrumentation. Thus, the opportunity exists for the new instrument interface to be subsequently released or added to this package to further empower the users of EMCAR and to advance the antenna art.

After the measurement server is started, subsequent calls to the server will produce newly measured RF data stored in the default data file in the user's home directory. This process is repeated until all measurement points described in the running G-Code program are completed.

The measurement server application persists throughout the duration of the overall measurement until it is signaled to terminate by one last call from the G-Code program. On the final call to the server a simple signal is transmitted that will close the A/D device, close the data file, and terminate the measurement server application, as well.

This whole process is demonstrated in the following annotated G-Code file listing, 360f.ngc, that implements a measurement over a range of Azimuth angle from 0 to 360 degrees with data increments of 5 degrees. Note this example is functional but not optimized as all moves are rapid moves using default velocity and acceleration in the configuration file.

360f.ngc

M101 P0.0 Q0.0 call script to initialize server

G00 M3 S1000 ( Z0.500 )

G00 X0.0000 ( Y0.0000 ) rapid move to first angle X=0.000 degrees

M110 P0.00 Q0.20 client call to server 1st data point at 0.0

(Z0.20 F5.00 ) ( ) denotes comments, disregard

(G01 Z0.0)

X5.0000 position to 2nd angle X=5.000 degrees

M110 P5.00 Q0.20 client call to server 2nd data point

X10.0000 position to 3rd angle X=10.000 degrees

M110 P10.00 Q0.20 client call to server 3rd data point

X15.0000 position to 4th angle X=15.000 degrees

M110 P15.00 Q0.20 client call to server 4th data point

X20.0000 position to 5th angle X=20.000 degrees

M110 P20.00 Q0.20 client call to server 5th data point

X25.0000 position to 6th angle X=25.000 degrees

M110 P25.00 Q0.20 client call to server 5th data point

X30.0000 position to 7th angle X=30.000 degrees

. .

. .

. .

X325.0000 position to N-7th angle X=325.000 degrees

M110 P325.00 Q0.20 client call to server N-7th data point

X330.0000 position to N-6th angle X=330.000 degrees

M110 P330.00 Q0.20 client call to server N-6th data point

X335.0000 position to N-5th angle X=335.000 degrees

M110 P335.00 Q0.20 client call to server N-5th data point

X340.0000 position to N-4th angle X=340.000 degrees

M110 P340.00 Q0.20 client call to server N-4th data point

X345.0000 position to N-3th angle X=345.000 degrees

M110 P345.00 Q0.20 client call to server N-3th data point

X350.0000 position to N-2th angle X=350.000 degrees

M110 P350.00 Q0.20 client call to server N-2th data point

X355.0000 position to N-1th angle X=355.000 degrees

M110 P355.00 Q0.20 client call to server N-1th data point

X360.0000 position to Nth angle X=360.000 degrees

M110 P360.00 Q0.20 client call to server Nth data point

(G00 Z0.20)

M111 P000.00 Q0.00 (this ends the scan)

M5 M30

Note that all the comments on the right are not a part of the G-Code file; they are simply placed here to explain the flow of the process. An unaltered G-Code file used in the EMCAR development system is available at /home/bob/EMC_Antenna_Range/1st_submit/LinuxCNC/nc_files/360f.ngc.

Also, note that loop structures are supported in the RS274, so shorter, more concise code can be generated—rather than the long-hand version shown above. Perhaps, an example of this is forthcoming, soon.

The G-Code facility that enables external calls are the "M-word" commands of syntax:

Mnn Pxxxx Qyyyy

where the parameters "P" and "Q" are passed to the external program.

Aside

Looking at the simplicity of the above code, one can envision several possibilities:

1. The G-Code program is a plain text file. As such, it could, in turn, be written by another program with, perhaps, a GUI interface for the lesser skilled operator, or for matters of convenience.  One avenue for this type of application is issuing MDI commands remotely by using the Axis GUI and the axis-remote system call.

2. The program enables the measurement process to be entirely controlled by the user via the G-Code. So, one might enable higher resolution measurements in the areas of interests (such as pattern null-depth measurements, for example) or lower resolution measurements in areas of lesser interest (i.e. rear radiation lobes, perhaps).

3. One could mix combinations of rapid (G00) moves with profiled (G01), velocity-controlled, motion to achieve a quicker overall measurement.

4. Measurements through a list of trajectories is made possible as one only needs to generate the sequence of coordinates desired and put them in the form of G-code for the LinuxCNC interpreter to follow. The resulting data file would contain only the data requested for the given trajectory.

5. Since the external program calls, afforded by the M-word commands, are completely generic, they might well be used to change polarizations, select and actuate switches, sequence relays, amplifiers, install filters, activate thermal chambers, coolants, blowers, or similar activity, as needed for the process to achieve the desired data acquisition.

6. To compensate for the effects of signal drift over time, one could regularly re-measure the system at a particular coordinate location using a rapid move, measure, and return to resume the planned acquisition. This is similar to a “before and after” type measurement used to characterize the magnitude of systematic drift. The drift data could be analyzed in-process, or upon completion using appropriate assumptions.

7. For the case of a planar scan geometry, there may be features within LinuxCNC for Z-axis correction. Presently, the planar scan is deemed to be impractical due to the step-wise motion presently employed in the development system. But, this is an area ripe for future work and enhancement.

As one might suspect, this list could go on for some time. The point is, the LinuxCNC-based EMCAR system provides a flexible framework for making automated antenna measurements with opportunities for expansion and customization to fit the user's needs. The following programs illustrate the ease with which the LinuxCNC is employed for use in making antenna measurements.

Example External Programs

The specific external programs employed in the development system are described in the following paragraphs. Review the G-Code program listing shown above to find there are only three external programs called, M101, M110, and M111. Each of these programs are described, below.

M101

M101 is a simple shell script that makes the initial call to start the measurement server application. By reviewing the LinuxCNC web site, it will become apparent that the example bears little difference from the example scripts provided with the LinuxCNC system. The script does, however, serve the function of starting the measurement server, named vnarec3d, as shown in the next to last line of code, below.

#!/bin/sh

# M101 in your G code program will run the Linux commands in this

# shell script "batch" file, passing the P and Q variables as command

# line arguments.

# give the command line arguments descriptive names

P=$1

Q=$2

#echo "M101 P$P Q$Q: put your code here"

/home/bob/LinuxCNC/nc_files/vnarec3e &> /home/bob/LinuxCNC/nc_files/M101.out &

exit 0

M110

M110 is a binary executable made from the C program, client.c. M110 takes the parameter passed from the G-Code call and passes it to the measurement server application. In the development system, the measurement angle is passed and used by the server code as information to store along with the current measured data record in the data file.

The M110 program is taken from the program, client.c, from the book, "Linux Programming," by Wall, Watson, and Whitis. Few changes were required to this code for use in the EMCAR application. Thanks to Mark for sharing this code for use by the community.

Note that, were the system to be expanded to separate the client and server processes across a computer network, the host name information would have to be changed to accommodate the new configuration. This version addresses ports on the local machine, only; the functionality would remain the same.

The program listing is shown below, for reference.

/* client.c

* Copyright Mark Watson 1999. Open Source Software License.

* Note: derived from NLPserver client example.

* See www.markwatson.com/opensource/opensource.htm for all

* of the natural language server (NLPserver) source code.

*/


#include <stdio.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <arpa/inet.h>

#include <netdb.h>


char * host_name = "127.0.0.1"; // local host

int port = 8000;


void main(int argc, char *argv[]) {

char buf[8192];

char message[256];

int socket_descriptor;

struct sockaddr_in pin;

struct hostent *server_host_name;


char * str = "A default test string";


if (argc < 2) {

printf("Usage: test \"Any test string\"\nWe will send a default test string.\n");

} else {

str = argv[1];

}


if ((server_host_name = gethostbyname(host_name)) == 0) {

perror("Error resolving local host\n");

exit(1);

}

bzero(&pin, sizeof(pin));

pin.sin_family = AF_INET;

pin.sin_addr.s_addr = htonl(INADDR_ANY);

pin.sin_addr.s_addr = ((struct in_addr *)(server_host_name->h_addr))->s_addr;

pin.sin_port = htons(port);


if ((socket_descriptor = socket(AF_INET, SOCK_STREAM, 0)) == -1) {

perror("Error opening socket\n");

exit(1);

}


if (connect(socket_descriptor, (void *)&pin, sizeof(pin)) == -1) {

perror("Error connecting to socket\n");

exit(1);

}


printf("Sending message %s to server...\n", str);


if (send(socket_descriptor, str, strlen(str), 0) == -1) {

perror("Error in send\n");

exit(1);

}


printf("..sent message.. wait for response...\n");


if (recv(socket_descriptor, buf, 8192, 0) == -1) {

perror("Error in receiving response from server\n");

exit(1);

}

printf("\nResponse from server:\n\n%s\n", buf);

close(socket_descriptor);


}


M111

M111 is a Unix script that is used as the final call to the measurement server. This final call signals the measurement server to close the measurement device, the data file, and to terminate. Viewing the code, this is done using the "special" parameter where P=XXXXXX; while this is not too sophisticated, it works, so-far.

#!/bin/sh

# M101 in your G code program will run the Linux commands in this

# shell script "batch" file, passing the P and Q variables as command

# line arguments.

# give the command line arguments descriptive names

P=$1

Q=$2

#echo "M101 P$P Q$Q: put your code here"

/home/bob/LinuxCNC/nc_files/M110 XXXXXXXXX # the X means to exit vnarec3d

exit 0


What About VNAREC3d?

The program vnarec3d.c is the measurement server application. As stated previously, it is responsible for opening the measurement device (the Dataq A/D Converter) for use, opening the data file, vna.dat, opening a Unix domain socket for use in subsequent communications. And, finally, vnarec3d.c opens a gnuplot process to display the active measurement on the user's screen.

Inspection shows that vnarec3d.c is an ugly piece of code and no better argument exists as justification for the calling for assistance from "real" programmers on the EMCAR measurement application. Don't you think?

In any case, a link to the code listing is included below for completeness. Of course, all computer codes should be retrieved from the repository in order to obtain the most up-to-date- version.

Some credits are in order, as follows:

The client / server code was re-used from Reference 6, as previously stated.

This code re-uses code from the gnuplot_i library written by N.Devillard <ndevilla@free.fr>. See http://ndevilla.free.fr/gnuplot/ for more information and the original code.

This code re-uses code from Paul Hubbard at NEESGrid . See http://users.sdsc.edu/~hubbard/neesgrid/dataq.html for more information and the original code.

Finally, here's a link to vnarec3d.c: /home/bob/EMC_Antenna_Range/1st_submit/ADC2/vnarec3d.c

gnuplot

Finally, the gnuplot program is employed to present the "real-time" plot during the measurement process. The version used is gnuplot-4.2.2 and this version, or later, is recommended as the version included o the LiveCD may or may not provide the desired functionality for use in polar plots. In any case, experience has shown these (live) plots to be useful to the antenna range operator as the measurement can be aborted in event that equipment setup problems or other interference is observed.

The polar plot employed for the real-time display is an adaptation of the gnuplot examples found at http://www.gnuplot.info/demo/poldat.html. The gnuplot homepage at http://www.gnuplot.info/ contains a wealth of detail on the program and a large number of examples for those who will prefer an alternative to the polar format.

The real-time display is generated based on data stored in the default data file, vna.dat, radgrid.dat, and the gnuplot script file that defines the format of the graphics. The default graphics is a polar plot with 40 dB of range, starting with a maximum of 0 dB. These definitions are provided in the script file, polar40dB.gnu and are easily changed to suit the operator's needs. A listing of this file is provided below, for reference.

polar40dB.gnu


#set terminal png nocrop enhanced font arial 12 size 640,800

#set output 'polar40dB.png'

#set terminal png transparent nocrop enhanced font arial 8 size 420,320

set clip points

unset border

set dummy t,y

set angles degrees

set grid polar 10.000000

set grid xtics nomxtics noytics nomytics noztics nomztics \

nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics

set grid layerdefault linetype 0 linewidth 1.000, linetype 0 linewidth 1.000

unset key

set polar

set size ratio 1 1,1

set style data lines

#set xtics axis in scale 1,0.5 nomirror norotate offset character 0, 0, 0 autofreq

#set ytics axis in scale 1,0.5 nomirror norotate offset character 0, 0, 0 autofreq

set xtics axis in scale 1,0.5 nomirror norotate offset character 0, 0, 0 10

set ytics axis in scale 1,0.5 nomirror norotate offset character 0, 0, 0 10

set title "Antenna Radiation Pattern"

set timestamp "%a %b %d %H:%M:%S %Y"

set rrange [ -40.000 : 10.0000 ] noreverse nowriteback

set trange [ -3.14159 : 3.14159 ] noreverse nowriteback

#set xlabel "Azimuth"

set xrange [ -43.000 : 43.000 ] noreverse nowriteback

#set ylabel "dB"

set yrange [ -43.000 : 43.000 ] noreverse nowriteback

tv(t,r) = sin(t)/(1+r)

tu(t,r) = (cos(t) +r)/(1+r)

cu(t,x) = 1 + cos(t)/x

cv(t,x) = (1+ sin(t))/x

set label "0" at -1,43

set label "30" at 21,36

set label "60" at 36,21

set label "90" at 42,0

set label "120" at 36,-22

set label "150" at 21,-37

set label "180" at -2,-43

set label "210" at -23,-37

set label "240" at -38,-22

set label "270" at -45,0

set label "300" at -38,21

set label "330" at -23,37

#plot "vna.dat" using 1:2,"-"

#plot "/home/bob/vna.dat" using (-$1+90.):2, \

"/home/bob/radgrid.dat" every 6 using ($1+90.):2 with impulses


The live data is added to the plot generated by the above script using a call to yet another script, polar40dB_step.gnu, shown below.

polar40dB_step.gnu

plot "/home/bob/vna.dat" using (-$1+90.):(20.*log10($2+0.01)) w l lw 2, \

"/home/bob/radgrid.dat" every 6 using ($1+90.):2 with impulses

This plotting process generates a persistent X-Window display on the user's display that is updated as the data come available. An example polar chart is shown below, for reference.

(polar antenna pattern plot)Illustration 3: Polar Plot of Antenna Radiation Data generated by gnuplot





Running the Acquisition Program

Running the antenna data acquisition program is straightforward and may be done by completing the following steps.

1. Start LinuxCNC by double-clicking on the icon on your Ubuntu Desktop.

2. Bring the program out of E-Stop by pressing F1.

3. Turn the servo system on by pressing F2.

4. Load the acquisition G-Code file.

If using the AXIS GUI, press "O" and select the file, 360f.ngc.

If using tkEMC GUI, click on File->Open and select the file, 360f.ngc

If using tkEMC GUI, press F4 for Auto.

5. Press "R" for Run, use the pull-down menu.

6. Grab a coffee and enjoy the process (while watching your signal levels, of course).

7. On completion, your might rename the vna.dat file to avoid writing over the data in the future, if desired.

8. Might use polar40dB_png.gnu or polar50dB_png.gnu to make a .png graphics file for display, and so on. Several graphics output formats are available from gnuplot, including pdf; refer to the gnuplot help for additional formats. (Will be interesting to see which gnuplot format will allow us a path to generate G-Code antenna radiation patterns for the mini-mill!)

Troubleshooting

Two avenues are available for diagnosis, in event of difficulty. For the LinuxCNC, error messages will be generated to inform the user of attempted illegal operations, physical limit conflicts, missing files, and the like. The other useful avemue for troubleshooting is to review the output file generated by the M101 script, M101.out. Refer to the M101 script example shown above, as needed. One may add a redirection of standard error output to the file, as well.

If the measurement process is aborted for some reason, the user may review the running processes to verify the server application is stopped, or not, and then take appropriate action.

Conclusion

An antenna measurement system based on the open source software LinuxCNC has been presented. By bringing together the diverse works of talented programmers, we've built an antenna measurement system that is new, flexible, capable, and extensible. The EMCAR system exemplifies the concept of "standing on the shoulders of giants" in that a useful alternative to expensive antenna measurement software is achieved by combining the works of several software designers from multiple open source projects.

Thanks go to all the developers and, especially, to those involved in the advancement of LinuxCNC. If some of the software used in this project are used improperly, or if credits are absent, or both, please advise the administrator of this project and we'll remedy the situation, as appropriate.

Best wishes to those who will use the EMCAR system's approach to antenna measurements. Please add your measurement server to the list with instructions and related documentation. There is plenty more to do and to come. Contributors are welcome here.

Finally, if there are any programmers who can help fix the function and organization of the A/D code within the client/server model, please feel free to contact me, or send updated codes, or both.  Thanks!

Have Fun!

Regards,


Bob Freeman

e-mail image