File Coverage

blib/lib/Lab/Moose/Instrument/SCPI/Source/Power.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 2 2 100.0
total 36 36 100.0


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::SCPI::Source::Power;
2             #ABSTRACT: Role for the SCPI SOURce:POWer subsystem
3             $Lab::Moose::Instrument::SCPI::Source::Power::VERSION = '3.880';
4 4     4   3056 use v5.20;
  4         18  
5              
6 4     4   26 use Moose::Role;
  4         25  
  4         50  
7 4     4   21938 use Lab::Moose::Instrument::Cache;
  4         11  
  4         32  
8             use Lab::Moose::Instrument
9 4     4   2538 qw/validated_channel_getter validated_channel_setter/;
  4         20  
  4         246  
10 4     4   42 use MooseX::Params::Validate;
  4         12  
  4         38  
11 4     4   1947 use Carp;
  4         9  
  4         224  
12              
13 4     4   30 use namespace::autoclean;
  4         9  
  4         47  
14              
15              
16             cache source_power_level_immediate_amplitude =>
17             ( getter => 'source_power_level_immediate_amplitude_query' );
18              
19             sub source_power_level_immediate_amplitude_query {
20 6     6 1 3328 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
21              
22 6         31 return $self->cached_source_power_level_immediate_amplitude(
23             $self->query( command => "SOUR${channel}:POW?", %args ) );
24             }
25              
26             sub source_power_level_immediate_amplitude {
27 6     6 1 12348 my ( $self, $channel, $value, %args ) = validated_channel_setter(
28             \@_,
29             value => { isa => 'Num' }
30             );
31 6         83 $self->write(
32             command => sprintf( "SOUR%s:POW %.17g", $channel, $value ),
33             %args
34             );
35 6         35 $self->cached_source_power_level_immediate_amplitude($value);
36             }
37              
38             1;
39              
40             __END__
41              
42             =pod
43              
44             =encoding UTF-8
45              
46             =head1 NAME
47              
48             Lab::Moose::Instrument::SCPI::Source::Power - Role for the SCPI SOURce:POWer subsystem
49              
50             =head1 VERSION
51              
52             version 3.880
53              
54             =head1 METHODS
55              
56             =head2 source_power_level_immediate_amplitude_query
57              
58             =head2 source_power_level_immediate_amplitude
59              
60             $self->source_power_level_immediate_amplitude(value => -20);
61              
62             Query/Set the signal amplitude, which will be set without waiting for further
63             commands (like e.g. triggers).
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
68              
69             Copyright 2017 Andreas K. Huettel, Simon Reinhardt
70             2020 Andreas K. Huettel
71              
72              
73             This is free software; you can redistribute it and/or modify it under
74             the same terms as the Perl 5 programming language system itself.
75              
76             =cut