Click here to Skip to main content
Licence CPOL
First Posted 18 Jul 2005
Views 89,508
Bookmarked 60 times

FreeCal - GPIB Instrument Automation for Metrology Test and Measurement

By | 2 Aug 2005 | Article
FreeCal is a free 100% .NET suite of utilities and instrument drivers for controlling multiple instruments in a Test and Measurement environment.
 
Part of The SQL Zone sponsored by
See Also

Sample screenshot

Introduction

FreeCal is a free 100% .NET suite of utilities, procedures, and instrument drivers for controlling instruments in a Test and Measurement environment. However, it can be used for any type of Instrument Control needs. I have started to develop libraries for TCP/IP, USB and serial devices.

The demo application will not run unless the NationalInstruments.NI4882.dll file is installed in the GAC. You can rebuild the source and change all references from the GAC to a specific file location. The application also requires that you have a National Instruments GPIB interface controller installed (USB, PCI or ISA card) in the system.

You can download the National Instruments drivers from here, but if you are downloading the source for this application then you probably already have everything you need.

Note: My apologies to all of the VS.NET users. For the past 6 months I only had the SharpDevelop IDE and not VS.NET. I now have VS.NET, and have converted the entire application. The new VS.NET source can now be downloaded from this page using the the link provided above.

Scope

My goal for this application is to provide a 100% free alternative to applications like LabView, LabWindows, SureCal, MetCal, and MeasurementStudio for Visual Studio .NET.

Features

  • Base instrument libraries for Signal Generators, Spectrum Analyzers, Network Analyzers, Power Meters, Function Generators, Universal and RF/Microwave Counters, Attenuator/Switch Drivers, EEPROM Power Sensors, Digital Multimeters and any other type of instrument that can be controlled remotely. All categories have specific instruments that have been coded for compatibility (due to the fact that all instruments have their own specific language for communication).
  • Charts/graphs are integrated into the code with the use of ZedGraph: A flexible charting library for .NET (Thanks to JChampion for ZedGraph, many sleepless nights have been avoided developing an integrated charting library).
  • Procedures for Power Sensors, Signal Generators, Spectrum Analyzers and Network Analyzer Calibration Kits have already been developed (so far most of them partially completed due to time), but they are not difficult to create as you will see in the examples below.
  • Several conversion functions included to aid in the development and presentation of data: Frequency conversion from one range to another (i.e. MHz to GHz), Amplitude and Time conversions are also included as a base for almost all formulas and instrument communication.
  • I recently started construction of a visual editor that allows "drag and drop" style test creation. It is included in the source and can be found in the demo under the Tools menu.
  • Integrates with MySQL using the MySQL.NET Connector. I have created a number of data classes that ease the task of saving result data to a MySQL database.
  • Various forms have been created for several of the instrument categories, like Network Analyzers. One of the most difficult tasks in RF/Microwave is downloading and manipulating data from the Agilent 8500 Series NWA, so I spent a lot of time writing the NWA data transfer classes.
  • Because every instrument has its own tolerances and capabilities, the drivers have been written to include all of this (any missing information is easily added as it is all structure based).
  • Instrument drivers and procedures are written with a "One Procedure Any Instrument" mindset. You can write one procedure that can calibrate any instrument of the same category. This is due to each instrument driver including the specifications for each test.

Requirements

The following software/hardware is required to operate FreeCal:

  • The National Instruments NI-488.2 (Win32) Version 2.3 driver.
  • One of the following NI boards: AT-GPIB/TNT(PnP), GPIB-ENET/100, GPIB-USB-B, PCI-GPIB, PCI-GPIB+, PCI-GPIB/LP, PCI-8212, PCI Express(TM) Interface for GPIB, PCMCIA-GPIB, PCMCIA-GPIB+, PMC-GPIB, PXI-GPIB, or PXI-8212, PXI-8232.
  • Some knowledge of GPIB instrument communication may be required depending on the instrument you are creating or the test/procedure you may develop. The NI driver download includes all GPIB documentation you should need to properly understand its use.

Quick Start

If you just want to get started controlling an instrument, the following is all you need:

  1. First, install the NationalInstruments.NI4882.dll file (located in the FreeCal\Program\Resources folder) into the GAC (all references point to the GAC for this file, unless you want to specify that all libraries look for the file at a specific location instead). This file is also installed when you download the National Instruments Win32 GPIB driver v2.3.
  2. Add a reference to the NationalInstrument.NI4882 library in the GAC, or if you decide to use the file directly then specify its location. Also reference the FreeCal.Instruments.dll, and depending on the family of instrument you wish to control, its respective library. For example, if you want to control a Signal Generator, then add a reference to the file FreeCal.Instruments.Microwave.SignalGenerators.dll. Some instrument libraries make reference to the FreeCal.Data.dll and if required the compiler will state that a reference must be made.
  3. Include the following line of code in the Namespace declaration section at the top of your code file (depending on the family of instrument to be controlled).
    Imports FreeCal.Instruments.Microwave.SignalGenerators
  4. Create a variable of the family (or specific instrument you are controlling).
    Dim SigGen As SignalGenerator = New AgilentE4433B(0, 19, False)

    The first parameter is the board (0 - 3), the second is the Primary Address of the instrument, and the third parameter is normally always false (used for pulling the current instrument state instead of presetting to defaults (not implemented 100%)). There is an optional fourth parameter (boolean) for simulation mode, it is False by default but if it is supplied as True, the instrument will run in a simulated state, not sending commands to the bus, all data sent to the instrument will be returned when read from the instrument.

Now that you have created the instrument variable, each instrument category has its own "Sections" property that will display all of the capabilities an instrument can provide. The following example will show you how to create an instrument and control it:

'Don't forget to Import (using in C#) the proper namespace for the category
'of instrument you wish to control.

Imports FreeCal.Instruments.Microwave.SignalGenerators
Imports FreeCal.Instruments.Microwave.PowerMeters
Public Sub ControlInstrument
    'Create the instrument
    Dim SigGen As New AgilentE4433B(0, 19, False)
   'Or Dim SigGen As SignalGenerator = New AgilentE4433B(0, 19, False)
    Dim PwrMtr As New AgilentE4417A(0, 13, False)
    'Control the instrument
    Dim TestLevel As Single = -10
    SigGen.Sections.RF.Frequency.Suffix = FrequencyEnum.GHz
    SigGen.Sections.RF.Frequency.CW = 3.5
    SigGen.Sections.RF.Amplitude.Suffix = AmplitudeEnum.dBm
    SigGen.Sections.RF.Amplitude.Level = TestLevel
    SigGen.Sections.RF.OutputState = OnOffStateEnum.[On]
    Dim Result As Single = PwrMtr.Sections.Measurements.Measure("A")
    MessageBox.Show("The " & PwrMtr.Model & " read " & Result & ".")
End Sub

Summary

That's all you need to get started, but there are many more instruments, tools and helpful forms that are included to help in the design of tests and procedures.

As of this date, the only documentation is included as a Word doc at the root of the FreeCal_src.zip file. I am working on documenting the entire project for future releases.

Enjoy!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Scott Page

Team Leader
Rolls-Royce North America, Inc.
United States United States

Member

Calibration Technician in the U.S. Marines from '99 until July of '07.
 
Metrologist for Lockheed Martin at John C. Stennis Space Center in Mississippi from March '04 until March of '07.
 
Currently working as a commerical Jet Engine Test Team Leader and system programmer for Rolls-Royce at John C. Stennis Space Center in Mississippi.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCool stuff wish I had the interface so I could start creating some scientific equipment! PingroupProto-Bytes19:58 22 Oct '10  
GeneralMy vote of 5 Pinmembershinchulkyu21:38 31 Aug '10  
GeneralError reading from instruments Pinmembermprice031719:17 18 Sep '06  
AnswerRe: Error reading from instruments PinmemberR. Scott Page9:10 19 Sep '06  
GeneralRe: Error reading from instruments Pinmembermprice03179:48 19 Sep '06  
QuestionRe: Error reading from instruments PinmemberR. Scott Page9:52 19 Sep '06  
GeneralRe: Error reading from instruments PinmemberR. Scott Page9:58 19 Sep '06  
GeneralRe: Error reading from instruments Pinmembermprice031712:51 20 Sep '06  
GeneralRe: Error reading from instruments PinmemberR. Scott Page9:17 21 Sep '06  
GeneralRe: Error reading from instruments PinmemberR. Scott Page9:21 21 Sep '06  
GeneralRe: Error reading from instruments PinmemberR. Scott Page9:38 21 Sep '06  
GeneralRe: Error reading from instruments Pinmembermprice03179:54 22 Sep '06  
GeneralRe: Error reading from instruments PinmemberR. Scott Page9:57 22 Sep '06  
GeneralRe: Error reading from instruments Pinmembermprice03176:49 2 Oct '06  
AnswerRe: Error reading from instruments PinmemberR. Scott Page10:44 2 Oct '06  
GeneralRe: Error reading from instruments Pinmembermprice031717:42 12 Oct '06  
QuestionProblem reading from device Pinmemberkrugerr0:08 9 Mar '06  
AnswerRe: Problem reading from device Pinmemberskinned_knuckles12:00 14 Jun '06  
AnswerRe: Problem reading from device PinmemberR. Scott Page16:11 22 Jun '06  
QuestionCan't find Demo Source Code Pinmemberyigiman6:01 28 Sep '05  
AnswerRe: Can't find Demo Source Code PinmemberR. Scott Page11:44 3 Oct '05  
General[Message Deleted] PinmemberTRiegler8:14 3 Aug '05  
GeneralRe: Very ambitious PinmemberR. Scott Page10:07 7 Aug '05  
QuestionCan't Build project? PinmemberGlenn Burnside11:05 25 Jul '05  
AnswerRe: Can't Build project? PinmemberR. Scott Page16:35 26 Jul '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 3 Aug 2005
Article Copyright 2005 by Scott Page
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid