|
1 ################################################## |
|
2 # |
|
3 # Protocol File |
|
4 # |
|
5 # Protocol file for Lakeshore 336 |
|
6 # Diamond Light Source, June 2010 |
|
7 # |
|
8 # Oak Ridge National Lab, UT-Battelle, 2013-2015. |
|
9 # Add more commands. |
|
10 # |
|
11 ################################################## |
|
12 |
|
13 # check check Lakeshore 331 |
|
14 |
|
15 ################################################## |
|
16 # General Settings |
|
17 ################################################## |
|
18 |
|
19 Terminator = "\r\n"; |
|
20 ReplyTimeout = 1000; |
|
21 |
|
22 |
|
23 ################################################### |
|
24 # Get functions |
|
25 ################################################### |
|
26 |
|
27 # /// Read the device ID |
|
28 getID { |
|
29 out "*IDN?"; |
|
30 in "LSCI,%s"; |
|
31 } |
|
32 |
|
33 # /// Read the model number |
|
34 getMODEL { |
|
35 in "LSCI,%8c,%*15c,%*s"; |
|
36 } |
|
37 |
|
38 # /// Read the serial number |
|
39 getSERIAL { |
|
40 in "LSCI,%*8c,%15c,%*s"; |
|
41 } |
|
42 |
|
43 # /// Read the device firmware number |
|
44 getFIRMWARE { |
|
45 in "LSCI,%*8c,%*15c,%s"; |
|
46 } |
|
47 |
|
48 # /// Read the heater status for output 1 or 2 |
|
49 getHTR { |
|
50 out "HTR? \$1"; |
|
51 in "%f"; |
|
52 } |
|
53 |
|
54 # /// Read the analog output for output 3 or 4 |
|
55 getAOUT { |
|
56 out "AOUT? \$1"; |
|
57 in "%f"; |
|
58 } |
|
59 |
|
60 # /// Read the setpoint for outputs 1-4 |
|
61 getSETP { |
|
62 out "SETP? \$1"; |
|
63 in "%f"; |
|
64 } |
|
65 |
|
66 # /// Read the temperature in kelvin for inputs 1-4 |
|
67 getKRDG { |
|
68 out "KRDG? \$1"; |
|
69 in "%f"; |
|
70 } |
|
71 |
|
72 # /// Read the voltage input for inputs 1-4 |
|
73 getSRDG { |
|
74 out "SRDG? \$1"; |
|
75 in "%f"; |
|
76 } |
|
77 |
|
78 # /// Read the range parameter (power range) for outputs 1-4 |
|
79 getRANGE { |
|
80 out "RANGE? \$1"; |
|
81 in "%d"; |
|
82 } |
|
83 |
|
84 # /// Read the ramp value and status for outputs 1-4 |
|
85 # /// The first parameter is the output number. |
|
86 # /// The second parameter is the ramp status record. |
|
87 getRAMP { |
|
88 out "RAMP? \$1"; |
|
89 in "%(\$2)d,%f"; |
|
90 } |
|
91 |
|
92 # /// Read the ramp status for outputs 1-4 |
|
93 getRAMPSTATUS { |
|
94 out "RAMP? \$1"; |
|
95 in "%d,%*f"; |
|
96 } |
|
97 |
|
98 # /// Read the manual output value for outputs 1-4 |
|
99 getMOUT { |
|
100 out "MOUT? \$1"; |
|
101 in "%f"; |
|
102 } |
|
103 |
|
104 # /// Read the PID params into 3 records using one write/read. |
|
105 # /// The first argument is the output number. The second and third are |
|
106 # /// the I and D records. |
|
107 getPID { |
|
108 out "PID? \$1"; |
|
109 in "%f,%(\$2:\$3)f,%(\$2:\$4)f"; |
|
110 } |
|
111 |
|
112 # /// Combine getOUTMODEMODE, getOUTMODEINPUT and getOUTMODEPE into one function. |
|
113 # /// The first argument is the output number. |
|
114 # /// The second argument is the PV prefix. |
|
115 # /// The third argument is the output mode intput record (suffix only). |
|
116 # /// The fourth argument is the output mode powerup enable record (suffix only). |
|
117 getOM { |
|
118 out "OUTMODE? \$1"; |
|
119 in "%d,%(\$2:\$3)d,%(\$2:\$4)d"; |
|
120 } |
|
121 |
|
122 # /// Read the output mode mode status for outputs 1-4 |
|
123 # /// 0=Off |
|
124 # /// 1=Closed Loop PID |
|
125 # /// 2=Zone |
|
126 # /// 3=Open Loop |
|
127 # /// 4=Monitor Out |
|
128 # /// 5=Warm Up Supply |
|
129 getOUTMODEMODE { |
|
130 out "OUTMODE? \$1"; |
|
131 in "%d,%*d,%*d"; |
|
132 } |
|
133 |
|
134 # /// Read the output mode input for outputs 1-4 |
|
135 # /// 0=None |
|
136 # /// 1=A |
|
137 # /// 2=B |
|
138 # /// 3=C |
|
139 # /// 4=D |
|
140 getOUTMODEINPUT { |
|
141 out "OUTMODE? \$1"; |
|
142 in "%*d,%d,%*d"; |
|
143 } |
|
144 |
|
145 # /// Read the output mode power up enable for outputs 1-4 |
|
146 # /// 0=Off |
|
147 # /// 1=On |
|
148 getOUTMODEPE { |
|
149 out "OUTMODE? \$1"; |
|
150 in "%*d,%*d,%d"; |
|
151 } |
|
152 |
|
153 |
|
154 # /// Read the tuning status |
|
155 getTUNEST { |
|
156 out "TUNEST?"; |
|
157 in "%s"; |
|
158 } |
|
159 |
|
160 # /// Read the tuning status success param |
|
161 getTUNESTSUCCESS { |
|
162 out "TUNEST?"; |
|
163 in "%*d,%*d,%d,%*d"; |
|
164 } |
|
165 |
|
166 # /// Read the ZONE parameters (this is read into a waveform) |
|
167 getZONE { |
|
168 out "ZONE? \$1,\$2"; |
|
169 separator=","; |
|
170 in "%f"; |
|
171 } |
|
172 |
|
173 # /// Read the input sensor name |
|
174 getINNAME { |
|
175 out "INNAME? \$1"; |
|
176 in "%#s"; |
|
177 } |
|
178 |
|
179 |
|
180 # /// Read the alarm status |
|
181 # /// The first param is the input number, the second is the alarm low record. |
|
182 getALARMST { |
|
183 out "ALARMST? \$1"; |
|
184 in "%d,%(\$2)d" |
|
185 } |
|
186 |
|
187 # /// Read the alarm params. I put the ends of the PV names here |
|
188 # /// to make the initial record INP link short. |
|
189 getALARM { |
|
190 out "ALARM? \$1"; |
|
191 in "%(\$2.A)d,%(\$2.B)f,%(\$2.C)f,%(\$2.D)f,%(\$2.E)d,%(\$2.F)d,%(\$2.G)d" |
|
192 } |
|
193 |
|
194 # /// Read the input reading status |
|
195 getRDGST { |
|
196 out "RDGST? \$1"; |
|
197 in "%d" |
|
198 } |
|
199 |
|
200 # /// Read the heater status for outputs 1 or 2 |
|
201 getHTRST { |
|
202 out "HTRST? \$1"; |
|
203 in "%d" |
|
204 } |
|
205 |
|
206 # /// Read the input curve number |
|
207 getINCRV { |
|
208 out "INCRV? \$1"; |
|
209 in "%d" |
|
210 } |
|
211 |
|
212 # /// Read the input curve header. |
|
213 # /// The first argument is the curve number record (also prefix for other record names). |
|
214 # /// The second argument is the curve name record (suffix only). |
|
215 # /// The third argument is the curve serial number record (suffix only). |
|
216 # /// The fourth argument is the curve data format record (suffix only). |
|
217 # /// The fifth argument is the curve temperature limit record (suffix only). |
|
218 # /// The sixth argument is the curve temperature coefficient record (suffix only). |
|
219 getCRVHDR { |
|
220 out "CRVHDR? %(\$1:\$2)d"; |
|
221 in "%(\$1:\$3.AA)15c,%(\$1:\$3.BB)10c,%(\$1:\$3.A)d,%(\$1:\$3.B)f,%(\$1:\$3.C)d" |
|
222 } |
|
223 |
|
224 # /// Read the input type params. I put the ends of the PV names here |
|
225 # /// to make the initial record INP link short. |
|
226 getINTYPE { |
|
227 out "INTYPE? \$1"; |
|
228 in "%(\$2.A)d,%(\$2.B)d,%(\$2.C)d,%(\$2.D)d,%(\$2.E)d" |
|
229 } |
|
230 |
|
231 |
|
232 ####################################################### |
|
233 # Set functions |
|
234 ####################################################### |
|
235 |
|
236 # /// Set the setpoint for outputs 1-4 |
|
237 setSETP { |
|
238 out "SETP \$1,%f"; |
|
239 @init { getSETP; } |
|
240 } |
|
241 |
|
242 # /// Set the range parameter for outputs 1-4 |
|
243 setRANGE { |
|
244 out "RANGE \$1,%d"; |
|
245 @init { getRANGE; } |
|
246 } |
|
247 |
|
248 # /// Set the ramp parameter for loops 1-2 |
|
249 #Need to pass in the PV name for the getRAMPSTATUS protocol. |
|
250 setRAMP { |
|
251 out "RAMP \$2,%(\$1.VAL)d,%f"; |
|
252 @init { out "RAMP? \$2"; in "%*d,%f"; } |
|
253 } |
|
254 |
|
255 # /// Set the ramp status for loops 1-2 |
|
256 #Need to pass in the PV name for the getRAMP protocol. |
|
257 setRAMPSTATUS { |
|
258 out "RAMP \$2,%d,%(\$1.VAL)f"; |
|
259 @init { out "RAMP? \$2"; in "%d,%*f"; } |
|
260 } |
|
261 |
|
262 # /// Set the manual output value for outputs 1-4 |
|
263 setMOUT { |
|
264 out "MOUT \$1,%f"; |
|
265 @init { getMOUT; } |
|
266 } |
|
267 |
|
268 # /// Set the PID P parameter for outputs 1-4 |
|
269 setP { |
|
270 out "PID \$1,%f,%(\$2:\$3)f,%(\$2:\$4)f"; |
|
271 @init { out "PID? \$1"; in "%f,%*f,%*f"; } |
|
272 } |
|
273 |
|
274 # /// Set the PID I parameter for outputs 1-4 |
|
275 setI { |
|
276 out "PID \$1,%(\$2:\$3)f,%f,%(\$2:\$4)f"; |
|
277 @init { out "PID? \$1"; in "%*f,%f,%*f"; } |
|
278 } |
|
279 |
|
280 # /// Set the PID D parameter for outputs 1-4 |
|
281 setD { |
|
282 out "PID \$1,%(\$2:\$3)f,%(\$2:\$4)f,%f"; |
|
283 @init { out "PID? \$1"; in "%*f,%*f,%f"; } |
|
284 } |
|
285 |
|
286 # /// Set the output mode [loop],[mode],[input],[power up enable] |
|
287 setOM { |
|
288 out "OUTMODE \$1,%d,%(\$2:\$3)d,%(\$2:\$4)d"; |
|
289 @init { out "OUTMODE? \$1"; in "%d,%*d,%*d";} |
|
290 } |
|
291 |
|
292 # /// Set the output mode input [loop],[mode],[input],[power up enable] |
|
293 setOMI { |
|
294 out "OUTMODE \$1,%(\$2:\$3)d,%d,%(\$2:\$4)d"; |
|
295 @init { out "OUTMODE? \$1"; in "%*d,%d,%*d";} |
|
296 } |
|
297 |
|
298 # /// Set the output mode power up enable [loop],[mode],[input],[power up enable] |
|
299 setOMP { |
|
300 out "OUTMODE \$1,%(\$2:\$3)d,%(\$2:\$4)d,%d"; |
|
301 @init { out "OUTMODE? \$1"; in "%*d,%*d,%d";} |
|
302 } |
|
303 |
|
304 |
|
305 # /// Start the auto tune process. |
|
306 setATUNE { |
|
307 out "ATUNE \$1,%(\$2.VAL)d"; |
|
308 } |
|
309 |
|
310 # /// Set the ZONE parameters |
|
311 setZONE { |
|
312 out "ZONE \$1,\$2,%(A)f,%(B)f,%(C)f,%(D)f,%(E)f,%(F)d,%(G)d,%(H)f"; |
|
313 } |
|
314 |
|
315 # /// Set the input sensor name |
|
316 setINNAME { |
|
317 out "INNAME \$1,\"%s\""; |
|
318 @init { getINNAME; } |
|
319 } |