- update instruments configurations

- new six version with status display
- bugfixes on TecsClient
- some changed samp. env. devices
This commit is contained in:
cvs
2003-10-17 09:35:37 +00:00
parent d62d2902ac
commit d63a4a4128
13 changed files with 425 additions and 252 deletions

View File

@ -1,7 +1,4 @@
name=CCR2_T
curv=4
name=CCR2_S ! name (15 char.max.,will be converted to uppercase)
name=CCR2_K ! name (15 char.max.,will be converted to uppercase)
sens=x10409 ! sensor no (max.10 char.)
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=3250 ! setpoint limit (automatic if omitted)
@ -82,7 +79,7 @@ curv ! curve (sensor,temp/K) follows, must be ordered, but can be inc
74.1057045 325.9043579
73.21666644 329.7353821
name=CCR2_M ! name (15 char.max.,will be converted to uppercase)
name=CCR2_S ! name (15 char.max.,will be converted to uppercase)
sens=x24506 ! sensor no (max.10 char.)
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=3250 ! setpoint limit (automatic if omitted)
@ -174,3 +171,95 @@ curv ! curve (sensor,temp/K) follows, must be ordered, but can be inc
47.6297072 321.2613963
46.74933639 328.7765688
name=CCR2_T ! name (15 char.max.,will be converted to uppercase)
sens=x14231 ! sensor no (max. 10 char.)
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
type=Cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
45346.09176 1.198717153
36706.00173 1.298616179
30407.09586 1.399152924
22223.29963 1.598426911
17175.65133 1.799308766
13877.32694 1.997886019
11390.09764 2.214142275
9906.509898 2.389526577
8539.145773 2.601747251
7516.284525 2.807291184
6744.498808 3.002487122
6100.009293 3.202475086
5551.381013 3.408289164
5108.853651 3.606142735
4731.042051 3.80500669
4416.159886 3.996132283
4143.794235 4.185137213
3640.535495 4.616513504
3268.12937 5.022147341
2899.676365 5.528662912
2512.606636 6.240495878
2185.580383 7.048665902
1886.592014 8.061087557
1663.486413 9.078580603
1490.913956 10.09831729
1353.808309 11.11262662
1241.978882 12.12053341
1149.175518 13.12453255
1070.200846 14.12385451
1002.590927 15.11930797
943.6033917 16.10992155
891.7175592 17.09784756
845.6352302 18.08488235
804.3306007 19.07335027
767.1307438 20.05756306
730.1316279 21.14546834
682.2281523 22.72983276
640.2446923 24.32652476
602.3359845 25.96250613
568.6695509 27.61161933
538.8443318 29.24410485
508.9742411 31.06754222
478.3257114 33.18021519
440.5589996 36.18972271
408.6376322 39.17322288
381.0960781 42.16172046
356.9619405 45.16110987
335.7847002 48.16065735
323.0015773 50.15751877
295.0585709 55.15427778
271.5202017 60.15845647
251.4849869 65.1554738
234.261859 70.15087616
219.2208675 75.13817156
206.0170192 80.13574238
193.8353068 85.35591401
183.8447324 90.12851069
174.4541594 95.12557876
165.9511715 100.1241728
150.2884406 110.7809236
138.8086112 120.1158899
128.2784478 130.1156516
119.2281279 140.1168039
111.3536703 150.1159926
104.4582753 160.1113105
98.36914182 170.1119695
92.95834383 180.1280541
88.13033956 190.1264348
83.79340557 200.1354211
79.87162555 210.1502982
76.35426251 220.1464909
73.13678899 230.1446765
70.20472384 240.142717
67.52770935 250.1298551
65.07150159 260.1424032
62.80585804 270.1413526
60.72207723 280.1360821
58.80254217 290.1099663
57.01318852 300.1296204
55.36154863 310.1251632
54.56232509 315.1323273
53.81080087 320.1337028
52.93912804 326.1023799
52.36765678 330.1165788
name=CCR2_M ! name (15 char.max.,will be converted to uppercase)
curv=4

View File

@ -184,25 +184,25 @@ curv ! curve (sensor,temp/K) follows, must be ordered, but can be inc
4.927322 331.981
name=MA09_T ! name (15 char.max.,will be converted to uppercase)
sens=Cplus45
sens=Cplus70
unit=Ohm
type=C
form=loglog
curv
50045 1
6545 2
2245 3
1145 4.2
670 6
395 10
295 15
255 20
225 27
205 35
185 50
169 77
161 100
152 150
148 200
143 300
50070 1
6570 2
2270 3
1170 4.2
695 6
420 10
320 15
280 20
250 27
230 35
210 50
194 77
186 100
177 150
173 200
168 300
135 500

View File

@ -52,8 +52,13 @@
+13, 'ccr4k' m dev="4 K closed cycle refrigerator"
tlimit=310 resist=25 maxPower=100
prop=50 int=20 deriv=0
+28,-28 'ccr2' mts_ dev="4 K closed cycle refrigerator (FOCUS)"
tlimit=330 resist=25 maxPower=100
+28,-28 'ccr2' t_ks dev="4 K closed cycle refrigerator (FOCUS)"
tlimit=700 resist=25 maxPower=100
sensA.alarm=310
prop=50 int=20 deriv=0
+28,-28 'ccr2ht' tmks dev="4 K closed cycle refrigerator (FOCUS) with hi-T stage"
tlimit=700 resist=25 maxPower=100
sensA.alarm=310
prop=50 int=20 deriv=0
+14,-11,'hef4c' mns dev="He-flow 4 circle cryostat"
tlimit=310 resist=50 maxPower=25
@ -91,12 +96,14 @@
tlimit=310 resist=50 maxpower=50 controlmode=0
sensA.lim=50 sensB.lim=60
prop=25 int=10 deriv=0
+27, 'ma11' t dev="SANS test carbon resistors" config=ma11.cfg
+23,-23,'ma02' m_s dev="1.8 T horizontal cryomagnet (Risoe)"
tlimit=310 resist=50 maxpower=50
prop=15 int=10 deriv=0
+90, 'variox' ms dev="variox cryostat/dilution (Risoe)"
tlimit=375 resist=16 maxpower=25
prop=50 int=10 deriv=0
+90, 'dil' __s dev="dilution (Risoe)"
+91, 'rdr11' m dev="LTF dilution cryostat"
tlimit=12.0 resist=708 maxPower=0.01 powfact=0.03
sensA.scale=0.01 config=rdr.cfg

View File

@ -1,127 +1,94 @@
name=VARIOX_M ! name (15 char.max.,will be converted to uppercase
sens=rhfe0734 ! sensor no (max.10 char.)
sens=x12533 ! sensor no (max.10 char.)
unit=Ohm ! sensor format (mV,V,Ohm), log formats are choosen automatically
!tlim=3250 ! setpoint limit (automatic if omitted)
type=RhFe ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
type=Cernox ! sensor type (Special,Si,GaAlAs,Pt250,Pt500,Pt2500,RhFe,C,Cernox,RuOx,Ge) (special if omitted)
!excit=300uA ! (off,30nA,100nA,300nA,1uA,3uA,10uA,30uA,100uA,300uA,1mA,10mV,1mV) (if omitted: default from sensor type)
!range=0 ! range in sensor units (if rang=0: determine range from table, if omitted: default from sensor type)
curv ! curve (sensor,temp/K) follows, must be ordered, but can be increasing or decreasing
+1.68 0.5831
+1.73 0.8616
+1.78 1.1426
+1.83 1.4276
+1.88 1.7179
+1.93 2.0148
+1.98 2.3195
+2.03 2.6331
+2.08 2.957
+2.13 3.292
+2.18 3.6391
+2.23 3.9993
+2.28 4.3734
+2.33 4.7622
+2.38 5.1668
+2.43 5.5881
+2.48 6.0273
+2.53 6.4856
+2.58 6.9644
+2.63 7.465
+2.68 7.9888
+2.73 8.5374
+2.78 9.1123
+2.83 9.7149
+2.88 10.3469
+2.93 11.0099
+2.98 11.7059
+3.03 12.4366
+3.08 13.2041
+3.13 14.0107
+3.18 14.8583
+3.23 15.7491
+3.28 16.685
+3.33 17.6671
+3.38 18.6961
+3.43 19.7717
+3.48 20.8922
+3.53 22.0546
+3.58 23.254
+3.63 24.4842
+3.68 25.7372
+3.73 27.0041
+3.78 28.275
+3.83 29.5403
+3.88 30.7913
+3.93 32.0212
+3.98 33.2277
+4.03 34.4064
+4.08 35.5549
+4.13 36.6724
+4.18 37.7591
+4.23 38.8156
+4.28 39.8428
+4.33 40.8421
+4.43 42.7622
+4.53 44.5869
+4.63 46.3269
+4.73 47.992
+4.83 49.5908
+4.93 51.1309
+5.03 52.6189
+5.13 54.0603
+5.23 55.4602
+5.33 56.8226
+5.43 58.1513
+5.53 59.4494
+5.63 60.7198
+5.73 61.9649
+5.83 63.1869
+5.93 64.3876
+6.03 65.5689
+6.13 66.7323
+6.23 67.8791
+6.33 69.0106
+6.43 70.1279
+6.53 71.232
+6.63 72.324
+6.73 73.4046
+6.83 74.4746
+6.93 75.5348
+7.03 76.5858
+7.13 77.6282
+7.23 78.6626
+7.33 79.6895
+7.43 80.7094
+7.53 81.7228
+7.63 82.7301
+7.73 83.7316
+7.83 84.7278
+7.93 85.7189
+8.03 86.7054
+8.13 87.6875
+8.23 88.6655
+8.33 89.6396
+9.33 99.2177
+10.33 108.6138
+11.33 117.9369
+12.33 127.252
+13.33 136.5978
+14.33 145.9964
+15.33 155.4592
+16.33 164.9901
+17.33 174.5886
+18.33 184.251
+19.33 193.9718
+20.33 203.7444
+21.33 213.5617
+22.33 223.4166
+23.33 233.3019
+24.33 243.211
+25.33 253.1376
+26.33 263.076
+27.33 273.0207
+29.33 292.9108
+31.33 312.7801
+33.33 332.6028
58491.11567 1.212535322
47949.5449 1.302323103
39259.49409 1.40324533
28281.43621 1.600896776
21767.98069 1.795822322
17155.67121 2.008253574
14213.75553 2.204490304
12007.63886 2.406743169
10415.31809 2.599679828
9105.003941 2.805752277
8097.388389 3.006976485
7291.357363 3.205610991
6646.490487 3.398921728
6076.028335 3.602926254
5637.018504 3.787533283
5214.064508 3.994657993
4839.768732 4.207356453
4501.690135 4.432101488
4057.668994 4.784009218
3511.923839 5.342074394
2973.614912 6.100896835
2579.128549 6.871365786
2207.384439 7.865557909
1915.850175 8.940035343
1726.748344 9.848879814
1563.465412 10.82483435
1418.13084 11.9001646
1316.964373 12.79871416
1224.187029 13.76333618
1139.695628 14.78597641
1069.281285 15.77101898
1010.884223 16.69764805
957.2041233 17.6546526
907.944238 18.63812733
863.1087092 19.63531017
814.3069506 20.84896278
757.6393844 22.4640255
710.4887602 24.00959301
665.7070891 25.68195915
627.583247 27.29504395
593.4598081 28.91486263
556.2805114 30.91711807
522.5368408 32.97060394
477.5900412 36.16845131
442.8664029 39.07749367
411.6814887 42.11124992
384.9241731 45.10907555
360.8523969 48.1827774
346.3993674 50.23285484
315.6773941 55.20724106
290.0937236 60.16088295
267.7935066 65.242836
249.4506493 70.1031723
233.2979124 75.00526047
218.8083315 80.00709915
205.717029 85.11898804
194.3976616 90.08143997
184.3289633 95.00944519
174.4566698 100.3590927
158.5832207 110.3372612
145.2116141 120.3833885
133.8192793 130.4760437
124.1684502 140.4295197
115.6706335 150.5550842
108.2798297 160.5835495
101.75565 170.6484222
95.95185322 180.7810669
90.8262136 190.7918854
86.2172275 200.8603973
82.03414533 210.9830551
78.2895644 221.0397034
74.89527823 231.0341873
71.75384718 241.2140121
68.9091264 251.3133316
66.30965093 261.3838348
63.91098586 271.4609528
61.72845994 281.4719086
59.67628607 291.6222687
57.78058314 301.7855835
56.02719573 311.8906708
55.19537744 316.946228
54.39166232 321.9963684
53.63383002 326.9981842
name=VARIOX_S ! name (15 char.max.,will be converted to uppercase)
sens=RX1976 ! sensor no (max.10 char.)
@ -172,3 +139,4 @@ curv ! curve mV,K (200 kOhm Range)
28.67 3.75
28.57 4.00
28.27 4.20
25.00 10.0

View File

@ -5,7 +5,7 @@ AMOR@lnsa14:bin/ DMC@lnsa05:bin/ FOCUS@lnsa16:bin/ \
HRPT@lnsa11:bin/ TASP@lnsa12:bin/ TRICS@lnsa18:bin/ \
lnslib@lnsa15:bin/ \
type@linux \
TOPSI@pc4120:topsi_sics/ SANS@pc3965:sans_sics/ \
TOPSI@pc4120:topsi_sics/ SANS@pc3965:sans_sics/ SANS2@sans2:sans2_sics/ \
)
set dests=""
@ -28,7 +28,7 @@ foreach dest ($destlist)
endif
end
set items=(TecsServer TecsClient six cfg)
set items=(TecsServer TecsClient six keep_running cfg)
echo ""
echo " all $items"

View File

@ -10,7 +10,8 @@ typedef struct { char *instr; char *host; int port; char *user; int cod; } Instr
static Instrument list[]={
{ "DMC", "lnsa05.psi.ch", 9753, "DMC" , 1},
{ "TOPSI", "pc4120.psi.ch", 9753, "TOPSI" , 1},
{ "SANS", "sans.psi.ch", 9753, "SANS" , 1},
{ "SANS", "sans.psi.ch", 9753, "SANS" , 1},
{ "SANS2", "sans2.psi.ch", 9753, "SANS2" , 1},
{ "HRPT", "lnsa11.psi.ch", 9753, "HRPT" , 1},
{ "TRICS", "lnsa18.psi.ch", 9753, "TRICS" , 1},
{ "AMOR", "lnsa14.psi.ch", 9753, "AMOR" , 1},
@ -18,8 +19,8 @@ static Instrument list[]={
{ "TASP", "lnsa12.psi.ch", 9753, "TASP", 1},
{ "TASP0", "lnsa09.psi.ch", 9753, NULL , 0},
{ "RITA", "pc4345.psi.ch", 9753, NULL , 0},
{ "PREP", "lnsa15.psi.ch", 9753, "lnslib", 2},
{ "AREA", "lnsa15.psi.ch", 9751, "lnslib", 2},
{ "PREP", "lnsa15.psi.ch", 9753, "lnsg" , 2},
{ "AREA", "lnsa15.psi.ch", 9751, "lnsg" , 2},
{ "TEST", "lnsa15.psi.ch", 9755, "lnslib", 2}
};

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[]) {
} else {
arg="";
}
str_append(cmd, "bin/startecs");
str_append(cmd, "/data/lnslib/bin/startecs");
secure_arg(cmd, sizeof(cmd), arg);
str_append(cmd, "\n");
} else {

View File

@ -46,51 +46,102 @@ int CocCreateSockAdr(
return 0;
}
int readWrite(int fd, int skip) {
char msg[128];
int l, i, go, iret, ires, n;
char* readWrite(int fd, int tmo, int skip, char *find) {
char msg[256];
int l, lbuf, pos, i, go, iret, n, ga;
char *p, chr;
static char result[256];
int match;
static int laststat=0;
/*
* read from fd and write to stdout until a key pressed,
* a timeout occured (1 or 5 sec.), or a <go ahead> message
* a timeout occurred (tmo [msec]), or a <go ahead> message
* received.
* skip=0: timeout 1 sec (normal behaviour)
* skip>0: timeout 10 sec.
* skip>1: swallow text
* skip=1,2: return 0 if SICS not found in message text
* skip=3: return 0 if not acknowledged
* skip=0: skip response that does not match
* skip=1: skip all responses
*
* if the response starts with the contents of find
* the second part of the line is returned
* if the response contain the contents of find, but not at the beginning
* "1" is returned
* if the text is not found, or find=NULL, an empty line is returned
*/
n=0;
go=0;
ires=0;
iret=term_wait_fd(fd, skip?10000:1000);
while (iret==1) {
ERR_SI(l=recv(fd, msg, sizeof(msg)-1, 0));
/* if (l==0) return(0); */
msg[l]='\0';
if (skip==3) {
if (NULL!=strstr(msg, "Acknowledged")) ires=1;
} else if (skip==1 || skip==2) {
if (NULL!=strstr(msg, "SICS")) ires=1;
}
for (i=0; i<l-1; i++) {
if (msg[i]==-1 && msg[i+1]==-7) { /* go ahead */
go=1;
msg[i]='<'; msg[i+1]='>';
ga=0;
str_copy(result, "");
iret=term_wait_fd(fd, tmo);
while (iret>0) {
pos=0;
ERR_SI(lbuf=recv(fd, &chr, 1, 0));
if (lbuf==0) return "0";
while (lbuf>0) {
if (chr<' ') {
if (chr=='\n') break;
if (chr==-1) {
ga=1;
} else if (chr==-7 && ga) {
go=1; break;
} else {
ga=0;
if (chr!='\r') {
msg[pos++]=chr;
}
}
} else {
go=0;
msg[pos++]=chr;
}
iret=term_wait_fd(fd, tmo);
if (iret!=1) break;
ERR_SI(lbuf=recv(fd, &chr, 1, 0));
}
msg[pos]='\0';
/* printf("[%s]\n", msg); */
match=0;
if (find != NULL) {
p=strstr(msg, find);
if (p!=NULL) { /* copy message to result */
if (p==msg) {
str_copy(result, msg+strlen(find));
p=strchr(result,'\r');
if (p != NULL) *p='\0';
} else {
str_copy(result, "1");
}
match=1;
if (find==strstr(find,"status")) {
if (result[0]=='E') {
tmo=100;
} else if (laststat!=result[0]) {
laststat=result[0];
go=1;
}
}
}
}
if (skip<2 || skip==2 && ires==0) {
fputs(msg, stdout);
} else {
if (skip || match) { /* skip text */
n+=strlen(msg);
} else {
term_clear();
fputs(msg, stdout);
if (chr=='\n') fputs("\n", stdout);
}
if (go) break;
iret=term_wait_fd(fd, skip?10000:1000);
iret=term_wait_fd(fd, tmo);
}
if (n==0 && ires==1) return 1;
return ires*n;
OnError: return -1;
if (iret==0) laststat=0;
return result;
OnError: return NULL;
}
int sendCmd(int fd, char *cmd) {
int l;
char buf[256];
ERR_I(str_copy(buf, cmd));
ERR_I(str_append(buf, "\r\n"));
ERR_SI(l=send(fd, buf, strlen(buf), 0));
return l;
OnError: return -1;
}
void Usage(void) {
@ -105,18 +156,20 @@ int main (int argc, char *argv[]) {
fd_set mask;
int fd, l, i, j, port, skip;
char buf[128], lbuf[16], ibuf[64], ilow[64];
char *rights, *instr, *sim="", *us, *ps;
char stdPrompt[128], prompt[256], instr[32];
char *rights, *sim="", *us, *ps;
char *p, *statusMatch;
struct sockaddr_in sadr;
port=1301;
skip=2;
skip=1;
j=0;
for (i=1; i<argc; i++) {
if (0==strcmp(argv[i], "-s")) {
port=1303; sim="-sim";
} else if (0==strcmp(argv[i], "-w")) {
skip=1;
skip=0;
} else {
if (strlen(argv[i])>=32) {
printf("argument too long\n");
@ -139,23 +192,32 @@ int main (int argc, char *argv[]) {
printf("missing password\n");
Usage(); return 0;
}
/*
instr=getenv("Instrument");
if (instr==NULL || instr[0]=='\0') {
printf("Instrument is undefined\n");
Usage(); return 0;
}
*/
ERR_I(CocCreateSockAdr(&sadr, "0", port));
ERR_SI(fd=socket(AF_INET, SOCK_STREAM, 0));
term_reg_socket(fd);
ERR_SI(connect(fd, (struct sockaddr *)&sadr, sizeof(sadr)));
strcpy(buf, "sicslogin Spy 007\r\n");
ERR_SI(send(fd, buf, strlen(buf), 0));
ERR_I(i=readWrite(fd,skip));
if (!i) {
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==2) printf("reading welcome message ...\n");
if (skip) printf("reading welcome message ...\n");
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;
}
if (j==0) {
rights=getenv("six_rights");
if (rights!=NULL && 0==strcmp(rights, instr)) {
@ -168,62 +230,64 @@ int main (int argc, char *argv[]) {
ps="03lns1";
}
}
sprintf(buf, "config Rights %s %s\r\n", us, ps);
ERR_SI(send(fd, buf, strlen(buf), 0));
ERR_I(i=readWrite(fd,3));
if (!i && 0 != strcmp(instr, "TASP")) {
printf("password guess failed, logged in as Spy\n\n");
Usage();
if (NULL == strstr(instr, "TASP")) {
sprintf(buf, "config Rights %s %s", us, ps);
ERR_I(sendCmd(fd, buf));
ERR_P(p=readWrite(fd,10000,0,"Acknowledged"));
if (*p=='\0') {
printf("password guess failed, logged in as Spy\n\n");
Usage();
us="Spy";
}
} else {
us="Spy";
}
printf("\rlogged in to SICS as %s on %s%s\n", us, instr, sim);
/*
if (*sim!='\0') {
strcpy(buf, "sync\r\n");
ERR_SI(send(fd, buf, strlen(buf), 0));
printf("\rsynchronize ...\n");
ERR_I(i=readWrite(fd,1));
}
*/
printf("\rlogged in to SICS as %s on %s\n", us, instr);
str_lowcase(ilow,instr);
sprintf(stdPrompt, "six[%s] ", ilow);
ERR_I(sendCmd(fd, "status interest"));
ERR_P(readWrite(fd,10000,0,"OK"));
ERR_I(sendCmd(fd, "status"));
ERR_P(p=readWrite(fd,10000,0,"status = "));
iret=1;
buf[0]='\0';
pos=0;
str_lowcase(ilow,instr);
sprintf(ibuf, "six[%s%s] ", ilow, sim);
while (1) {
if (*p=='E') { /* Eager to ... */
strcpy(prompt, stdPrompt);
} else if (*p>'1') {
sprintf(prompt, "%s(%s) ", stdPrompt, p);
}
FD_ZERO(&mask);
FD_SET(fd, &mask);
iret=term_get_line(buf, sizeof(buf)-2, &pos, ibuf, &mask);
iret=term_get_line(buf, sizeof(buf)-2, &pos, prompt, &mask);
if (iret==STDIN_FILENO) { /* input line terminated */
str_lowcase(lbuf, buf);
if (0==strcmp(lbuf,"quit")) break;
if (0==strcmp(lbuf,"exit")) break;
statusMatch="status = ";
if (0==strcmp(lbuf,"stop")) {
strcpy(buf, "INT1712 3");
} else if (0==strcmp(buf, "")) {
strcpy(buf, "status");
statusMatch=NULL;
}
fputs("\n", stdout);
skip=0;
if (0==strcmp(lbuf,"sync")) {
printf("\rsynchronize ...\n");
skip=1;
}
l=strlen(buf);
/*
printf("sent> %s[%d chars]\n", buf, l);
*/
buf[l]=13;
buf[l+1]=10;
ERR_SI(send(fd, buf, l+2, 0));
ERR_I(i=readWrite(fd,skip));
ERR_I(sendCmd(fd, buf));
ERR_P(p=readWrite(fd,1000,skip,statusMatch));
buf[0]='\0';
pos=0;
} else if (iret<0) { /* ?? */
printf("\nwhat?\n"); exit(1);
} else { /* socket iret ready to read */
assert(fd==iret);
ERR_I(readWrite(fd,0));
ERR_P(p=readWrite(fd,1000,0,"status = "));
}
}
fputs("\n", stdout);

View File

@ -60,6 +60,7 @@ static SensorT
*heliumSens=NULL,
*auxSens=NULL,
*testSens=NULL,
*test2Sens=NULL,
*sens=&sensA;
typedef struct {
@ -107,6 +108,7 @@ static float
tx=DATA_UNDEF, /* controlled temperature */
tr=DATA_UNDEF, /* set temperature (read back) */
te=DATA_UNDEF, /* test temperature */
tk=DATA_UNDEF, /* test temperature 2 */
he=DATA_UNDEF, /* helium level value */
aux=DATA_UNDEF, /* auxiliary value */
ramp=0,
@ -582,7 +584,7 @@ int PrepInput(char *label) {
s=sensors[i];
typ=chans[i];
if (typ=='_') typ='\0';
if (NULL==strchr("mnslhxft", typ)) ERR_MSG("unknown channel type code");
if (NULL==strchr("mnslhxftk", typ)) ERR_MSG("unknown channel type code");
if (typ!='\0') {
s->present=-1;
}
@ -711,6 +713,10 @@ void LogMinMax(int new) {
sprintf(buf1, " Te %.5g", te);
str_append(buf, buf1);
}
if (tk!=DATA_UNDEF) {
sprintf(buf1, " Tk %.5g", tk);
str_append(buf, buf1);
}
} else if (nScan==0) {
return;
}
@ -954,6 +960,11 @@ int ReadTemp(void) {
} else {
te=DATA_UNDEF;
}
if (test2Sens != NULL) {
tk=test2Sens->t * test2Sens->scale;
} else {
tk=DATA_UNDEF;
}
if (heliumSens == NULL) {
he=DATA_UNDEF;
}
@ -1305,6 +1316,7 @@ int Settings(void) {
heliumSens=NULL;
auxSens=NULL;
testSens=NULL;
test2Sens=NULL;
for (i=0; i<4+nScan; i++) {
s=sensors[i];
if (s->present==1) {
@ -1327,6 +1339,8 @@ int Settings(void) {
auxSens=s;
} else if ('t'==typ) {
testSens=s;
} else if ('k'==typ) {
test2Sens=s;
}
s->band=10;
}
@ -1389,6 +1403,11 @@ int Settings(void) {
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;
@ -1493,7 +1512,7 @@ int ConfigByName(int plugNr) {
int PeriodicTask(void) {
char buf[256], lbuf[16];
char *next, *alms;
int i, k;
int i, k, iret;
float t3[3], p, d, w, t;
if (nScan==0) {
@ -1508,8 +1527,10 @@ 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,serialNo,"));
if (0!=strcmp(buf1, "LSCI") || 0!=strcmp(buf2, "MODEL340") || serialNo==0) return 0;
ERR_P(LscCmd(ser, "*IDN?>buf1,buf2,buf3,"));
serialNo=1;
sscanf(buf3, "%d", &serialNo); /* illegal serial No. will be 1 for buggy controller */
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");
@ -2159,6 +2180,9 @@ int StatusHdl(int mode, void *base, int fd) {
if (testSens!=NULL) {
ERR_I(ShowSensor(&buf, testSens, "T", "K", 0));
}
if (test2Sens!=NULL) {
ERR_I(ShowSensor(&buf, test2Sens, "T", "K", 0));
}
for (i=4; i<4+nScan; i++) {
ERR_I(ShowSensor(&buf, sensors[i], "T", "K", 0));
}
@ -2401,6 +2425,7 @@ int main(int argc, char *argv[]) {
CocDefFlt(tr, RD);
CocDefFlt(tx, RD);
CocDefFlt(te, RD);
CocDefFlt(tk, RD);
CocDefFlt(aux, RD);
CocDefFlt(he, RD);
CocDefFlt(fbuf, RD);
@ -2568,6 +2593,7 @@ int main(int argc, char *argv[]) {
ERR_P(DataCreateSet(NULL, "Ts", &ts, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "Tr", &tr, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "Te", &te, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "Tk", &tk, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "He", &he, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "T1", &sensA1.t, 5, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "T2", &sensA2.t, 5, LOGLIFETIME, tim));

View File

@ -16,6 +16,29 @@ static char response[COC_RES_LEN];
static char *rwCode="rwacs";
static char *rdCode="rdacs";
pTecsClient TeccStart(char *startcmd, char *host, int port) {
CocConn *conn;
char *code, *cmd, thishost[64], *th;
int iret;
NEW(conn, CocConn);
code=rwCode;
cmd=startcmd;
if (host[0]!='\0') {
gethostname(thishost, sizeof(thishost));
th=getenv(thishost);
if (th==NULL) th=thishost;
if (0!=strcmp(th, host)) {
code=rdCode;
cmd="";
}
}
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);
}
pTecsClient TeccInit(char *startcmd, int port) {
CocConn *conn=NULL;
char *code, host[64];
@ -37,27 +60,6 @@ pTecsClient TeccInit(char *startcmd, int port) {
return(NULL);
}
pTecsClient TeccStart(char *startcmd, char *host, int port) {
CocConn *conn;
char *code, *cmd, thishost[64];
int iret;
NEW(conn, CocConn);
code=rwCode;
cmd=startcmd;
if (host[0]!='\0') {
gethostname(thishost, sizeof(thishost));
if (0!=strcmp(thishost, host)) {
code=rdCode;
cmd="";
}
}
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);
}
int TeccGet3(pTecsClient conn, float *tC, float *tX, float *tP) {
int iret;

View File

@ -3,7 +3,7 @@
character*(*) auxpar
integer dmax, nmax, tmax, amax, nmenu, chartperiod, naux
parameter (dmax=400, nmax=9, tmax=8, amax=3, nmenu=13
parameter (dmax=400, nmax=10, tmax=9, amax=3, nmenu=13
1 , chartperiod=5, naux=1)
integer minRange, maxRange, oneDay
parameter (minRange=60, maxRange=7*24*3600, oneDay=24*3600)
@ -20,7 +20,7 @@
integer l,j,i,n,t,leng,i1,i2,rl,startday,thisday
integer ncol, nset, mode
integer first,last,step,tbase,lastj
integer colorList(nmax)/5,3,2,4,6,8,14,15,8/
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/
@ -43,7 +43,7 @@
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','T1','T2','T3','T4'/
character*4 tpar(tmax)/'Te','Tr','Tm','Ts','Tk','T1','T2','T3','T4'/
character*4 apar(amax)/'P', 'He', 'Aux'/
character*16 parnam(nmax)
logical gap, done
@ -75,7 +75,7 @@
print *,'No PGPLOT-Device defined'
goto 9
endif
call sys_setenv('PGPLOT_DEV', device)
call sys_setenv('PGPLOT_DEV', '/'//device)
endif
call pgqcol(i,ncol)
@ -728,7 +728,7 @@
real*4 xd(dmax,nmax), yd(dmax,nmax)
integer oneDay, maxn
parameter (oneDay = 24*3600, maxn=9)
parameter (oneDay = 24*3600, maxn=10)
integer tecs_get_data
integer i,j,rl(maxn),m,k,n,mm

View File

@ -104,7 +104,13 @@ int term_get_key(char *key, int msecTmo) {
} else if (k >= 'l' && k <= 'y') {
k=k-64;
} else {
k='?';
switch (k) { /* L,R,U,D arrows */
case 'D': k=L_ARROW; break;
case 'C': k=R_ARROW; break;
case 'A': k=U_ARROW; break;
case 'B': k=D_ARROW; break;
default: k='?';
}
}
break;
case '\177': /* del */
@ -132,6 +138,14 @@ static char *history[HISTORY_LINES]={NULL};
static int hist_pos=0; /* position when scrolling through the history */
static int hist_end=0; /* end of history. Always history[hist_end]==NULL */
static int dirty=0; /* line is to be cleared through a call of term_clear_line */
void term_clear(void) {
if (dirty) {
fputs("\r\033[K", stdout);
dirty=0;
}
}
int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask) {
char key, *lin;
@ -166,13 +180,13 @@ int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask) {
}
switch (key) {
case EVT_CHAR:
fputs("\r\033[K", stdout);
/* caller must clear line before next write with term_clear() */
dirty=1;
return(iret);
/* interrupted EXIT */
case RET_CHAR:
/* fputs("\r\033[K", stdout); */
i=hist_end-1; if (i<0) i=HISTORY_LINES-1;
if ((history[i]==NULL || 0!=strcmp(history[i], buf)) && buf[0]!='\0') { /* do not save equal and empty lines */
buflen=strlen(buf)+1;

View File

@ -14,6 +14,8 @@ int term_wait_fd(int fd, int msecTmo);
int term_get_key(char *key, int msecTmo);
void term_clear(void);
int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask);
#endif /* TERM_H_ */