line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::Moose::Instrument::RS_RTB2000; |
2
|
|
|
|
|
|
|
$Lab::Moose::Instrument::RS_RTB2000::VERSION = '3.880'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Rohde & Schwarz RTB 2000 oscilloscope (work in progress) |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1931
|
use v5.20; |
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
7091
|
use MooseX::Params::Validate; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
8
|
|
9
|
1
|
|
|
1
|
|
546
|
use Moose::Util::TypeConstraints qw/enum/; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
10
|
|
10
|
1
|
|
|
1
|
|
564
|
use List::Util qw/sum/; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
84
|
|
11
|
1
|
|
|
1
|
|
8
|
use List::MoreUtils qw/minmax/; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
12
|
|
|
|
|
|
|
use Lab::Moose::Instrument |
13
|
1
|
|
|
1
|
|
831
|
qw/validated_channel_getter validated_channel_setter validated_getter validated_setter/; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
82
|
|
14
|
1
|
|
|
1
|
|
9
|
use Lab::Moose::Instrument::Cache; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
9
|
|
15
|
1
|
|
|
1
|
|
752
|
use Carp 'croak'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
16
|
1
|
|
|
1
|
|
15
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'Lab::Moose::Instrument'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# around default_connection_options => sub { |
21
|
|
|
|
|
|
|
# my $orig = shift; |
22
|
|
|
|
|
|
|
# my $self = shift; |
23
|
|
|
|
|
|
|
# my $options = $self->$orig(); |
24
|
|
|
|
|
|
|
# my $usb_opts = { vid => 0x0957, pid => 0x2b07 }; |
25
|
|
|
|
|
|
|
# $options->{USB} = $usb_opts; |
26
|
|
|
|
|
|
|
# $options->{'VISA::USB'} = $usb_opts; |
27
|
|
|
|
|
|
|
# return $options; |
28
|
|
|
|
|
|
|
# }; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub BUILD { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
$self->clear(); |
33
|
0
|
|
|
|
|
|
$self->cls(); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# MY FUNCTIONS |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
with qw( |
43
|
|
|
|
|
|
|
Lab::Moose::Instrument::Common |
44
|
|
|
|
|
|
|
Lab::Moose::Instrument::SCPIBlock |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Lab::Moose::Instrument::RS_RTB2000 - Rohde & Schwarz RTB 2000 oscilloscope (work in progress) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
version 3.880 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
use Lab::Moose; |
68
|
|
|
|
|
|
|
my $rtb = instrument( |
69
|
|
|
|
|
|
|
type => 'RS_RTB2000', |
70
|
|
|
|
|
|
|
connection_type => '...', |
71
|
|
|
|
|
|
|
connection_options => {...} |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$rtb->write(command => 'CHAN:TYPE HRES'); # set high-resolution mode |
75
|
|
|
|
|
|
|
$rtb->write(command => 'ACQ:POIN 10000'); # record 10k points per waveform |
76
|
|
|
|
|
|
|
$rtb->write(command => 'ACQ:TYPE AVER'); |
77
|
|
|
|
|
|
|
$rtb->write(command => 'ACQ:AVER:COUN 100'); # average over 100 waveforms |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# vertical setup |
81
|
|
|
|
|
|
|
$rtb->write(command => 'CHAN1:RANG 10'); # set 0 to 10V range |
82
|
|
|
|
|
|
|
$rtb->write(command => 'CHAN1:POS -5'); |
83
|
|
|
|
|
|
|
$rtb->write(command => 'CHAN1:COUP DCLimit'); |
84
|
|
|
|
|
|
|
$rtb->write(command => 'CHAN1:BAND B20'); # 20MHz Bandwith |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# horizontal setup |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# set measurement time of 1ms, i.e. 1/12 ms per division |
92
|
|
|
|
|
|
|
$rtb->write(command => 'TIM:RANG 1e-3'); |
93
|
|
|
|
|
|
|
$rtb->write(command => 'TIM:REF 50'); # reference point in the middle |
94
|
|
|
|
|
|
|
# set trigger position at start of measurement time |
95
|
|
|
|
|
|
|
$rtb->write(command => 'TIM:POS 0.5e-3'); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
$rtb->write(command => 'FORM REAL'); |
98
|
|
|
|
|
|
|
$rtb->write(command => 'FORM:BORD LSBF'); # little-endian data format |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# trigger |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:MODE NORM'); |
103
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:SOUR CH1'); |
104
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:TYPE EDGE'); |
105
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:EDGE:SLOP NEG'); |
106
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:LEV1 10e-3'); |
107
|
|
|
|
|
|
|
$rtb->write(command => 'TRIG:A:EDGE:FILT:HFR ON'); # 5kHz filter |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# output signal (option R&S RTB-B6) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:OUTP ON'); |
112
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:FUNC RAMP'); |
113
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:FUNC:RAMP:POL POS'); |
114
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:VOLT 5'); |
115
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:VOLT:OFFS 2.5'); |
116
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:FREQ 100'); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# burst setup |
119
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:BURS ON'); |
120
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:BURS:NCYC 50'); # 50 ramps |
121
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:BURS:TRIG SING'); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# record single measurement |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$rtb->write(command => 'ACQ:AVER:RESET'); # reset average calculation |
126
|
|
|
|
|
|
|
$rtb->write(command => 'SING'); |
127
|
|
|
|
|
|
|
$rtb->write(command => 'WGEN:BURS:TRIG:SING'); # start output signal |
128
|
|
|
|
|
|
|
$rtb->query(command => '*OPC?'); # wait until acquisiton is complete |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# transfer data |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $header = $rtb->query(command => 'CHAN1:DATA:HEAD?'); |
133
|
|
|
|
|
|
|
my ($x_start, $x_stop, $samples, $vals_per_sample) = split(',', $header); |
134
|
|
|
|
|
|
|
my $data = $rtb->query(command => 'CHAN:DATA?', read_length => '...'); |
135
|
|
|
|
|
|
|
# returns binary data #520000>??[>??[>??[>??[>??[>??... |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
my @points = $rtb->block_to_array($data, precision => 'single'); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 METHODS |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Used roles: |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=over |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item L<Lab::Moose::Instrument::Common> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item L<Lab::Moose::Instrument::SCPIBlock> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Copyright 2022 Andreas K. Huettel, Erik Fabrizzi, Simon Reinhardt |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
161
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |