Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/iviPublic

Go-based implementation of the Interchangeable Virtual Instrument (IVI) standard

License

NotificationsYou must be signed in to change notification settings

gotmc/ivi

Repository files navigation

Go-based implementation of the Interchangeable Virtual Instrument (IVI)standard.

GoDocGo Report CardLicense Badge

Overview

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.

IVI Driver Goal

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.

IVI Specification Deviation

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)

Installation

$ go get github.com/gotmc/ivi

Usage

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

Examples can be found athttps://github.com/gotmc/ivi-examples.

Documentation

Documentation can be found at either:

Contributing

Contributions are welcome! To contribute please:

  1. Fork the repository
  2. Create a feature branch
  3. Code
  4. Submit apull request

Testing

Prior to submitting apull request, please run:

$ make check$ make lint

To update and view the test coverage report:

$ make cover

License

ivi is released under the MIT license. Please see theLICENSE.txt file for more information.


[8]ページ先頭

©2009-2025 Movatter.jp