From e762ecb6a1d84d0f2cd473526ed043875c6c2844 Mon Sep 17 00:00:00 2001 From: zolliker Date: Thu, 19 Feb 2009 13:29:03 +0000 Subject: [PATCH] - various enhancements in tecs and six --- tecs/coc_server.c | 2 +- tecs/make_crv | 35 +++++++++++++++++++++++++++++++++++ tecs/six.c | 20 ++++++++++++++++---- tecs/tecs.c | 26 ++++++++++++++++++-------- 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/tecs/coc_server.c b/tecs/coc_server.c index 362e1b0..02f0325 100644 --- a/tecs/coc_server.c +++ b/tecs/coc_server.c @@ -384,7 +384,7 @@ int CocPushThisHandler(CocVar *var, CocClient *cl, void *base, int mode) { int n; if (mode==COC_DWR) { - if (var->pending) return(0); + if (var->pending && cl->npend != 0) return(0); var->pending=1; } n=cl->npend; diff --git a/tecs/make_crv b/tecs/make_crv index 0df6827..7b9ad87 100644 --- a/tecs/make_crv +++ b/tecs/make_crv @@ -56,6 +56,9 @@ $(CFGDIR)ccs130.crv: ccrv inp/ccs130.inp $(CFGDIR)c_ill.crv: ccrv inp/c_ill.inp $Q -p$(CFGDIR) +$(CFGDIR)cma02.crv: ccrv inp/cma02.inp + $Q -p$(CFGDIR) + $(CFGDIR)cma11.crv: ccrv inp/cma11.inp $Q -p$(CFGDIR) @@ -71,6 +74,9 @@ $(CFGDIR)cma11r3lc.crv: ccrv inp/cma11r3lc.inp $(CFGDIR)cma11r4rc.crv: ccrv inp/cma11r4rc.inp $Q -p$(CFGDIR) +$(CFGDIR)cma6.crv: ccrv inp/cma6.inp + $Q -p$(CFGDIR) + $(CFGDIR)cplus45.crv: ccrv inp/cplus45.inp $Q -p$(CFGDIR) @@ -110,6 +116,15 @@ $(CFGDIR)g26552.crv: ccrv inp/g26552.inp $(CFGDIR)gemark.crv: ccrv inp/gemark.inp $Q -p$(CFGDIR) +$(CFGDIR)ln2a.crv: ccrv inp/ln2a.inp + $Q -p$(CFGDIR) + +$(CFGDIR)ln2b.crv: ccrv inp/ln2b.inp + $Q -p$(CFGDIR) + +$(CFGDIR)ln2.crv: ccrv inp/ln2.inp + $Q -p$(CFGDIR) + $(CFGDIR)mz020124.crv: ccrv inp/mz020124.inp $Q -p$(CFGDIR) @@ -329,6 +344,9 @@ $(CFGDIR)x38622.crv: ccrv inp/x38622.inp $(CFGDIR)x40188.crv: ccrv inp/x40188.inp $Q -p$(CFGDIR) +$(CFGDIR)x48581.crv: ccrv inp/x48581.inp + $Q -p$(CFGDIR) + $(CFGDIR)x50830.crv: ccrv inp/x50830.inp $Q -p$(CFGDIR) @@ -341,6 +359,9 @@ $(CFGDIR)x50921.crv: ccrv inp/x50921.inp $(CFGDIR)x50923.crv: ccrv inp/x50923.inp $Q -p$(CFGDIR) +$(CFGDIR)x50991.crv: ccrv inp/x50991.inp + $Q -p$(CFGDIR) + $(CFGDIR)x51079.crv: ccrv inp/x51079.inp $Q -p$(CFGDIR) @@ -367,11 +388,13 @@ all_crv: dev.list \ $(CFGDIR)c_ab.crv \ $(CFGDIR)ccs130.crv \ $(CFGDIR)c_ill.crv \ + $(CFGDIR)cma02.crv \ $(CFGDIR)cma11.crv \ $(CFGDIR)cma11r1al.crv \ $(CFGDIR)cma11r2ol.crv \ $(CFGDIR)cma11r3lc.crv \ $(CFGDIR)cma11r4rc.crv \ + $(CFGDIR)cma6.crv \ $(CFGDIR)cplus45.crv \ $(CFGDIR)cplus70.crv \ $(CFGDIR)cs405.crv \ @@ -385,6 +408,9 @@ all_crv: dev.list \ $(CFGDIR)g26550.crv \ $(CFGDIR)g26552.crv \ $(CFGDIR)gemark.crv \ + $(CFGDIR)ln2a.crv \ + $(CFGDIR)ln2b.crv \ + $(CFGDIR)ln2.crv \ $(CFGDIR)mz020124.crv \ $(CFGDIR)mz030500.crv \ $(CFGDIR)pcry.crv \ @@ -458,10 +484,12 @@ all_crv: dev.list \ $(CFGDIR)x38604.crv \ $(CFGDIR)x38622.crv \ $(CFGDIR)x40188.crv \ + $(CFGDIR)x48581.crv \ $(CFGDIR)x50830.crv \ $(CFGDIR)x50903.crv \ $(CFGDIR)x50921.crv \ $(CFGDIR)x50923.crv \ + $(CFGDIR)x50991.crv \ $(CFGDIR)x51079.crv \ $(CFGDIR)z030114.crv \ @@ -485,11 +513,13 @@ inp/cab505.inp \ inp/c_ab.inp \ inp/ccs130.inp \ inp/c_ill.inp \ +inp/cma02.inp \ inp/cma11.inp \ inp/cma11r1al.inp \ inp/cma11r2ol.inp \ inp/cma11r3lc.inp \ inp/cma11r4rc.inp \ +inp/cma6.inp \ inp/cplus45.inp \ inp/cplus70.inp \ inp/cs405.inp \ @@ -503,6 +533,9 @@ inp/g25550.inp \ inp/g26550.inp \ inp/g26552.inp \ inp/gemark.inp \ +inp/ln2a.inp \ +inp/ln2b.inp \ +inp/ln2.inp \ inp/mz020124.inp \ inp/mz030500.inp \ inp/pcry.inp \ @@ -576,10 +609,12 @@ inp/x37346.inp \ inp/x38604.inp \ inp/x38622.inp \ inp/x40188.inp \ +inp/x48581.inp \ inp/x50830.inp \ inp/x50903.inp \ inp/x50921.inp \ inp/x50923.inp \ +inp/x50991.inp \ inp/x51079.inp \ inp/z030114.inp \ diff --git a/tecs/six.c b/tecs/six.c index 133e0ba..f01e7b0 100644 --- a/tecs/six.c +++ b/tecs/six.c @@ -605,6 +605,10 @@ int main (int argc, char *argv[]) { clcname="seacmd"; servername="sea"; clclen=strlen(clcname); + } else if (0==strcmp(argv[i], "-graph") || 0==strcmp(argv[i], "graph")) { + clcname="graphcmd"; + servername="graph"; + clclen=strlen(clcname); } else if (0==strcmp(argv[i], "-a") || 0==strcmp(argv[i], "a")) { remember=0; } else if (0==strcmp(argv[i], "-c") || 0==strcmp(argv[i], "c")) { @@ -634,14 +638,14 @@ int main (int argc, char *argv[]) { } else if (0==strcmp(argv[i], "-h")) { i++; if (i>=argc) { - PutC("missing host"); + PutC("missing host"); UsageNote(); return 0; } hostArg = argv[i]; } else if (0==strcmp(argv[i], "-p")) { i++; if (i>=argc) { - PutC("missing port"); + PutC("missing port"); UsageNote(); return 0; } port=atoi(argv[i]); @@ -653,7 +657,7 @@ int main (int argc, char *argv[]) { sicslogin=0; } else { if (strlen(argv[i])>=32) { - PutC("argument too long"); + PutC("argument too long"); UsageNote(); return 0; } else if (argv[i][0] == '-') { PutC("unknown option: "); @@ -705,7 +709,7 @@ int main (int argc, char *argv[]) { } home = 1; } - } else { + } else if (strcmp(clcname, "seacmd") == 0) { PutC("seacmd, a sea commandline client (doc: seacmd help)\n"); if (port == -1) { port = 8641; @@ -713,6 +717,14 @@ int main (int argc, char *argv[]) { port += 8640; } home = 1; + } else { + PutC("graphcmd, a graph commandline client (doc: graphcmd help)\n"); + if (port == -1) { + port = 8741; + } else if (port > 0 && port < 9) { + port += 8740; + } + home = 1; } PutC( "---------------------------------------------------\n"); PutC("."); diff --git a/tecs/tecs.c b/tecs/tecs.c index e7fbb6d..8b480e4 100644 --- a/tecs/tecs.c +++ b/tecs/tecs.c @@ -1217,17 +1217,23 @@ int ReadTemp(void) { float Percent2Power(float percent) { float curr; - if (linearPower != 0) { + if (linearPower > 0) { return percent/100*linearPower; } curr=maxCurrent*percent/100; + if (linearPower < 0) { + return curr*sqrt(resist)*powFact; + } return curr*curr*resist*powFact; } float Power2Percent(float power) { - if (linearPower != 0) { + if (linearPower > 0) { return power/linearPower*100; } + if (linearPower < 0) { + return power/powFact/sqrt(resist)/maxCurrent*100; + } return sqrt(power/powFact/resist)/maxCurrent*100; } @@ -1382,18 +1388,19 @@ int SetTemp(int switchOn) { if (ramp < 0) ramp=-ramp; if (ramp < 0.1) ramp=0.1; if (showSet) { - ERR_P(LscCmd(ser, "RAMP [loop]:1,[ramp];SETP [loop],[setH];SETP?[loop]>fbuf")); + fbuf = ramp; } else { ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); if (fabs(fbuf-setH) >= ramp*smooth) { fbuf=ramp; } else { fbuf=sqrt(fabs(fbuf-setH)*ramp/smooth); - if (fbuf<0.1) fbuf=0.1; } - ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]")); - ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); } + fbuf = fbuf / ctlSens->scale; + if (fbuf<0.1) fbuf=0.1; + ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]")); + ERR_P(LscCmd(ser, "SETP?[loop]>fbuf")); tr=TrueScale(ctlSens, fbuf); if (showSet) { logfileOut(LOG_MAIN, "set %g (on %s) %g K/min, starting from %g\n", set, ctlSens->ch, ramp, tr); @@ -1663,8 +1670,11 @@ int ConfigAlarms(float genLimit) { int LoadFromLsc(void) { ERR_P(LscCmd(ser, "PID?[loop]>prop,integ,deriv")); ERR_P(LscCmd(ser, "RAMP?[loop]>,ramp")); + if (ctlSens != NULL) { + ramp *= ctlSens->scale; + } ERR_P(LscCmd(ser, "ANALOG?1>,,,,,,fbuf")); - still=fbuf*fbuf/70; + still=fbuf; return 0; OnError: return -1; } @@ -2920,7 +2930,7 @@ int StillHdl(int mode, void *base, int fd) { if (mode==COC_WR) { return COC_DWR; } else if (mode==COC_DWR) { - fbuf=sqrt(still*70); + fbuf=still; ERR_P(LscCmd(ser,"ANALOG 1:0,2,,,,,[fbuf]")); } return 0;