- Notifications
You must be signed in to change notification settings - Fork6
Go-based implementation of the Interchangeable Virtual Instrument (IVI) standard
License
gotmc/ivi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Go-based implementation of the Interchangeable Virtual Instrument (IVI)standard.
TheIVI Specifications developed by theIVIFoundation provide standardized APIs for programming testinstruments. This package is a partial, Go-based implementation of the IVISpecifications.
The main advantage of theivi package is not having to learn theSCPIcommands for each individual piece of test equipment. For instance, by using theivi package both the Agilent 33220A and the Stanford Research Systems DS345function generators can be programmed using one standard API. The onlyrequirement for this is having an IVI driver for the desired test equipment.
If anivi driver doesn't exist for a peice of test equipment that you wantto use, please open an issue and/or submit a pull request. TheIVISpecifications don't provide APIs for every type of test equipment(e.g., they don't specify an API for electronic loads) in which case a set ofAPIs will be developed as needed for new types of test equipment.
Development focus is currently on solidifying the APIs and creating a few IVIdrivers for each instrument type.
Per Section 2.6 Capability Groups in IVI-3.1 Driver Architecture Specification:
The fundamental goal of IVI drivers is to allow test developers to change theinstrumentation hardware on their test systems without changing test programsource code, recompiling, or re-linking. To achieve this goal, instrumentdrivers must have a standard programming interface...Because instruments donot have identical functionality or capability, it is impossible to create asingle programming interface that covers all features of all instruments in aclass. For this reason, the IVI Foundation recognizes different types ofcapabilities – Inherent Capabilities, Base Class Capabilities, Class ExtensionCapabilities and Instrument Specific Capabilities.
TL;DR: When developing the Go-based IVI drivers, follow the .NET methods andprototypes as much as possible.
As stated in Section 1.5 Conformance Requirements of theIVI-3.1: DriverArchitecture Specification, Revision 3.8, "IVI drivers can be developed with aCOM, ANSI-C, or .NET API." In general, the Go method signatures try to be asclose to the .NET signatures as possible. However, given the desire to writeidiomatic Go, where necessary and where it makes sense, the Go-based IVI driversdeviate from the detailedIVI Specifications at times.
For instance, since Go does not providemethod overloading,the .NET method prototypes cannot be followed in all cases. For example,in the IVI-4.2 IviDmm Class Specification, the .NET method prototypes show twoConfigure
methods with different function signatures based on whetherauto-range is specified or a manual range value is provided.
voidConfigure(MeasurementFunctionmeasurementFunction,AutoautoRange,Doubleresolution);voidConfigure(MeasurementFunctionmeasurementFunction,Doublerange, Doubleresolution);
However, Go isn't C, so the Go-based IVI drivers don't have to rely on definedvalues, such as specific negative numbers representing auto-range (e.g., -1.0 =auto range on) and positive numbers representing the user specified manualrange. Using the same example, below is the C prototype forConfigure
, whereRange
is aViReal64
and negative values provided defined values.
ViStatusIviDmm_ConfigureMeasurement (ViSessionVi,ViInt32Function,ViReal64Range,ViReal64Resolution);
Because of these differences, the Go function signatures may deviate from theIVI Specifications, when required and where it makes sense toenable writing idiomatic Go. Using the same example, below is the functionsignature forConfigureMeasurement
in Go.
ConfigureMeasurement(msrFuncMeasurementFunction,autoRangeAutoRange,rangeValuefloat64,resolutionfloat64,)error
MeasurementFunction
andAutoRange
are user-defined types withenumeratedconstant values. Note: the function parameterrangeValue
is usedinstead ofrange
, sincerange
is a reserved keyword and cannot be used as anidentifier in Go.
typeMeaurementFunctionintconst (DCVoltsMeasurementFunction=iotaACVolts...PeriodTemperature)typeAutoRangeintconst (AutoOnAutoRange=iotaAutoOffAutoOnce)
$ go get github.com/gotmc/ivi
Theivi package requires receiving an Instrument interface. The followinggotmc packages meet the Instrument interface:
- visa — Callslxi orusbtmc as needed, so that you can identifyinstruments using a VISA resource address string.
- lxi — Used to control LXI enabled instruments via Ethernet.
- usbtmc — Used to control USBTMC compliant instruments via USB.
- prologix — Used to communicate with instruments using a Prologix GPIBcontroller.
- asrl — Used to control intstruments via serial.
Examples can be found athttps://github.com/gotmc/ivi-examples.
Documentation can be found at either:
- https://godoc.org/github.com/gotmc/ivi
- http://localhost:6060/pkg/github.com/gotmc/ivi/ after running
$ godoc -http=:6060
Contributions are welcome! To contribute please:
- Fork the repository
- Create a feature branch
- Code
- Submit apull request
Prior to submitting apull request, please run:
$ make check$ make lint
To update and view the test coverage report:
$ make cover
ivi is released under the MIT license. Please see theLICENSE.txt file for more information.
About
Go-based implementation of the Interchangeable Virtual Instrument (IVI) standard