- various bug fixes and improvements

- modified automatic instrument detection on six and tecs client
This commit is contained in:
zolliker
2005-11-17 07:58:07 +00:00
parent 01fce80d95
commit 4c7f439377
5 changed files with 31 additions and 8 deletions

View File

@@ -134,6 +134,7 @@ static float
fbuf, /* float buffer */
r1, r2, /* temporary values */
still=0,
linearPower=0, /* normally 0. Maximum power when loop=2 and the power linear to the output */
mout,
tInt=0; /* integral time (sec.) for setpoint shift */
@@ -604,6 +605,7 @@ again:
slope=0;
ramp=0;
controlMode=0;
linearPower=0;
powFact=1;
config[0]='\0';
lscfg[0]='\0';
@@ -1131,11 +1133,18 @@ int ReadTemp(void) {
float Percent2Power(float percent) {
float curr;
if (linearPower != 0) {
return percent/100*linearPower;
}
curr=maxCurrent*percent/100;
return curr*curr*resist*powFact;
}
float Power2Percent(float power) {
if (linearPower != 0) {
return power/linearPower*100;
}
return sqrt(power/powFact/resist)/maxCurrent*100;
}
@@ -1490,6 +1499,9 @@ int SetMaxPower(void) {
pold=limCurrent*limCurrent*resist;
}
CalcMaxPower();
} else if (linearPower != 0) {
maxCurrent = 1;
maxPowerFlt = linearPower;
} else {
maxCurrent=10/resist; /* 10 V max. */
if (maxCurrent>0.1) {
@@ -2925,6 +2937,7 @@ int main(int argc, char *argv[]) {
CocDefFlt(r2, RD);
CocDefFlt(tShift, RW);
CocDefFlt(tInt, RW);
CocDefFlt(linearPower, RW);
CocDefPtr(clData, ClientData);
CocStrFld(ClientData, cmd, RW); CocHdl(SendHdl);