Moose/Instrument/HP34420A.pm

filter: Statementstmt 88.8% 40 / 45 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 12 / 14 Podpod 83.3% 5 / 6 totaltotal 87.6% 57 / 65 SCAR 0.0
CC
1
Cov
89%
input_filter_state_query
2.0
input_filter_state
2.0
BEGIN
1.0
CRAP 1.0
« Moose/Instrument/SCPI/Sense/Average.pm ↑ Summary Moose/Instrument/SCPI/Sense/Sweep.pm »
1 package Lab::Moose::Instrument::HP34420A;
2 2 $Lab::Moose::Instrument::HP34420A::VERSION = '3.881';
3 #ABSTRACT: HP 34420A nanovolt meter.
4  
5 2 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Moose::Util::TypeConstraints 'enum';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Lab::Moose::Instrument qw/validated_getter validated_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 extends 'Lab::Moose::Instrument';
19  
20 2 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 ▶ my $self = shift;
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
29 1 $self->clear();
30 1 $self->cls();
31 }
32  
33  
34  
35 sub get_value {
36 1 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine get_value: called CC=1 SCAR=0.0
Pod documented
37 1 return $self->query( command => 'READ?', %args );
38 }
39  
40  
41 2 cache route_terminals => ( getter => 'route_terminals_query' );
42  
43 sub route_terminals_query {
44 2 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine route_terminals_query: called CC=1 SCAR=0.0
Pod documented
45 2 return $self->cached_route_terminals(
46 $self->query( command => 'ROUT:TERM?', %args ) );
47 }
48  
49 sub route_terminals {
50 3 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine route_terminals: called CC=1 SCAR=0.0
Pod documented
51 \@_,
52 value => { isa => enum( [qw/FRON FRON1 FRON2/] ) }
53 );
54 3 $self->write( command => "ROUT:TERM $value" );
55 3 $self->cached_route_terminals($value);
56 }
57  
58  
59 2 cache input_filter_state => ( getter => 'input_filter_state_query' );
60  
61 sub input_filter_state_query {
62 0 ▶ my ( $self, %args ) = validated_getter( \@_ );
Subroutine input_filter_state_query: not called CC=1 SCAR=6.9
Pod documented
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 ▶ my ( $self, $value, %args ) = validated_setter(
Subroutine input_filter_state: not called CC=1 SCAR=6.9
Pod documented
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 2 __PACKAGE__->meta()->make_immutable();
77  
78 2 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
« Moose/Instrument/SCPI/Sense/Average.pm ↑ Summary Moose/Instrument/SCPI/Sense/Sweep.pm »