Mezurit 2: Virtual instrumentation for electronics experiments Dr. - - PowerPoint PPT Presentation

mezurit 2 virtual instrumentation for electronics
SMART_READER_LITE
LIVE PREVIEW

Mezurit 2: Virtual instrumentation for electronics experiments Dr. - - PowerPoint PPT Presentation

Mezurit 2: Virtual instrumentation for electronics experiments Dr. Brian Standley FOSDEM 2 Feb 2013 Origin of Mezurit 2 Problem #1: Acquire, scale, and record data Problem #2: Sweep a region of parameter space Problem #3: Find and


slide-1
SLIDE 1

Mezurit 2: Virtual instrumentation for electronics experiments

  • Dr. Brian Standley

FOSDEM 2 Feb 2013

slide-2
SLIDE 2

Brian Standley FOSDEM 2 Feb 2013

Origin of Mezurit 2

Common hardware:

  • Semiconductor parameter analyzer (expensive, inflexible)
  • Computer with DAQ and/or GPIB cards

Common software: Problem #2: Sweep a region of parameter space Problem #3: Find and trigger on rare events

  • Lab-specific LabVIEW/Matlab/IDL
  • Mezurit "1" by Marc Bockrath and David Cobden
  • meaSureit by Vera Sazonova

Problem #1: Acquire, scale, and record data

slide-3
SLIDE 3

Brian Standley FOSDEM 2 Feb 2013

Key features

Virtual channels:

  • Arbitrary (Python) functions of hardware ports (and GPIB)
  • Invertible functions can be outputs

Virtual instruments:

  • Acquisition
  • Scope
  • Sweeps
  • Triggers

Command-line terminal

– – – – Data logging up to ~5 kHz Asynchronous acquisition up to hardware limits (~1 MHz) Linear or non-linear output ramps Event detection with predefined responses (also ~5 kHz)

Continuously-updated plot and data readout

slide-4
SLIDE 4

Brian Standley FOSDEM 2 Feb 2013

Example experiment

BGVA

V

tg

1

V

bg

V

b

kΩ 100

10×

PCI-GPIB SR830

X Y Master SINE OUT

100.3

Ω

109

INPUT

I

  • Addr. 8

1000:1 divider DL1211

105V/A

Ω

130

chip carrier

(each) junction box

feed- through

Oxford VTI

ADC

PCI-6036e

3 DAC 1

computer

ADC 4 DAC 0

slide-5
SLIDE 5

Brian Standley FOSDEM 2 Feb 2013

Example experiment

BGVA

V

tg

1

V

bg

V

b

kΩ 100

10×

PCI-GPIB SR830

X Y Master SINE OUT

100.3

Ω

109

INPUT

I

  • Addr. 8

1000:1 divider DL1211

105V/A

Ω

130

chip carrier

(each) junction box

feed- through

Oxford VTI

ADC

PCI-6036e

3 DAC 1

computer

ADC 4 DAC 0

slide-6
SLIDE 6

Brian Standley FOSDEM 2 Feb 2013

A BRIEF DEMO

slide-7
SLIDE 7

Brian Standley FOSDEM 2 Feb 2013

Implementation

Code (v0.91):

Language files blank comment code

  • C 67 2456 1314 9591

C/C++ Header 37 513 747 1263 Python 3 134 40 333

(Linux) libraries:

  • COMEDI
  • Linux-GPIB
  • C Python API
  • Python interpreter
  • GTK+ 2
  • VTE

Platforms:

  • GNU/Linux
  • Windows XP/7 (via MinGW)

License: GPL3

www.ugcs.caltech.edu/~mezurit2/

slide-8
SLIDE 8

Brian Standley FOSDEM 2 Feb 2013

Architecture

Widgets Refresh logic Settings Operation logic

Acquisition loop: Wrapper libraries:

RPC nodes MCF nodes

Interface loop:

DAQ GPIB Timing Binning system Trigger Scanning

COMEDI NI-DAQ GTimer linux-gpib NI-488.2

Terminal:

  • Perf. count.

GPIB loop Receive input Varset

glibc mscvrt

Python interpreter Widgets Settings RPC nodes MCF nodes

Tools:

Virtual chan. computation

Sub- systems:

MCF system Logging Sweep Display status Plot data RPC server Status messaging

slide-9
SLIDE 9

Brian Standley FOSDEM 2 Feb 2013

Architecture

Widgets Refresh logic Settings Operation logic

Acquisition loop: Wrapper libraries:

RPC nodes MCF nodes

Interface loop:

DAQ GPIB Timing Binning system Trigger Scanning

COMEDI NI-DAQ GTimer linux-gpib NI-488.2

Terminal:

  • Perf. count.

GPIB loop Receive input Varset

glibc mscvrt

Python interpreter Widgets Settings RPC nodes MCF nodes

Tools:

Virtual chan. computation

Sub- systems:

MCF system Logging Sweep Display status Plot data RPC server Status messaging

Buffer readout due? GTK events pending? RPC queued?

RPC queue

  • Exec. RPC

RPC received? Type == DAQ? Queue for GUI Scanning? Limit rate (~1 kHz) Read ADCs sadc DAQ device Compute {X }

n

Moving average Acquired point Binning event? Recorded points Record point Triggers armed? Sweeping?

Yes No

Format msg. Slot update due? Send msg.

  • Recv. reply

GPIB dev. GPIB slots Limit rate (50 Hz)

  • Interp. reply

Scanning?

  • Exec. cmds.

T == 1?

i

Transfer due?

Read samples

Yes No No Yes Yes No No Yes Yes No Yes

Compute {{X }

n j}

Sample buffer

No

Scan done?

Yes No

Store samples Record points Set GPIB slots Compute {X'

p}, {x' p} Yes No

DAQ device

No Yes No Yes No Yes

  • Exec. RPC

No Yes

  • Proc. events

Refresh

Yes No

} readout due?

n

{X Copy point

  • Ret. buffer status

Plot data

No Yes

Refresh Limit rate (120 Hz) Acquired point

GUI DAQ GPIB

Set DACs DAQ device

slide-10
SLIDE 10

Brian Standley FOSDEM 2 Feb 2013

Configuration system

  • String identifier
  • Data type
  • Pointer to the setting variable
  • Callback

Text-based config files — each line maps to an "MCF node": Config is scriptable through the "set_var" terminal function.

slide-11
SLIDE 11

Brian Standley FOSDEM 2 Feb 2013

Configuration system

  • String identifier
  • Data type
  • Pointer to the setting variable
  • Callback

Text-based config files — each line maps to an "MCF node": Config is scriptable through the "set_var" terminal function.

lock(mutex) var = new_value unlock(mutex) set_value(widget, new_value) }

DAQ thread:

Variables

1.2E+0 rate_var

9 10

hold_var 5.0E-2 delta_var 0.0E+0

11

Widgets MCF Closures

setvar_mcf()

+ var = rate_var + widget = rate_widget

'sweep_rate' 'hold_time' setvar_mcf()

+ var = hold_var + widget = hold_widget

'sweep_delta' setvar_mcf()

+ var = delta_var + widget = delta_widget

lock(mutex) step_sweep(delta_var, rate_var, hold_var) unlock(mutex) } while (running) {

8

key, value = parse(arg) func = mcf_lookup(key)) mcf_call(func, value) } def setvar_mcf(var, widget, new_value) { def setvar_rpc(arg) { cmd, arg = get_msg() func = rpc_lookup(cmd) rpc_call(func, arg) }

12 6

Terminal:

GUI thread:

mcf_closure(setvar_mcf, 'sweep_rate', rate_var, rate_widget) } if (rpc_queued()) { while (running) {

RPC Closures

setvar_rpc() 'set_var' 'get_var' getvar_rpc() savedata_rpc() 'save_data'

1 2 4 3

rpc_closure(setvar_rpc, 'set_var')

5 7

slide-12
SLIDE 12

Brian Standley FOSDEM 2 Feb 2013

TODO

Ongoing work:

  • GTK+ 3 support
  • Python 3 support
  • Realtime operation (PREEMPT_RT, if possible)
  • Incomplete features here and there
  • Bug fixes

Future work:

  • More users
  • >1 developer?
slide-13
SLIDE 13

Brian Standley FOSDEM 2 Feb 2013

  • LabVIEW
  • Matlab/Simulink
  • Scilab/Scicos/RTAI-Lab

Alternative frameworks

Current alternatives: A simpler approach?

slide-14
SLIDE 14

Brian Standley FOSDEM 2 Feb 2013

  • LabVIEW
  • Matlab/Simulink
  • Scilab/Scicos/RTAI-Lab

Alternative frameworks

Current alternatives: A simpler approach?

User-supplied script

Realtime layer (C):

Instrument libraries

Model definition (Python):

Interface library General DAQ / control engine Drivers User-supplied script Widget libraries Interface library

Control and display GUI (Python):

slide-15
SLIDE 15

Brian Standley FOSDEM 2 Feb 2013

Credits

Helpful discussions:

  • Prof. Marc Bockrath (UC Riverside)
  • Prof. Henk Postma (CSU Northridge)

Testing:

  • Dr. Hang Zhang, Dr. Wenzhong Bao, Dr. Jairo Velasco Jr.,

Peng Wang, Tengfei Miao, Oleg Martynov

THANKS!

www.ugcs.caltech.edu/~mezurit2/