| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lab::Moose::Instrument::SCPI::Sense::Function::Concurrent; |
|
2
|
|
|
|
|
|
|
$Lab::Moose::Instrument::SCPI::Sense::Function::Concurrent::VERSION = '3.881'; |
|
3
|
|
|
|
|
|
|
#ABSTRACT: Role for the SCPI SENSe:FUNCtion subsystem with support for concurrent sense |
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
2677
|
use v5.20; |
|
|
3
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
22
|
use Moose::Role; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
24
|
|
|
8
|
3
|
|
|
3
|
|
16596
|
use Lab::Moose::Instrument::Cache; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
31
|
|
|
9
|
|
|
|
|
|
|
use Lab::Moose::Instrument |
|
10
|
3
|
|
|
3
|
|
1999
|
qw/validated_channel_getter validated_channel_setter/; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
205
|
|
|
11
|
3
|
|
|
3
|
|
26
|
use MooseX::Params::Validate; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
25
|
|
|
12
|
3
|
|
|
3
|
|
1539
|
use Carp; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
187
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
24
|
use namespace::autoclean; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
excludes 'Lab::Moose::Instrument::SCPI::Sense::Function'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
cache sense_function_concurrent => |
|
20
|
|
|
|
|
|
|
( getter => 'sense_function_concurrent_query' ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub sense_function_concurrent_query { |
|
23
|
2
|
|
|
2
|
1
|
999
|
my ( $self, $channel, %args ) = validated_channel_getter( \@_ ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
23
|
my $value = $self->query( command => "SENS${channel}:FUNC:CONC?", %args ); |
|
26
|
2
|
|
|
|
|
12
|
return $self->cached_sense_function_concurrent($value); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub sense_function_concurrent { |
|
30
|
4
|
|
|
4
|
1
|
12736
|
my ( $self, $channel, $value, %args ) = validated_channel_setter( |
|
31
|
|
|
|
|
|
|
\@_, |
|
32
|
|
|
|
|
|
|
value => { isa => 'Bool' } |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
26
|
$self->write( command => "SENS${channel}:FUNC:CONC $value", %args ); |
|
36
|
4
|
|
|
|
|
24
|
return $self->cached_sense_function_concurrent($value); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
cache sense_function => ( getter => 'sense_function_query' ); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub sense_function { |
|
43
|
2
|
|
|
2
|
1
|
38
|
my ( $self, $channel, $value, %args ) = validated_channel_setter( \@_ ); |
|
44
|
2
|
|
|
|
|
14
|
return $self->cached_sense_function($value); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub sense_function_query { |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# overwrite in instrument driver to get different default. |
|
51
|
0
|
|
|
0
|
1
|
0
|
return 'CURR'; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
cache sense_function_on => |
|
56
|
|
|
|
|
|
|
( isa => 'ArrayRef[Str]', getter => 'sense_function_on_query' ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub sense_function_on { |
|
59
|
6
|
|
|
6
|
1
|
3066
|
my ( $self, $channel, $value, %args ) = validated_channel_setter( |
|
60
|
|
|
|
|
|
|
\@_, |
|
61
|
|
|
|
|
|
|
value => { isa => 'ArrayRef[Str]' } |
|
62
|
|
|
|
|
|
|
); |
|
63
|
6
|
|
|
|
|
17
|
my @values = @{$value}; |
|
|
6
|
|
|
|
|
19
|
|
|
64
|
6
|
100
|
|
|
|
24
|
if ( not $self->cached_sense_function_concurrent ) { |
|
65
|
3
|
50
|
|
|
|
13
|
if ( @values != 1 ) { |
|
66
|
0
|
|
|
|
|
0
|
croak |
|
67
|
|
|
|
|
|
|
"sense_function_on without concurrent sense only accepts single function"; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} |
|
70
|
6
|
|
|
|
|
23
|
@values = map {"'$_'"} @values; |
|
|
6
|
|
|
|
|
26
|
|
|
71
|
6
|
|
|
|
|
21
|
my $param = join( ',', @values ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
6
|
|
|
|
|
36
|
$self->write( command => "SENS${channel}:FUNC:ON $param", %args ); |
|
74
|
6
|
|
|
|
|
38
|
return $self->sense_function_on_query(%args); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub sense_function_on_query { |
|
78
|
13
|
|
|
13
|
1
|
77
|
my ( $self, $channel, %args ) = validated_channel_getter( \@_ ); |
|
79
|
|
|
|
|
|
|
|
|
80
|
13
|
|
|
|
|
61
|
my $value = $self->query( command => "SENS${channel}:FUNC:ON?", %args ); |
|
81
|
13
|
|
|
|
|
59
|
$value =~ s/["']//g; |
|
82
|
13
|
|
|
|
|
46
|
my @values = split( ',', $value ); |
|
83
|
13
|
|
|
|
|
68
|
$self->cached_sense_function_on( [@values] ); |
|
84
|
13
|
|
|
|
|
74
|
return [@values]; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub sense_function_off { |
|
89
|
2
|
|
|
2
|
1
|
601
|
my ( $self, $channel, $value, %args ) = validated_channel_setter( |
|
90
|
|
|
|
|
|
|
\@_, |
|
91
|
|
|
|
|
|
|
value => { isa => 'ArrayRef[Str]' } |
|
92
|
|
|
|
|
|
|
); |
|
93
|
2
|
|
|
|
|
6
|
my @values = @{$value}; |
|
|
2
|
|
|
|
|
20
|
|
|
94
|
2
|
|
|
|
|
8
|
@values = map {"'$_'"} @values; |
|
|
3
|
|
|
|
|
13
|
|
|
95
|
2
|
|
|
|
|
7
|
my $param = join( ',', @values ); |
|
96
|
|
|
|
|
|
|
|
|
97
|
2
|
|
|
|
|
14
|
$self->write( command => "SENS${channel}:FUNC:OFF $param", %args ); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# update cached_sense_function_on |
|
100
|
2
|
|
|
|
|
9
|
$self->sense_function_on_query(%args); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub sense_function_off_query { |
|
104
|
0
|
|
|
0
|
1
|
|
my ( $self, $channel, %args ) = validated_channel_getter( \@_ ); |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $value = $self->query( command => "SENS${channel}:FUNC:OFF?", %args ); |
|
107
|
0
|
|
|
|
|
|
$value =~ s/["']//g; |
|
108
|
0
|
|
|
|
|
|
my @values = split( ',', $value ); |
|
109
|
0
|
|
|
|
|
|
return [@values]; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=encoding UTF-8 |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 NAME |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Lab::Moose::Instrument::SCPI::Sense::Function::Concurrent - Role for the SCPI SENSe:FUNCtion subsystem with support for concurrent sense |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 VERSION |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
version 3.881 |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This role is intended for instruments which support multiple concurrent sense |
|
131
|
|
|
|
|
|
|
functions. For example, the Keithley2400 or KeysightB2901A source/measure units |
|
132
|
|
|
|
|
|
|
which can measure voltage and current simultaneously. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The set sense function is used by other SENSE: roles, like SENSE:NPLC. For |
|
135
|
|
|
|
|
|
|
example, let us enable concurrent measurement of voltage and current and set the integration time for both |
|
136
|
|
|
|
|
|
|
measured parameters: |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$source->sense_function_concurrent(value => 1); |
|
139
|
|
|
|
|
|
|
$source->sense_function_on(value => ['VOLT', 'CURR']); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Set NPLC for current measurement |
|
142
|
|
|
|
|
|
|
$source->sense_function(value => 'CURR'); |
|
143
|
|
|
|
|
|
|
$source->sense_nplc(value => 10); |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Set NPLC for voltage measurement |
|
146
|
|
|
|
|
|
|
$source->sense_function(value => 'VOLT'); |
|
147
|
|
|
|
|
|
|
$source->sense_nplc(value => 10); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 METHODS |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 sense_function_concurrent_query/sense_function_concurrent |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Set/Get concurrent property of sensor block. Allowed values: C<0> or C<1>. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 sense_function |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
$source->sense_function(value => $function); |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Unlike the C<sense_function> method from the |
|
160
|
|
|
|
|
|
|
L<Lab::Moose::Instrument::SCPI::Sense::Function> method, does not send a command, only used by other SENSE: roles, like SENSE:NPLC |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 cached_sense_function/sense_function_query |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
C<sense_function_query> is only used to initialize the cache. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 sense_function_on |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
$source->sense_function_on(value => ['CURR', 'VOLT']); |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Enable parameters which should be measured. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 sense_function_on_query |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
my @params = @{$source->sense_function_on_query()}; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Query list of parameters which are measured. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 sense_function_off_query/sense_function_off |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
$source->sense_function_off(value => ['CURR']); |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Query/set list of parameters which should not be measured. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Copyright 2018 Simon Reinhardt |
|
189
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
193
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=cut |