- various enhancements in tecs and six
This commit is contained in:
26
tecs/tecs.c
26
tecs/tecs.c
@@ -1217,17 +1217,23 @@ int ReadTemp(void) {
|
||||
float Percent2Power(float percent) {
|
||||
float curr;
|
||||
|
||||
if (linearPower != 0) {
|
||||
if (linearPower > 0) {
|
||||
return percent/100*linearPower;
|
||||
}
|
||||
curr=maxCurrent*percent/100;
|
||||
if (linearPower < 0) {
|
||||
return curr*sqrt(resist)*powFact;
|
||||
}
|
||||
return curr*curr*resist*powFact;
|
||||
}
|
||||
|
||||
float Power2Percent(float power) {
|
||||
if (linearPower != 0) {
|
||||
if (linearPower > 0) {
|
||||
return power/linearPower*100;
|
||||
}
|
||||
if (linearPower < 0) {
|
||||
return power/powFact/sqrt(resist)/maxCurrent*100;
|
||||
}
|
||||
return sqrt(power/powFact/resist)/maxCurrent*100;
|
||||
}
|
||||
|
||||
@@ -1382,18 +1388,19 @@ int SetTemp(int switchOn) {
|
||||
if (ramp < 0) ramp=-ramp;
|
||||
if (ramp < 0.1) ramp=0.1;
|
||||
if (showSet) {
|
||||
ERR_P(LscCmd(ser, "RAMP [loop]:1,[ramp];SETP [loop],[setH];SETP?[loop]>fbuf"));
|
||||
fbuf = ramp;
|
||||
} else {
|
||||
ERR_P(LscCmd(ser, "SETP?[loop]>fbuf"));
|
||||
if (fabs(fbuf-setH) >= ramp*smooth) {
|
||||
fbuf=ramp;
|
||||
} else {
|
||||
fbuf=sqrt(fabs(fbuf-setH)*ramp/smooth);
|
||||
if (fbuf<0.1) fbuf=0.1;
|
||||
}
|
||||
ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]"));
|
||||
ERR_P(LscCmd(ser, "SETP?[loop]>fbuf"));
|
||||
}
|
||||
fbuf = fbuf / ctlSens->scale;
|
||||
if (fbuf<0.1) fbuf=0.1;
|
||||
ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]"));
|
||||
ERR_P(LscCmd(ser, "SETP?[loop]>fbuf"));
|
||||
tr=TrueScale(ctlSens, fbuf);
|
||||
if (showSet) {
|
||||
logfileOut(LOG_MAIN, "set %g (on %s) %g K/min, starting from %g\n", set, ctlSens->ch, ramp, tr);
|
||||
@@ -1663,8 +1670,11 @@ int ConfigAlarms(float genLimit) {
|
||||
int LoadFromLsc(void) {
|
||||
ERR_P(LscCmd(ser, "PID?[loop]>prop,integ,deriv"));
|
||||
ERR_P(LscCmd(ser, "RAMP?[loop]>,ramp"));
|
||||
if (ctlSens != NULL) {
|
||||
ramp *= ctlSens->scale;
|
||||
}
|
||||
ERR_P(LscCmd(ser, "ANALOG?1>,,,,,,fbuf"));
|
||||
still=fbuf*fbuf/70;
|
||||
still=fbuf;
|
||||
return 0;
|
||||
OnError: return -1;
|
||||
}
|
||||
@@ -2920,7 +2930,7 @@ int StillHdl(int mode, void *base, int fd) {
|
||||
if (mode==COC_WR) {
|
||||
return COC_DWR;
|
||||
} else if (mode==COC_DWR) {
|
||||
fbuf=sqrt(still*70);
|
||||
fbuf=still;
|
||||
ERR_P(LscCmd(ser,"ANALOG 1:0,2,,,,,[fbuf]"));
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user