Click here to Skip to main content
Click here to Skip to main content

FreeCal - GPIB Instrument Automation for Metrology Test and Measurement

, 2 Aug 2005 CPOL
Rate this:
Please Sign up or sign in to vote.
FreeCal is a free 100% .NET suite of utilities and instrument drivers for controlling multiple instruments in a Test and Measurement environment.

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)

Share

About the Author

Scott Page
Team Leader Rolls-Royce North America, Inc.
United States United States
Calibration Technician in the U.S. Marines from 1999 to July 2007.
 
Metrologist for Lockheed Martin at John C. Stennis Space Center in Mississippi from June 2004 to December 2007.
 
Currently working as a commercial Jet Engine Test Team Leader and system programmer for Rolls-Royce at John C. Stennis Space Center in Mississippi.
 
Invented and developed the first ever multi-computer development turbofan jet engine test cell control room training simulator with a physical throttle interface, and real-time calculated turbofan jet engine for Rolls-Royce global.

Comments and Discussions

 
GeneralMy vote of 5 PinmemberKoh Twee Toong15-May-13 7:16 
GeneralCool stuff wish I had the interface so I could start creating some scientific equipment! PingroupProto-Bytes22-Oct-10 20:58 
GeneralMy vote of 5 Pinmembershinchulkyu31-Aug-10 22:38 
GeneralError reading from instruments Pinmembermprice031718-Sep-06 20:17 
AnswerRe: Error reading from instruments PinmemberR. Scott Page19-Sep-06 10:10 
GeneralRe: Error reading from instruments Pinmembermprice031719-Sep-06 10:48 
QuestionRe: Error reading from instruments PinmemberR. Scott Page19-Sep-06 10:52 
GeneralRe: Error reading from instruments PinmemberR. Scott Page19-Sep-06 10:58 
GeneralRe: Error reading from instruments Pinmembermprice031720-Sep-06 13:51 
GeneralRe: Error reading from instruments PinmemberR. Scott Page21-Sep-06 10:17 
GeneralRe: Error reading from instruments PinmemberR. Scott Page21-Sep-06 10:21 
GeneralRe: Error reading from instruments PinmemberR. Scott Page21-Sep-06 10:38 
GeneralRe: Error reading from instruments Pinmembermprice031722-Sep-06 10:54 
GeneralRe: Error reading from instruments PinmemberR. Scott Page22-Sep-06 10:57 
GeneralRe: Error reading from instruments Pinmembermprice03172-Oct-06 7:49 
AnswerRe: Error reading from instruments PinmemberR. Scott Page2-Oct-06 11:44 
GeneralRe: Error reading from instruments Pinmembermprice031712-Oct-06 18:42 
QuestionProblem reading from device Pinmemberkrugerr9-Mar-06 1:08 
AnswerRe: Problem reading from device Pinmemberskinned_knuckles14-Jun-06 13:00 
AnswerRe: Problem reading from device PinmemberR. Scott Page22-Jun-06 17:11 
QuestionCan't find Demo Source Code Pinmemberyigiman28-Sep-05 7:01 
AnswerRe: Can't find Demo Source Code PinmemberR. Scott Page3-Oct-05 12:44 
General[Message Deleted] PinmemberTRiegler3-Aug-05 9:14 
GeneralRe: Very ambitious PinmemberR. Scott Page7-Aug-05 11:07 
QuestionCan't Build project? PinmemberGlenn Burnside25-Jul-05 12: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.

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