Moose/Instrument/Agilent33210A.pm

filter: Statementstmt 52.4% 43 / 82 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 38.7% 12 / 31 Podpod 52.6% 10 / 19 totaltotal 49.2% 65 / 132 CC 1 SCAR 4.8
CC
1
Cov
52%
BUILD
2.0
get_id
2.0
reset
2.0
CRAP 1.6
« Moose/Catfile.pm ↑ Summary Moose/Instrument/HP33120A.pm »
1 package Lab::Moose::Instrument::Agilent33210A;
2 1 $Lab::Moose::Instrument::Agilent33210A::VERSION = '3.931';
3 #ABSTRACT: Agilent 33210A Arbitrary Waveform Generator, also as voltage source
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Time::HiRes qw (usleep);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Lab::Moose::Instrument qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
13 validated_getter
14 validated_setter
15 validated_no_param_setter
16 setter_params
17 1 /;
18 1 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Time::HiRes qw/time usleep/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Lab::Moose 'linspace';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 extends 'Lab::Moose::Instrument';
25  
26  
27 1 has [qw/max_units_per_second max_units_per_step min_units max_units/] =>
28 ( is => 'ro', isa => 'Num', required => 1 );
29  
30 1 has source_level_timestamp => (
31 is => 'rw',
32 isa => 'Num',
33 init_arg => undef,
34 );
35  
36 1 has verbose => (
37 is => 'ro',
38 isa => 'Bool',
39 default => 1
40 );
41  
42 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
43 0 my $self = shift;
44 0 $self->get_id();
45 }
46  
47 0 ▶sub get_id {
Subroutine get_id: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my $self = shift;
49 0 return $self->query( command => sprintf("*IDN?") );
50 }
51  
52  
53  
54 0 ▶sub reset {
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
55 0 my $self = shift;
56 0 $self->write( command => sprintf("*RST") );
57 }
58  
59  
60 0 ▶sub set_frq {
Subroutine set_frq: not called CC=1 SCAR=6.9
Pod documented
61 0 my ( $self, $value, %args ) = validated_setter( \@_,
62 value => { isa => 'Num' },
63 );
64  
65 0 $self->write( command => sprintf("FREQuency %d Hz", $value), %args );
66 }
67  
68  
69 0 ▶sub get_frq {
Subroutine get_frq: not called CC=1 SCAR=6.9
Pod documented
70 0 my $self = shift;
71  
72 0 return $self->query( command => sprintf("FREQuency?") );
73 }
74  
75  
76 0 ▶sub set_amplitude {
Subroutine set_amplitude: not called CC=1 SCAR=6.9
Pod documented
77 0 my ( $self, $value, %args ) = validated_setter( \@_,
78 value => { isa => 'Num' },
79 );
80  
81 0 $self->write( command => sprintf("VOLTage %e V", $value) );
82 }
83  
84  
85 0 ▶sub get_amplitude {
Subroutine get_amplitude: not called CC=1 SCAR=6.9
Pod documented
86 0 my $self = shift;
87  
88 0 return $self->query( command => sprintf("VOLTage?") );
89 }
90  
91  
92  
93 0 ▶sub set_offset {
Subroutine set_offset: not called CC=1 SCAR=6.9
Pod documented
94 0 my ( $self, $value, %args ) = validated_setter( \@_,
95 value => { isa => 'Num' },
96 );
97  
98 0 $self->write( command => sprintf("VOLTage:OFFSet %e V", $value) );
99 }
100  
101  
102 0 ▶sub get_offset {
Subroutine get_offset: not called CC=1 SCAR=6.9
Pod documented
103 0 my $self = shift;
104  
105 0 return $self->query( command => "VOLTage:OFFSet?" );
106 }
107  
108 #
109 # from here on we define the voltage source interface to be able
110 # to use the AWG as replacement for a boring dc source
111 #
112  
113 1 cache source_level => ( getter => 'source_level_query' );
114  
115 0 ▶sub source_level_query {
Subroutine source_level_query: not called CC=1 SCAR=6.9
Pod undocumented
116 0 my ( $self, %args ) = validated_getter( \@_ );
117  
118 0 return $self->cached_source_level(
119 $self->get_offset()
120 );
121 }
122  
123 0 ▶sub source_level {
Subroutine source_level: not called CC=1 SCAR=6.9
Pod undocumented
124 0 my ( $self, $value, %args ) = validated_setter(
125 \@_,
126 value => { isa => 'Num' }
127 );
128  
129 0 $self->set_offset( value => $value, %args );
130 0 $self->cached_source_level($value);
131 }
132  
133  
134 0 ▶sub set_level {
Subroutine set_level: not called CC=1 SCAR=6.9
Pod documented
135 0 my ( $self, $value, %args ) = validated_setter(
136 \@_,
137 value => { isa => 'Num' },
138 );
139  
140 0 return $self->linear_step_sweep(
141 to => $value, verbose => $self->verbose,
142 %args
143 );
144 }
145  
146  
147 0 ▶sub cached_level {
Subroutine cached_level: not called CC=1 SCAR=6.9
Pod documented
148 0 my $self = shift;
149 0 return $self->cached_source_level(@_);
150 }
151  
152  
153 0 ▶sub get_level {
Subroutine get_level: not called CC=1 SCAR=6.9
Pod documented
154 0 my $self = shift;
155 0 return $self->source_level_query(@_);
156 }
157  
158 # odds and oods
159  
160  
161 0 ▶sub selftest {
Subroutine selftest: not called CC=1 SCAR=6.9
Pod undocumented
162 0 my $self = shift;
163 0 return $self->query( command => sprintf("*TST?") );
164 }
165  
166 0 ▶sub display_on {
Subroutine display_on: not called CC=1 SCAR=6.9
Pod undocumented
167 0 my $self = shift;
168 0 $self->write( command => sprintf("DISPlay ON") );
169 }
170  
171 0 ▶sub display_off {
Subroutine display_off: not called CC=1 SCAR=6.9
Pod undocumented
172 0 my $self = shift;
173 0 $self->write( command => sprintf("DISPlay OFF") );
174 }
175  
176 0 ▶sub set_shape {
Subroutine set_shape: not called CC=1 SCAR=6.9
Pod undocumented
177 0 my ( $self, $value, %args ) = validated_setter( \@_,
178 value => { isa => 'Str' },
179 );
180  
181 0 $self->write( command => 'FUNCtion:SHAPe '.$value );
182 }
183  
184 0 ▶sub get_shape {
Subroutine get_shape: not called CC=1 SCAR=6.9
Pod undocumented
185 0 my $self = shift;
186 0 return $self->query( command => 'FUNCtion:SHAPe?' );
187 }
188  
189  
190 1 with qw(
191 Lab::Moose::Instrument::Common
192 Lab::Moose::Instrument::SCPI::Source::Function
193 Lab::Moose::Instrument::LinearStepSweep
194 );
195  
196  
197  
198 1 1;
199  
200 __END__
« Moose/Catfile.pm ↑ Summary Moose/Instrument/HP33120A.pm »