Moose/Instrument/SCPI/Sense/Function.pm

filter: Statementstmt 100% 31 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 2 / 2 totaltotal 100% 42 / 42 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Moose/Instrument/Agilent34460A.pm ↑ Summary Moose/Instrument/SCPI/Sense/NPLC.pm »
1 package Lab::Moose::Instrument::SCPI::Sense::Function;
2 4 $Lab::Moose::Instrument::SCPI::Sense::Function::VERSION = '3.881';
3 #ABSTRACT: Role for the SCPI SENSe:FUNCtion subsystem
4  
5 4 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 use Lab::Moose::Instrument
10 4 ▶ qw/validated_channel_getter validated_channel_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 excludes 'Lab::Moose::Instrument::SCPI::Sense::Function::Concurrent';
17  
18  
19 # Cache used by multiple functions in sense subsystem
20 4 cache sense_function => ( getter => 'sense_function_query' );
21  
22 sub sense_function_query {
23 5 ▶ my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
Subroutine sense_function_query: called CC=1 SCAR=0.0
Pod documented
24  
25 5 my $value = $self->query( command => "SENS${channel}:FUNC?", %args );
26 5 $value =~ s/["']//g;
27 5 return $self->cached_sense_function($value);
28 }
29  
30 sub sense_function {
31 9 ▶ my ( $self, $channel, $value, %args ) = validated_channel_setter( \@_ );
Subroutine sense_function: called CC=1 SCAR=0.0
Pod documented
32  
33 9 $self->write( command => "SENS${channel}:FUNC '$value'", %args );
34 9 return $self->cached_sense_function($value);
35 }
36  
37  
38  
39 4 1;
40  
41 __END__
42  
43 =pod
44  
45 =encoding UTF-8
46  
47 =head1 NAME
48  
49 Lab::Moose::Instrument::SCPI::Sense::Function - Role for the SCPI SENSe:FUNCtion subsystem
50  
51 =head1 VERSION
52  
53 version 3.881
54  
55 =head1 DESCRIPTION
56  
57 This role is intended for instruments which support a single sense function.
58 The command for setting the function must be SENS:FUNC $function.
59 Instruments with concurrent sense shell use the Sense::Function:Concurrent
60 role.
61  
62 The set sense function is used by other SENSE: roles, like SENSE:NPLC. For
63 example,
64  
65 $source->sense_function(value => 'CURR');
66 $source->sense_nplc(value => 10);
67  
68 will set the integration time for current measurement to 10 power line cycles.
69  
70 =head1 METHODS
71  
72 =head2 sense_function_query
73  
74 =head2 sense_function
75  
76 Query/Enable the sense function used by the instrument
77  
78 =head1 COPYRIGHT AND LICENSE
79  
80 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
81  
82 Copyright 2016 Simon Reinhardt
83 2017 Andreas K. Huettel, Simon Reinhardt
84 2018 Simon Reinhardt
85 2020 Andreas K. Huettel
86  
87  
88 This is free software; you can redistribute it and/or modify it under
89 the same terms as the Perl 5 programming language system itself.
90  
91 =cut
« Moose/Instrument/Agilent34460A.pm ↑ Summary Moose/Instrument/SCPI/Sense/NPLC.pm »