line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lab::Instrument::TRMC2; |
2
|
|
|
|
|
|
|
#ABSTRACT: ABB TRMC2 temperature controller |
3
|
|
|
|
|
|
|
$Lab::Instrument::TRMC2::VERSION = '3.881'; |
4
|
1
|
|
|
1
|
|
1714
|
use v5.20; |
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
8
|
1
|
|
|
1
|
|
6
|
use Lab::Instrument; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
9
|
1
|
|
|
1
|
|
5
|
use Lab::Instrument::TemperatureControl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
10
|
1
|
|
|
1
|
|
5
|
use IO::File; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
187
|
|
11
|
1
|
|
|
1
|
|
8
|
use Time::HiRes qw/usleep/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
94
|
use Time::HiRes qw/sleep/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = ("Lab::Instrument::TemperatureControl"); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our %fields = ( supported_connections => ['none'], ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $WAIT = 0.3; #sec. waiting time for each reading; |
19
|
|
|
|
|
|
|
my $mounted = 0; # Ist sie schon mal angemeldet |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $buffin |
22
|
|
|
|
|
|
|
= "C:\\Program Files\\Trmc2\\buffin.txt"; # Hierhin gehen die Befehle |
23
|
|
|
|
|
|
|
my $buffout |
24
|
|
|
|
|
|
|
= "C:\\Program Files\\Trmc2\\buffout.txt"; # Hierher kommen die Antworten |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $TRMC2_LSP = 0.02; #Lower Setpoint Limit |
27
|
|
|
|
|
|
|
my $TRMC2_HSP = 1; #Upper Setpoint Limit |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
31
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
32
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
33
|
0
|
|
|
|
|
|
$self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); |
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub TRMC2init { |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Checks input and output buffer for TRMC2 commands |
41
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
42
|
0
|
0
|
|
|
|
|
if ( $mounted == 1 ) { die "TRMC already Initialized\n" } |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#files öffnen und schliessen |
45
|
0
|
0
|
|
|
|
|
if ( !open FHIN, "<$buffin" ) { |
46
|
0
|
|
|
|
|
|
die "could not open command file $buffin: $!\n"; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
close(FHIN); |
49
|
0
|
0
|
|
|
|
|
if ( !open FHOUT, "<$buffout" ) { |
50
|
0
|
|
|
|
|
|
die "could not open reply file $buffout: $!\n"; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
close(FHOUT); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#sleep($WAIT); |
55
|
0
|
|
|
|
|
|
$mounted = 1; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub TRMC2off { |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# "Unmounts" the TRMC |
61
|
0
|
|
|
0
|
0
|
|
$mounted = 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
0
|
0
|
|
sub set_heatercontrol { |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub TRMC2_Heater_Control_On { |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Switch the Heater Control (The coupling heater and set point NOT the heater switch in the main menu) |
71
|
|
|
|
|
|
|
# 1 On |
72
|
|
|
|
|
|
|
# 0 Off |
73
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
my $state = shift; |
75
|
0
|
0
|
0
|
|
|
|
if ( $state != 0 && $state != 1 ) { |
76
|
0
|
|
|
|
|
|
die |
77
|
|
|
|
|
|
|
"TRMC heater control can be turned off or on by 0 and 1 not by $state\n"; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
my $cmd = sprintf( "MAIN:ON=%d\0", $state ); |
80
|
0
|
|
|
|
|
|
TRMC2_Write( $cmd, 0.3 ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub TRMC2_Prog_On { |
84
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
my $state = shift; |
86
|
0
|
0
|
0
|
|
|
|
if ( $state != 0 && $state != 1 ) { |
87
|
0
|
|
|
|
|
|
die "TRMC Program can be turned off or on by 0 and 1 not by $state\n"; |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
my $cmd = sprintf( "MAIN:PROG=%d\0", $state ); |
90
|
0
|
|
|
|
|
|
TRMC2_Write( $cmd, 1.0 ); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub TRMC2_get_SetPoint { |
94
|
0
|
|
|
0
|
0
|
|
my $cmd = sprintf("MAIN:SP?"); |
95
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.1 ); |
96
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
97
|
0
|
|
|
|
|
|
chomp $val; |
98
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
return $value[0]; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub set_T { |
104
|
0
|
|
|
0
|
0
|
|
return TRMC2_set_SetPoint(@_); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub TRMC2_set_SetPoint { |
108
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
my $Setpoint = shift; |
110
|
0
|
|
|
|
|
|
my $FrSetpoint = MakeFrenchComma( sprintf( "%.6E", $Setpoint ) ); |
111
|
0
|
|
|
|
|
|
my $cmd = sprintf("MAIN:SP=$FrSetpoint"); |
112
|
0
|
|
|
|
|
|
TRMC2_Write( $cmd, 0.2 ); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub TRMC2_Set_T { |
116
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
117
|
0
|
|
|
|
|
|
my $T = shift; |
118
|
0
|
|
|
|
|
|
$T = sprintf( "%.6E", $T ); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#printf "T_SET=$T\n"; |
121
|
0
|
|
|
|
|
|
my $Tfr = MakeFrenchComma( sprintf( "%.6E", $T ) ); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
#printf "Frensh T_SET=$Tfr\n"; |
124
|
0
|
|
|
|
|
|
my $cmd = sprintf("MAIN:SP=$Tfr"); |
125
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.1 ); |
126
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
127
|
0
|
|
|
|
|
|
chomp $val; |
128
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
129
|
|
|
|
|
|
|
} |
130
|
0
|
|
|
|
|
|
return $value[0]; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub get_value { |
134
|
0
|
|
|
0
|
0
|
|
return TRMC2_get_PV(@_); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub TRMC2_get_PV { |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
0
|
0
|
|
my $cmd = sprintf("MAIN:PV?"); |
140
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
141
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
142
|
0
|
|
|
|
|
|
chomp $val; |
143
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
144
|
|
|
|
|
|
|
} |
145
|
0
|
|
|
|
|
|
return $value[0]; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub TRMC2_AllMEAS { |
149
|
0
|
|
|
0
|
0
|
|
my $cmd = sprintf("ALLMEAS?"); |
150
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
151
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
152
|
0
|
|
|
|
|
|
chomp $val; |
153
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
154
|
|
|
|
|
|
|
} |
155
|
0
|
|
|
|
|
|
return @value; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub TRMC2_get_T { #------------Reads Out Temperature------------- |
160
|
|
|
|
|
|
|
# Sensor Number: |
161
|
|
|
|
|
|
|
# 1 Heater |
162
|
|
|
|
|
|
|
# 2 Output |
163
|
|
|
|
|
|
|
# 3 Sample |
164
|
|
|
|
|
|
|
# 4 Still |
165
|
|
|
|
|
|
|
# 5 Mixing Chamber |
166
|
|
|
|
|
|
|
# 6 Cernox |
167
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
168
|
0
|
|
|
|
|
|
my $sensor = shift; |
169
|
|
|
|
|
|
|
|
170
|
0
|
0
|
0
|
|
|
|
if ( $sensor < 0 || $sensor > 6 ) { |
171
|
0
|
|
|
|
|
|
die "Sensor# $sensor not available\n"; |
172
|
|
|
|
|
|
|
} |
173
|
0
|
|
|
|
|
|
my $cmd = sprintf("ALLMEAS?"); |
174
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
175
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
177
|
0
|
|
|
|
|
|
chomp $val; |
178
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
#printf "$val\n"; |
181
|
|
|
|
|
|
|
} |
182
|
0
|
|
|
|
|
|
my @sensorval = split( /;/, $value[$sensor] ); |
183
|
0
|
|
|
|
|
|
my $T = $sensorval[1]; |
184
|
0
|
|
|
|
|
|
return $T; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub TRMC2_get_R { #------------Reads Out Resistance------------- |
189
|
|
|
|
|
|
|
# Sensor Number: |
190
|
|
|
|
|
|
|
# 1 Heater |
191
|
|
|
|
|
|
|
# 2 Output |
192
|
|
|
|
|
|
|
# 3 Sample |
193
|
|
|
|
|
|
|
# 4 Still |
194
|
|
|
|
|
|
|
# 5 Mixing Chamber |
195
|
|
|
|
|
|
|
# 6 Cernox |
196
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
197
|
0
|
|
|
|
|
|
my $sensor = shift; |
198
|
|
|
|
|
|
|
|
199
|
0
|
0
|
0
|
|
|
|
if ( $sensor < 0 || $sensor > 6 ) { |
200
|
0
|
|
|
|
|
|
die "Sensor# $sensor not available\n"; |
201
|
|
|
|
|
|
|
} |
202
|
0
|
|
|
|
|
|
my $cmd = sprintf("ALLMEAS?"); |
203
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
206
|
0
|
|
|
|
|
|
chomp $val; |
207
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
#printf "$val\n"; |
210
|
|
|
|
|
|
|
} |
211
|
0
|
|
|
|
|
|
my @sensorval = split( /;/, $value[$sensor] ); |
212
|
0
|
|
|
|
|
|
my $R = $sensorval[0]; |
213
|
0
|
|
|
|
|
|
return $R; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub TRMC2_get_RT |
218
|
|
|
|
|
|
|
{ #------------Reads Out Resistance and Temperature simoultaneously------------- |
219
|
|
|
|
|
|
|
# Sensor Number: |
220
|
|
|
|
|
|
|
# 1 Heater |
221
|
|
|
|
|
|
|
# 2 Output |
222
|
|
|
|
|
|
|
# 3 Sample |
223
|
|
|
|
|
|
|
# 4 Still |
224
|
|
|
|
|
|
|
# 5 Mixing Chamber |
225
|
|
|
|
|
|
|
# 6 Cernox |
226
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
227
|
0
|
|
|
|
|
|
my $sensor = shift; |
228
|
|
|
|
|
|
|
|
229
|
0
|
0
|
0
|
|
|
|
if ( $sensor < 0 || $sensor > 6 ) { |
230
|
0
|
|
|
|
|
|
die "Sensor# $sensor not available\n"; |
231
|
|
|
|
|
|
|
} |
232
|
0
|
|
|
|
|
|
my $cmd = sprintf("ALLMEAS?"); |
233
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
236
|
0
|
|
|
|
|
|
chomp $val; |
237
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
#printf "$val\n"; |
240
|
|
|
|
|
|
|
} |
241
|
0
|
|
|
|
|
|
my @sensorval = split( /;/, $value[$sensor] ); |
242
|
0
|
|
|
|
|
|
my $R = $sensorval[0]; |
243
|
0
|
|
|
|
|
|
my $T = $sensorval[1]; |
244
|
0
|
|
|
|
|
|
return ( $R, $T ); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub TRMC2_Read_Prog { #------------Reads Heater Batch Job------------- |
249
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
250
|
0
|
|
|
|
|
|
my $cmd = sprintf("MAIN:PROG_Table?\0"); |
251
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.2 ); |
252
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
253
|
0
|
|
|
|
|
|
chomp $val; |
254
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
#printf "$val\n"; |
257
|
|
|
|
|
|
|
} |
258
|
0
|
|
|
|
|
|
return @value; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub TRMC2_Set_T_Sweep { #------------Set T_Sweep------------- |
263
|
|
|
|
|
|
|
# TRMC2_Set_T_Sweep(SetPoint,Sweeprate,Holdtime=0) |
264
|
|
|
|
|
|
|
# Programs the built in Temperature Sweep. |
265
|
|
|
|
|
|
|
# After Activation it will sweep from the current Temperature |
266
|
|
|
|
|
|
|
# to the Set Temperature with the given Sweeprate. |
267
|
|
|
|
|
|
|
# The Sweep can be started with TRMC2_Start_Sweep(1) |
268
|
|
|
|
|
|
|
# Variables: |
269
|
|
|
|
|
|
|
# SetPoint in K |
270
|
|
|
|
|
|
|
# Sweeprate in K/Min |
271
|
|
|
|
|
|
|
# Holdtime=0 |
272
|
0
|
|
|
0
|
0
|
|
my $arg_cnt = @_; |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
#printf "#of variables=$arg_cnt\n"; |
275
|
0
|
|
|
|
|
|
my $self = shift; |
276
|
0
|
|
|
|
|
|
my $Setpoint = shift; #K |
277
|
0
|
|
|
|
|
|
my $Sweeprate = shift; #K/min |
278
|
0
|
|
|
|
|
|
my $Holdtime = 0.; #sec. |
279
|
0
|
0
|
|
|
|
|
if ( $arg_cnt == 4 ) { $Holdtime = shift } |
|
0
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
my $FrSetpoint = MakeFrenchComma( sprintf( "%.6E", $Setpoint ) ); |
281
|
0
|
|
|
|
|
|
my $FrSweeprate = MakeFrenchComma( sprintf( "%.6E", $Sweeprate ) ); |
282
|
0
|
|
|
|
|
|
my $FrHoldtime = MakeFrenchComma( sprintf( "%.6E", $Holdtime ) ); |
283
|
0
|
|
|
|
|
|
my $cmd = sprintf("MAIN:PROG_Table=1\0"); |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
#printf $cmd; |
286
|
0
|
|
|
|
|
|
TRMC2_Write( $cmd, 0.5 ); |
287
|
0
|
|
|
|
|
|
$cmd = sprintf( |
288
|
|
|
|
|
|
|
"PROG_TABLE(%d)=%s;%s;%s\n", |
289
|
|
|
|
|
|
|
0, $FrSetpoint, $FrSweeprate, $FrHoldtime |
290
|
|
|
|
|
|
|
); |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
#printf $cmd; |
293
|
0
|
|
|
|
|
|
TRMC2_Write( $cmd, 0.5 ); |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
sub TRMC2_Start_Sweep |
297
|
|
|
|
|
|
|
{ #---Start/Stops The Sweep---Provided Heater in TRMC2 Window is turned ON------ |
298
|
|
|
|
|
|
|
# 1 Start Sweep |
299
|
|
|
|
|
|
|
# 0 Stop Sweep leaves power on; |
300
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
301
|
0
|
|
|
|
|
|
my $state = shift; |
302
|
0
|
0
|
0
|
|
|
|
if ( $state != 0 && $state != 1 ) { |
303
|
0
|
|
|
|
|
|
die "Sweep can be turned off or on by 0 and 1 not by $state\n"; |
304
|
|
|
|
|
|
|
} |
305
|
0
|
0
|
|
|
|
|
if ( $state == 1 ) { $self->TRMC2_Heater_Control_On($state); } |
|
0
|
|
|
|
|
|
|
306
|
0
|
|
|
|
|
|
$self->TRMC2_Prog_On($state); |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub TRMC2_All_CHANNEL { |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
# Reads Out All Channels and Values and returns an Array |
312
|
0
|
|
|
0
|
0
|
|
my $cmd = sprintf("*CHANNEL"); |
313
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, 0.1 ); |
314
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
315
|
0
|
|
|
|
|
|
chomp $val; |
316
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
317
|
|
|
|
|
|
|
} |
318
|
0
|
|
|
|
|
|
return @value; |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub TRMC2_Active_CHANNEL { |
323
|
|
|
|
|
|
|
|
324
|
0
|
|
|
0
|
0
|
|
my $cmd = sprintf("CHANNEL?"); |
325
|
0
|
|
|
|
|
|
my @value = TRMC2_Query( $cmd, $WAIT ); |
326
|
0
|
|
|
|
|
|
foreach my $val (@value) { |
327
|
0
|
|
|
|
|
|
chomp $val; |
328
|
0
|
|
|
|
|
|
$val = RemoveFrenchComma($val); |
329
|
|
|
|
|
|
|
} |
330
|
0
|
|
|
|
|
|
return @value; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub TRMC2_Shut_Down { |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
# Will Stop the Sweep and the Heater Control |
337
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
338
|
0
|
|
|
|
|
|
$self->TRMC2_Start_Sweep(0); |
339
|
0
|
|
|
|
|
|
$self->TRMC2_Heater_Control_On(0); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub TRMC2_Write { |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# TRMC2_Write($cmd, $wait_write=$WAIT) |
345
|
|
|
|
|
|
|
# Sends a command to the TRMC and will wait $wait_write |
346
|
0
|
|
|
0
|
0
|
|
my $arg_cnt = @_; |
347
|
0
|
|
|
|
|
|
my $cmd = shift; |
348
|
0
|
|
|
|
|
|
my $wait_write = $WAIT; |
349
|
0
|
0
|
|
|
|
|
if ( $arg_cnt == 2 ) { $wait_write = shift } |
|
0
|
|
|
|
|
|
|
350
|
0
|
0
|
|
|
|
|
if ( !open FHIN, ">$buffin" ) { |
351
|
0
|
|
|
|
|
|
die "could not open command file $buffin: $!\n"; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
#printf "$cmd\n"; |
355
|
0
|
|
|
|
|
|
printf FHIN $cmd; #put $cmd it in buffin! |
356
|
0
|
|
|
|
|
|
close(FHIN); |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
#printf "Wait Write=$wait_write\n"; |
359
|
0
|
|
|
|
|
|
sleep($wait_write); |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub TRMC2_Query { |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# TRMC2_Query($cmd, $wait_query=$WAIT) |
365
|
|
|
|
|
|
|
# Sends a command to the TRMC and will wait $wait_query sec long |
366
|
|
|
|
|
|
|
# and returns the result |
367
|
0
|
|
|
0
|
0
|
|
my $arg_cnt = @_; |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
#printf "# Variables=$arg_cnt\n"; |
370
|
0
|
|
|
|
|
|
my $cmd = shift; |
371
|
0
|
|
|
|
|
|
my $wait_query = $WAIT; |
372
|
0
|
0
|
|
|
|
|
if ( $arg_cnt == 2 ) { $wait_query = shift } |
|
0
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
#----Open Command File--------- |
375
|
0
|
0
|
|
|
|
|
if ( !open FHIN, ">$buffin" ) { |
376
|
0
|
|
|
|
|
|
die "could not open command file $buffin: $!\n"; |
377
|
|
|
|
|
|
|
} |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
#printf "Command $cmd\n"; |
380
|
0
|
|
|
|
|
|
printf FHIN $cmd; #put $cmd it in buffin! |
381
|
0
|
|
|
|
|
|
close(FHIN); |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
#printf "Wait Query=$wait_query\n"; |
384
|
|
|
|
|
|
|
#-----------End Of Setting Command----------- |
385
|
0
|
|
|
|
|
|
sleep($wait_query); |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
#--------Reading Value---------------------- |
388
|
0
|
0
|
|
|
|
|
if ( !open FHOUT, "<$buffout" ) { |
389
|
0
|
|
|
|
|
|
die "could not open reply file $buffout: $!\n"; |
390
|
|
|
|
|
|
|
} |
391
|
0
|
|
|
|
|
|
my @line = <FHOUT>; |
392
|
0
|
|
|
|
|
|
close(FHOUT); |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
#printf "read lines are:@line\n"; |
395
|
0
|
|
|
|
|
|
return @line; |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub RemoveFrenchComma { |
399
|
0
|
|
|
0
|
0
|
|
my $value = shift; |
400
|
0
|
|
|
|
|
|
$value =~ s/,/./g; |
401
|
0
|
|
|
|
|
|
return $value; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
sub MakeFrenchComma { |
405
|
0
|
|
|
0
|
0
|
|
my $value = shift; |
406
|
0
|
|
|
|
|
|
$value =~ s/\./,/g; |
407
|
0
|
|
|
|
|
|
return $value; |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
__END__ |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=pod |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=encoding UTF-8 |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=head1 NAME |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Lab::Instrument::TRMC2 - ABB TRMC2 temperature controller |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=head1 VERSION |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
version 3.881 |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=head1 SYNOPSIS |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
use Lab::Instrument::TRMC2; |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=head1 DESCRIPTION |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
The Lab::Instrument::ILM class implements an interface to the ABB TRMC2 temperature |
431
|
|
|
|
|
|
|
controller. The driver works, but documentation is lacking. |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
my $trmc=... |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head1 CAVEATS/BUGS |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
probably many |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=head1 SEE ALSO |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=over 4 |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=item L<Lab::Instrument> |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=back |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Copyright 2011 Andreas K. Huettel, Florian Olbrich |
454
|
|
|
|
|
|
|
2012 Alois Dirnaichner, Andreas K. Huettel |
455
|
|
|
|
|
|
|
2013 Alois Dirnaichner |
456
|
|
|
|
|
|
|
2016 Simon Reinhardt |
457
|
|
|
|
|
|
|
2017 Andreas K. Huettel, Simon Reinhardt |
458
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
462
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=cut |