File Coverage

blib/lib/Lab/Moose/Instrument/HP34420A.pm
Criterion Covered Total %
statement 33 38 86.8
branch n/a
condition n/a
subroutine 12 14 85.7
pod 5 6 83.3
total 50 58 86.2


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::HP34420A;
2             $Lab::Moose::Instrument::HP34420A::VERSION = '3.881';
3             #ABSTRACT: HP 34420A nanovolt meter.
4              
5 2     2   4530 use v5.20;
  2         10  
6              
7             # So far only one channel. Could add support for two channels
8             # by using validated_channel_(setter/getter) in the SCPI/SENSE roles.
9              
10 2     2   13 use Moose;
  2         5  
  2         19  
11 2     2   15523 use Moose::Util::TypeConstraints 'enum';
  2         8  
  2         32  
12 2     2   1007 use MooseX::Params::Validate;
  2         6  
  2         24  
13 2     2   1038 use Lab::Moose::Instrument qw/validated_getter validated_setter/;
  2         4  
  2         141  
14 2     2   21 use Carp;
  2         6  
  2         124  
15 2     2   550 use Lab::Moose::Instrument::Cache;
  2         6  
  2         17  
16 2     2   1250 use namespace::autoclean;
  2         6  
  2         15  
17              
18             extends 'Lab::Moose::Instrument';
19              
20             with qw(
21             Lab::Moose::Instrument::Common
22             Lab::Moose::Instrument::SCPI::Sense::Function
23             Lab::Moose::Instrument::SCPI::Sense::Range
24             Lab::Moose::Instrument::SCPI::Sense::NPLC
25             );
26              
27             sub BUILD {
28 1     1 0 3 my $self = shift;
29 1         15 $self->clear();
30 1         6 $self->cls();
31             }
32              
33              
34              
35             sub get_value {
36 1     1 1 11 my ( $self, %args ) = validated_getter( \@_ );
37 1         491 return $self->query( command => 'READ?', %args );
38             }
39              
40              
41             cache route_terminals => ( getter => 'route_terminals_query' );
42              
43             sub route_terminals_query {
44 2     2 1 1738 my ( $self, %args ) = validated_getter( \@_ );
45 2         1080 return $self->cached_route_terminals(
46             $self->query( command => 'ROUT:TERM?', %args ) );
47             }
48              
49             sub route_terminals {
50 3     3 1 13092 my ( $self, $value, %args ) = validated_setter(
51             \@_,
52             value => { isa => enum( [qw/FRON FRON1 FRON2/] ) }
53             );
54 3         21 $self->write( command => "ROUT:TERM $value" );
55 3         19 $self->cached_route_terminals($value);
56             }
57              
58              
59             cache input_filter_state => ( getter => 'input_filter_state_query' );
60              
61             sub input_filter_state_query {
62 0     0 1   my ( $self, %args ) = validated_getter( \@_ );
63 0           return $self->cached_input_filter_state(
64             $self->query( command => 'INP:FILT:STAT?', %args ) );
65             }
66              
67             sub input_filter_state {
68 0     0 1   my ( $self, $value, %args ) = validated_setter(
69             \@_,
70             value => { isa => enum( [ 0 .. 1 ] ) }
71             );
72 0           $self->write( command => "INP:FILT:STAT? $value", %args );
73 0           return $self->cached_input_filter_state($value);
74             }
75              
76             __PACKAGE__->meta()->make_immutable();
77              
78             1;
79              
80             __END__
81              
82             =pod
83              
84             =encoding UTF-8
85              
86             =head1 NAME
87              
88             Lab::Moose::Instrument::HP34420A - HP 34420A nanovolt meter.
89              
90             =head1 VERSION
91              
92             version 3.881
93              
94             =head1 SYNOPSIS
95              
96             my $dmm = instrument(
97             type => 'HP34420A',
98             connection_type => 'LinuxGPIB',
99             connection_options => {pad => 24},
100             );
101              
102             # Set properties of channel1:
103             $dmm->sense_range(value => 10);
104             $dmm->sense_nplc(value => 2);
105            
106             my $voltage = $dmm->get_value();
107              
108             The C<SENSE> methods only support channel 1 so far.
109              
110             =head1 METHODS
111              
112             Used roles:
113              
114             =over
115              
116             =item L<Lab::Moose::Instrument::SCPI::Sense::Function>
117              
118             =item L<Lab::Moose::Instrument::SCPI::Sense::Range>
119              
120             =item L<Lab::Moose::Instrument::SCPI::Sense::NPLC>
121              
122             =back
123              
124             =head2 get_value
125              
126             my $voltage = $dmm->get_value();
127              
128             Perform voltage/current measurement.
129              
130             =head2 route_terminals/route_terminals_query
131              
132             $dmm->route_terminals(value => 'FRON2');
133              
134             Set/get used measurement channel. Allowed values: C<FRON[1], FRON2>.
135              
136             =head2 input_filter_state/input_filter_state_query
137              
138             $dmm->input_filter_state(value => 0); # Filter OFF
139             $dmm->input_filter_state(value => 1); # Filter ON
140              
141             Enable/Disable input filter. Allowed values: C<0>, C<1>.
142              
143             =head1 COPYRIGHT AND LICENSE
144              
145             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
146              
147             Copyright 2018 Simon Reinhardt
148             2020 Andreas K. Huettel, Simon Reinhardt
149              
150              
151             This is free software; you can redistribute it and/or modify it under
152             the same terms as the Perl 5 programming language system itself.
153              
154             =cut