Lab-Measurement-Legacy

 view release on metacpan or  search on metacpan

lib/Lab/Measurement/Legacy/Tutorial.pod  view on Meta::CPAN

L<Lab::Instrument::Source> that is inherited by voltage sources like
L<Lab::Instrument::Yokogawa7651>.

  #!/usr/bin/perl
  
  use strict;
  use Lab::Instrument::Yokogawa7651;
  
  unless (@ARGV > 0) {
  	print "Usage: $0 GPIB-address [Target-voltage]\n";
  	exit;
  }
  
  my ($gpib,$goto)=@ARGV;
  
  my $source=new Lab::Instrument::Yokogawa7651(
  	connection_type=>'LinuxGPIB',
  	gpib_address => $gpib,
  	gpib_board=>0,
  	gate_protect=>1,
  	gp_max_unit_per_second=>0.05,
  	gp_max_unit_per_step=>0.005
  	gp_max_step_per_second=>10,
  );
  
  if (defined $goto) {
  	$source->set_voltage($goto);
  } else {
  	print $source->get_voltage();
  }

Here the gate_protect mechanism limits the step size of the voltage source to
0.005mV, and the sweep speed to at most 10 such steps per second. This is
implemented automatically within the C<set_voltage($goto)> command; after we
have set the parameters in the initialization phase, we do not have to take
care of it anymore.

=head1 Using the high-level Lab::Measurement and related classes

With the tools introduced so far you should be able to easily write short
individual scripts for your measurement tasks. These scripts will probably
serve as well as all other home grown solutions using LabView or whatever.
The C<Lab::Measurement> class together with the related C<Lab::Data:...> classes
now provide additional tools to write better measurement scripts.

One main goal is to provide means to keep additional information stored
along with the raw measured data. Additional information means all the notes
that you would usually write down in your laboratory book, like date and
time, settings of additional instruments, the environment temperature, the
color of the shirt you were wearing while recording the data and everything
else that might be of importance for a later interpretation of the data. In
my experience, having to write these things in a book by hand is tedious and
error-prone. It's the kind of job that computers were made for.

Another goal is to free the experimenter from having to repeat himself all the
time when the data is used for analysis or presentation. Let us assume that,
for example, you are measuring a very small current with the help of a current
amplifier. This current amplifier will output a voltage that is proportional to
the original current, so in fact you will be measuring a voltage that can be
converted to the original current by multiplying it with a certain factor. But
as long as the precise formula for this transformation is not stored
together with the data, you will still find yourself repeatedly typing in
the same expressions, whenever you work with the data. This is where the I<axis>
concept comes into play. Already at the time you are preparing your measurement script,
you define an I<axis> named I<current> that stores the expression to calculate
the current from the voltage. From there you work with the current-axis and will
never have to care about the conversion again. And of course you can define many
different axes. Read on!

=head2 The concept of sweeps

The L<Sweep|Lab::XPRESS::Sweep> classes provide a high-level interface for measurement
automation. The following script explains the basic use of sweeps. This
example shows a two-dimensional L<Voltage Sweep|Lab::XPRESS::Sweep::Voltage>: The I<master sweep> controls
the gate voltage. For each value of the gate voltage we perform a 
I<slave sweep> of the source-drain voltage.

We perform a measurement
task at each grid point. This is done by providing a callback subroutine.
In our example, the callback reads the value of a
multimeter and logs to a DataFile object.

  #-------- 1. Import Lab::Measurement -------
  
  use warnings;
  use strict;
  use 5.010;
  
  use Lab::Measurement::Legacy;
  
  
  #-------- 2. Some constants ----------------
  
  my $gain = -1e-9;         # A/V amplifier sensit.
  my $stepwidthbias = 0.05; # step width bias
  my $stepwidthgate = 0.1;  # step width gate
  my $NPLC=2;               # integration time, 2*20ms
  
  
  #-------- 3. Initialize Instruments --------
  
  my $gate_source = Instrument('YokogawaGS200', 
      {
      connection_type => 'VISA_GPIB',
      gpib_address => 2,
      gate_protect => 0
      });
  
  my $bias_source = Instrument('YokogawaGS200', 
      {
      connection_type => 'VISA_GPIB',
      gpib_address => 6,
      gate_protect => 0
      });
  
  my $DMM_I = Instrument('HP34401A', 
      {
      connection_type => 'VISA_GPIB',
      gpib_address => 14,
      nplc => $NPLC
      });



( run in 0.965 second using v1.01-cache-2.11-cpan-2398b32b56e )