File Coverage

blib/lib/Lab/Moose/Instrument/HP83732A.pm
Criterion Covered Total %
statement 35 66 53.0
branch n/a
condition n/a
subroutine 12 26 46.1
pod 7 14 50.0
total 54 106 50.9


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::HP83732A;
2             $Lab::Moose::Instrument::HP83732A::VERSION = '3.881';
3             #ABSTRACT: HP 83732A Series Synthesized Signal Generator
4              
5 1     1   2285 use v5.20;
  1         4  
6              
7 1     1   6 use strict;
  1         2  
  1         32  
8 1     1   12 use Time::HiRes qw (usleep);
  1         2  
  1         15  
9 1     1   143 use Moose;
  1         3  
  1         20  
10 1     1   7492 use Moose::Util::TypeConstraints qw/enum/;
  1         4  
  1         13  
11 1     1   580 use MooseX::Params::Validate;
  1         4  
  1         10  
12 1         88 use Lab::Moose::Instrument qw/
13             validated_getter
14             validated_setter
15             validated_no_param_setter
16             setter_params
17 1     1   552 /;
  1         4  
18 1     1   11 use Lab::Moose::Instrument::Cache;
  1         3  
  1         11  
19 1     1   719 use Carp;
  1         3  
  1         64  
20 1     1   8 use namespace::autoclean;
  1         3  
  1         8  
21 1     1   142 use Time::HiRes qw/time usleep/;
  1         2  
  1         6  
22 1     1   103 use Lab::Moose 'linspace';
  1         2  
  1         9  
23              
24             extends 'Lab::Moose::Instrument';
25              
26             sub BUILD {
27 0     0 0   my $self = shift;
28 0           $self->get_id();
29             }
30              
31             sub get_id {
32 0     0 0   my $self = shift;
33 0           return $self->query( command => sprintf("*IDN?") );
34             }
35              
36              
37              
38             sub reset {
39 0     0 1   my $self = shift;
40 0           $self->write( command => sprintf("*RST") );
41             }
42              
43              
44             sub set_frq {
45 0     0 1   my ( $self, $value, %args ) = validated_setter( \@_,
46             value => { isa => 'Num' },
47             );
48              
49 0           $self->write( command => sprintf("FREQuency:CW %d Hz", $value), %args );
50             }
51              
52              
53             sub get_frq {
54 0     0 1   my $self = shift;
55              
56 0           return $self->query( command => sprintf("FREQuency:CW?") );
57             }
58              
59             sub set_power {
60 0     0 1   my ( $self, $value, %args ) = validated_setter( \@_,
61             value => { isa => 'Num' },
62             );
63              
64 0           $self->write( command => sprintf("POWer:LEVel %d DBM", $value) );
65             }
66              
67              
68             sub get_power {
69 0     0 1   my $self = shift;
70              
71 0           return $self->query( command => sprintf("POWer:LEVel?") );
72             }
73              
74             sub power_on {
75 0     0 1   my $self = shift;
76 0           $self->write( command => sprintf("OUTP:STATe ON") );
77             }
78              
79             sub power_off {
80 0     0 1   my $self = shift;
81 0           $self->write( command => sprintf("OUTP:STATe OFF") );
82             }
83              
84             sub selftest {
85 0     0 0   my $self = shift;
86 0           return $self->query( command => sprintf("*TST?") );
87             }
88              
89             sub display_on {
90 0     0 0   my $self = shift;
91 0           $self->write( command => sprintf("DISPlay ON") );
92             }
93              
94             sub display_off {
95 0     0 0   my $self = shift;
96 0           $self->write( command => sprintf("DISPlay OFF") );
97             }
98              
99             sub enable_external_am {
100 0     0 0   my $self = shift;
101 0           $self->write( command => sprintf("AM:DEPTh MAX") );
102 0           $self->write( command => sprintf("AM:SENSitivity 70PCT/VOLT") );
103 0           $self->write( command => sprintf("AM:TYPE LINear") );
104 0           $self->write( command => sprintf("AM:STATe ON") );
105             }
106              
107             sub disable_external_am {
108 0     0 0   my $self = shift;
109 0           $self->write( command => sprintf("AM:STATe OFF") );
110             }
111              
112             1;
113              
114             __END__
115              
116             =pod
117              
118             =encoding UTF-8
119              
120             =head1 NAME
121              
122             Lab::Moose::Instrument::HP83732A - HP 83732A Series Synthesized Signal Generator
123              
124             =head1 VERSION
125              
126             version 3.881
127              
128             =head1 SYNOPSIS
129              
130             use Lab::Moose;
131              
132             # Constructor
133             my $HP = instrument(
134             type => 'HP83732A',
135             connection_type => 'VISA_GPIB',
136             connection_options => {
137             pad => 28,
138             },
139             );
140              
141             =head1 METHODS
142              
143             =head2 reset
144              
145             $HP->reset();
146              
147             =head2 set_frq
148              
149             $HP->set_frq( value => );
150              
151             The frequency can range from 10 MHz to 20 GHz.
152             TODO: How is the format of the frequency? float?
153              
154             =head2 get_frq
155              
156             $HP->get_frq();
157              
158             =head2 set_power
159              
160             $HP->set_power( value => );
161              
162             TODO: format of power?
163              
164             =head2 get_power
165              
166             $HP->get_power();
167              
168             =head2 power_on
169              
170             $HP->power_on();
171              
172             =head2 power_off
173              
174             $HP->power_off();
175              
176             =head1 COPYRIGHT AND LICENSE
177              
178             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
179              
180             Copyright 2022 Mia Schambeck
181              
182              
183             This is free software; you can redistribute it and/or modify it under
184             the same terms as the Perl 5 programming language system itself.
185              
186             =cut