From 4c7f439377294ee8c84d97d059de003e83e89088 Mon Sep 17 00:00:00 2001 From: zolliker Date: Thu, 17 Nov 2005 07:58:07 +0000 Subject: [PATCH] - various bug fixes and improvements - modified automatic instrument detection on six and tecs client --- tecs/didi | 1 - tecs/instr_hosts.c | 6 +++--- tecs/make_gen | 2 +- tecs/six.c | 17 ++++++++++++++--- tecs/tecs.c | 13 +++++++++++++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/tecs/didi b/tecs/didi index a94a5ca..edbac50 100755 --- a/tecs/didi +++ b/tecs/didi @@ -7,7 +7,6 @@ set destlist=( type@osf1 \ alpha=/afs/psi.ch/project/sinq/tru64/stow/tecs/bin/ \ type@linux \ slinux=/afs/psi.ch/project/sinq/sl-linux/stow/tecs/bin/ \ -linux=/afs/psi.ch/project/sinq/linux/stow/tecs/bin/ \ amor@amor:tecs/ focus@focus:tecs/ trics@trics:tecs/ \ tasp@tasp:tecs/ dmc@dmc:tecs/ hrpt@hrpt:tecs/ \ morpheus@morpheus:tecs/ sans@sans:tecs/ sans2@sans2:tecs/ \ diff --git a/tecs/instr_hosts.c b/tecs/instr_hosts.c index 7a1609b..098dae7 100644 --- a/tecs/instr_hosts.c +++ b/tecs/instr_hosts.c @@ -11,8 +11,8 @@ static char *getItem(char *line, char *name, char *value, int value_len) { snprintf(find, sizeof find, "%s=%s", name, value); found = strstr(line, find); - if (found && *value != '\0' && found[strlen(find)] > ' ') { - /* when value is given, it must be complete */ + if (found && *value != '\0' && found[strlen(find)] > ' ' && found[strlen(find)] != '.') { + /* when value is given, it must be complete, (a dot or a space terminates the value) */ found = NULL; } if (found) { @@ -75,7 +75,7 @@ int InstrHost(char *service, char *input, char *instr, int instr_len, crit = "host"; input = getenv("HOST"); } else { - crit="instr"; + crit = "instr"; } finished = 0; while (NULL != fgets(line, sizeof line, fil)) { diff --git a/tecs/make_gen b/tecs/make_gen index b898356..08399ef 100644 --- a/tecs/make_gen +++ b/tecs/make_gen @@ -30,7 +30,7 @@ all: libtecsl.a TecsServer TecsClient keep_running six CFGDIR=/afs/psi.ch/project/sinq/common/lib/tecs/cfg/ -#-include make_crv +-include make_crv make_crv: make_crv.tcsh inp/lsc.codes $(ALLINP) make_crv.tcsh inp/lsc.codes diff --git a/tecs/six.c b/tecs/six.c index be34d2c..d2ab7b5 100644 --- a/tecs/six.c +++ b/tecs/six.c @@ -674,9 +674,20 @@ int main (int argc, char *argv[]) { , host, sizeof host, &port); ent = gethostbyname(host); if (!ent) { - PutC("unknown host: "); - PutC(host); - PutC("\n"); + if (hostArg == NULL || hostArg[0] <= ' ') { + snprintf(host, sizeof host, "%s", getenv("HOST")); + hostArg = host; + } + PutC(service); + PutC(" on "); + PutC(hostArg); + PutC(" not found in InstrumentHostList\n"); + p=getenv("InstrumentHostList"); + if (p) { + PutC("("); + PutC(p); + PutC(")\n"); + } return 0; } snprintf(host, sizeof host, "%s", ent->h_name); diff --git a/tecs/tecs.c b/tecs/tecs.c index 3bf1b8f..a9cf779 100644 --- a/tecs/tecs.c +++ b/tecs/tecs.c @@ -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);