usertempcontrol.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 //---------------------------------------------------------------------------
15 
16 #ifndef usertempcontrolH
17 #define usertempcontrolH
18 
19 #include "tempcontrol.h"
20 #include "oxforddriver.h"
21 #include "chardevicedriver.h"
22 //---------------------------------------------------------------------------
23 //! ITC503 Oxford
24 class XITC503 : public XOxfordDriver<XTempControl> {
25 public:
26  XITC503(const char *name, bool runtime,
27  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
28  virtual ~XITC503() {}
29 
30 protected:
31  //! reads sensor value from the instrument
32  virtual double getRaw(shared_ptr<XChannel> &channel);
33  //! reads a value in Kelvin from the instrument
34  virtual double getTemp(shared_ptr<XChannel> &channel);
35  //! obtains current heater power
36  //! \sa m_heaterPowerUnit()
37  virtual double getHeater(unsigned int loop);
38  //! ex. "W", "dB", or so
39  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
40 
41  //! Be called just after opening interface. Call start() inside this routine appropriately.
42  virtual void open() throw (XKameError &);
43 
44  virtual void onPChanged(unsigned int loop, double p);
45  virtual void onIChanged(unsigned int loop, double i);
46  virtual void onDChanged(unsigned int loop, double d);
47  virtual void onTargetTempChanged(unsigned int loop, double temp);
48  virtual void onManualPowerChanged(unsigned int loop, double pow);
49  virtual void onHeaterModeChanged(unsigned int loop, int mode);
50  virtual void onPowerRangeChanged(unsigned int loop, int range);
51  virtual void onPowerMaxChanged(unsigned int, double v) {}
52  virtual void onPowerMinChanged(unsigned int, double v) {}
53  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
54 
55  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
56 private:
57 };
58 
59 //! Picowatt/Oxford AVS47-IB
60 //! AVS47 and TS530A
61 class XAVS47IB:public XCharDeviceDriver<XTempControl> {
62 public:
63  XAVS47IB(const char *name, bool runtime,
64  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
65  ~XAVS47IB() {}
66 
67 protected:
68  //! reads sensor value from the instrument
69  virtual double getRaw(shared_ptr<XChannel> &channel);
70  //! reads a value in Kelvin from the instrument
71  virtual double getTemp(shared_ptr<XChannel> &channel);
72  //! obtains current heater power
73  //! \sa m_heaterPowerUnit()
74  virtual double getHeater(unsigned int loop);
75  //! ex. "W", "dB", or so
76  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "W";}
77 
78  //! Be called just after opening interface. Call start() inside this routine appropriately.
79  virtual void open() throw (XKameError &);
80  //! Be called for closing interfaces.
81  virtual void closeInterface();
82 
83  virtual void onPChanged(unsigned int loop, double p);
84  virtual void onIChanged(unsigned int loop, double i);
85  virtual void onDChanged(unsigned int loop, double d);
86  virtual void onTargetTempChanged(unsigned int loop, double temp);
87  virtual void onManualPowerChanged(unsigned int loop, double pow);
88  virtual void onHeaterModeChanged(unsigned int loop, int mode);
89  virtual void onPowerRangeChanged(unsigned int loop, int range);
90  virtual void onPowerMaxChanged(unsigned int, double v) {}
91  virtual void onPowerMinChanged(unsigned int, double v) {}
92  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
93 
94  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
95 
96 private:
97  double read(const char *str);
98 
99  void setTemp(double temp);
100  void setHeaterMode(int /*mode*/) {}
101  int setPoint();
102  //AVS-47 COMMANDS
103  int setRange(unsigned int range);
104  double getRes();
105  int getRange();
106  //TS-530 COMMANDS
107  int setBias(unsigned int bias);
108  void setPowerRange(int range);
109 
110  int m_autorange_wait;
111 };
112 
114 public:
115  XCryoconCharInterface(const char *name, bool runtime, const shared_ptr<XDriver> &driver)
116  : XCharInterface(name, runtime, driver) {}
117  virtual ~XCryoconCharInterface() {}
118  virtual void send(const XString &str) throw (XCommError &) { ::msecsleep(20); XCharInterface::send(str);}
119  virtual void send(const char *str) throw (XCommError &) { ::msecsleep(20); XCharInterface::send(str);}
120  virtual void write(const char *sendbuf, int size) throw (XCommError &) { ::msecsleep(20); XCharInterface::write(sendbuf, size);}
121 };
122 
123 //! Cryo-con base class
124 class XCryocon : public XCharDeviceDriver<XTempControl, XCryoconCharInterface> {
125 public:
126  XCryocon(const char *name, bool runtime,
127  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
128  virtual ~XCryocon() {}
129 
130 protected:
131 
132  //! reads sensor value from the instrument
133  virtual double getRaw(shared_ptr<XChannel> &channel);
134  //! reads a value in Kelvin from the instrument
135  virtual double getTemp(shared_ptr<XChannel> &channel);
136  //! obtains current heater power
137  //! \sa m_heaterPowerUnit()
138  virtual double getHeater(unsigned int loop);
139  //! ex. "W", "dB", or so
140  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
141 
142  //! Be called just after opening interface. Call start() inside this routine appropriately.
143  virtual void open() throw (XKameError &);
144 
145  virtual void onPChanged(unsigned int loop, double p);
146  virtual void onIChanged(unsigned int loop, double i);
147  virtual void onDChanged(unsigned int loop, double d);
148  virtual void onTargetTempChanged(unsigned int loop, double temp);
149  virtual void onManualPowerChanged(unsigned int loop, double pow);
150  virtual void onHeaterModeChanged(unsigned int loop, int mode);
151  virtual void onPowerRangeChanged(unsigned int loop, int range);
152  virtual void onPowerMinChanged(unsigned int loop, double v) {}
153  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
154 
155  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
156 private:
157  void setTemp(unsigned int loop, double temp);
158  // void SetChannel(XChannel *channel);
159  void setHeaterMode(unsigned int loop);
160  void getChannel(unsigned int loop);
161  int control();
162  int stopControl();
163  double getInput(shared_ptr<XChannel> &channel);
164  int setHeaterSetPoint(unsigned int loop, double value);
165 protected:
166  virtual const char *loopString(unsigned int loop) = 0;
167 };
168 
169 //! Cryo-con Model 32 Cryogenic Inst.
170 class XCryoconM32:public XCryocon {
171 public:
172  XCryoconM32(const char *name, bool runtime,
173  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
174  virtual ~XCryoconM32() {}
175 
176 protected:
177  //! Be called just after opening interface. Call start() inside this routine appropriately.
178  virtual void open() throw (XKameError &);
179 
180  virtual void onPowerMaxChanged(unsigned int loop, double v);
181  virtual const char *loopString(unsigned int loop) {
182  return (loop == 0) ? "LOOP 1" : "LOOP 2";
183  }
184 };
185 
186 //! Cryo-con Model 62 Cryogenic Inst.
187 class XCryoconM62 : public XCryocon {
188 public:
189  XCryoconM62(const char *name, bool runtime,
190  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
191  virtual ~XCryoconM62() {}
192 
193 protected:
194  //! Be called just after opening interface. Call start() inside this routine appropriately.
195  virtual void open() throw (XKameError &);
196 
197  virtual void onPowerMaxChanged(unsigned int loop, double v) {}
198  virtual const char *loopString(unsigned int loop) {
199  return (loop == 0) ? "HEATER" : "AOUT";
200  }
201 };
202 
203 //! Linear-Research 700 AC resistance bridge
204 class XLinearResearch700 : public XCharDeviceDriver<XTempControl> {
205 public:
206  XLinearResearch700(const char *name, bool runtime,
207  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
208  virtual ~XLinearResearch700() {}
209 
210 protected:
211  //! reads sensor value from the instrument
212  virtual double getRaw(shared_ptr<XChannel> &channel);
213  //! reads a value in Kelvin from the instrument
214  virtual double getTemp(shared_ptr<XChannel> &channel);
215  //! obtains current heater power
216  //! \sa m_heaterPowerUnit()
217  virtual double getHeater(unsigned int loop);
218  //! ex. "W", "dB", or so
219  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
220 
221  //! Be called just after opening interface. Call start() inside this routine appropriately.
222  virtual void open() throw (XKameError &);
223 
224  virtual void onPChanged(unsigned int loop, double p);
225  virtual void onIChanged(unsigned int loop, double i);
226  virtual void onDChanged(unsigned int loop, double d);
227  virtual void onTargetTempChanged(unsigned int loop, double temp);
228  virtual void onManualPowerChanged(unsigned int loop, double pow);
229  virtual void onHeaterModeChanged(unsigned int loop, int mode);
230  virtual void onPowerRangeChanged(unsigned int loop, int range);
231  virtual void onPowerMaxChanged(unsigned int loop, double v) {}
232  virtual void onPowerMinChanged(unsigned int loop, double v) {}
233  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
234 
235  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
236 private:
237  double parseResponseMessage();
238 };
239 
240 //! Neocera LTC-21.
241 class XNeoceraLTC21 : public XCharDeviceDriver<XTempControl> {
242 public:
243  XNeoceraLTC21(const char *name, bool runtime,
244  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
245  virtual ~XNeoceraLTC21() {}
246 
247 protected:
248  //! reads sensor value from the instrument
249  virtual double getRaw(shared_ptr<XChannel> &channel);
250  //! reads a value in Kelvin from the instrument
251  virtual double getTemp(shared_ptr<XChannel> &channel);
252  //! obtains current heater power
253  //! \sa m_heaterPowerUnit()
254  virtual double getHeater(unsigned int loop);
255  //! ex. "W", "dB", or so
256  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
257 
258  //! Be called just after opening interface. Call start() inside this routine appropriately.
259  virtual void open() throw (XKameError &);
260 
261  virtual void onPChanged(unsigned int loop, double p);
262  virtual void onIChanged(unsigned int loop, double i);
263  virtual void onDChanged(unsigned int loop, double d);
264  virtual void onTargetTempChanged(unsigned int loop, double temp);
265  virtual void onManualPowerChanged(unsigned int loop, double pow);
266  virtual void onHeaterModeChanged(unsigned int loop, int mode);
267  virtual void onPowerRangeChanged(unsigned int loop, int range);
268  virtual void onPowerMaxChanged(unsigned int loop, double v);
269  virtual void onPowerMinChanged(unsigned int loop, double v) {}
270  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
271 
272  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
273 private:
274  //! set the system into the control mode.
275  void control();
276  //! leave the control mode.
277  void monitor();
278  //! set PID, manual power.
279  void setHeater(unsigned int loop);
280 };
281 
282 //! Base class for LakeShore 340/370
283 class XLakeShoreBridge : public XCharDeviceDriver<XTempControl> {
284 public:
285  XLakeShoreBridge(const char *name, bool runtime,
286  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
287  virtual ~XLakeShoreBridge() {}
288 };
289 
290 //! LakeShore 340
292 public:
293  XLakeShore340(const char *name, bool runtime,
294  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
295  virtual ~XLakeShore340() {}
296 protected:
297  //! reads sensor value from the instrument
298  virtual double getRaw(shared_ptr<XChannel> &channel);
299  //! reads a value in Kelvin from the instrument
300  virtual double getTemp(shared_ptr<XChannel> &channel);
301  //! obtains current heater power
302  //! \sa m_heaterPowerUnit()
303  virtual double getHeater(unsigned int loop);
304  //! ex. "W", "dB", or so
305  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
306 
307  //! Be called just after opening interface. Call start() inside this routine appropriately.
308  virtual void open() throw (XKameError &);
309 
310  virtual void onPChanged(unsigned int loop, double p);
311  virtual void onIChanged(unsigned int loop, double i);
312  virtual void onDChanged(unsigned int loop, double d);
313  virtual void onTargetTempChanged(unsigned int loop, double temp);
314  virtual void onManualPowerChanged(unsigned int loop, double pow);
315  virtual void onHeaterModeChanged(unsigned int loop, int mode);
316  virtual void onPowerRangeChanged(unsigned int loop, int range);
317  virtual void onPowerMaxChanged(unsigned int loop, double v);
318  virtual void onPowerMinChanged(unsigned int loop, double v) {}
319  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
320 
321  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
322 private:
323 };
324 //! LakeShore 370
326 public:
327  XLakeShore370(const char *name, bool runtime,
328  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
329  virtual ~XLakeShore370() {}
330 
331 protected:
332  //! reads sensor value from the instrument
333  virtual double getRaw(shared_ptr<XChannel> &channel);
334  //! reads a value in Kelvin from the instrument
335  virtual double getTemp(shared_ptr<XChannel> &channel);
336  //! obtains current heater power
337  //! \sa m_heaterPowerUnit()
338  virtual double getHeater(unsigned int loop);
339  //! ex. "W", "dB", or so
340  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
341 
342  //! Be called just after opening interface. Call start() inside this routine appropriately.
343  virtual void open() throw (XKameError &);
344 
345  virtual void onPChanged(unsigned int loop, double p);
346  virtual void onIChanged(unsigned int loop, double i);
347  virtual void onDChanged(unsigned int loop, double d);
348  virtual void onTargetTempChanged(unsigned int loop, double temp);
349  virtual void onManualPowerChanged(unsigned int loop, double pow);
350  virtual void onHeaterModeChanged(unsigned int loop, int mode);
351  virtual void onPowerRangeChanged(unsigned int loop, int range);
352  virtual void onPowerMaxChanged(unsigned int loop, double v) {}
353  virtual void onPowerMinChanged(unsigned int loop, double v) {}
354  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch);
355 
356  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc);
357 private:
358 };
359 
360 //! Keithley Integra 2700 w/ 7700 switching module.
361 class XKE2700w7700 : public XCharDeviceDriver<XTempControl> {
362 public:
363  XKE2700w7700(const char *name, bool runtime,
364  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
365  virtual ~XKE2700w7700() {}
366 
367 protected:
368  //! reads sensor value from the instrument
369  virtual double getRaw(shared_ptr<XChannel> &channel);
370  //! reads a value in Kelvin from the instrument
371  virtual double getTemp(shared_ptr<XChannel> &channel);
372  //! obtains current heater power
373  //! \sa m_heaterPowerUnit()
374  virtual double getHeater(unsigned int loop);
375  //! ex. "W", "dB", or so
376  virtual const char *m_heaterPowerUnit(unsigned int loop) {return "%";}
377 
378  //! Be called just after opening interface. Call start() inside this routine appropriately.
379  virtual void open() throw (XKameError &);
380 
381  virtual void onPChanged(unsigned int loop, double p) {}
382  virtual void onIChanged(unsigned int loop, double i) {}
383  virtual void onDChanged(unsigned int loop, double d) {}
384  virtual void onTargetTempChanged(unsigned int loop, double temp) {}
385  virtual void onManualPowerChanged(unsigned int loop, double pow) {}
386  virtual void onHeaterModeChanged(unsigned int loop, int mode) {}
387  virtual void onPowerRangeChanged(unsigned int loop, int range) {}
388  virtual void onPowerMaxChanged(unsigned int, double v) {}
389  virtual void onPowerMinChanged(unsigned int, double v) {}
390  virtual void onCurrentChannelChanged(unsigned int loop, const shared_ptr<XChannel> &ch) {}
391 
392  virtual void onExcitationChanged(const shared_ptr<XChannel> &ch, int exc) {}
393 private:
394 };
395 #endif

Generated for KAME4 by  doxygen 1.8.3