Moose/Instrument/HP83732A.pm

filter: Statementstmt 55.0% 38 / 69 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.1% 12 / 26 Podpod 50.0% 7 / 14 totaltotal 52.2% 57 / 109 SCAR 0.9
CC
1
Cov
55%
BUILD
2.0
get_id
2.0
reset
2.0
CRAP 1.1
« Moose/Instrument/KeysightE3633E.pm ↑ Summary Moose/Instrument/Yokogawa7651.pm »
1 package Lab::Moose::Instrument::HP83732A;
2 1 $Lab::Moose::Instrument::HP83732A::VERSION = '3.881';
3 #ABSTRACT: HP 83732A Series Synthesized Signal Generator
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/
13 validated_getter
14 validated_setter
15 validated_no_param_setter
16 setter_params
17 1 ▶/;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 sub BUILD {
27 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
28 0 $self->get_id();
29 }
30  
31 sub get_id {
32 0 ▶ my $self = shift;
Subroutine get_id: not called CC=1 SCAR=6.9
Pod undocumented
33 0 return $self->query( command => sprintf("*IDN?") );
34 }
35  
36  
37  
38 sub reset {
39 0 ▶ my $self = shift;
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
40 0 $self->write( command => sprintf("*RST") );
41 }
42  
43  
44 sub set_frq {
45 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine set_frq: not called CC=1 SCAR=6.9
Pod documented
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 ▶ my $self = shift;
Subroutine get_frq: not called CC=1 SCAR=6.9
Pod documented
55  
56 0 return $self->query( command => sprintf("FREQuency:CW?") );
57 }
58  
59 sub set_power {
60 0 ▶ my ( $self, $value, %args ) = validated_setter( \@_,
Subroutine set_power: not called CC=1 SCAR=6.9
Pod documented
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 ▶ my $self = shift;
Subroutine get_power: not called CC=1 SCAR=6.9
Pod documented
70  
71 0 return $self->query( command => sprintf("POWer:LEVel?") );
72 }
73  
74 sub power_on {
75 0 ▶ my $self = shift;
Subroutine power_on: not called CC=1 SCAR=6.9
Pod documented
76 0 $self->write( command => sprintf("OUTP:STATe ON") );
77 }
78  
79 sub power_off {
80 0 ▶ my $self = shift;
Subroutine power_off: not called CC=1 SCAR=6.9
Pod documented
81 0 $self->write( command => sprintf("OUTP:STATe OFF") );
82 }
83  
84 sub selftest {
85 0 ▶ my $self = shift;
Subroutine selftest: not called CC=1 SCAR=6.9
Pod undocumented
86 0 return $self->query( command => sprintf("*TST?") );
87 }
88  
89 sub display_on {
90 0 ▶ my $self = shift;
Subroutine display_on: not called CC=1 SCAR=6.9
Pod undocumented
91 0 $self->write( command => sprintf("DISPlay ON") );
92 }
93  
94 sub display_off {
95 0 ▶ my $self = shift;
Subroutine display_off: not called CC=1 SCAR=6.9
Pod undocumented
96 0 $self->write( command => sprintf("DISPlay OFF") );
97 }
98  
99 sub enable_external_am {
100 0 ▶ my $self = shift;
Subroutine enable_external_am: not called CC=1 SCAR=6.9
Pod undocumented
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 ▶ my $self = shift;
Subroutine disable_external_am: not called CC=1 SCAR=6.9
Pod undocumented
109 0 $self->write( command => sprintf("AM:STATe OFF") );
110 }
111  
112 1 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
« Moose/Instrument/KeysightE3633E.pm ↑ Summary Moose/Instrument/Yokogawa7651.pm »