ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsTEC.hpp
Go to the documentation of this file.
1
8#ifndef ngcdcsTEC_H
9#define ngcdcsTEC_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <ngc/core/ngcbAddr.h>
17#include <ngc/core/ngcbMOD.hpp>
18
19/*
20 * Cooling state
21 */
22#define ngcdcsTEC_WARM 0 //< warm
23#define ngcdcsTEC_COOLDOWN 1 //< cooling down
24#define ngcdcsTEC_COLD 2 //< cold
25#define ngcdcsTEC_WARMUP 3 //< warming up
26
27
28/*
29 * Device status
30 */
31#define ngcdcsTEC_STAT_INIT 0 //< Init
32#define ngcdcsTEC_STAT_READY 1 //< ReadyTemperature regulation is not active
33#define ngcdcsTEC_STAT_RUN 2 //< Run
34#define ngcdcsTEC_STAT_ERROR 3 //< Error
35#define ngcdcsTEC_STAT_BOOT 4 //< Bootloader
36#define ngcdcsTEC_STAT_RESET 5 //< Reset within next 200 ms
37
42{
43public:
44 int type; //< Device type
45 int serialNumber; //< Serial number
46 int hwVersion; //< Hardware version
47 int fwVersion; //< Firmware version
48 int fwBuild; //< Firmware build number
49 char fwId[64]; //< Firmware identification string
50
53 type = 1091;
54 serialNumber = 2447;
55 hwVersion = 110;
56 fwVersion = 300;
57 fwBuild = 417;
58 strcpy(fwId, "8065-TEC SW G01");
59 }
60
62 virtual ~ngcdcs_tec_info() {}
63
64protected:
65private:
66};
67
72{
73public:
76
79
82
85
88
90 double temp;
91
93 double heatExTemp;
94
97
100
103
106
109
113 tempStatus = 0;
114 errorNumber = 0;
115 errorInstance = 0;
116 errorParam = 0;
117 temp = 25.0;
118 heatExTemp = 25.0;
119 basePlateTemp = 25.0;
120 peltierCurrent = 0.0;
121 peltierVoltage = 0.0;
122 drvInVoltage = 24.0;
123 medIntSupply = 5.0;
124 }
125
127 virtual ~ngcdcs_tec_stat() {}
128
129protected:
130private:
131};
132
136class ngcdcsTEC: public ngcbMOD
137{
138public:
141
144
146 double coldTemp;
147
149 double warmTemp;
150
153
156
158 explicit ngcdcsTEC(const ngcb_route_t &r);
159
161 ngcdcsTEC(ngcbIFC *ifc, const ngcb_route_t &r);
162
164 virtual ~ngcdcsTEC();
165
167 void Reset();
168
170 int Enable(int check = 1);
171
173 int Disable();
174
176 int Selftest();
177
179 void ResetSeqNr();
180
182 void CoolingState(int state);
183
185 int Info(ngcdcs_tec_info *info);
186
188 int SetTemp(double temp);
189
191 int Action(const char *action, char *reply = NULL);
192
194 int Update();
195
197 int SetParam(int paramId, int value, int inst = 1);
198
200 int SetParam(int paramId, double value, int inst = 1);
201
203 int GetParam(int paramId, int *value, int inst = 1);
204
206 int GetParam(int paramId, double *value, int inst = 1);
207
209 int Command(const char *cmd, char *reply = NULL);
210
212 int SetupKey(const char *key, const int *idx, const char *value,
213 int *s = NULL);
214
216 int StatusKey(const char *key, const int *idx, char *value,
217 int *s = NULL);
218
220 char *StatusString();
221
223 void Err2String(char *s, unsigned int errorNumber);
224
225protected:
226
227private:
229 unsigned int seqNr_;
230
232 unsigned char frame_[512];
233
235 unsigned char response_[512];
236
238 char statStr_[32];
239
241 void Init_();
242
244 int Status_(ngcdcs_tec_stat *st);
245
247 int SendFrame_(const char *data, size_t size, char *reply = NULL);
248
250 int Send_(const unsigned char *buffer, size_t size);
251
253 int Recv_(unsigned char *buffer);
254
256 unsigned int SeqNr_(const unsigned char *buffer);
257
259 unsigned int CRC_(const unsigned char *buffer);
260
262 unsigned int ErrCode_(const unsigned char *buffer);
263
265 unsigned int CRC16_(const unsigned char *buffer, size_t size);
266
268 void CRC16_(unsigned int *crc, unsigned char ch);
269};
270
271#endif
Definition ngcbIFC.hpp:760
ngcbMOD(const ngcbMOD &other)
Copy constructor.
Definition ngcbMOD.cpp:43
int Command(const char *cmd, char *reply=NULL)
Send frame buffer.
Definition ngcdcsTEC.cpp:545
double warmTemp
Target object pre-defined warm temperature.
Definition ngcdcsTEC.hpp:149
int StatusKey(const char *key, const int *idx, char *value, int *s=NULL)
Status.
Definition ngcdcsTecStatus.cpp:26
int Info(ngcdcs_tec_info *info)
Get device info.
Definition ngcdcsTEC.cpp:253
ngcdcs_tec_stat status
TEC status.
Definition ngcdcsTEC.hpp:140
void ResetSeqNr()
Reset protocol sequence number.
Definition ngcdcsTEC.cpp:221
int SetupKey(const char *key, const int *idx, const char *value, int *s=NULL)
Setup.
Definition ngcdcsTecSetup.cpp:26
int GetParam(int paramId, int *value, int inst=1)
Get parameter (32-bit integer)
Definition ngcdcsTEC.cpp:509
int Selftest()
Execute selftest.
Definition ngcdcsTEC.cpp:213
char * StatusString()
Get status string.
Definition ngcdcsTEC.cpp:72
void Err2String(char *s, unsigned int errorNumber)
Convert error number to error-string.
Definition ngcdcsTEC.cpp:889
int Update()
Run update cycle.
Definition ngcdcsTEC.cpp:449
void Reset()
Align software state after reset.
Definition ngcdcsTEC.cpp:77
double tempSetPoint
Target object temperature set point.
Definition ngcdcsTEC.hpp:143
void CoolingState(int state)
Set cooling state.
Definition ngcdcsTEC.cpp:226
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsTEC.cpp:82
int coolingState
Cooling state.
Definition ngcdcsTEC.hpp:155
int SetTemp(double temp)
Set target object temperature set point.
Definition ngcdcsTEC.cpp:285
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsTEC.cpp:208
int autoCooldown
Automatic cooldown at ONLINE.
Definition ngcdcsTEC.hpp:152
double coldTemp
Target object pre-defined cold temperature.
Definition ngcdcsTEC.hpp:146
ngcdcsTEC(const ngcb_route_t &r)
Constructor with route.
Definition ngcdcsTEC.cpp:30
int SetParam(int paramId, int value, int inst=1)
Set parameter (32-bit integer)
Definition ngcdcsTEC.cpp:479
int Action(const char *action, char *reply=NULL)
Execute TEC action.
Definition ngcdcsTEC.cpp:303
virtual ~ngcdcsTEC()
Destructor.
Definition ngcdcsTEC.cpp:45
Definition ngcdcsTEC.hpp:42
virtual ~ngcdcs_tec_info()
Destructor.
Definition ngcdcsTEC.hpp:62
int fwBuild
Definition ngcdcsTEC.hpp:48
char fwId[64]
Definition ngcdcsTEC.hpp:49
int serialNumber
Definition ngcdcsTEC.hpp:45
int fwVersion
Definition ngcdcsTEC.hpp:47
int type
Definition ngcdcsTEC.hpp:44
int hwVersion
Definition ngcdcsTEC.hpp:46
ngcdcs_tec_info()
Constructor.
Definition ngcdcsTEC.hpp:52
Definition ngcdcsTEC.hpp:72
double temp
Object temperature.
Definition ngcdcsTEC.hpp:90
int errorParam
Error parameter (if in error state)
Definition ngcdcsTEC.hpp:87
double drvInVoltage
Driver input voltage.
Definition ngcdcsTEC.hpp:105
double basePlateTemp
Base plate temperature.
Definition ngcdcsTEC.hpp:96
ngcdcs_tec_stat()
Constructor.
Definition ngcdcsTEC.hpp:111
int devStatus
Device status.
Definition ngcdcsTEC.hpp:75
double medIntSupply
Medium internal supply voltage.
Definition ngcdcsTEC.hpp:108
int errorNumber
Error number (if in error state)
Definition ngcdcsTEC.hpp:81
double peltierVoltage
Peltier voltage.
Definition ngcdcsTEC.hpp:102
double peltierCurrent
Peltier current.
Definition ngcdcsTEC.hpp:99
virtual ~ngcdcs_tec_stat()
Destructor.
Definition ngcdcsTEC.hpp:127
int tempStatus
Temperature regulation status (0 = off, 1 = not stable, 2 = stable)
Definition ngcdcsTEC.hpp:78
double heatExTemp
Heat exchanger temperature.
Definition ngcdcsTEC.hpp:93
int errorInstance
Error instance (if in error state)
Definition ngcdcsTEC.hpp:84
#define ngcdcsTEC_STAT_READY
Definition ngcdcsTEC.hpp:32
Definition ngcbIFC.hpp:78