ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsTEC.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsTEC_H
8#define ngcdcsTEC_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcbAddr.h>
16#include <ngc/core/ngcbMOD.hpp>
17
18/*
19 * Cooling state
20 */
21#define ngcdcsTEC_WARM 0 //< warm
22#define ngcdcsTEC_COOLDOWN 1 //< cooling down
23#define ngcdcsTEC_COLD 2 //< cold
24#define ngcdcsTEC_WARMUP 3 //< warming up
25
26
27/*
28 * Device status
29 */
30#define ngcdcsTEC_STAT_INIT 0 //< Init
31#define ngcdcsTEC_STAT_READY 1 //< ReadyTemperature regulation is not active
32#define ngcdcsTEC_STAT_RUN 2 //< Run
33#define ngcdcsTEC_STAT_ERROR 3 //< Error
34#define ngcdcsTEC_STAT_BOOT 4 //< Bootloader
35#define ngcdcsTEC_STAT_RESET 5 //< Reset within next 200 ms
36
41{
42public:
43 int type; //< Device type
44 int serialNumber; //< Serial number
45 int hwVersion; //< Hardware version
46 int fwVersion; //< Firmware version
47 int fwBuild; //< Firmware build number
48 char fwId[64]; //< Firmware identification string
49
52 type = 1091;
53 serialNumber = 2447;
54 hwVersion = 110;
55 fwVersion = 300;
56 fwBuild = 417;
57 strcpy(fwId, "8065-TEC SW G01");
58 }
59
61 virtual ~ngcdcs_tec_info() {}
62
63protected:
64private:
65};
66
71{
72public:
75
78
81
84
87
89 double temp;
90
92 double heatExTemp;
93
96
99
102
105
108
112 tempStatus = 0;
113 errorNumber = 0;
114 errorInstance = 0;
115 errorParam = 0;
116 temp = 25.0;
117 heatExTemp = 25.0;
118 basePlateTemp = 25.0;
119 peltierCurrent = 0.0;
120 peltierVoltage = 0.0;
121 drvInVoltage = 24.0;
122 medIntSupply = 5.0;
123 }
124
126 virtual ~ngcdcs_tec_stat() {}
127
128protected:
129private:
130};
131
135class ngcdcsTEC: public ngcbMOD
136{
137public:
140
143
145 double coldTemp;
146
148 double warmTemp;
149
152
155
157 explicit ngcdcsTEC(const ngcb_route_t &r);
158
160 ngcdcsTEC(ngcbIFC *ifc, const ngcb_route_t &r);
161
163 virtual ~ngcdcsTEC();
164
166 void Reset();
167
169 int Enable(int check = 1);
170
172 int Disable();
173
175 int Selftest();
176
178 void ResetSeqNr();
179
181 void CoolingState(int state);
182
184 int Info(ngcdcs_tec_info *info);
185
187 int SetTemp(double temp);
188
190 int Action(const char *action, char *reply = NULL);
191
193 int Update();
194
196 int SetParam(int paramId, int value, int inst = 1);
197
199 int SetParam(int paramId, double value, int inst = 1);
200
202 int GetParam(int paramId, int *value, int inst = 1);
203
205 int GetParam(int paramId, double *value, int inst = 1);
206
208 int Command(const char *cmd, char *reply = NULL);
209
211 int SetupKey(const char *key, const int *idx, const char *value,
212 int *s = NULL);
213
215 int StatusKey(const char *key, const int *idx, char *value,
216 int *s = NULL);
217
219 char *StatusString();
220
222 void Err2String(char *s, unsigned int errorNumber);
223
224protected:
225
226private:
228 unsigned int seqNr_;
229
231 unsigned char frame_[512];
232
234 unsigned char response_[512];
235
237 char statStr_[32];
238
240 void Init_();
241
243 int Status_(ngcdcs_tec_stat *st);
244
246 int SendFrame_(const char *data, size_t size, char *reply = NULL);
247
249 int Send_(const unsigned char *buffer, size_t size);
250
252 int Recv_(unsigned char *buffer);
253
255 unsigned int SeqNr_(const unsigned char *buffer);
256
258 unsigned int CRC_(const unsigned char *buffer);
259
261 unsigned int ErrCode_(const unsigned char *buffer);
262
264 unsigned int CRC16_(const unsigned char *buffer, size_t size);
265
267 void CRC16_(unsigned int *crc, unsigned char ch);
268};
269
270#endif
Definition ngcbIFC.hpp:754
ngcbMOD(const ngcbMOD &other)
Copy constructor.
Definition ngcbMOD.cpp:43
int Command(const char *cmd, char *reply=NULL)
Send frame buffer.
Definition ngcdcsTEC.cpp:544
double warmTemp
Target object pre-defined warm temperature.
Definition ngcdcsTEC.hpp:148
int StatusKey(const char *key, const int *idx, char *value, int *s=NULL)
Status.
Definition ngcdcsTecStatus.cpp:25
int Info(ngcdcs_tec_info *info)
Get device info.
Definition ngcdcsTEC.cpp:252
ngcdcs_tec_stat status
TEC status.
Definition ngcdcsTEC.hpp:139
void ResetSeqNr()
Reset protocol sequence number.
Definition ngcdcsTEC.cpp:220
int SetupKey(const char *key, const int *idx, const char *value, int *s=NULL)
Setup.
Definition ngcdcsTecSetup.cpp:25
int GetParam(int paramId, int *value, int inst=1)
Get parameter (32-bit integer)
Definition ngcdcsTEC.cpp:508
int Selftest()
Execute selftest.
Definition ngcdcsTEC.cpp:212
char * StatusString()
Get status string.
Definition ngcdcsTEC.cpp:71
void Err2String(char *s, unsigned int errorNumber)
Convert error number to error-string.
Definition ngcdcsTEC.cpp:888
int Update()
Run update cycle.
Definition ngcdcsTEC.cpp:448
void Reset()
Align software state after reset.
Definition ngcdcsTEC.cpp:76
double tempSetPoint
Target object temperature set point.
Definition ngcdcsTEC.hpp:142
void CoolingState(int state)
Set cooling state.
Definition ngcdcsTEC.cpp:225
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsTEC.cpp:81
int coolingState
Cooling state.
Definition ngcdcsTEC.hpp:154
int SetTemp(double temp)
Set target object temperature set point.
Definition ngcdcsTEC.cpp:284
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsTEC.cpp:207
int autoCooldown
Automatic cooldown at ONLINE.
Definition ngcdcsTEC.hpp:151
double coldTemp
Target object pre-defined cold temperature.
Definition ngcdcsTEC.hpp:145
ngcdcsTEC(const ngcb_route_t &r)
Constructor with route.
Definition ngcdcsTEC.cpp:29
int SetParam(int paramId, int value, int inst=1)
Set parameter (32-bit integer)
Definition ngcdcsTEC.cpp:478
int Action(const char *action, char *reply=NULL)
Execute TEC action.
Definition ngcdcsTEC.cpp:302
virtual ~ngcdcsTEC()
Destructor.
Definition ngcdcsTEC.cpp:44
Definition ngcdcsTEC.hpp:41
virtual ~ngcdcs_tec_info()
Destructor.
Definition ngcdcsTEC.hpp:61
int fwBuild
Definition ngcdcsTEC.hpp:47
char fwId[64]
Definition ngcdcsTEC.hpp:48
int serialNumber
Definition ngcdcsTEC.hpp:44
int fwVersion
Definition ngcdcsTEC.hpp:46
int type
Definition ngcdcsTEC.hpp:43
int hwVersion
Definition ngcdcsTEC.hpp:45
ngcdcs_tec_info()
Constructor.
Definition ngcdcsTEC.hpp:51
Definition ngcdcsTEC.hpp:71
double temp
Object temperature.
Definition ngcdcsTEC.hpp:89
int errorParam
Error parameter (if in error state)
Definition ngcdcsTEC.hpp:86
double drvInVoltage
Driver input voltage.
Definition ngcdcsTEC.hpp:104
double basePlateTemp
Base plate temperature.
Definition ngcdcsTEC.hpp:95
ngcdcs_tec_stat()
Constructor.
Definition ngcdcsTEC.hpp:110
int devStatus
Device status.
Definition ngcdcsTEC.hpp:74
double medIntSupply
Medium internal supply voltage.
Definition ngcdcsTEC.hpp:107
int errorNumber
Error number (if in error state)
Definition ngcdcsTEC.hpp:80
double peltierVoltage
Peltier voltage.
Definition ngcdcsTEC.hpp:101
double peltierCurrent
Peltier current.
Definition ngcdcsTEC.hpp:98
virtual ~ngcdcs_tec_stat()
Destructor.
Definition ngcdcsTEC.hpp:126
int tempStatus
Temperature regulation status (0 = off, 1 = not stable, 2 = stable)
Definition ngcdcsTEC.hpp:77
double heatExTemp
Heat exchanger temperature.
Definition ngcdcsTEC.hpp:92
int errorInstance
Error instance (if in error state)
Definition ngcdcsTEC.hpp:83
#define ngcdcsTEC_STAT_READY
Definition ngcdcsTEC.hpp:31
Definition ngcbIFC.hpp:72