- last version?
This commit is contained in:
56
tecs/tecs.c
56
tecs/tecs.c
@ -141,6 +141,8 @@ static float
|
|||||||
linearPower=0, /* normally 0. Maximum power when loop=2 and the power linear to the output */
|
linearPower=0, /* normally 0. Maximum power when loop=2 and the power linear to the output */
|
||||||
shiftUp, shiftLow, /* upper and lower limit of tShift correction */
|
shiftUp, shiftLow, /* upper and lower limit of tShift correction */
|
||||||
maxpower2=1.0,
|
maxpower2=1.0,
|
||||||
|
stickhtron=5.0, /* switch stick heater on when sample is more than this value below main */
|
||||||
|
stickhtroff=0.0, /* switch stick heater off when sample is less than this value below main */
|
||||||
state,
|
state,
|
||||||
mout;
|
mout;
|
||||||
|
|
||||||
@ -184,7 +186,9 @@ static int
|
|||||||
unit=1, /* 1: Kelvin, 2: Celsius */
|
unit=1, /* 1: Kelvin, 2: Celsius */
|
||||||
autoconfig=0, /* automatic configuration 1: inside tecs, 0: done by SEA */
|
autoconfig=0, /* automatic configuration 1: inside tecs, 0: done by SEA */
|
||||||
lockAlarm,
|
lockAlarm,
|
||||||
stickhtr=-1,
|
stickhtr=-1, /* -1, no stick heater, 1: use stick heater in parallel */
|
||||||
|
parallelhtr=0, /* is parallel heater active ? */
|
||||||
|
ramping=0, /* setpoint is ramping */
|
||||||
cntError;
|
cntError;
|
||||||
|
|
||||||
static int tim, rdTim; /* actual time, read Time */
|
static int tim, rdTim; /* actual time, read Time */
|
||||||
@ -530,6 +534,7 @@ int InstalCurve(SensorT *sensor, char *devArg) {
|
|||||||
ERR_SI(fputs(e, fil));
|
ERR_SI(fputs(e, fil));
|
||||||
}
|
}
|
||||||
ERR_SI(fputc('\0', fil));
|
ERR_SI(fputc('\0', fil));
|
||||||
|
ERR_SI(fputc('\n', fil));
|
||||||
ERR_SI(fclose(fil));
|
ERR_SI(fclose(fil));
|
||||||
str_copy(buf, logDir);
|
str_copy(buf, logDir);
|
||||||
sprintf(lbuf, "lsc.%d", serialNo);
|
sprintf(lbuf, "lsc.%d", serialNo);
|
||||||
@ -995,7 +1000,9 @@ int ReadTemp(void) {
|
|||||||
}
|
}
|
||||||
if (doit) {
|
if (doit) {
|
||||||
if (ramp!=0) {
|
if (ramp!=0) {
|
||||||
str_append(buf, ";SETP?[loop]>fbuf");
|
str_append(buf, ";SETP?[loop]>fbuf;RAMPST?[loop]>ramping");
|
||||||
|
} else {
|
||||||
|
ramping = 0;
|
||||||
}
|
}
|
||||||
str_append(buf, ";MNMXRST");
|
str_append(buf, ";MNMXRST");
|
||||||
ERR_P(LscCmd(ser, buf));
|
ERR_P(LscCmd(ser, buf));
|
||||||
@ -1257,7 +1264,7 @@ int SetTemp(int switchOn) {
|
|||||||
ERR_P(LscCmd(ser, "CSET 1:[chan],[unit],0,0"));
|
ERR_P(LscCmd(ser, "CSET 1:[chan],[unit],0,0"));
|
||||||
}
|
}
|
||||||
if (ramp > 0 && set != 0) {
|
if (ramp > 0 && set != 0) {
|
||||||
/* take ramp from actual temperature if more than 10 % deviation */
|
/* start ramp from actual temperature */
|
||||||
ERR_P(LscCmd(ser, "CSET?[loop]>,,cod1;SETP?[loop]>fbuf"));
|
ERR_P(LscCmd(ser, "CSET?[loop]>,,cod1;SETP?[loop]>fbuf"));
|
||||||
if (loop == 1 && cod1 != 0) {
|
if (loop == 1 && cod1 != 0) {
|
||||||
ERR_P(LscCmd(ser, "RANGE?>cod1"));
|
ERR_P(LscCmd(ser, "RANGE?>cod1"));
|
||||||
@ -2164,8 +2171,15 @@ int PeriodicTask(void) {
|
|||||||
if (stickhtr < 0) {
|
if (stickhtr < 0) {
|
||||||
ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy"));
|
ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy"));
|
||||||
} else {
|
} else {
|
||||||
cod1=0;
|
if (parallelhtr) {
|
||||||
ERR_P(LscCmd(ser, "DOUT 3,0;BUSY?>busy"));
|
out1 = 2;
|
||||||
|
} else {
|
||||||
|
out1 = 0;
|
||||||
|
}
|
||||||
|
if (stickhtr > 1) {
|
||||||
|
out1 |= stickhtr;
|
||||||
|
}
|
||||||
|
ERR_P(LscCmd(ser, "DOUT 3,[out1];BUSY?>busy"));
|
||||||
}
|
}
|
||||||
if ((plug0.codDefined && plug1.codDefined)) {
|
if ((plug0.codDefined && plug1.codDefined)) {
|
||||||
per=period; /* no timeout on above command and codes are defined: normal period */
|
per=period; /* no timeout on above command and codes are defined: normal period */
|
||||||
@ -2227,19 +2241,29 @@ int PeriodicTask(void) {
|
|||||||
str_copy(plug0.device, buf1+1);
|
str_copy(plug0.device, buf1+1);
|
||||||
plug0.codChanged=0;
|
plug0.codChanged=0;
|
||||||
ConfigByName(0);
|
ConfigByName(0);
|
||||||
if (autoconfig == 0) ConfigByCode(0);
|
if (autoconfig == 0) {
|
||||||
|
str_copy(devname0, plug0.device);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (plug0.code!=0) str_copy(plug0.device, buf1);
|
if (plug0.code!=0) str_copy(plug0.device, buf1);
|
||||||
plug0.devcmd=0;
|
plug0.devcmd=0;
|
||||||
|
if (autoconfig == 0) {
|
||||||
|
ConfigByName(0);
|
||||||
|
str_copy(devname0, plug0.device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (buf2[0]=='*') {
|
if (buf2[0]=='*') {
|
||||||
str_copy(plug1.device, buf2+1);
|
str_copy(plug1.device, buf2+1);
|
||||||
plug1.codChanged=0;
|
plug1.codChanged=0;
|
||||||
ConfigByName(1);
|
ConfigByName(1);
|
||||||
if (autoconfig == 0) ConfigByCode(1);
|
/* if (autoconfig == 0) ConfigByCode(1); */
|
||||||
} else {
|
} else {
|
||||||
if (plug1.code!=0) str_copy(plug1.device, buf2);
|
if (plug1.code!=0) str_copy(plug1.device, buf2);
|
||||||
plug1.devcmd=0;
|
plug1.devcmd=0;
|
||||||
|
if (autoconfig == 0) {
|
||||||
|
ConfigByName(1);
|
||||||
|
str_copy(devname1, plug1.device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ConcatDevice();
|
ConcatDevice();
|
||||||
|
|
||||||
@ -2427,7 +2451,9 @@ int PeriodicTask(void) {
|
|||||||
slopeU.mx = -1;
|
slopeU.mx = -1;
|
||||||
slopeL.mx = -1;
|
slopeL.mx = -1;
|
||||||
}
|
}
|
||||||
if (rdTim < finTime) {
|
if (ramping) {
|
||||||
|
/* do not change tShift when ramping */
|
||||||
|
} else if (rdTim < finTime) {
|
||||||
if (slopeS.wasmax) {
|
if (slopeS.wasmax) {
|
||||||
finTime = rdTim + int2 + 30;
|
finTime = rdTim + int2 + 30;
|
||||||
}
|
}
|
||||||
@ -2474,6 +2500,16 @@ int PeriodicTask(void) {
|
|||||||
ERR_P(LscCmd(ser, "KEYST?>key;DIOST?>cod2,out2;DOUT 3,30"));
|
ERR_P(LscCmd(ser, "KEYST?>key;DIOST?>cod2,out2;DOUT 3,30"));
|
||||||
} else {
|
} else {
|
||||||
ERR_P(LscCmd(ser, "KEYST?>key"));
|
ERR_P(LscCmd(ser, "KEYST?>key"));
|
||||||
|
if (stickhtr == 1) {
|
||||||
|
d = set - samp.temp;
|
||||||
|
if (parallelhtr) {
|
||||||
|
if (d < stickhtroff) {
|
||||||
|
parallelhtr = 0;
|
||||||
|
}
|
||||||
|
} else if (d > stickhtron) {
|
||||||
|
parallelhtr=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (busy==0) {
|
if (busy==0) {
|
||||||
if (stickhtr < 0) {
|
if (stickhtr < 0) {
|
||||||
@ -3413,6 +3449,7 @@ int main(int argc, char *argv[]) {
|
|||||||
CocDefInt(tim0, RD);
|
CocDefInt(tim0, RD);
|
||||||
CocDefInt(ibuf, RD);
|
CocDefInt(ibuf, RD);
|
||||||
CocDefInt(autoconfig, RW);
|
CocDefInt(autoconfig, RW);
|
||||||
|
CocDefInt(ramping, RD);
|
||||||
|
|
||||||
CocDefInt(logMask, RW);
|
CocDefInt(logMask, RW);
|
||||||
CocDefInt(logPeriod, RW);
|
CocDefInt(logPeriod, RW);
|
||||||
@ -3422,6 +3459,9 @@ int main(int argc, char *argv[]) {
|
|||||||
CocDefInt(serialNo, RD);
|
CocDefInt(serialNo, RD);
|
||||||
CocDefInt(quit, RW);
|
CocDefInt(quit, RW);
|
||||||
CocDefInt(stickhtr, RW);
|
CocDefInt(stickhtr, RW);
|
||||||
|
CocDefInt(parallelhtr, RW);
|
||||||
|
CocDefFlt(stickhtron, RW);
|
||||||
|
CocDefFlt(stickhtroff, RW);
|
||||||
CocDefInt(keepT, RW);
|
CocDefInt(keepT, RW);
|
||||||
CocDefInt(swRangeOn, RW);
|
CocDefInt(swRangeOn, RW);
|
||||||
CocDefInt(doubleControl, RW);
|
CocDefInt(doubleControl, RW);
|
||||||
|
Reference in New Issue
Block a user