diff --git a/hardsup/makefile b/hardsup/makefile index aef0ab2..4d3ce09 100644 --- a/hardsup/makefile +++ b/hardsup/makefile @@ -1,7 +1,5 @@ # this makefile delegates to a version specific makefile -# where this subdirectory is (relative to the sics root) -S_DOWN=psi/hardsup # where root is (from here) S_UP=../.. diff --git a/makefile b/makefile index 776084f..887b267 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,5 @@ # this makefile delegates to a version specific makefile -# where this subdirectory is (relative to root) -S_DOWN=psi # where root is S_UP=.. diff --git a/psi.c b/psi.c index 1bc969a..4e206ac 100644 --- a/psi.c +++ b/psi.c @@ -309,7 +309,9 @@ static void ConfigureController(char *name, pEVControl pNew, SConnection *pCon){ EVCSetPar(pNew,"upperlimit",300.0,pCon); EVCSetPar(pNew,"lowerlimit",1.0,pCon); - if(strcmp(name,"euro") == 0){ + if(strcmp(name,"tecs") == 0){ + TecsCustomize(pCon, pNew); + } else if(strcmp(name,"euro") == 0){ EVCSetPar(pNew,"upperlimit",750.0,pCon); EVCSetPar(pNew,"lowerlimit",15.0,pCon); } else if(strcmp(name,"el755") == 0){ diff --git a/tecs/coc_client.c b/tecs/coc_client.c index d3b1ef7..1d34636 100644 --- a/tecs/coc_client.c +++ b/tecs/coc_client.c @@ -35,6 +35,8 @@ int CocConnect(CocConn *conn) { /* connect, but do not start */ ERR_SI(setsockopt(conn->fd,SOL_SOCKET,SO_REUSEADDR,&i,sizeof(int))); /* allow quick port reuse */ i=connect(conn->fd, (struct sockaddr *)&sadr, sizeof(sadr)); if (i<0) { + close(conn->fd); + conn->fd=-1; if (errno==ECONNREFUSED) return(1); ERR_COD(errno); } @@ -132,7 +134,7 @@ int CocCheck(CocConn *conn) { int CocTryCmd(CocConn *conn) { int iret=-1, siz; - +int j; signal(SIGPIPE, SIG_IGN); if (conn->fd<0) { ERR_I(iret=CocConnect(conn)); /* was CocOpen earlier */ @@ -290,10 +292,12 @@ int CocGetArray(CocConn *conn, const char *name, float *value, int value_size) { int CocDoIt(CocConn *conn, char *res, int res_len) { StrBuf *buf; int i, pending; + float *arr; CocArg *a; char *resp, *t, tag; int iret=0; - + int siz; + assert(conn!=NULL); ERR_I(CocCmdWithRetry(conn)); buf=&conn->resbuf; @@ -341,7 +345,11 @@ int CocDoIt(CocConn *conn, char *res, int res_len) { } else if (a->type==ARG_FLT) { ERR_I(StrGetFloat(buf, (float *)a->adr, COC_SEP)); } else if (a->type==ARG_ARR) { - ERR_I(StrGetArray(buf, (float *)a->adr, a->size)); + arr=(float *)a->adr; + ERR_I(siz=StrGetArray(buf, arr, a->size)); + while (siz < a->size) { /* fill with zeroes */ + arr[siz++]=0.0; + } resp=""; } else if (a->type==ARG_CHAR) { ERR_P(StrNGet(buf, (char *)a->adr, a->size, COC_SEP)); diff --git a/tecs/coc_util.c b/tecs/coc_util.c index 4f61c68..422eff6 100644 --- a/tecs/coc_util.c +++ b/tecs/coc_util.c @@ -73,7 +73,7 @@ int CocRecv(int fd, StrBuf *buf, int timeout, int *flag) { fd_set mask; int i, l; int siz, n; - + if (timeout>=0) { tmo.tv_sec=timeout; diff --git a/tecs/coc_util.h b/tecs/coc_util.h index c022d2e..22327e0 100644 --- a/tecs/coc_util.h +++ b/tecs/coc_util.h @@ -5,7 +5,8 @@ #include "myc_buf.h" #define COC_CMD_LEN 256 -#define COC_RES_LEN 16384 +/* the follwing should be larger than 4x(largest array)+length of additional parameters */ +#define COC_RES_LEN 50000 int CocCreateSockAdr( struct sockaddr_in *sockaddrPtr, /* Socket address */ diff --git a/tecs/didi b/tecs/didi index e7ef819..4dc4e53 100755 --- a/tecs/didi +++ b/tecs/didi @@ -1,10 +1,15 @@ #!/bin/tcsh +set what="$1" +set where="$2" + set destlist=( type@osf1 \ AMOR@lnsa14:bin/ DMC@lnsa05:bin/ FOCUS@lnsa16:bin/ \ -HRPT@lnsa11:bin/ TASP@lnsa12:bin/ TRICS@lnsa18:bin/ \ +HRPT@lnsa11:bin/ TRICS@lnsa18:bin/ \ lnslib@lnsa15:bin/ \ type@linux \ +zolliker@llc3:/afs/psi.ch/project/sinq/linux/bin/ \ +TASP@pc4478:tasp_sics/ \ TOPSI@pc4120:topsi_sics/ SANS@pc3965:sans_sics/ SANS2@sans2:sans2_sics/ \ ) @@ -33,7 +38,9 @@ set items=(TecsServer TecsClient six keep_running cfg) echo "" echo " all $items" echo -n "distribute what: " -set what=$< +if ("$what" == "") then + set what=$< +endif if ($what == all) then set what=($items) endif @@ -41,7 +48,9 @@ endif echo "" echo " all $dests" echo "distribute where: " -set where=$< +if ("$where" == "") then + set where=$< +endif if ($where == all) then set where=($dests) endif diff --git a/tecs/instr_hosts.c b/tecs/instr_hosts.c index e6750b5..5e1e787 100644 --- a/tecs/instr_hosts.c +++ b/tecs/instr_hosts.c @@ -16,11 +16,11 @@ static Instrument list[]={ { "TRICS", "lnsa18.psi.ch", 9753, "TRICS" , 1}, { "AMOR", "lnsa14.psi.ch", 9753, "AMOR" , 1}, { "FOCUS", "lnsa16.psi.ch", 9753, "FOCUS" , 1}, - { "TASP", "lnsa12.psi.ch", 9753, "TASP", 1}, - { "TASP0", "lnsa09.psi.ch", 9753, NULL , 0}, + { "TASP", "pc4478.psi.ch", 9753, "TASP", 1}, { "RITA", "pc4345.psi.ch", 9753, NULL , 0}, - { "PREP", "lnsa15.psi.ch", 9753, "lnsg" , 2}, - { "AREA", "lnsa15.psi.ch", 9751, "lnsg" , 2}, + { "PREP", "lnsa15.psi.ch", 9751, "lnsg" , 2}, + { "PREP2", "lnsa15.psi.ch", 9756, "lnsg" , 2}, + { "AREA", "lnsa15.psi.ch", 9757, "lnsg" , 2}, { "TEST", "lnsa15.psi.ch", 9755, "lnslib", 2} }; @@ -61,6 +61,8 @@ int InstrHost(char *input, char *instr, char *host, char *user, char *pcod lnscode=getenv("LNSCODE"); if (lnscode == NULL) { sprintf(pcod, "%02dlns%d", tim.tm_year % 100, tim.tm_mon/6+1); + } else if (strlen(lnscode)==3) { + sprintf(pcod, "%c%clns%c", lnscode[0], lnscode[1], lnscode[2]); } else { sprintf(pcod, "%02dlns%s", tim.tm_year % 100, lnscode); } diff --git a/tecs/make_gen b/tecs/make_gen index 7cd958b..6a3037d 100644 --- a/tecs/make_gen +++ b/tecs/make_gen @@ -24,12 +24,6 @@ TECLI_OBJ =tecs_client.o tecs_plot.o str.o instr_hosts.o \ HARDSUPLIB = ../hardsup/libhlib.a -#.f.o: -# $(FC) $(FFLAGS) -c $F -# -#.c.o: -# $(CC) $(CFLAGS) -c $C - libtecsl.a: $(CLI_OBJ) rm -f $@ $(AR) $(ARFLAGS) $@ $Q @@ -43,6 +37,10 @@ test: tecs_cli.c TecsServer: $(SERV_OBJ) $(HARDSUPLIB) $(FORTIFYOBJ) $(CC) $(CFLAGS) -o $@ $Q -lm +lsc331: lsc331.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o \ + $(LIBR_OBJ) $(HARDSUPLIB) $(FORTIFYOBJ) + $(CC) $(CFLAGS) -o $@ $Q -lm + TecsClient: $(TECLI_OBJ) $(FORTIFYOBJ) $(FC) -o $@ $Q $(PGLIB) $(RDLIB) @@ -79,12 +77,6 @@ six: six.c term.o sys_select.o libtecsl.a rexstart: rstart.c myc_str.o myc_err.o instr_hosts.o $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) @ echo "$(PWD)/rstart" -# -#serverd: serverd.c myc_str.o myc_err.o coc_util.o myc_buf.o -# $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) -# -#starts: starts.c myc_str.o myc_err.o coc_util.o myc_buf.o -# $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) clean: rm -f *.o *.a six keep_running TecsServer TecsClient diff --git a/tecs/makefile b/tecs/makefile index d68ec23..4d3ce09 100644 --- a/tecs/makefile +++ b/tecs/makefile @@ -1,8 +1,6 @@ # this makefile delegates to a version specific makefile -# where this subdirectory is (relative to the sics root) -S_DOWN=psi/tecs # where root is (from here) S_UP=../.. -include $(S_UP)/make_forward +include ../../make_forward diff --git a/tecs/makefile_linux b/tecs/makefile_linux index e7d20d0..b3f7ebc 100644 --- a/tecs/makefile_linux +++ b/tecs/makefile_linux @@ -5,7 +5,7 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include ../../linux_def +include $(SRC)../../linux_def SICST=.. SICS=$(SRC).. diff --git a/tecs/myc_time.h b/tecs/myc_time.h index 80142b7..f9f5c70 100644 --- a/tecs/myc_time.h +++ b/tecs/myc_time.h @@ -25,7 +25,8 @@ int mycDate(int time); int mycTime(int date); /* - does the inverse of MycDate. Chooses the last possible date not later than today + does the inverse of MycDate. Chooses the last possible date not later than today, + if day, month or year is undefined (zero) */ /* the following subroutines are to be called from FORTRAN diff --git a/tecs/six.c b/tecs/six.c index f3f1d48..57b9ea5 100644 --- a/tecs/six.c +++ b/tecs/six.c @@ -22,27 +22,32 @@ static char pswd1[32]=""; static char user2[32]=""; static char pswd2[32]=""; -void Usage(void) { - printf("\n"); - printf(" six commandline options:\n"); - printf(" - login as spy\n"); - printf(" + login as manager\n"); - printf(" 0 login as user\n"); - printf(" -- set spy as default\n"); - printf(" 00 set user as default\n"); - printf(" ++ set manager as default\n"); - printf(" help show this help text\n"); - printf(" -a or a ask always for username/password, forget passwords\n"); - printf(" -s or s simulation mode (on some instruments)\n"); - printf(" -w or w do not skip welcome message\n"); - printf(" -h \"host\" connect to a SICServer on a different host\n"); - printf(" no option login with default privilege\n"); +void Usage(int cmds_only) { + if (!cmds_only) { + printf("\n"); + printf(" six commandline options:\n"); + printf(" - login as spy\n"); + printf(" + login as manager\n"); + printf(" 0 login as user\n"); + printf(" -- set spy as default\n"); + printf(" 00 set user as default\n"); + printf(" ++ set manager as default\n"); + printf(" help show this help text\n"); + printf(" -a or a ask always for username/password, forget passwords\n"); + printf(" -s or s simulation mode (on some instruments)\n"); + printf(" -w or w do not skip welcome message\n"); + printf(" -h \"host\" connect to a SICServer on a different host\n"); + printf(" -p \"port\" connect to a SICServer on a different port\n"); + printf(" -n do not login\n"); + printf(" no option login with default privilege\n"); + } printf("\n"); printf(" Special commands treated by six (these are no SICS commands!)\n"); printf("\n"); printf(" quit exit six\n"); printf(" exit exit six\n"); printf(" stop interrupt SICS\n"); + printf(" help show this help text\n"); printf(" + increase privilege\n"); printf(" - decrease privilege\n"); printf("\n"); @@ -350,7 +355,7 @@ int setrights(int gotolevel) { level=gotolevel; ERR_I(sendCmd(fd, "config list")); ERR_P(p=readWrite(fd,10000,1,"UserRights = ")); - if (p!=NULL) { + if (*p!='\0') { level=*p-'0'; } if (level==3) { @@ -393,11 +398,11 @@ int setrights(int gotolevel) { int main (int argc, char *argv[]) { int iret, pos; fd_set mask; - int l, i, j, port, skip, gotolevel; + int l, i, j, port, skip, gotolevel, sicslogin; char buf[128], lbuf[16], ilow[64]; char stdPrompt[128], prompt[256]; char *sim=""; - char *p, *statusMatch; + char *p, *statusMatch=NULL; char *pnam[4]={"0", "MANAGER", "user", "spy"}; struct sockaddr_in sadr; @@ -407,6 +412,7 @@ int main (int argc, char *argv[]) { printf("---------------------------------------------------\n"); port=1301; skip=1; + sicslogin=1; j=0; deflevel=0; gotolevel=0; @@ -434,27 +440,40 @@ int main (int argc, char *argv[]) { gotolevel=2; deflevel=2; } else if (0==strcmp(argv[i], "help")) { - Usage(); + Usage(0); return 0; } else if (0==strcmp(argv[i], "-h")) { i++; if (i>=argc) { printf("missing host\n"); - Usage(); return 0; + Usage(0); return 0; } host=argv[i]; + } else if (0==strcmp(argv[i], "-p")) { + i++; + if (i>=argc) { + printf("missing port\n"); + Usage(0); return 0; + } + port=atoi(argv[i]); + if (port == 0) { + printf("illegal port\n"); + Usage(0); return 0; + } + } else if (0==strcmp(argv[i], "-n")) { + sicslogin=0; } else { if (strlen(argv[i])>=32) { printf("argument too long\n"); - Usage(); return 0; + Usage(0); return 0; } else if (argv[i][0]!='-') { if (j==0) { printf("syntax has changed, username can not be given as argument\n"); - Usage(); j=1; + Usage(0); j=1; } } else { printf("unknown option: %s\n", argv[i]); - Usage(); return 0; + Usage(0); return 0; } } } @@ -462,38 +481,44 @@ int main (int argc, char *argv[]) { ERR_SI(fd=socket(AF_INET, SOCK_STREAM, 0)); term_reg_socket(fd); ERR_SI(connect(fd, (struct sockaddr *)&sadr, sizeof(sadr))); - ERR_I(sendCmd(fd, "sicslogin Spy 007")); - ERR_P(p=readWrite(fd,10000,skip,"SICS")); - if (*p=='\0') { - printf("rejected\n"); - return 0; - } - if (skip) printf("reading welcome message ...\n"); + if (sicslogin) { + ERR_I(sendCmd(fd, "sicslogin Spy 007")); + ERR_P(p=readWrite(fd,10000,skip,"SICS")); + if (*p=='\0') { + printf("rejected\n"); + return 0; + } + if (skip) printf("reading welcome message ...\n"); - ERR_I(sendCmd(fd, "status interest")); - ERR_P(readWrite(fd,10000,0,"OK")); + ERR_I(sendCmd(fd, "status interest")); + ERR_P(readWrite(fd,10000,0,"OK")); - ERR_I(sendCmd(fd, "Instrument")); - ERR_P(p=readWrite(fd,10000,0,"Instrument = ")); - str_copy(instr, p); - if (*instr=='\0') { - printf("can not detect instrument\n"); - return 0; - } - p=strchr(instr,' '); - if (p!=NULL) *p='\0'; - if (0==strcmp(instr,"SANS-II")) { - str_copy(instr, "SANS2"); - } - ERR_I(i=setrights(gotolevel)); - if (i==1) return 0; - printf("\rlogged in to SICS as %s on %s\n", pnam[level], instr); + ERR_I(sendCmd(fd, "Instrument")); + ERR_P(p=readWrite(fd,10000,0,"Instrument = ")); + str_copy(instr, p); + if (*instr=='\0') { + printf("can not detect instrument\n"); + return 0; + } + p=strchr(instr,' '); + if (p!=NULL) *p='\0'; + if (0==strcmp(instr,"SANS-II")) { + str_copy(instr, "SANS2"); + } + ERR_I(i=setrights(gotolevel)); + if (i==1) return 0; + printf("\rlogged in to SICS as %s on %s\n", pnam[level], instr); - str_lowcase(ilow,instr); - sprintf(stdPrompt, "six[%s] ", ilow); + str_lowcase(ilow,instr); + sprintf(stdPrompt, "six[%s] ", ilow); - ERR_I(sendCmd(fd, "status")); - ERR_P(p=readWrite(fd,10000,0,"status = ")); + ERR_I(sendCmd(fd, "status")); + ERR_P(p=readWrite(fd,10000,0,"status = ")); + + } else { + sprintf(stdPrompt, "six[%s] ", host); + p="E"; + } iret=1; buf[0]='\0'; @@ -514,7 +539,7 @@ int main (int argc, char *argv[]) { str_lowcase(lbuf, buf); if (0==strcmp(lbuf,"quit")) break; if (0==strcmp(lbuf,"exit")) break; - statusMatch="status = "; + if (sicslogin) statusMatch="status = "; skip=0; printf("\n"); if (0==strcmp(lbuf,"stop")) { @@ -542,14 +567,16 @@ int main (int argc, char *argv[]) { } skip=1; strcpy(buf, "status"); + } else if (0==strcmp(buf, "help")) { + Usage(1); + strcpy(buf, "status"); } else if (0==strcmp(buf, "six help")) { - Usage(); + Usage(0); strcpy(buf, "status"); } else if (0==strcmp(buf, "")) { strcpy(buf, "status"); statusMatch=NULL; } - ERR_I(sendCmd(fd, buf)); ERR_P(p=readWrite(fd,1000,skip,statusMatch)); buf[0]='\0'; @@ -559,13 +586,15 @@ int main (int argc, char *argv[]) { } else { /* socket iret ready to read */ assert(fd==iret); ERR_P(p=readWrite(fd,1000,0,"status = ")); + if (strcmp(p, "0") == 0) { + printf("\nconnection lost\n"); + break; + } } } fputs("\n", stdout); - term_save_hist(1); /* save history wihtout last line */ + term_save_hist(1); /* save history without last line */ return 0; - Usage: - return 0; OnError: ErrShow("end"); return 0; diff --git a/tecs/tecs.c b/tecs/tecs.c index 5dc8884..7b3697c 100644 --- a/tecs/tecs.c +++ b/tecs/tecs.c @@ -36,12 +36,18 @@ typedef struct { char ch[4]; float t, t0, t1, t2, min, max, band; /* temperatures */ float scale; /* scale for extreme ranges */ + float kink; /* for T > kink scale is used + kink > RT for thermocouples going to more than 1500 K */ float lim; /* range limit (used when two sensors present) */ float alarm; + int customAlarm; int stat1, stat2; /* reading status summary */ int present; /* 0: sensor inactive, 1: sensor configured, -1: sensor parameters read */ int readStat; /* reading status */ - char type; + int dispfld; + char dispfmt; + char curve[32]; /* name of curve file */ + char typ; } SensorT; enum Sensors { A, B, C, D, A1, A2, A3, A4, N_SENSORS }; @@ -77,7 +83,7 @@ static Testpoint /* C standard guarantees initialization to zero */ typedef struct _Plug { SensorT *sensor1, *sensor2; - int manual; /* manual device */ + int devcmd; /* 1: device configured by command, 0: by cabling code */ int code, code1, code2; /* device code, buffers for device code */ int codChanged; /* code has changed */ int codDefined; /* code is not yet confirmed */ @@ -95,14 +101,16 @@ static float setH, /* set T on heat exchanger */ htr, power=DATA_UNDEF, /* heater current percentage, heater power */ tLimit, /* temperature limit */ + tMaxLimit, /* maximal temperature limit */ maxPower, /* max. Power */ - scalPower, + maxCurrent, /* maxCurrent (not really reached for resist > 25 Ohm */ powFact=1, /* power factor (for external power supplies) */ - resist, /* heater resistance */ + resist=10, /* heater resistance */ tShift=0, /* setpoint shift */ full, /* full value for helium level */ prop, integ, deriv, /* pid */ maxShift=2, /* maximal shift in when controlMode=2 */ + maxOver=0, /* maximal overshoot in when controlMode=2 */ tm=DATA_UNDEF, /* main temperature */ ts=DATA_UNDEF, /* sample temperature */ tx=DATA_UNDEF, /* controlled temperature */ @@ -129,6 +137,7 @@ static int noResp=1, /* no response */ quit, /* quit server */ controlMode=2, /* 0: control on heater, 1: control on sample, 3: 2nd loop for difference heater-sample */ + manual=0, int2=30, /* inegration time for controlMode 2 */ remoteMode, /* 1: local, 2: remote */ maxfld, /* last used display field */ @@ -137,10 +146,13 @@ static int deviceFlag, /* device given via net */ num, /* curve number */ key, /* key status */ - serialNo, + serialNo=340000, /* initialize with a valid, but not existing value */ + lscVersion, /* firmware version date yyyymmdd */ readTemp, /* client requested readTemp */ cod1, cod2, out1, out2, /* codes read from digital input/output */ iRange, iAmp, /* max. range and max. current code */ + jRange, /* range code, jRange=iRange if controller did not switch off */ + ibuf, /* temporary int. buffer */ htrst, htrst0, /* heater status */ loop=1, /* active loop */ touched, /* user touched keys */ @@ -149,6 +161,9 @@ static int mmInt, mmTime, /* interval and time for next min-max logging */ nScan=0, /* number of scanned channels */ alarmListSize=0, + keepT=0, /* keep control over power-up */ + swRangeOn=0, /* switch heater range on when controller switched it off */ + initMaxPower=0, /* set MaxPower for the first time */ lockAlarm, cntError, tableTime; /* last time when table was read */ @@ -172,8 +187,10 @@ static char heUnits[4], /* helium level units */ alarmChannels[N_SENSORS], alarmHistory[N_SENSORS], + swap[4], dev[80], - dev2[80], + dev0[80], + dev1[80], devHelp[10000], controlChannel[4]="A"; @@ -185,7 +202,7 @@ static char static int logMask=LOG_MAIN; -static float gradata[7200]; +static float gradata[COC_RES_LEN/4-100]; static char grapar[128]; static int* grasize; @@ -229,35 +246,23 @@ void *SetClientData(void *data) { void ConcatDevice(void) { str_copy(device, plug0.device); - if (0!=strcmp(plug0.device, plug1.device) && (plug1.device[0]!='\0' || plug1.manual)) { + if (0!=strcmp(plug0.device, plug1.device) && (plug1.device[0]!='\0' || plug1.devcmd)) { str_append(device, "/"); str_append(device, plug1.device); } if (device[0]=='\0') return; - if (plug0.manual) { - str_append(device, " (manual"); - } else { - str_append(device, " (auto"); - } - if (plug1.manual==plug0.manual) { - str_append(device, ")"); - } else if (plug1.manual) { - str_append(device, "/manual)"); - } else { - str_append(device, "/auto)"); - } } int PutPermanentData(FILE *fil) { char buf[256]; char *d1, *d2; - if (plug0.manual) { + if (plug0.devcmd) { d1="*"; } else { d1=""; } - if (plug1.manual) { + if (plug1.devcmd) { d2="*"; } else { d2=""; @@ -268,7 +273,7 @@ int PutPermanentData(FILE *fil) { OnError: return -1; } -int InstalCurve(SensorT *sensor, char *dev) { +int InstalCurve(SensorT *sensor, char *devArg) { /* install sensor */ @@ -285,13 +290,13 @@ int InstalCurve(SensorT *sensor, char *dev) { str_copy(chan, sens->ch); ERR_P(LscCmd(ser, "FILTER [chan]:1,64,10")); sens->present=0; - if (sens->type=='x' || sens->type=='h' || sens->type=='f') { + if (sens->typ=='x' || sens->typ=='h' || sens->typ=='f') { if (chan[0]>='C') { ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,13;INSET [chan],1")); /* 7.5 V Range */ } else { ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,12;INSET [chan],1")); /* 5 V Range */ } - if (sens->type=='f') { + if (sens->typ=='f') { ERR_P(LscCmd(ser, "MNMX [chan]:1,4;INCRV [chan]:0")); } else { ERR_P(LscCmd(ser, "MNMX [chan]:1,3;INCRV [chan]:0")); @@ -304,14 +309,18 @@ int InstalCurve(SensorT *sensor, char *dev) { crv=NULL; e=NULL; - sprintf(nam, "%s_%c", dev, sens->type); + sprintf(nam, "%s_%c", devArg, sens->typ); logfileOut(LOG_MAIN+LOG_STAT, "install curve %s\n", nam); /* read curve file */ str_copy(nbuf, binDir); - str_append(nbuf, nam); + if (sensor->curve[0]=='\0') { /* old style file name */ + str_append(nbuf, nam); + } else { + str_append(nbuf, sensor->curve); + } str_append(nbuf, ".crv"); - + ERR_P(crv=str_read_file(nbuf)); t=str_split(chead, crv, '\n'); @@ -335,11 +344,18 @@ int InstalCurve(SensorT *sensor, char *dev) { } else { - strcpy(buf, ":"); - str_append(buf, nam); - str_append(buf, " "); - str_upcase(buf, buf); - + if (sensor->curve[0]!='\0') { + strcpy(buf, ","); + str_append(buf, sensor->curve); + str_append(buf, " "); + str_upcase(buf, buf); + } else { + strcpy(buf, ":"); + str_append(buf, nam); + str_append(buf, " "); + str_upcase(buf, buf); + } + entry=strstr(start, buf); if (entry==NULL) { /* sensor not found in cache */ entry=start; @@ -378,8 +394,14 @@ int InstalCurve(SensorT *sensor, char *dev) { if (e!=NULL) { *e='\0'; e++; } } } - if (head[0]!='\0' && LscEqPar(head, chead)) { /* header matches: select sensor type and curve */ + i=0; + if (num>20) i=12; /* check only from 12th character (CRC) for user curves */ + if (head[0]!='\0' && LscEqPar(head+i, chead+i)) { /* header matches: select sensor type and curve */ + if (i>0 && !LscEqPar(head, chead)) { /* name does not match */ + str_upcase(head, chead); + ERR_P(LscCmd(ser, "CRVHDR [num]:[head]")); + } if (chan[1]>'1') { /* scanned inputs A2...A4 */ ERR_P(LscCmd(ser, "INCRV?[chan]>buf2;INSET?[chan]>buf3")); str_copy(buf1, intype); @@ -406,7 +428,7 @@ int InstalCurve(SensorT *sensor, char *dev) { if (chan[1]<='1') ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype]")); n=3; - do { + do { /* try to delete curve 3 times */ ERR_P(LscCmd(ser, "CRVDEL [num];CRVHDR?[num]>buf1,")); buf1[4]='\0'; i=strcmp(buf1, "User"); @@ -426,7 +448,11 @@ int InstalCurve(SensorT *sensor, char *dev) { t=str_split(nbuf, points, '\n'); if (nbuf[0]!='\0') { ERR_I(str_substitute(buf, nbuf, "#0", lbuf)); - ERR_P(LscCmd(ser, buf)); + if (lscVersion<20030000 || strstr(buf,":0,0")==NULL) { + ERR_P(LscCmd(ser, buf)); + } else { + logfileOut(LOG_MAIN, "skip %s\n", buf); + } i++; sprintf(statusBuf, "downloading curve %d at line %d", num, i); } @@ -441,9 +467,10 @@ int InstalCurve(SensorT *sensor, char *dev) { } FREE(crv); crv=NULL; - if (sens->scale!=1.0) - ERR_P(LscCmd(ser, "LINEAR [chan]:1,[sens.scale],1,1,0")); /* scaling for display */ - + if (sens->scale != 1.0 || sens->kink != 0.0) { /* scaling for display */ + fbuf = sens->kink * (1.0 - sens->scale); + ERR_P(LscCmd(ser, "LINEAR [chan]:1,[sens.scale],1,1,[fbuf]")) + } if (settingsFlag==0) sens->present=1; /* if (num<=20) return 0; @@ -524,6 +551,8 @@ int PrepInput(char *label) { sensB.present=0; sensA.scale=1; sensB.scale=1; + sensA.kink=0; + sensB.kink=0; sensA.lim=0; sensB.lim=0; sensA.alarm=0; @@ -533,19 +562,26 @@ int PrepInput(char *label) { controlMode=0; powFact=1; config[0]='\0'; - tLimit=310; + tLimit=0; + tMaxLimit=0; + keepT=0; + swRangeOn=0; + loop=1; + initMaxPower=1; + resist=10; } else { sensC.present=0; sensD.present=0; sensC.scale=1; sensD.scale=1; + sensC.kink=0; + sensD.kink=0; sensC.lim=0; sensD.lim=0; sensC.alarm=0; sensD.alarm=0; } - loop=1; - resist=10; + dev[0]='\0'; str_copy(heUnits, "%"); i=sscanf(t, "%12s%n", nam, &l); @@ -559,13 +595,16 @@ int PrepInput(char *label) { /* interprete settings until '+' appeares (after whitespace) */ ERR_P(CocReadVars(t, '+')); - if (loop!=2) loop=1; if (strlen(chans)>4) ERR_MSG("no more than 4 channels allowed"); - j=0; - if (plug==&plug1) j=2; - + if (plug==&plug0) { + j=0; + str_copy(dev0, dev); + } else { + j=2; + str_copy(dev1, dev); + } if (chans[0]>'0' && chans[0]<='4') { nScan=chans[0]-'0'; for (i=4;i<4+nScan;i++) { @@ -573,7 +612,7 @@ int PrepInput(char *label) { s->present=-1; s->band=10; if (s->scale==0.0) s->scale=1.0; - s->type='1'+i-4; + s->typ='1'+i-4; } chans[0]='_'; for (i=4+nScan; ipresent=0; } } + if (tLimit==0.0) { + if (tMaxLimit==0.0) { + tLimit=310; + tMaxLimit=350; + } else { + tLimit=tMaxLimit; + } + } else if (tMaxLimit==0.0) { + tMaxLimit=tLimit; + } else if (tLimit>tMaxLimit) { + tLimit=tMaxLimit; + } for (i=j; ipresent=-1; } - s->type=typ; + s->typ=typ; s->band=10; if (s->scale==0.0) s->scale=1.0; - if (s->alarm==0.0 && typ=='m' || typ=='s') s->alarm=tLimit; + if (s->alarm==0.0 && typ=='m' || typ=='s') { + s->alarm=tLimit; + s->customAlarm=0; + } else { + s->customAlarm=1; + } } - if (!plug->manual) { /* set device name */ + if (!plug->devcmd) { /* set device name */ str_copy(plug->device, nam); ConcatDevice(); } @@ -642,6 +698,34 @@ int LoadCache(void) { return -1; } +float TrueScale(SensorT *s, float val) { + float tval; + if (s==NULL) { + return val; + } else { + if (val > s->kink) { + tval = (val - s->kink) * s->scale + s->kink; + } else { + tval = val; + } + return tval; + } +} + +float FakeScale(SensorT *s, float val) { + float fval; + if (s==NULL) { + return val; + } else { + if (val > s->kink) { + fval = (val - s->kink) / s->scale + s->kink; + } else { + fval = val; + } + return fval; + } +} + float WeightedAverage(float tH, float tL, Testpoint *t) { float p,q, tLow, tHigh; SensorT *s1, *s2; @@ -650,8 +734,8 @@ float WeightedAverage(float tH, float tL, Testpoint *t) { if (tL==DATA_UNDEF) tL=0.0; s1=t->sensor1; s2=t->sensor2; - tH = tH * s1->scale; - tL = tL * s2->scale; + tH = TrueScale(s1, tH); + tL = TrueScale(s2, tL); if (tH!=0.0) { if (tL!=0.0) { tLow=s1->lim; @@ -758,7 +842,7 @@ void LogMinMax(int new) { } } -float CtlScale(void) { +void SetCtlSens(void) { if (controlMode==1) { tShift=0; if (ctlSens==NULL) { @@ -790,15 +874,11 @@ float CtlScale(void) { ctlSens=cryo.sensor1; } } - if (ctlSens==NULL) { - return 1.0; - } else { - return ctlSens->scale; - } } + int ReadTemp(void) { - char buf[256], typ, *err; + char buf[256], typ, *err, dispfmt; int i, doit, stat; int tfill, dfill; static int iScan=0; @@ -835,10 +915,10 @@ int ReadTemp(void) { , "KRDG?#>sens#.t1;RDGST?#>sens#.stat1;DIOST?>,sens#.stat2" , "#", s->ch); } - if (s->type=='h' || s->type=='x') { + if (s->typ=='h' || s->typ=='x') { buf[0]='S'; /* change KRDG to SRDG */ typ='S'; - } else if (s->type=='f') { + } else if (s->typ=='f') { buf[0]='L'; /* change KRDG to LDAT */ buf[1]='D'; buf[2]='A'; @@ -853,10 +933,13 @@ int ReadTemp(void) { } str_append(buf, ";MNMXRST"); ERR_P(LscCmd(ser, buf)); - if (ramp!=0) { - tr=fbuf*CtlScale(); + SetCtlSens(); + if (manual) { + tr=DATA_UNDEF; + } else if (ramp!=0) { + tr=TrueScale(ctlSens, fbuf); } else { - tr=setH*CtlScale(); + tr=TrueScale(ctlSens, setH); } if (tr==0) tr=DATA_UNDEF; } @@ -891,7 +974,7 @@ int ReadTemp(void) { } if (stat==0) { - if (s->type=='h') { + if (s->typ=='h') { hlev = s->t1; /* take minimum only */ if (full>0) { if (hlev0) { @@ -920,6 +1003,18 @@ int ReadTemp(void) { if (s->max - s->min > s->band) { s->band = s->max - s->min; } + if (s->scale > 1.0 && s->kink != 0) { + if (s->t > s->kink) { + dispfmt='4'; + } else { + dispfmt='1'; + } + if (dispfmt != s->dispfmt) { /* change display format */ + s->dispfmt = dispfmt; + sprintf(buf, "DISPFLD %d,%s,%c", s->dispfld, s->ch, dispfmt); + ERR_P(LscCmd(ser, buf)); + } + } } else { s->t=DATA_UNDEF; } @@ -952,17 +1047,17 @@ int ReadTemp(void) { tx=ts; } if (auxSens != NULL) { - aux=auxSens->t * auxSens->scale; + aux=TrueScale(auxSens, auxSens->t); } else { aux=DATA_UNDEF; } if (testSens != NULL) { - te=testSens->t * testSens->scale; + te=TrueScale(testSens, testSens->t); } else { te=DATA_UNDEF; } if (test2Sens != NULL) { - tk=test2Sens->t * test2Sens->scale; + tk=TrueScale(test2Sens, test2Sens->t); } else { tk=DATA_UNDEF; } @@ -973,22 +1068,45 @@ int ReadTemp(void) { OnError: return -1; } -int ReadHeater(void) { +float Percent2Power(float percent) { + float curr; + curr=maxCurrent*percent/100; + return curr*curr*resist*powFact; +} + +float Power2Percent(float power) { + return sqrt(power/powFact/resist)/maxCurrent*100; +} + +int ReadHeater(int full) { if (loop==1) { - if (relay) { - ERR_P(LscCmd(ser, "HTRST?>htrst")); - htr=0; + if (full) { + if (relay) { + ERR_P(LscCmd(ser, "HTRST?>htrst")); + htr=0; + } else { + ERR_P(LscCmd(ser, "HTR?>htr;HTRST?>htrst;RELAYST?1>relay;RANGE?>ibuf")); + if (jRange!=0 && ibuf==0) { + if (swRangeOn) { + logfileOut(LOG_MAIN, "controller switched heater off - switch on again\n"); + ERR_P(LscCmd(ser, "RANGE:[jRange]")); + } else { + logfileOut(LOG_MAIN, "controller switched heater off\n"); + jRange=0; + } + } + } } else { - ERR_P(LscCmd(ser, "HTR?>htr;HTRST?>htrst;RELAYST?1>relay")); + ERR_P(LscCmd(ser, "HTR?>htr")); } } else { ERR_P(LscCmd(ser, "AOUT?2>htr")); htrst=0; } - if (set == 0) { + if (htr == 0 && set == 0 && manual == 0) { power=DATA_UNDEF; } else { - power=htr*htr*scalPower*1e-4; + power=Percent2Power(htr); if (power>maxPower) power=maxPower; } return 0; @@ -997,7 +1115,7 @@ int ReadHeater(void) { int SetTemp(int switchOn) { int showSet; - float scale; + float diff, tc; if (set<0 || set>tLimit) { set=0; @@ -1007,7 +1125,7 @@ int SetTemp(int switchOn) { ERR_I(ReadTemp()); LogMinMax(switchOn); } - scale=CtlScale(); + SetCtlSens(); if (ctlSens==NULL) return 0; str_copy(chan, ctlSens->ch); @@ -1016,8 +1134,22 @@ int SetTemp(int switchOn) { } else if (tShift<-maxShift) { tShift=-maxShift; } - setH=(set+tShift)/scale; - if (setH>tLimit/scale) setH=tLimit/scale; + if (controlMode==2) { + diff=set-samp.temp; + if (diff>maxOver) { /* do overshoot */ + diff=maxOver; + tShift=0; + tInt=0; + } else if (diff<-maxOver) { /* do undershoot */ + diff=-maxOver; + tShift=0; + tInt=0; + } + } else { + diff=0.0; + } + setH=FakeScale(ctlSens, set+tShift+diff); + if (setH > FakeScale(ctlSens, tLimit)) setH=FakeScale(ctlSens, tLimit); if (switchOn) { /* switch off other loop */ if (loop==1) { @@ -1026,28 +1158,35 @@ int SetTemp(int switchOn) { ERR_P(LscCmd(ser, "CSET 1:[chan],1,0,0")); } if (ramp > 0 && set != 0) { - /* take ramp from actual temperature if more than 1 % deviation */ + /* take ramp from actual temperature if more than 10 % deviation */ ERR_P(LscCmd(ser, "CSET?[loop]>,,cod1;SETP?[loop]>fbuf")); - tr=fbuf*scale; - if (cod1 == 0 || fabsf(ctlSens->t - tr) >= 0.1 * ctlSens->t) { + if (loop == 1 && cod1 != 0) { + ERR_P(LscCmd(ser, "RANGE?>cod1")); + } /* cod1 == 0 --> heater is off */ + tr=TrueScale(ctlSens, fbuf); + tc=TrueScale(ctlSens, ctlSens->t); + if (cod1 == 0 || fabsf(tc - tr) >= 0.1 * tc) { fbuf = ctlSens->t; - tr = fbuf * scale; + tr = TrueScale(ctlSens, fbuf); ERR_P(LscCmd(ser, "SETP [loop],[fbuf];RAMP [loop],0,0;SETP [loop],[fbuf]")); } } } if (set==0) { - ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,0")); + mout=0; + ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,[keepT];MOUT [loop],0")); if (loop==1) { ERR_P(LscCmd(ser, "RANGE:0")); + jRange=0; } else { ERR_P(LscCmd(ser, "ANALOG 2:0,0")); } setH=0; } else if (switchOn) { /* switch on also when bad heater message and no alarms: || (htrst>=5 && !relay)) */ - ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,0")); + ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,[keepT]")); if (loop==1) { ERR_P(LscCmd(ser, "RANGE:[iRange]")); + jRange=iRange; } else { ERR_P(LscCmd(ser, "ANALOG 2:0,3")); } @@ -1073,7 +1212,7 @@ int SetTemp(int switchOn) { } else { setH=fbuf; } - tr=setH*scale; + tr=TrueScale(ctlSens, setH); if (showSet) { logfileOut(LOG_MAIN, "set %g (on %s)\n", set, ctlSens->ch); } @@ -1093,7 +1232,7 @@ int SetTemp(int switchOn) { ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]")); ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); } - tr=fbuf*scale; + 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); } @@ -1101,7 +1240,7 @@ int SetTemp(int switchOn) { if (tr==0) tr=DATA_UNDEF; if (showSet) { /* relay=0; */ - ERR_I(ReadHeater()); + ERR_I(ReadHeater(1)); } return 0; OnError: return -1; @@ -1109,12 +1248,15 @@ int SetTemp(int switchOn) { void CalcMaxPower(void) { int i, j, vmax; - float pa, pr, pw, quo, p, pl, plim; - + float pa, pr, pw, quo, p, pl, plim, h; + iAmp=1; iRange=0; -/* if (scalPower==0) */ scalPower=maxPower; + maxCurrent=0; if (maxPower>0) { - p=scalPower/powFact; + if (resist<1) resist=10; + maxCurrent=1; + h=Power2Percent(maxPower)/100; + p=h*h*resist; /* power before amplifier */ plim=2500/resist; /* power limited by 50 V output. U*U/R=2500/R */ if (p>plim) p=plim; @@ -1136,13 +1278,12 @@ void CalcMaxPower(void) { } pa=pa/4; } - scalPower=pw*powFact; - assert(scalPower>0); - if (scalPower0); } else { iRange=0; } @@ -1172,18 +1313,22 @@ int PidSumHdl(int mode, void *base, int fd) { ERR_I(StrPut(&buf, " ", StrNONE)); ERR_I(PutFloat(&buf, 4, deriv)); ERR_I(StrPut(&buf, " /", ' ')); - ERR_I(PutFloat(&buf, 4, prop*sqrt(scalPower/resist)/600)); + ERR_I(PutFloat(&buf, 4, prop*maxCurrent*resist/600)); ERR_I(StrPut(&buf, " A/K,", ' ')); - ERR_I(PutFloat(&buf, 4, 1000.0/integ)); - ERR_I(StrPut(&buf, " sec,", ' ')); - ERR_I(PutFloat(&buf, 4, deriv)); - ERR_I(StrPut(&buf, " sec/scalPower", ' ')); - if (scalPower>0.5) { - ERR_I(PutFloat(&buf, 4, scalPower)); - ERR_I(StrPut(&buf, " W", StrNONE)); + if (integ == 0.0) { + ERR_I(StrPut(&buf, " inf,", ' ')); } else { - ERR_I(PutFloat(&buf, 4, scalPower*1000)); - ERR_I(StrPut(&buf, " mW", StrNONE)); + ERR_I(PutFloat(&buf, 4, 1000.0/integ)); + ERR_I(StrPut(&buf, " sec,", ' ')); + } + ERR_I(PutFloat(&buf, 4, deriv)); + ERR_I(StrPut(&buf, " sec/maxCurrent", ' ')); + if (maxCurrent>0.5) { + ERR_I(PutFloat(&buf, 4, maxCurrent)); + ERR_I(StrPut(&buf, " A", StrNONE)); + } else { + ERR_I(PutFloat(&buf, 4, maxCurrent*1000)); + ERR_I(StrPut(&buf, " mA", StrNONE)); } return 0; OnError: @@ -1191,32 +1336,65 @@ int PidSumHdl(int mode, void *base, int fd) { } int SetMaxPower(void) { - static float p0, pold; + /* static float p0; */ + static float lastCurrent, limCurrent, pold; float plim; if (loop == 1) { - ERR_P(LscCmd(ser, "CLIMIT?1>,,,iAmp,iRange")); + if (initMaxPower) { + ERR_P(LscCmd(ser, "CLIMIT?1>,,,iAmp,iRange")); + pold=0; + } else { + iRange=0; + } if (iRange>0) { + lastCurrent=pow(2.0,iAmp-3)*pow(sqrt(10.0),iRange-5); + /* p0=resist*pow(4.0,iAmp)*pow(10.0,iRange)/6.4e6*powFact; - plim=2500/resist; + plim=2500/resist*powFact; pold=p0; if (pold>plim) pold=plim; + */ + if (resist<1) resist=10; + limCurrent=50/resist; /* 50 V max. */ + if (limCurrent > lastCurrent) limCurrent=lastCurrent; + pold=limCurrent*limCurrent*resist; } CalcMaxPower(); + } else { + maxCurrent=10/resist; /* 10 V max. */ + if (maxCurrent>0.1) { + limCurrent=0.1; /* 0.1 A max. */ + } else { + limCurrent=maxCurrent; + } + maxPower=limCurrent*limCurrent*resist; } logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", pold, maxPower); - ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:1")); + if (manual) { + cod1=3; + } else { + cod1=1; + } + ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:[cod1]")); mout=0; + jRange=0; if (slope<0) slope=-slope; if (slope!=0 && slope<0.1) slope=0.1; - fbuf=tLimit/CtlScale(); + SetCtlSens(); + fbuf=FakeScale(ctlSens, tLimit); if (loop==1) { - if (scalPower!=0) prop=sqrt(p0/scalPower)*prop; + PidSumHdl(COC_RD, NULL, 0); + if (!initMaxPower && lastCurrent != maxCurrent) { + logfileOut(LOG_MAIN, "pid: %s\nlast %f max %f\n", pid, lastCurrent, maxCurrent); + prop=prop*lastCurrent/maxCurrent; + } ERR_P(LscCmd(ser, "CLIMIT 1:[fbuf],[slope],0,[iAmp],[iRange];PID [loop],[prop]")); } else { ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0")); } - p0=scalPower; + initMaxPower=0; + lastCurrent=maxCurrent; pold=maxPower; PidSumHdl(COC_RD, NULL, 0); logfileOut(LOG_MAIN, "pid: %s\n", pid); @@ -1224,22 +1402,7 @@ int SetMaxPower(void) { OnError: return -1; } -char DisplayFmt(SensorT *s) { - if (s==NULL || s->present<=0 || s->type=='h') return '\0'; - if (s->type=='x') { - return '3'; - } else if (s->type=='f') { - return '4'; - } else { - if (s->scale==1.0) { - return '1'; - } else { - return '4'; - } - } -} - -int ConfigAlarms(void) { +int ConfigAlarms(float genLimit) { int i, k; SensorT *s; @@ -1249,8 +1412,9 @@ int ConfigAlarms(void) { for (i=0;i<4+nScan;i++) { s=sensors[i]; str_copy(buf1, s->ch); + if (s->customAlarm==0 && genLimit>0.0) s->alarm=genLimit; if (s->present==1 && s->alarm>0) { - r1=s->alarm/s->scale; + r1=FakeScale(s, s->alarm); ERR_P(LscCmd(ser, "ALARM [buf1]:1,1,[r1],0,1,1")); alarmList[k]=s->ch; k++; @@ -1272,12 +1436,90 @@ int LoadFromLsc(void) { OnError: return -1; } +int DisplayFmt(SensorT *s, SensorT *fields[], int *dispfld) { + if (s==NULL || s->present<=0 || s->typ=='h' || *dispfld>4) return 0; + if (s->typ == 'x') { + s->dispfmt='3'; + } else if (s->typ == 'f') { + s->dispfmt='4'; + } else { + if (s->scale == 1.0 || s->kink > 0.0) { + s->dispfmt='1'; + } else { + s->dispfmt='4'; + } + } + s->dispfld=*dispfld; + fields[*dispfld]=s; + *dispfld=*dispfld+1; + /* logfileOut(LOG_MAIN, "display %d %c\n", *dispfld, s->dispfmt); */ + return 1; +} + +void AssignTypes(void) { + int i; + char typ; + SensorT *s; + + cryo.sensor1=NULL; + cryo.sensor2=NULL; + samp.sensor1=NULL; + samp.sensor2=NULL; + heliumSens=NULL; + auxSens=NULL; + testSens=NULL; + test2Sens=NULL; + for (i=0; i<4+nScan; i++) { + s=sensors[i]; + if (s->present==1) { + typ=s->typ; + if ('m'==typ) { + if (cryo.sensor2==NULL) cryo.sensor2=s; + cryo.sensor1=s; + } else if ('n'==typ) { + if (cryo.sensor1==NULL) cryo.sensor1=s; + cryo.sensor2=s; + } else if ('s'==typ) { + if (samp.sensor2==NULL) samp.sensor2=s; + samp.sensor1=s; + } else if ('l'==typ) { + if (samp.sensor1==NULL) samp.sensor1=s; + samp.sensor2=s; + } else if ('h'==typ) { + heliumSens=s; + } else if ('x'==typ || 'f'==typ) { + auxSens=s; + } else if ('t'==typ) { + testSens=s; + } else if ('k'==typ) { + test2Sens=s; + } + s->band=10; + } + } + if (cryo.sensor1==NULL) { + if (samp.sensor1==NULL) { + if (testSens==NULL) { + cryo.sensor1=test2Sens; + } else { + cryo.sensor1=testSens; + } + } else { + cryo.sensor1=samp.sensor1; + cryo.sensor2=samp.sensor2; + } + } else if (samp.sensor1==NULL) { + samp.sensor1=cryo.sensor1; + samp.sensor2=cryo.sensor2; + } +} + int Settings(void) { - char buf[256], typ; - char *flds[6], fmt[6]; + char buf[256]; + SensorT *s; + SensorT *fields[8]; char *cfg, *p; int i,k,l; - SensorT *s; if (remoteMode!=2) { remoteMode=2; /* set to remote mode */ @@ -1310,49 +1552,7 @@ int Settings(void) { ERR_P(LscCmd(ser, "INSET A13,0;INSET A14,0;INSET A15,0;INSET A16,0")); } - cryo.sensor1=NULL; - cryo.sensor2=NULL; - samp.sensor1=NULL; - samp.sensor2=NULL; - heliumSens=NULL; - auxSens=NULL; - testSens=NULL; - test2Sens=NULL; - for (i=0; i<4+nScan; i++) { - s=sensors[i]; - if (s->present==1) { - typ=s->type; - if ('m'==typ) { - if (cryo.sensor2==NULL) cryo.sensor2=s; - cryo.sensor1=s; - } else if ('n'==typ) { - if (cryo.sensor1==NULL) cryo.sensor1=s; - cryo.sensor2=s; - } else if ('s'==typ) { - if (samp.sensor2==NULL) samp.sensor2=s; - samp.sensor1=s; - } else if ('l'==typ) { - if (samp.sensor1==NULL) samp.sensor1=s; - samp.sensor2=s; - } else if ('h'==typ) { - heliumSens=s; - } else if ('x'==typ || 'f'==typ) { - auxSens=s; - } else if ('t'==typ) { - testSens=s; - } else if ('k'==typ) { - test2Sens=s; - } - s->band=10; - } - } - if (cryo.sensor1==NULL) { - cryo.sensor1=samp.sensor1; - cryo.sensor2=samp.sensor2; - } else if (samp.sensor1==NULL) { - samp.sensor1=cryo.sensor1; - samp.sensor2=cryo.sensor2; - } + AssignTypes(); if (settingsFlag) return 0; @@ -1364,7 +1564,7 @@ int Settings(void) { if (settingsFlag) return 0; str_copy(statusBuf, "alarms"); - ERR_I(ConfigAlarms()); + ERR_I(ConfigAlarms(0.0)); if (settingsFlag) return 0; @@ -1373,55 +1573,23 @@ int Settings(void) { /* display */ k=1; - fmt[k]=DisplayFmt(cryo.sensor1); - if (fmt[k]!='\0') { - flds[k]=cryo.sensor1->ch; - k++; - } + DisplayFmt(cryo.sensor1, fields, &k); if (samp.sensor1 != cryo.sensor1) { - fmt[k]=DisplayFmt(samp.sensor1); - if (fmt[k]!='\0') { - flds[k]=samp.sensor1->ch; - k++; - } + DisplayFmt(samp.sensor1, fields, &k); } if (cryo.sensor2 != cryo.sensor1) { - fmt[k]=DisplayFmt(cryo.sensor2); - if (fmt[k]!='\0') { - flds[k]=cryo.sensor2->ch; - k++; - } + DisplayFmt(cryo.sensor2, fields, &k); } if (samp.sensor2 != samp.sensor1 && samp.sensor2 != cryo.sensor2) { - fmt[k]=DisplayFmt(samp.sensor2); - if (fmt[k]!='\0') { - flds[k]=samp.sensor2->ch; - k++; - } - } - fmt[k]=DisplayFmt(testSens); - if (fmt[k]!='\0' && k<=4) { - flds[k]=testSens->ch; - k++; - } - fmt[k]=DisplayFmt(test2Sens); - if (fmt[k]!='\0' && k<=4) { - flds[k]=test2Sens->ch; - k++; - } - fmt[k]=DisplayFmt(auxSens); - if (fmt[k]!='\0' && k<=4) { - flds[k]=auxSens->ch; - k++; + DisplayFmt(samp.sensor2, fields, &k); } + DisplayFmt(testSens, fields, &k); + DisplayFmt(test2Sens, fields, &k); + DisplayFmt(auxSens, fields, &k); if (nScan>0) { i=0; - while (k<=4 && ich; - k++; i++; - } + while (ich, fields[k]->dispfmt); l=strlen(buf); } str_append(buf, "DISPLAY:[maxfld]"); @@ -1474,7 +1642,7 @@ int ConfigByCode(int plugNr) { plug=plugs[plugNr]; str_copy(plug->device,""); - plug->manual=0; + plug->devcmd=0; ConcatDevice(); if (plug->code==0) { logfileOut(LOG_MAIN ,"reset inputs on plug%d\n", plugNr); @@ -1494,7 +1662,7 @@ int ConfigByName(int plugNr) { char buf[20]; plug=plugs[plugNr]; - plug->manual=1; + plug->devcmd=1; logfileOut(LOG_MAIN+LOG_STAT ,"configure plug%d for %s\n", plugNr, plug->device); plug->sensor1->present=0; plug->sensor2->present=0; @@ -1511,10 +1679,11 @@ int ConfigByName(int plugNr) { } int PeriodicTask(void) { + static int lastIntTim; char buf[256], lbuf[16]; char *next, *alms; - int i, k, iret; - float t3[3], p, d, w, t; + int i, k, iret, cnt; + float t3[3], p, d, w, t, dif, htr0, mstep; if (nScan==0) { ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy")); @@ -1528,14 +1697,27 @@ int PeriodicTask(void) { } if (noResp) { /* there was no response on an earlier command, or we are initializing */ k=serialNo; /* check serial number */ - ERR_P(LscCmd(ser, "*IDN?>buf1,buf2,buf3,")); - serialNo=1; - sscanf(buf3, "%d", &serialNo); /* illegal serial No. will be 1 for buggy controller */ + ERR_P(LscCmd(ser, "*IDN?>buf1,buf2,buf3,buf4")); + + /* decode firmware version date */ + i=0; + sscanf(buf4, "%d", &i); + i=i/100+(i%100+2000)*10000; + if (i>20900000) i-=1000000; /* 90..99 --> 1990-1999 */ + lscVersion=i; + + sscanf(buf3, "%d", &serialNo); if (0!=strcmp(buf1, "LSCI") || 0!=strcmp(buf2, "MODEL340")) return 0; if (k!=serialNo) { /* controller exchanged or we are initializing */ - if (k!=0) { - logfileOut(LOG_MAIN, "controller connected\n"); + logfileOut(LOG_MAIN, "serialNo: %d (was %d)\n", serialNo, k); + if (serialNo < 340000 || serialNo > 349999) { + serialNo=k; + } else if (k < 340000 || k > 349999) { + k=serialNo; } + } + if (k!=serialNo) { /* controller exchanged or we are initializing */ + logfileOut(LOG_MAIN, "controller connected\n"); set=0; /* reload curve cache: */ @@ -1571,7 +1753,7 @@ int PeriodicTask(void) { ConfigByName(0); } else { if (plug0.code!=0) str_copy(plug0.device, buf1); - plug0.manual=0; + plug0.devcmd=0; } if (buf2[0]=='*') { str_copy(plug1.device, buf2+1); @@ -1579,7 +1761,7 @@ int PeriodicTask(void) { ConfigByName(1); } else { if (plug1.code!=0) str_copy(plug1.device, buf2); - plug1.manual=0; + plug1.devcmd=0; } ConcatDevice(); @@ -1588,7 +1770,7 @@ int PeriodicTask(void) { noResp=0; } - ERR_I(ReadHeater()); + ERR_I(ReadHeater(1)); if (relay || loop !=1) { if (alarmListSize!=0) { @@ -1625,6 +1807,7 @@ int PeriodicTask(void) { if (!relay0 && set!=0) { lockAlarm=1; logfileOut(LOG_MAIN, "Switch off heater\n"); + jRange=0; if (loop==1) { /* turn on high relay manually, switch off heater and reset alarms */ ERR_P(LscCmd(ser, "RELAY 1:2,1;RANGE:0;ALMRST")); } else { @@ -1666,8 +1849,68 @@ int PeriodicTask(void) { if (rdTim>mmTime && (cryo.sensor1 != NULL || nScan>0)) LogMinMax(0); } if (set!=0 && remoteMode==2) { + t=ctlSens->t; + if (htr == 0.0 && mout < 0) { + mstep=0.2; + while (htr == 0 && mout < 0) { + mstep *= 2; + mout += mstep; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + ERR_I(ReadHeater(0)); + } + cnt=10; + while (htr >= 0.2 && cnt > 0) { + mout -= htr - 0.1; + htr0=htr; + if (mout > 0) mout=0; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + while (htr == htr0 && cnt > 0) { + ERR_I(ReadHeater(0)); + cnt--; + } + } + logfileOut(LOG_MAIN, "adjusted mout=%.2f\n", mout); + } + if (htr == 100.0 && mout > 0) { + mstep = 0.2; + while (htr == 0 && mout > 0) { + mstep *= 2; + mout -= mstep; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + ERR_I(ReadHeater(0)); + } + cnt=10; + while (htr <= 99.8 && cnt > 0) { + mout += 99.9 - htr; + htr0=htr; + if (mout < 0) mout=0; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + while (htr == htr0 && cnt > 0) { + ERR_I(ReadHeater(0)); + cnt--; + } + } + logfileOut(LOG_MAIN, "adjusted mout=%.2f\n", mout); + } + fbuf=htr-mout-prop/6*(setH-t); /* value of integrator (assume deriv=0) */ + if (fbuf > 99.8 && mout < 0 || + fbuf < 0.2 && mout > 0) { /* probably integrator overflow */ + if (lastIntTim > 0) { + mout += (setH-t)*prop*integ/3000*(rdTim-lastIntTim); /* use mout for integral */ + if (mout < -100) mout=-100; + if (mout > 100) mout=100; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + } else { + logfileOut(LOG_MAIN, "possible integrator overflow, mout=%.2f\n", mout); + } + lastIntTim=rdTim; + } else { + if (lastIntTim>0) { + logfileOut(LOG_MAIN, "end integrator overflow mout=%.2f\n", mout); + lastIntTim=0; + } + } if (cryo.sensor1!=samp.sensor1 && controlMode==2) { - t=ctlSens->t; d=(setH-t)/t; /* relative difference */ w=exp(-d*d*230); /* gaussian */ /* if (w<0.1) tInt=0; reset when far from setpoint (more than 10 %) */ @@ -1678,6 +1921,7 @@ int PeriodicTask(void) { } else { p=1.0; } + dif=cryo.temp-samp.temp; tShift=tShift*(1.0-p)+p*(cryo.temp-samp.temp); ERR_I(SetTemp(0)); } else { @@ -1748,13 +1992,19 @@ int PeriodicTask(void) { if (iRange==0) set=0; } else { ERR_P(LscCmd(ser, "RAMP?[loop]>,ramp")); - ERR_P(LscCmd(ser, "RANGE?>iRange;CSET?[loop]>,cod1,;SETP?[loop]>set")); + ERR_P(LscCmd(ser, "RANGE?>iRange;CSET?[loop]>,cod1,;SETP?[loop]>fbuf")); + if (ctlSens!=NULL) { + set=TrueScale(ctlSens,fbuf); + } else { + set=0; + } if (cod1!=1) { set=0; logfileOut(LOG_MAIN, "set point was not in K, set to 0\n"); } } settingsFlag=1; + jRange=iRange; } } @@ -1811,6 +2061,118 @@ int DeviceHdl(int mode, void *base, int fd) { OnError: return -1; } +int PidHdl(int mode, void *base, int fd) { + if (mode==COC_WR) { + return COC_DWR; + } else if (mode==COC_DWR) { + ERR_P(LscCmd(ser,"PID [loop]:[prop],[integ],[deriv]")); + PidSumHdl(COC_RD, base, fd); + logfileOut(LOG_MAIN, "pid: %s\n", pid); + } + return 0; + OnError: return -1; +} + +int AlarmHdl(int mode, void *base, int fd) { + if (mode==COC_WR) { + return COC_DWR; + } else if (mode==COC_DWR) { + ERR_I(ConfigAlarms(0.0)); + } + return 0; + OnError: return -1; +} + +int TLimitHdl(int mode, void *base, int fd) { + if (mode==COC_WR) { + if (tLimit>tMaxLimit) tLimit=tMaxLimit; + return COC_DWR; + } else if (mode==COC_DWR) { + ERR_I(ConfigAlarms(tLimit)); + } + return 0; + OnError: return -1; +} + +int SwapHdl(int mode, void *base, int fd) { + int i,j; + static int idx[2]; + if (mode==COC_WR) { + if (strlen(swap) != 2) ERR_MSG("must be 2 letters"); + str_lowcase(swap, swap); + for (j=0; j<2; j++) { + idx[j]=-1; + for (i=0; i<4; i++) { + if (swap[j] == tolower(sensors[i]->ch[0])) { + swap[j]=sensors[i]->typ; + } + if (sensors[i]->typ == swap[j]) idx[j]=i; + } + if (strchr("msnltk", swap[j]) == 0) ERR_MSG("only letters m,s,n,l,e,k are allowed"); + } + if (idx[0]==idx[1]) { + if (idx[0]<0) ERR_MSG("no such sensors"); + return 0; + } + return COC_DWR; + } else if (mode==COC_DWR) { + for (j=0; j<2; j++) { + if (idx[j]>=0) { + sensors[idx[j]]->typ=swap[1-j]; + } + } + AssignTypes(); + } + return 0; + OnError: return -1; +} + +int SetPower(float setpower) { + float htr1, htr0, diff, dist; + int cnt; + + logfileOut(LOG_MAIN,"SetPower\n"); + if (setpower<0) return 0; + if (setpower>maxPower) setpower=maxPower; + if (setpower<0) setpower=0; + mout=Power2Percent(setpower); + if (mout>100) mout=100; + if (!manual && set == 0 && setpower > 0) { + ERR_P(LscCmd(ser, "RANGE:[iRange]")); + manual=1; + } + ERR_P(LscCmd(ser, "CMODE [loop]:3;MOUT [loop],[mout]")); /* set to open loop */ + if (manual) return 0; + ERR_I(ReadHeater(0)); + ERR_P(LscCmd(ser, "RANGE:0")); + htr0=htr; + ERR_P(LscCmd(ser, "CMODE [loop]:1")); /* pid control*/ + ERR_P(LscCmd(ser, "RANGE:[iRange]")); + ERR_I(ReadHeater(0)); + cnt=20; + htr1=htr; + while (htr1==htr && cnt>0) { /* wait for heater change */ + ERR_I(ReadHeater(0)); + cnt--; + } + if (htr != htr0) { + mout=0; + cnt=10; + while (cnt>0) { + mout+=htr0-htr; + if (mout > 100) mout=100; + if (mout < -100) mout =-100; + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + ERR_I(ReadHeater(0)); + cnt--; + } + } + power=Percent2Power(htr); + logfileOut(LOG_MAIN, "power: %5f (tried %5f), mout %.1f\n", power, setpower, mout); + return 0; + OnError: return -1; +} + int SetHdl(int mode, void *base, int fd) { if (mode==COC_WR) { if (remoteMode!=2) { @@ -1829,6 +2191,11 @@ int SetHdl(int mode, void *base, int fd) { } return COC_DWR; } else if (mode==COC_DWR) { + if (manual) { + manual=0; + mout=0; + ERR_P(LscCmd(ser, "CMODE [loop],1;MOUT [loop],0")); + } if (cryo.sensor1!=NULL && remoteMode==2) { tInt=0; /* reset integral time */ ERR_I(SetTemp(1)); @@ -1838,92 +2205,11 @@ int SetHdl(int mode, void *base, int fd) { OnError: return -1; } -int PidHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_P(LscCmd(ser,"PID [loop]:[prop],[integ],[deriv]")); - PidSumHdl(COC_RD, base, fd); - logfileOut(LOG_MAIN, "pid: %s\n", pid); - } - return 0; - OnError: return -1; -} - -int AlarmHdl(int mode, void *base, int fd) { - if (mode==COC_WR) { - return COC_DWR; - } else if (mode==COC_DWR) { - ERR_I(ConfigAlarms()); - } - return 0; - OnError: return -1; -} - -int SetPower(float setpower) { - float htr1, htr0, diff, dist; - int cnt; - - if (setpower<0) return 0; - if (setpower>maxPower) setpower=maxPower; - if (setpower<0) setpower=0; - htr1=sqrt(setpower/scalPower*1e4); - ERR_P(LscCmd(ser, "HTR?>htr")); - diff=htr1-htr; - if (abs(diff) <0.11) return 0; - if (htr==0) { - if (diff<10) diff=10; - if (diff>50) diff=50; - diff+=diff*0.5+10; - while (htr==0) { - mout+=diff; - ERR_P(LscCmd(ser, "MOUT 1,[mout]")); - ERR_P(LscCmd(ser, "HTR?>htr")); - } - } - if (htr==100) { - if (diff>-10) diff=-10; - if (diff<-50) diff=-50; - while (htr==100) { - mout+=diff; - ERR_P(LscCmd(ser, "MOUT 1,[mout]")); - ERR_P(LscCmd(ser, "HTR?>htr")); - } - } - diff=htr1-htr; - if (abs(diff) >0.11) { - cnt=20; - if (mout+diff >= 100) { - if (mout>99.89) cnt=0; - mout=100; - } else if (mout+diff <= -100) { - if (mout<-99.89) cnt=0; - mout=-100; cnt=0; - } else { - mout+=diff; - } - ERR_P(LscCmd(ser, "MOUT 1,[mout]")); - htr0=htr; - while (htr0 == htr && cnt>0) { - ERR_P(LscCmd(ser, "HTR?>htr")); - cnt--; - } - } - if (abs(htr1-htr) > 0.11) { - power=htr*htr*scalPower*1e-4; - logfileOut(LOG_MAIN, "power: %f (tried %f)\n", power, setpower); - } else { - logfileOut(LOG_MAIN, "power: %f\n", setpower); - } - return 0; - OnError: return -1; -} - int MaxPowerHdl(int mode, void *base, int fd) { static float setpower; if (mode==COC_WR) { + if (loop!=1) return COC_DWR; setpower=power; - scalPower=maxPower; CalcMaxPower(); if (remoteMode!=2) { ERR_MSG("controller is in local mode, enter 'remote' first"); @@ -1937,7 +2223,9 @@ int MaxPowerHdl(int mode, void *base, int fd) { return COC_DWR; } else if (mode==COC_DWR && remoteMode==2) { ERR_I(SetMaxPower()); - ERR_I(SetPower(setpower)); + if (maxCurrent>0 && loop==1) { + ERR_I(SetPower(setpower)); + } } return 0; OnError: return -1; @@ -1948,25 +2236,47 @@ int PowerHdl(int mode, void *base, int fd) { float htr1, diff; if (mode==COC_WR) { if (power>maxPower) power=maxPower; - htr1=sqrt(power/scalPower*1e4); + htr1=Power2Percent(power); diff=htr1-htr; if (mout+diff>100) { diff=100-mout; - power=(htr+diff)*(htr+diff)*scalPower/1e4; + htr+=diff; + power=Percent2Power(htr); } else if (mout+diff<-100) { diff=-100-mout; - power=(htr+diff)*(htr+diff)*scalPower/1e4; + htr+=diff; + power=Percent2Power(htr); } if (power<0) power=0; setpower=power; return COC_DWR; - } else if (mode==COC_DWR && scalPower>0) { + } else if (mode==COC_DWR && maxCurrent>0) { ERR_I(SetPower(setpower)); } return 0; OnError: return -1; } +int ManualHdl(int mode, void *base, int fd) { + if (mode == COC_DWR && maxCurrent>0) { + if (manual == 0 && ctlSens != NULL) { + set=TrueScale(ctlSens, ctlSens->t); + } + } + return PowerHdl(mode, base, fd); +} + +int MoutHdl(int mode, void *base, int fd) { + if (mode==COC_WR) { + return COC_DWR; + } else if (mode==COC_DWR) { + ERR_P(LscCmd(ser, "MOUT [loop],[mout]")); + } + return 0; + OnError: return -1; +} + + int StillHdl(int mode, void *base, int fd) { if (mode==COC_WR) { return COC_DWR; @@ -2020,7 +2330,7 @@ int PltHdl(int mode, void *base, int fd) { int GraHdl(int mode, void *base, int fd) { ClientData *data; - int l; + int l, i; char names[64]; long startTime, endTime, step; @@ -2046,14 +2356,14 @@ int ShowSensor(StrBuf *buf, SensorT *s, char *name, char *units, char lim) { ERR_I(StrPut(buf, "not yet read", StrNONE)); } else { ERR_I(StrPut(buf, name, '=')); - ERR_I(PutFloat(buf, 5, s->t * s->scale)); + ERR_I(PutFloat(buf, 5, TrueScale(s, s->t))); ERR_I(StrPut(buf, " ", StrNONE)); ERR_I(StrPut(buf, units, StrNONE)); } } else { ERR_I(StrPut(buf, LscReadStat(s->readStat), StrNONE)); } - if (s==ctlSens) { + if (s==ctlSens && !manual) { ERR_I(StrPut(buf, ", setpoint", '=')); if (tr==DATA_UNDEF) { ERR_I(PutFloat(buf, 5, 0.0)); @@ -2077,6 +2387,7 @@ int StatusHdl(int mode, void *base, int fd) { float tM, tS; SensorT *s; char pendAct[256]; + char *p; readTemp=1; StrLink(&buf, status); @@ -2109,18 +2420,41 @@ int StatusHdl(int mode, void *base, int fd) { ERR_I(StrPut(&buf, "LOCAL mode, enter 'remote' to enable remote control", '\n')); } ERR_I(StrPut(&buf, "device:", ' ')); - ERR_I(StrPut(&buf, device, StrNONE)); + p=strchr(device, '/'); + if (p!=NULL) { + *p='\0'; + ERR_I(StrPut(&buf, device, ' ')); + *p='/'; p++; + } else { + ERR_I(StrPut(&buf, device, ' ')); + } + ERR_I(StrPut(&buf, dev0, StrNONE)); + if (plug0.devcmd) { + ERR_I(StrPut(&buf, " ", '*')); + } + if (p!=NULL) { + ERR_I(StrPut(&buf, "\n ", ' ')); + ERR_I(StrPut(&buf, p, ' ')); + ERR_I(StrPut(&buf, dev1, StrNONE)); + if (plug1.devcmd) { + ERR_I(StrPut(&buf, " ", '*')); + } + } if (set==0) { ERR_I(StrPut(&buf, "\nheater off,",' ')); } else { - ERR_I(StrPut(&buf, "\ntarget", '=')); - ERR_I(PutFloat(&buf, 5, set)); - if (ramp==0 || tr==setH) { - ERR_I(StrPut(&buf, " K,", ' ')); + if (manual) { + ERR_I(StrPut(&buf, "\nmanual power,", ' ')); } else { - ERR_I(StrPut(&buf, " K ramping at", ' ')); - ERR_I(PutFloat(&buf, 4, ramp)); - ERR_I(StrPut(&buf, " K/min,", ' ')); + ERR_I(StrPut(&buf, "\ntarget", '=')); + ERR_I(PutFloat(&buf, 5, set)); + if (ramp==0 || tr==setH) { + ERR_I(StrPut(&buf, " K,", ' ')); + } else { + ERR_I(StrPut(&buf, " K ramping at", ' ')); + ERR_I(PutFloat(&buf, 4, ramp)); + ERR_I(StrPut(&buf, " K/min,", ' ')); + } } } if (relay) { @@ -2175,7 +2509,7 @@ int StatusHdl(int mode, void *base, int fd) { } ERR_I(ShowSensor(&buf, samp.sensor2, "T", "K", '<')); } - if (testSens!=NULL || nScan>0) { + if (testSens!=NULL || test2Sens!=NULL || nScan>0) { ERR_I(StrPut(&buf, "\ntest", ':')); } if (testSens!=NULL) { @@ -2222,11 +2556,11 @@ int DevHelpHdl(int mode, void *base, int fd) { while (t!=NULL) { t++; n=strchr(t, '\''); - d=strchr(t, '"'); + d=strstr(t, "dev=\""); t=strchr(t, '\n'); if (n!=NULL && d!=NULL && n < d && d < t) { en=strchr(n+1, '\''); - ed=strchr(d+1, '"'); + ed=strchr(d+5, '"'); if (en != NULL && en12) l=12; @@ -2234,7 +2568,7 @@ int DevHelpHdl(int mode, void *base, int fd) { str_npad(line, line, 12); l=ed-d; if (l>77) l=77; - str_ncpy(line+12, d+1, l); + str_ncpy(line+12, d+5, l); str_append(line, "\n"); str_append(devHelp, line); } @@ -2352,6 +2686,7 @@ int MainBody(void) { /* remoteMode=1; */ noResp=3; } else if (noResp < 2) { + logfileShowErr("no response"); logfileOut(LOG_ALL ,"no response\n"); noResp=2; per=100; /* try again soon */ @@ -2374,8 +2709,8 @@ int main(int argc, char *argv[]) { CocDefStruct(cryo, Testpoint); CocDefStruct(samp, Testpoint); + CocDefPtr(tpoint, Testpoint); - CocFltFld(Testpoint, temp, RD); CocFltFld(Testpoint, t1, RD); CocFltFld(Testpoint, t2, RD); @@ -2388,19 +2723,21 @@ int main(int argc, char *argv[]) { CocDefStruct(sensA2, SensorT); CocDefStruct(sensA3, SensorT); CocDefStruct(sensA4, SensorT); + CocDefPtr(sens, SensorT); - CocFltFld(SensorT, t, RD); CocFltFld(SensorT, t0, RD); CocFltFld(SensorT, t1, RD); CocFltFld(SensorT, t2, RD); CocFltFld(SensorT, lim, RW); CocFltFld(SensorT, scale, RD); + CocFltFld(SensorT, kink, RD); CocFltFld(SensorT, alarm, RW); CocHdl(AlarmHdl); CocIntFld(SensorT, readStat, RD); CocIntFld(SensorT, stat1, RD); CocIntFld(SensorT, stat2, RD); CocStrFld(SensorT, ch, RD); + CocStrFld(SensorT, curve, RD); CocDefFlt(maxPower, RW); CocHdl(MaxPowerHdl); CocDefFlt(slope, RW); CocHdl(MaxPowerHdl); @@ -2411,16 +2748,18 @@ int main(int argc, char *argv[]) { CocDefFlt(ramp, RW); CocHdl(SetHdl); CocDefFlt(still, RW); CocHdl(StillHdl); CocDefFlt(power, RW); CocHdl(PowerHdl); - CocDefFlt(mout, RD); - CocDefFlt(scalPower, RD); + CocDefFlt(mout, RW); CocHdl(MoutHdl); + CocDefFlt(tLimit, RW); CocHdl(TLimitHdl); + CocDefFlt(tMaxLimit, RD); + CocDefFlt(maxCurrent, RD); CocDefFlt(smooth, RW); CocDefFlt(powFact, RW); CocDefFlt(resist, RD); CocDefFlt(htr, RD); CocDefFlt(setH, RD); CocDefFlt(full, RW); - CocDefFlt(tLimit, RD); CocDefFlt(maxShift, RW); + CocDefFlt(maxOver, RW); CocDefFlt(tm, RD); CocDefFlt(ts, RD); CocDefFlt(tr, RD); @@ -2457,8 +2796,10 @@ int main(int argc, char *argv[]) { CocDefStr(status, RD); CocHdl(StatusHdl); CocDefStr(pid, RD); CocHdl(PidSumHdl); CocDefStr(config, RD); + CocDefStr(swap, RW); CocHdl(SwapHdl); CocDefStr(dev, RD); - CocDefStr(dev2, RD); + CocDefStr(dev0, RD); + CocDefStr(dev1, RD); CocDefStr(devHelp, RD); CocHdl(DevHelpHdl); CocDefInt(cod1, RD); @@ -2470,22 +2811,27 @@ int main(int argc, char *argv[]) { CocDefInt(maxfld, RD); CocDefInt(iAmp, RD); CocDefInt(iRange, RD); + CocDefInt(jRange, RD); CocDefInt(remoteMode, RW); CocHdl(RemoteHdl); CocDefInt(relay, RW); CocHdl(RelayHdl); + CocDefInt(manual, RW); CocHdl(ManualHdl); CocDefInt(htrst, RD); CocDefInt(loop, RD); CocDefInt(rdTim, RD); CocDefInt(tim0, RD); + CocDefInt(ibuf, RD); CocDefInt(logMask, RW); CocDefInt(logPeriod, RW); CocDefInt(readTemp, RW); - CocDefInt(controlMode, RW); + CocDefInt(controlMode, RW); CocHdl(SetHdl); CocDefInt(int2, RW); CocDefInt(busy, RD); CocDefInt(serialNo, RD); CocDefInt(quit, RW); CocDefInt(nScan, RD); + CocDefInt(keepT, RW); + CocDefInt(swRangeOn, RW); CocDefStr(grapar, RA); CocDefArr(gradata, RD); CocHdl(GraHdl); grasize=CocSizePtr(); diff --git a/tecs/tecs_cli.c b/tecs/tecs_cli.c index 1d4dd11..b1be843 100644 --- a/tecs/tecs_cli.c +++ b/tecs/tecs_cli.c @@ -28,7 +28,7 @@ pTecsClient TeccStart(char *startcmd, char *host, int port) { gethostname(thishost, sizeof(thishost)); th=getenv(thishost); if (th==NULL) th=thishost; - if (0!=strcmp(th, host)) { + if (0!=strcmp(th, host) && host!=strstr(host, th)) { code=rdCode; cmd=""; } @@ -36,7 +36,9 @@ pTecsClient TeccStart(char *startcmd, char *host, int port) { ERR_I(iret=CocInitClient(conn, host, port, code, 0, cmd)); if (iret==1) ErrShort("TECS_INIT: can not connect to TecsServer"); return((pTecsClient)conn); - OnError: return(NULL); + OnError: + if (conn!=NULL) FREE(conn); + return NULL; } pTecsClient TeccInit(char *startcmd, int port) { @@ -215,7 +217,8 @@ int F_FUN(tecs_get_mult)(F_CHAR(names), int *time, int *nvalues, float values[], while (nams!=NULL && i < *nvalues) { nams=str_split(nam, nams, ' '); if (nam[0]!='\0') { - ERR_I(CocGetFloat(conn, nam, values+i)); + values[i]=DATA_UNDEF; + CocGetFloat(conn, nam, values+i); i++; } } @@ -303,7 +306,7 @@ int F_FUN(tecs_get_data)(F_CHAR(names), int *startTime, int *endTime, int *step, , int retLen[], int names_len) { char nam[64]; char str[128]; - float offset, fact, *py, data[8192]; + float offset, fact, *py, data[COC_RES_LEN/4-100]; int i, j, k, l, iret; if (*endTime - *startTime > *step * (*maxLen-1)) { diff --git a/tecs/tecs_client.f b/tecs/tecs_client.f index 3865bd4..6ce01e1 100644 --- a/tecs/tecs_client.f +++ b/tecs/tecs_client.f @@ -37,10 +37,12 @@ oneCommand=.true. port=instr_host(line, inst, host, user, pcod) else + call sys_getenv('HOST', line) + port=instr_host(line, inst, host, user, pcod) oneCommand=.false. - port=0 endif + call sys_getenv('TECS_START', start) if (port .gt. 0) then if (port .eq. 1) port=9753 @@ -60,26 +62,12 @@ if (oneCommand) goto 11 - print * - print *,'Tecs Client' - print *,'-----------' - print * - print *,'set set temperature' - print *,'send direct command to LSC340' - print *,'device set cryo device' - print *,' show parameter' - print *,' set parameter' - print * - print *,' show summary' - print *,'plot chart for temperature and ' - 1 ,' var = P (default), He, Aux' - print *,'log show last n lines of logfile' - print *,'remote set to remote mode' - print *,'reset reset alarms' - print *,'kill shut down TecsServer' - print *,'restart restart TecsServer' - print *,'exit,quit exit tecs client' - print *,'help show list of parameters and cryo devices' + line='tecs' + line(52-i:64)='connected to '//inst(1:i) + print '(x,64(''-''))' + print '(x,a)',line(1:64) + print '(x,64(''-''))' + print '(33x,a)','type help for a list of commands' print * l=0 @@ -180,7 +168,26 @@ call tecs_plot(' ') elseif (cmd .eq. 'help') then print * - print *,'Writeable parameters:' + print *,'tecs client commands (can not be used from SICS)' + print * + print *,' show summary' + print *,'plot chart for temperature' + print *,'log show last n lines of logfile' + print *,'remote set to remote mode' + print *,'reset reset alarms' + print *,'kill shut down TecsServer' + print *,'restart restart TecsServer' + print *,'exit, quit exit tecs client' + print * + print *,'commands/parameters:' + print * + print *,' From tecs: show parameter' + print *,' set parameter' + print * + print *,' From SICS: tt show parameter' + print *,' tt set parameter' + print * + print *,'changeable parameters:' print * print *,'set temperature set-point' print *,'device temperature device' @@ -193,14 +200,15 @@ print *,'deriv PID derivation term' print *,'maxShift maximum (set-tempH) for controlMode=2' print *,'int2 integration time (sec) for controlMode=2' + print *,'tLimit temperature limit' ! print *,'remoteMode 1: local, 2: remote' + print *,'send direct command to LSC340' print * - print *,'Read only parameters:' + print *,'read only parameters:' print * print *,'Tm main temperature' print *,'Ts sample temperature' print *,'Tr set-point on regulation' - print *,'tLimit temperature limit' print *,'helium helium level' print *,'htr heater current percentage' print *,'resist heater resistance' diff --git a/tecs/tecs_data.c b/tecs/tecs_data.c index 1fb7bca..ac37d4b 100644 --- a/tecs/tecs_data.c +++ b/tecs/tecs_data.c @@ -204,6 +204,7 @@ int Put(Set *set, int time, float value) { int t, try = 1; int size; float last; + static int errcnt=0; ERR_P(set); if (value == DATA_UNDEF) return 0; @@ -221,9 +222,13 @@ int Put(Set *set, int time, float value) { } if (t<0) { if (t<-1) { - logfileOut(LOG_MAIN, "%s %d set.name, time, r->endTime); + if (errcnt<4) { + errcnt++; + logfileOut(LOG_MAIN, "%s %d set.name, time, r->endTime); + } ERR_MSG("back in time not possible"); } + if (errcnt>0) errcnt--; t=0; } if (t == 0) { diff --git a/tecs/tecs_plot.f b/tecs/tecs_plot.f index 41369b0..f70a05f 100644 --- a/tecs/tecs_plot.f +++ b/tecs/tecs_plot.f @@ -1,10 +1,11 @@ - subroutine tecs_plot(auxpar) + subroutine tecs_plot(reserved) - character*(*) auxpar - - integer dmax, nmax, tmax, amax, nmenu, chartperiod, naux - parameter (dmax=400, nmax=10, tmax=9, amax=3, nmenu=13 + character*(*) reserved + + integer dmax, nmax, nmenu, chartperiod, naux, nwin + parameter (dmax=1024, nmax=12, nmenu=13, nwin=4 1 , chartperiod=5, naux=1) + ! dmax*nmax*4 should be less than COC_RES_LEN in coc_util.h integer minRange, maxRange, oneDay parameter (minRange=60, maxRange=7*24*3600, oneDay=24*3600) integer zoom, right, live @@ -12,74 +13,95 @@ real winmin, undef parameter (winmin=60., undef=-1.125/1024./1024./1024.) - real*4 x1,x2,xmin,xmax,ymin(2),ymax(2),window + real*4 x1,x2,xmin,xmax,ymin(nwin),ymax(nwin),window real*4 xd(dmax, nmax),yd(dmax,nmax), yy0(nmax), yy1(nmax) real*4 ylast1,ylast2,y1,y2 real*4 ex,ey,fx,fy,row,ticks,tim0,tim1,menuwid real*4 dx,dy - integer l,j,i,n,t,leng,i1,i2,rl,startday,thisday - integer ncol, nset, mode + real*4 ylim(nmax) ! limits of sensor label text + integer l,j,n,t,leng,i1,i2,rl,startday,thisday + integer iostat + integer nset + integer ncol, mode + integer is ! 1...nset + integer im ! 1...nmax integer first,last,step,tbase,lastj - integer colorList(nmax)/5,3,2,4,6,8,14,15,9,8/ - integer color(nmax) integer retLen(nmax) - integer sel/0/, sel1, sel2, auxsel/1/ + logical focus(nmax)/3*.true.,9*.false./ + logical omit(nmax)/12*.false./ + logical fixleft/.false./ + integer winconf(nwin) ! number of windows below actual + integer showsets + real winh + integer nticks character key*1 character text(2,nmenu)*16/ 1 'L' ,'live off' 1 ,'z' ,'sel. zoom' 1 ,'+' ,'zoom in' 1 ,'-' ,'zoom out' - 1 ,'x' ,'show all' 1 ,'2d' ,'2 days' 1 ,'1h' ,'1 hour' 1 ,'15m' ,'15 min' 1 ,'31.7t','goto date' - 1 ,'c' ,'show P/He/Aux' - 1 ,'s' ,'select T' + 1 ,'a' ,'all chan' + 1 ,'c' ,'clear chan' + 1 ,'s' ,'focus' 1 ,'f' ,'write file' 1 ,'q' ,'quit'/ character weekdays(7)*4/ 1 'Mon','Tue','Wed','Thu','Fri','Sat','Sun'/ character buf*8, device*8, name*40, filnam*128, numb*16 - character title*64, pars*64 - character*4 tpar(tmax)/'Te','Tr','Tm','Ts','Tk','T1','T2','T3','T4'/ - character*4 apar(amax)/'P', 'He', 'Aux'/ - character*16 parnam(nmax) + character title*64, pars*64, allpars*64 + character*4 parnam(nmax) + 1 /'Tm','Ts','Tr','Te','Tk','T1','T2','T3','T4','P','He','Aux'/ + integer unit(nmax) + 1 / 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4/ ! 1: Kelvin, 2: Watt, 3: %, 4: other + integer color(nmax) + 1 / 2, 4, 3, 5, 6, 8, 14, 15, 13, 2, 2, 2/ + integer isx(nmax)/12*1/ ! at begin all channels selected + integer imx(nmax) + save imx + integer idx(nmax) logical gap, done logical saveit integer iret, lund, numl, mon, day integer pars_len, title_len, text_len, name_len - integer idx(nmax) character line*132 real x0 logical loop + integer tdif + integer fact ! functions integer myc_now, myc_time, myc_date, get_data integer tecs_get_mult, tecs_get_par + integer pgopen data window/0./ - + + fact=1 + read(reserved, *, iostat=iostat) fact + if (fact .lt. 1) fact=1 if (window .eq. 0) window=1800. saveit=.false. mode=live - call pgopen(' ') + iret=pgopen(' ') call pgqinf('TYPE', device, l) - if (device .eq. 'NULL') then + if (device .eq. 'NULL' .or. iret .le. 0) then call pgclos - call pgopen('?') + iret=pgopen('?') call pgqinf('TYPE', device, l) - if (device .eq. 'NULL') then + if (device .eq. 'NULL' .or. iret .le. 0) then print *,'No PGPLOT-Device defined' goto 9 endif call sys_setenv('PGPLOT_DEV', '/'//device) endif - call pgqcol(i,ncol) - ! print *,i,ncol,' colors ',device + call pgqcol(j,ncol) + ! print *,j,ncol,' colors ',device if (ncol .ge. 8 .and. device .ne. 'VT125') then call pgscr(0, 1.0, 1.0, 1.0) call pgscr(1, 0.0, 0.0, 0.0) @@ -97,38 +119,67 @@ l=0 x1=0 step=0 - do i=1,amax - if (auxpar .eq. apar(i)) then - auxsel=i + allpars=' ' + do im=1,nmax + call str_trim(allpars, allpars, l) + allpars=allpars(1:l)//' '//parnam(im) + enddo + showsets=1 + +1 continue + + iret=tecs_get_mult(allpars, t, nmax, yy1) + if (iret .lt. 0) goto 99 + tdif=myc_now()-t + tdif=tdif-mod(tdif+1800*25, 3600)+1800 ! round to next full hour + if (tdif .ne. 0) then + print *,'time difference ',tdif + endif + t=t+tdif + if (showsets .eq. 1) then ! select only channels which have NOW a signal + do im=1,nmax + if (isx(im) .eq. 0 .and. yy1(im) .ne. undef) then + isx(im)=1 + endif + enddo + else if (showsets .eq. 2) then ! select all channels + do im=1,nmax + isx(im)=1 + enddo + endif + is=0 + pars=' ' + do im=1,nmax + if (omit(im)) then + isx(im)=0 + omit(im)=.false. + else if (isx(im) .ne. 0) then + is=is+1 + isx(im)=is + imx(is)=im + call str_trim(pars, pars, pars_len) + pars=pars(1:pars_len)//' '//parnam(im) endif enddo + nset=is -1 pars=' ' - nset=0 - do i=1,tmax - nset=nset+1 - color(nset)=colorList(i) - parnam(nset)=tpar(i) - call str_trim(pars, pars, pars_len) - pars=pars(1:pars_len)//' '//parnam(nset) - enddo - nset=nset+1 - color(nset)=colorList(3) - parnam(nset)=apar(auxsel) - call str_trim(pars, pars, pars_len) - pars=pars(1:pars_len)//' '//parnam(nset) - - iret=tecs_get_mult(pars, t, nset, yy0) - if (iret .lt. 0) goto 99 if (window .eq. 0) then last=t step=maxRange/dmax window=maxRange first=t-min(dmax*step-1,maxRange-step) else if (mode .ge. right) then + last=t + if (fixleft) then + window=last-tbase-x1 + fixleft=.false. + endif step=window/(dmax-2)+0.99 last=t first=t-min(dmax*step-1,nint(window)) + if (first .ne. t-nint(window)) then + print *,'t-shift',first-(t-nint(window)) + endif else if (mode .eq. zoom) then x2=(x1+x2+window)/2 @@ -145,7 +196,7 @@ step=(step+59)/60*60 else if (step .gt. 30) then step=60 - elseif (step .gt. 20) then + else if (step .gt. 20) then step=30 else step=(step+4)/5*5 @@ -153,7 +204,7 @@ first=last-(last-first+step-1)/step*step ! round first ! print *,step,last-first tbase=first-mod(first,7*oneDay) - iret=get_data(pars, first, last, step, tbase + iret=get_data(pars, first-tdif, last-tdif, step*fact, tbase-tdif 1 , xd, yd, dmax, nmax, retLen) if (iret .lt. 0) goto 99 @@ -164,47 +215,112 @@ x1 = first - tbase endif tim0=t-tbase - do i=1,nset - leng=retLen(i) - do while (leng .gt. 1 .and. yd(leng,i) .eq. undef) + + do is=1,nset + im=imx(is) + leng=retLen(is) + do while (leng .gt. 1 .and. yd(leng,is) .eq. undef) leng=leng-1 enddo if (leng .eq. 1) leng=0 - retLen(i)=leng - if (mode .eq. live .and. leng .gt. 0) then - xd(leng,i)=tim0 - yd(leng,i)=yy0(i) + retLen(is)=leng + yy0(is)=yy1(im) + if (leng .gt. 0) then + if (mode .eq. live) then + xd(leng,is)=tim0 + yd(leng,is)=yy0(is) + endif + omit(im)=.false. +! else if (showsets .eq. 2) then ! next time omit unused channels +! omit(im)=.true. endif enddo - if (sel .ne. 0) then - do while (sel .lt. nset .and. retLen(sel) .eq. 0) - sel=sel+1 + + showsets=0 + + j=0 + do im=1,nmax + is=isx(im) + if (focus(im)) then + if (is .ne. 0 .and. unit(im) .eq. 1) then + if (retLen(is) .gt. 0) then + j=j+1 ! focus o.k. + goto 2 + endif + endif + focus(im)=.false. + if (j .eq. 0 .and. im .lt. nmax) focus(im+1)=.true. +2 continue + endif + enddo + if (j .eq. 0) then ! no T-channel in focus: select all + do is=1,nset + im=imx(is) + if (retLen(is) .gt. 0 .and. unit(im) .eq. 1) focus(im)=.true. enddo - if (sel .ge. nset) sel = 0 endif if (saveit) goto 9 if (mode .eq. live) then x2=max(tim0,x2)+min(1800., window*0.5) endif - if (window .gt. 50*3600) then - ticks=8*3600 - elseif (window .gt. 25*3600) then - ticks=4*3600 + if (window .gt. 36*3600) then + ticks=12*3600 + if (window .lt. 60*3600) then + nticks=6 + else + nticks=2 + endif + elseif (window .gt. 18*3600) then + ticks=6*3600 + if (window .lt. 30*3600) then + nticks=6 + else + nticks=3 + endif + elseif (window .gt. 10*3600) then + ticks=2*3600 + nticks=2 + elseif (window .gt. 3*3600) then + ticks=3600 + if (window .lt. 5*3600) then + nticks=6 + else + nticks=2 + endif + elseif (window .gt. 6000) then + ticks=1200 + nticks=2 + elseif (window .gt. 1800) then + ticks=600 + if (window .lt. 3600) then + nticks=5 + else + nticks=2 + endif + elseif (window .gt. 900) then + ticks=300 + nticks=5 + elseif (window .gt. 600) then + ticks=120 + nticks=2 + elseif (window .gt. 120) then + ticks=60 + if (window .lt. 300) then + nticks=6 + else + nticks=2 + endif else - ticks=0.0 ! automatic + ticks=30 + nticks=3 endif - - i1=1 - i2=nset-naux - if (sel .eq. 0) then - sel1=i1 - sel2=i2 - else - sel1=sel - sel2=sel - endif - do rl=1,2 + + do rl=1,nwin + winconf(rl)=nwin-rl ! number of windows to follow + enddo + + do rl=1,nwin if (mode .eq. zoom .and. rl .eq. 1) then ymin(1)=y1 ymax(1)=y2 @@ -213,19 +329,22 @@ ymax(rl)=-1e30 ylast1=ymin(rl) ylast2=ymax(rl) - do i=sel1,sel2 - do j=1,retLen(i) - if (yd(j,i) .ne. undef) then - ymin(rl)=min(ymin(rl),yd(j,i)) - ymax(rl)=max(ymax(rl),yd(j,i)) - endif - enddo - do j=max(1,retLen(i)-4),retLen(i) - if (yd(j, i) .ne. undef) then - ylast1=min(ylast1,yd(j, i)) - ylast2=max(ylast2,yd(j, i)) - endif - enddo + do is=1,nset + im=imx(is) + if (unit(im) .eq. rl .and. (focus(im) .or. rl .gt. 1)) then + do j=1,retLen(is) + if (yd(j,is) .ne. undef) then + ymin(rl)=min(ymin(rl),yd(j,is)) + ymax(rl)=max(ymax(rl),yd(j,is)) + endif + enddo + do j=max(1,retLen(is)-4),retLen(is) + if (yd(j,is) .ne. undef) then + ylast1=min(ylast1,yd(j, is)) + ylast2=max(ylast2,yd(j, is)) + endif + enddo + endif enddo ey=(ymax(rl)-ymin(rl)) @@ -239,89 +358,109 @@ endif if (ymax(rl) .lt. ymin(rl)) then + do j=1,rl-1 + winconf(j)=winconf(j)-1 + enddo ymax(rl)=1.0 ymin(rl)=0 elseif (ymax(rl) .eq. ymin(rl)) then ymax(rl)=ymin(rl)*1.00001+1.0 ymin(rl)=-1.0e-3 endif + enddo - call set_win(rl,x1,x2,ymin(rl),ymax(rl)) + winh=0.9/(winconf(1)+3.5) - do i=i1,i2 - call pgsci(color(i)) - l=0 - lastj=1 - do j=1,retLen(i) - if (yd(j,i) .eq. undef) then - if (j .gt. lastj) then - call pgline(j-lastj, xd(lastj,i), yd(lastj,i)) + do rl=1,nwin + + if (rl .gt. 1) then + if (winconf(rl) .eq. winconf(rl-1)) goto 6 ! window empty + endif + call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) + + do is=nset,1,-1 + im=imx(is) + if (unit(im) .eq. rl) then + call pgsci(color(im)) + l=0 + lastj=1 + do j=1,retLen(is) + if (yd(j,is) .eq. undef) then + if (j .gt. lastj) then + call pgline(j-lastj, xd(lastj,is), yd(lastj,is)) + endif + lastj=j+1 + else + l=j endif - lastj=j+1 - else - l=j - endif - enddo - if (retLen(i) .gt. lastj) - 1 call pgline(retLen(i)+1-lastj, xd(lastj,i), yd(lastj,i)) - retLen(i)=l + enddo + if (retLen(is) .gt. lastj) + 1 call pgline(retLen(is)+1-lastj, xd(lastj,is), yd(lastj,is)) + retLen(is)=l + endif enddo call pgsci(1) if (rl .eq. 1) then call pgsch(1.0) - call pgtbox('ZHXYBINST', ticks, 0, 'BCINMST', 0.0, 0) + call pgtbox('ZHXYBINST', ticks, nticks, 'BCINMST1', 0.0, 0) call pgtbox('C', 0.0, 0, ' ', 0.0, 0) ey=0.0 - do i=i1,i2 - if (retLen(i) .gt. 0) then - name=parnam(i) + do is=1,nset + im=imx(is) + if (unit(im) .eq. rl .and. retLen(is) .gt. 0) then + name=parnam(im) if (name .eq. 'Tm') then - name='Main Sensor' + name='Main' elseif (name .eq. 'Ts') then - name='Sample Sensor' + name='Sample' elseif (name .eq. 'Tr') then - name='SetPoint' + name='Set' endif call str_trim(name, name, name_len) - if (sel .eq. i) then + if (focus(im)) then name=name(1:name_len)//'*' call str_trim(name, name, name_len) endif call pglen(5, name(1:name_len), fx, fy) - call pgsci(color(i)) + call pgsci(color(im)) call pgmtxt ('L', 2.5, ey, 0.0, name(1:name_len)) ey=ey+fy+0.04 endif + ylim(is)=ymin(1)+(ey-0.02)*(ymax(1)-ymin(1)) enddo call pgsci(1) call pgmtxt ('L', 2.5, ey, 0.0, 'T [K]') else - call pgsch(0.7) - call pgtbox('ZCIST', ticks, 0, 'BCVINMST', 0.0, 0) - call pgtbox('B', 0.0, 0, ' ', 0.0, 0) - call pgsci(color(nset)) - call pgsch(1.0) - if (parnam(nset) .eq. 'P' .or. parnam(nset) .eq. 'p') then - call pgmtxt ('L', 2.5, 0.5, 0.5, 'Power [W]') - elseif (parnam(nset) .eq. 'He') then - title='%' - iret=tecs_get_par('heUnits', title, 0) - call str_trim(title, title, title_len) - call pgmtxt ('L', 2.5, 0.5, 0.5, - 1 'Helium ['//title(1:title_len)//']') - else - call pgmtxt ('L', 2.5, 0.5, 0.5, parnam(nset)) + do is=1,nset + im=imx(is) + if (unit(im) .eq. rl) goto 5 + enddo + im=0 +5 if (im .ne. 0) then + call pgsch(4*winh) + call pgtbox('ZCIST', ticks, nticks, 'BINST1', 0.0, 0) + call pgtbox('B', 0.0, 0, 'CIVMST', 0.0, 0) + call pgsci(color(im)) + call pgsch(1.0) + if (parnam(im) .eq. 'P' .or. parnam(im) .eq. 'p') then + call pgmtxt ('L', 2.5, 0.5, 0.5, 'Power [W]') + elseif (parnam(im) .eq. 'He') then + title='%' + iret=tecs_get_par('heUnits', title, 0) + call str_trim(title, title, title_len) + call pgmtxt ('L', 2.5, 0.5, 0.5, + 1 'Helium ['//title(1:title_len)//']') + else + call pgmtxt ('L', 2.5, 0.5, 0.5, parnam(im)) + endif endif endif - i1=nset-naux+1 - i2=nset - sel1=i1 - sel2=i2 +6 continue enddo call pgsch(0.7) rl=1 - call set_win(rl,x1,x2,ymin(rl),ymax(rl)) + call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) call pgsci(1) call pgsclp(0) @@ -330,14 +469,13 @@ else text(2,1)='live on' endif - text(2,10)='show '//apar(mod(auxsel,3)+1) menuwid=0.0 - do i=1,nmenu - call str_trim(text(2,i), text(2,i), text_len) - call pglen(5, text(2,i)(1:text_len), fx, fy) - call pgmtxt('T', 3.0, menuwid, 0.0, '|'//text(1,i)) + do j=1,nmenu + call str_trim(text(2,j), text(2,j), text_len) + call pglen(5, text(2,j)(1:text_len), fx, fy) + call pgmtxt('T', 3.0, menuwid, 0.0, '|'//text(1,j)) call pgmtxt('T', 2.5, menuwid, 0.0, '|') - call pgmtxt('T', 2.0, menuwid, 0.0, '|'//text(2,i)) + call pgmtxt('T', 2.0, menuwid, 0.0, '|'//text(2,j)) menuwid=menuwid+fx+0.01 enddo call pgmtxt('T', 3.0, menuwid, 0.0, '|') @@ -349,14 +487,14 @@ done=.false. row=(ymax(rl)-ymin(rl))/30. ey=ymin(rl)-row*3.5 - i=max(0,int((x1+oneDay/2)/oneDay)) + j=max(0,int((x1+oneDay/2)/oneDay)) - ex=(i+0.5)*oneDay + ex=(j+0.5)*oneDay do while (ex .le. x2) done=.true. write(buf,'(i8.8)') myc_date(nint(ex)+tbase) call pgptxt(ex, ey, 0.0, 0.5, - 1 weekdays(mod(i,7)+1)//buf(7:8)//'.'//buf(5:6)) + 1 weekdays(mod(j,7)+1)//buf(7:8)//'.'//buf(5:6)) ex=ex-12*3600 if (ex .gt. x1) then call pgmove(ex, ey) @@ -367,41 +505,43 @@ call pgmove(ex, ey) call pgdraw(ex, ey+row) endif - i=i+1 - ex=(i+0.5)*oneDay + j=j+1 + ex=(j+0.5)*oneDay enddo if (.not. done) then n=nint(x2)/oneDay*oneDay - i=nint(x1)-n + l=nint(x1)-n j=nint(x2)-n - if (i .lt. 0) then - if (-i .gt. j) then + if (l .lt. 0) then + if (-l .gt. j) then ex=0.0 - i=nint(x1)+tbase + l=nint(x1)+tbase else ex=1.0 - i=nint(x2)+tbase + l=nint(x2)+tbase endif else ex=0.5 - i=nint(x2)+tbase + l=nint(x2)+tbase endif - thisday=mod(i/oneDay,7)+1 - write(buf,'(i8.8)') myc_date(i) + thisday=mod(l/oneDay,7)+1 + write(buf,'(i8.8)') myc_date(l) call pgmtxt('B', 3.5, ex, ex, 1 weekdays(thisday)//buf(7:8)//'.'//buf(5:6)) endif iret=tecs_get_par('device', title, 0) if (iret .lt. 0) goto 99 - i=index(title, '(') - if (i .gt. 2 ) then - title=title(1:i-1) - else + j=index(title, '(') + if (j .gt. 2 ) then + title=title(1:j-1) + else if (title .eq. ' ') then title='test - no device' endif - call pgmtxt('T', -1.5, 0.02, 0.0, title) + if (mode .eq. live) then + call pgmtxt('T', -1.5, 0.02, 0.0, title) + endif call pgsclp(1) call purge_keys ! purge buffer @@ -414,52 +554,52 @@ ! call pgmtxt('T', 0.5, 0.0, 0.0, 'LIVE MODE (click on text window before pressing any further key)') ! endif ! call get_key(key, 0, chartperiod) - i=chartperiod-mod(myc_now(), chartperiod) - call get_cursor(ex, ey, key, -i) + j=chartperiod-mod(myc_now(), chartperiod) + call get_cursor(ex, ey, key, -j) do while (key .eq. char(0) .or. key .eq. ' ') ! no key or space key pressed iret=tecs_get_mult(pars, t, nset, yy1) if (iret .lt. 0) goto 99 + t=t+tdif tim1=t-tbase if (tim1 .gt. x2) then call pgpage - window=x2-x1 + fixleft=.true. goto 1 endif if (tim1 .gt. tim0) then - i1=1 - i2=nset-naux - do rl=1,2 - call set_win(rl,x1,x2,ymin(rl),ymax(rl)) - do i=i1,i2 - if (yy0(i) .ne. undef .and. yy1(i) .ne. undef) then - if ((sel .eq. 0 .or. sel .eq. i) .and. - 1 (yy1(i) .lt. ymin(rl) .or. - 1 yy1(i) .gt. ymax(rl))) then - call pgpage - window=x2-x1 - goto 1 + do rl=1,nwin + call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) + do is=nset,1,-1 + im=imx(is) + if (unit(im) .eq. rl) then + if (yy0(is) .ne. undef .and. yy1(is) .ne. undef) then + if ((focus(im) .or. unit(im) .gt. 1) .and. + 1 (yy1(is) .lt. ymin(rl) .or. + 1 yy1(is) .gt. ymax(rl))) then + call pgpage + fixleft=.true. + goto 1 + endif + call pgsci(color(im)) + call pgmove(tim0, yy0(is)) + call pgdraw(tim1, yy1(is)) endif - call pgsci(color(i)) - call pgmove(tim0, yy0(i)) - call pgdraw(tim1, yy1(i)) + yy0(is)=yy1(is) endif - yy0(i)=yy1(i) enddo - i1=nset-naux+1 - i2=nset enddo tim0=tim1 endif - i=chartperiod-mod(myc_now(), chartperiod) - call get_cursor(ex, ey, key, -i) + j=chartperiod-mod(myc_now(), chartperiod) + call get_cursor(ex, ey, key, -j) enddo else call get_cursor(ex, ey, key, 0) endif rl=1 - call set_win(rl,x1,x2,ymin(rl),ymax(rl)) + call set_win(rl,winh,winconf,x1,x2,ymin(rl),ymax(rl)) 8 if (key .ge. 'a') key=char(ichar(key)-32) if (key .eq. '-') then @@ -547,19 +687,19 @@ goto 7 elseif (key .eq. 'D') then ex=1 - read(numb, *, iostat=i) ex + read(numb, *, iostat=iostat) ex window=min(maxRange,max(minRange, nint(oneDay*ex))) if (mode .lt. right) mode=right x1=0 elseif (key .eq. 'H') then ex=1 - read(numb, *, iostat=i) ex + read(numb, *, iostat=iostat) ex window=min(maxRange,max(minRange, nint(3600*ex))) if (mode .lt. right) mode=right x1=0 elseif (key .eq. 'M') then ex=1 - read(numb, *, iostat=i) ex + read(numb, *, iostat=iostat) ex window=min(maxRange,max(minRange, nint(60*ex))) if (mode .lt. right) mode=right x1=0 @@ -568,12 +708,12 @@ j=index(numb,'.') day=0 if (j .gt. 1 .and. j .lt. numl) then - read(numb(1:j-1), *, iostat=i) day + read(numb(1:j-1), *, iostat=iostat) day mon=0 - read(numb(j+1:numl), *, iostat=i) mon + read(numb(j+1:numl), *, iostat=iostat) mon tbase = myc_time(day+mon*100) else - read(numb, *, iostat=i) day + read(numb, *, iostat=iostat) day tbase = myc_time(day) endif x1=0 @@ -591,13 +731,67 @@ elseif (key .eq. 'Q' .or. key .eq. char(13) 1 .or. key .eq. char(10)) then goto 9 - elseif (key .eq. 'S') then - sel=sel+1 - if (sel .gt. tmax) sel=0 - if (mode .eq. zoom) mode=0 - elseif (key .eq. 'C') then - auxsel=auxsel+1 - if (auxsel .gt. amax) auxsel=1 + elseif (key .eq. 'A') then + showsets=2 + elseif (key .eq. 'C') then ! clear set + if (ex .lt. x1) then + if (ey .ge. ymin(1) .and. + 1 ey .le. ymax(1)) then + do is=1,nset + if (ey .lt. ylim(is)) then + im=imx(is) + omit(im)=.true. + goto 7 + endif + enddo + else + ey=(ymin(1)-ey)/(ymax(1)-ymin(1))*3.0+0.5 + if (ey .gt. 1.0) then + do im=1,nmax + j=unit(im) + if (winconf(1)-winconf(j) .eq. int(ey)) then + omit(im)=.true. + endif + enddo + endif + endif + endif + elseif (key .eq. 'S') then ! toggle focus + if (ex .lt. x1) then + if (ey .ge. ymin(1) .and. + 1 ey .le. ymax(1)) then + do is=1,nset + if (ey .lt. ylim(is)) then + im=imx(is) + focus(im)=.not. focus(im) + goto 89 + endif + enddo + endif + endif + j=nset + n=0 + do is=1,nset + im=imx(is) + if (focus(im)) then + focus(im)=.false. + j=is + n=n+1 + endif + enddo + if (n .gt. 1) then + if (j .gt. 4) then ! was "all", set to "default" + focus(1)=.true. + focus(2)=.true. + focus(3)=.true. + else ! was "default" select 1 + focus(1)=.true. + endif + else if (j .lt. nset) then ! select next + im=imx(j) + focus(im)=.true. + endif ! else select none -> will be all +89 if (mode .eq. zoom) mode=0 elseif (mode .eq. live) then goto 7 endif @@ -616,16 +810,17 @@ read(*,'(a)') filnam open(lund, file=filnam, status='unknown') - line='time [h]' + line='hour' call str_trim(line, line, l) - do j=1,nset - idx(j)=0 - do i=1,retlen(j) - if (yd(i,j) .ne. undef) then - idx(j)=1 + do is=1,nset + im=imx(is) + idx(is)=0 + do j=1,retlen(is) + if (yd(j,is) .ne. undef) then + idx(is)=1 l=l+1 line(l:l)=char(9) - call str_trim(line(l+1:), parnam(j), text_len) + call str_trim(line(l+1:), parnam(im), text_len) l=l+max(9,text_len) goto 109 endif @@ -638,24 +833,24 @@ x0=0 do while (x0 .lt. 3e7) x0=4e7 - do j=1,nmax ! find next x - if (idx(j) .gt. 0 .and. idx(j) .lt. retlen(j)) then - x0=min(x0,xd(idx(j),j)) + do is=1,nmax ! find next x + if (idx(is) .gt. 0 .and. idx(is) .lt. retlen(is)) then + x0=min(x0,xd(idx(is),is)) endif enddo if (x0 .lt. 3e7) then write(line,'(f9.4)') x0/3600. l=9 - do j=1,nmax - if (idx(j) .gt. 0) then + do is=1,nmax + if (idx(is) .gt. 0) then l=l+1 line(l:l)=char(9) - if (idx(j) .le. retlen(j)) then - if (xd(idx(j),j) .lt. x0+1) then + if (idx(is) .le. retlen(is)) then + if (xd(idx(is),is) .lt. x0+1) then write(line(l+1:), '(f9.4)') - 1 max(-999.,min(9999.,yd(idx(j),j))) + 1 max(-999.,min(9999.,yd(idx(is),is))) l=l+9 - idx(j)=idx(j)+1 + idx(is)=idx(is)+1 endif endif endif @@ -706,14 +901,19 @@ end - subroutine set_win(rl, x1, x2, y1, y2) + subroutine set_win(rl, winh, winconf, x1, x2, y1, y2) integer rl + real winh + integer winconf(*) real x1, x2, y1, y2 + real b + if (rl .eq. 1) then - call pgsvp(0.07,0.93,0.3,0.9) + call pgsvp(0.07,0.93,0.9-3*winh,0.9) else - call pgsvp(0.07,0.93,0.01,0.20) + b=winconf(rl)*winh + call pgsvp(0.07,0.93,b+0.01,b+winh-0.01) endif call pgswin(x1,x2,y1,y2) @@ -728,7 +928,7 @@ real*4 xd(dmax,nmax), yd(dmax,nmax) integer oneDay, maxn - parameter (oneDay = 24*3600, maxn=10) + parameter (oneDay = 24*3600, maxn=12) integer tecs_get_data integer i,j,rl(maxn),m,k,n,mm @@ -752,13 +952,15 @@ n=retlen(j) do k=m+1,m+rl(j) n=n+1 - xd(n,j)=xd(k,j) - yd(n,j)=yd(k,j) + xd(n,j)=xd(k,j) + yd(n,j)=yd(k,j) enddo retlen(j)=n mm=max(mm,n) enddo - ! print *,mm-m,' points read' + if (m .gt. 0) then + print '(a,$)',' .' + endif m=mm enddo endif diff --git a/tecs/tecs_serial.c b/tecs/tecs_serial.c index ea432a7..0371092 100644 --- a/tecs/tecs_serial.c +++ b/tecs/tecs_serial.c @@ -161,6 +161,7 @@ char *SerCmd(SerChannel *serch, char *cmnd) { AsynSrvChan *aser; TermSrvChan *tser; char *result, *pos, *trm; + char junk[256]; int iret, incomplete; l=strlen(cmnd); @@ -181,6 +182,18 @@ char *SerCmd(SerChannel *serch, char *cmnd) { if (result==NULL) ERR_MSG("empty result"); } else if (serch->type==TERMSRV_TYPE) { tser=(TermSrvChan *)serch; + ERR_I(iret=SerWait(0, tser->fd)); + while (iret>0) { /* skip contents in type-ahead buffer */ + ERR_SI(l=recv(tser->fd, junk, sizeof(junk)-1, 0)); + if (l==0) { + ErrMsg("disconnected"); + SerClose(serch); + goto OnError; + } + junk[l]='\0'; + logfileOut(LOG_MAIN, "skipped: '%s'\n", junk); + ERR_I(iret=SerWait(0, tser->fd)); + } iret=send(tser->fd, cmnd, l, 0); if (iret<0) { ErrMsg("disconnected"); diff --git a/tecs/term.c b/tecs/term.c index 2bc761f..0a67778 100644 --- a/tecs/term.c +++ b/tecs/term.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/tecsdriv.c b/tecsdriv.c index 2a79fa3..1887e14 100644 --- a/tecsdriv.c +++ b/tecsdriv.c @@ -1,9 +1,9 @@ /*--------------------------------------------------------------------------- T E C S D R I V . C - + This is the implementation for TECS object derived from an more general environment controller. At present, TECS is used for driving the - LakeShore 340 Temperutre Controller. + LakeShore 340 Temperature Controller. Markus Zolliker, March 2000 @@ -68,6 +68,7 @@ char *lastError; time_t lastGet; int iLastError, port; + int (*EVLimits)(void *, float , char *, int); char server[256]; } TecsDriv, *pTecsDriv; @@ -78,7 +79,7 @@ int argc, char *argv[]) { pEVControl self = NULL; - char pBueffel[256], result[1024]; + char pBueffel[256], result[1024], *res; int iRet; pEVDriver pD; pTecsDriv pMe; @@ -111,43 +112,51 @@ iRet=CocGet(pMe->pData,"set",result); /* get parameter */ if (iRet<0) goto Error; self->fTarget = atof(result); + iRet=CocGet(pMe->pData,"tlimit",result); /* get parameter */ + if (iRet<0) goto Error; + fVal = atof(result); + iRet = EVCSetPar(self, "upperlimit", fVal,pCon); iRet = EVControlWrapper(pCon,pSics,pData,argc,argv); if (iRet != 0) { - iRet=CocGet(pMe->pData,"tlimit",result); /* get parameter */ - if (iRet<0) goto Error; - fVal = atof(result); - if (fVal != 0 && ObVal(self->pParam,UPLIMIT) > fVal) { - sprintf(pBueffel,"WARNING: upper limit is above %g, (limit of the device)", fVal); - SCWrite(pCon,pBueffel,eValue); - } - iRet=CocGet(pMe->pData,"status",result); /* get parameter */ + iRet=CocGet(pMe->pData,"status",result); /* show status */ if (iRet<0) goto Error; SCWrite(pCon,result,eValue); } return iRet; } else if (0==strcmp(pBueffel," upperlimit ")) { - if (argc > 2) { - iRet=CocGet(pMe->pData,"tlimit",result); /* get parameter */ - if (iRet<0) goto Error; - fVal=atof(result); - if (atof(argv[2]) > fVal) { - sprintf(pBueffel,"ERROR: upper limit must not be higher than %g", fVal); - SCWrite(pCon,pBueffel,eError); - return 0; - } + if (argc == 3) { + iRet=CocSetGet(pMe->pData,"tLimit",argv[2],result); /* set and get parameter */ + res=strchr(result, '='); + if (res != NULL) { + str_copy(result, res+1); + } + } else if (argc == 2) { + iRet=CocGet(pMe->pData,"tLimit",result); /* get parameter */ } - return EVControlWrapper(pCon,pSics,pData,argc,argv); + if (iRet<0) goto Error; + fVal=atof(result); + if (argc==3 && atof(argv[2]) > fVal) { + sprintf(pBueffel,"WARNING: upper limit reduced to maximal allowed value: %g", fVal); + SCWrite(pCon,pBueffel,eWarning); + } + iRet = EVCSetPar(self, "upperlimit", fVal,pCon); + if (iRet) { + sprintf(pBueffel,"%s.%s = %s\n",self->pName, + argv[1],result); + SCWrite(pCon,pBueffel,eValue); + } + return iRet; } else if (0==strcmp(pBueffel," lowerlimit ")) { if (argc > 2) { if (atof(argv[2]) > ObVal(self->pParam,UPLIMIT)) { SCWrite(pCon,"ERROR: lower limit must not be higher than upperlimit",eError); return 0; - } + } } return EVControlWrapper(pCon,pSics,pData,argc,argv); } else if (NULL!=strstr( - " log send tolerance access errorhandler interrupt interest safevalue currentvalue maxwait settle " - , pBueffel)) { + " log send tolerance access errorhandler interrupt interest safevalue currentvalue maxwait settle errorscript driver " + , pBueffel)) { /* forward to standard handler */ return EVControlWrapper(pCon,pSics,pData,argc,argv); } @@ -386,12 +395,12 @@ pPort=fgets(buf, sizeof(buf), fil); if (pPort != NULL) { pMe->port=atoi(pPort); - } - fgets(buf, sizeof(buf), fil); - fgets(pMe->server, sizeof(pMe->server), fil); + } + fgets(buf, sizeof(buf), fil); + fgets(pMe->server, sizeof(pMe->server), fil); } } - + if (pMe->port==0) { /* get the port number for tecs */ pPort = IFindOption(pSICSOptions, "TecsPort"); @@ -414,4 +423,38 @@ pNew->GetValues= TecsGetX; return pNew; - } + } +/*------------------------------------------------------------------------*/ + static int TecsLimits(void *pData, float fVal, char *pError, int iErrLen) { + /* wrapper for EVILimits */ + pEVControl pEvc; + pTecsDriv pMe; + int iRet; + float f; + char result[64]; + + pEvc = (pEVControl)pData; + assert(pEvc); + pMe=pEvc->pDriv->pPrivate; + assert(pMe); + iRet=CocGet(pMe->pData,"tLimit",result); /* get parameter */ + if (iRet>=0) { + f=0.0; + f=atof(result); + if (f>0.0) pEvc->pParam[UPLIMIT].fVal=f; + } + return pMe->EVLimits(pData, fVal, pError, iErrLen); + } +/*------------------------------------------------------------------------*/ + void TecsCustomize(SConnection *pCon, pEVControl pEvc) { + /* customize tecs driver */ + pTecsDriv pMe; + + pMe=pEvc->pDriv->pPrivate; + assert(pMe); + assert(pMe->EVLimits != pEvc->pDrivInt->CheckLimits); + pMe->EVLimits=pEvc->pDrivInt->CheckLimits; /* save original CheckLimits function */ + pEvc->pDrivInt->CheckLimits=TecsLimits; + EVCSetPar(pEvc,"upperlimit",1800.0,pCon); + EVCSetPar(pEvc,"lowerlimit",0.01,pCon); + } diff --git a/tecsdriv.h b/tecsdriv.h index d38b69a..818a91e 100644 --- a/tecsdriv.h +++ b/tecsdriv.h @@ -24,4 +24,6 @@ int TecsError(pEVDriver self, int *iCode, char *error, int iErrLen); + void TecsCustomize(SConnection *pCon, pEVControl pEvc); + #endif diff --git a/utils/makefile b/utils/makefile index afe8fd1..4d3ce09 100644 --- a/utils/makefile +++ b/utils/makefile @@ -1,7 +1,5 @@ # this makefile delegates to a version specific makefile -# where this subdirectory is (relative to the sics root) -S_DOWN=psi/utils # where root is (from here) S_UP=../..