new tecs version M.Z.08.2001

This commit is contained in:
cvs
2001-08-16 10:17:09 +00:00
parent b56745eb46
commit 0cda158849
35 changed files with 5289 additions and 2065 deletions

View File

@@ -1,26 +1,33 @@
program tecs_client
real*4 temp(4)
character device*32, init*80, line*80, cmd*16, par*80, response*80
real temp
character device*32, init*80, line*80, cmd*16, par*80, response*1024
integer i,j,k,iret,l
character file*128, cmdpar*128
character cmdpar*128
character prompt*32/'tecs>'/
integer promptlen/6/
logical oneCommand
character logarg*4/'25'/
character defcmd*8/'status'/
! functions
integer tecs_get_par, tecs_quit_server, tecs_send, tecs_set_par
integer tecs_get_par, tecs_quit_server, tecs_set_par, tecs_watch_log
integer tecs_get, show_log
call sys_getenv('TECS_INIT', init)
call sys_get_cmdpar(line, l)
if (l .ne. 0) then
if (line .eq. 'off' .or. line .eq. 'OFF') init=' '
oneCommand=.true.
else
oneCommand=.false.
endif
if (init .eq. ' ') then
call tecs_open(0, ' ', iret)
if (oneCommand .and. line(1:1) .eq. '#') then
call tecs_open(0, line, iret)
oneCommand=.false.
else if (init .eq. ' ') then
call tecs_open(0, line, iret)
else
call tecs_open(1, init, iret)
endif
@@ -38,7 +45,8 @@
print *,'device <device> set cryo device'
print *,'<parameter> show parameter'
print *,'<parameter> <value> set parameter'
print *,'plot temperature and power chart'
print *,'plot <var> chart for temperature and <var>'
1 ,' var = P (default), He, Aux'
print *,'log <n> show last n lines of logfile'
print *,'kill close TecsServer and exit'
print *,'exit,quit exit, but do not close TecsServer'
@@ -47,7 +55,7 @@
l=0
1 if (oneCommand) goto 99
call sys_rd_line(line, l, 'tecs> ')
call sys_rd_line(line, l, prompt(1:promptlen))
if (l .lt. 0) goto 99
11 l=l+1
line(l:l)=' '
@@ -61,44 +69,54 @@
cmd(k:k)=char(ichar(cmd(k:k))+32)
endif
elseif (k .gt. 0) then ! end of command
goto 2
par=' '
do i=j,l
if (line(i:i) .gt. ' ') then
par=line(i:l)
goto 3 ! command with parameter
endif
enddo
goto 2 ! parameterless command
endif
enddo
if (k .eq. 0) then ! empty line
call tecs_get_t(6, temp, iret)
if (iret .ne. 0) goto 1
iret=tecs_get_par('device', device)
if (iret .lt. 0) goto 19
print '(x,3(a,f8.3),2a)','tempX=', temp(3),', tempP=',temp(2)
1 ,', set=',temp(1), ', device=',device
if (k .ne. 0) then
print *,'command too long'
goto 1
endif
print *,'command too long'
goto 1
2 par=' '
do i=j,l
if (line(i:i) .gt. ' ') then
par=line(i:l)
goto 3
endif
enddo
! empty command
! simple query
12 cmd=defcmd
if (cmd .eq. 'kill' .or. cmd .eq. 'off') then
2 continue ! parameterless command
defcmd='status'
if (cmd(1:1) .eq. '#') then
call tecs_close
call tecs_open(0, cmd, iret)
if (iret .lt. 0) goto 91
prompt='tecs/'//cmd(2:)
promptlen=1
do i=1,len(prompt)-2
if (prompt(i:i) .ne. ' ') promptlen=i
enddo
promptlen=promptlen+1
prompt(promptlen:promptlen)='>'
promptlen=promptlen+1
else if (cmd .eq. 'kill') then
iret=tecs_quit_server()
elseif (cmd .eq. 'exit' .or. cmd .eq. 'quit') then
goto 99
elseif (cmd .eq. 'on') then
elseif (cmd .eq. 'status') then
iret=tecs_get_par('status', response, 1)
if (iret .lt. 0) goto 19
elseif (cmd .eq. 'on' .or. cmd .eq. 'off') then
l=0
goto 11
elseif (cmd .eq. 'plot') then
iret=tecs_get_par('dlogfile', file)
if (iret .lt. 0) goto 19
call tecs_plot(file)
call tecs_plot('Tm Ts Tr P', 1)
elseif (cmd .eq. 'help') then
print *
print *,'Writeable parameters:'
@@ -116,9 +134,9 @@
print *
print *,'Read only parameters:'
print *
print *,'tX heat exchanger temperature'
print *,'tS sample temperature'
print *,'tempH set-point on regulation'
print *,'Tm main temperature'
print *,'Ts sample temperature'
print *,'setH set-point on regulation'
print *,'tLimit temperature limit'
print *,'htr heater current percentage'
print *,'resist heater resistance'
@@ -126,10 +144,7 @@
print *,'remoteMode 1: local, 2: remote '
1 ,'(switch on with device command)'
print *
print *,'t1 regulation temperature (hi-T sensor)'
print *,'t2 regulation temperature (low-T sensor)'
print *,'t3 sample temperature (hi-T sensor)'
print *,'t4 sample temperature (low-T sensor)'
print *,'Ta,Tb,Tc,Td values of channels A,B,C,D'
print *
print *,'Temperature devices:'
print *
@@ -139,33 +154,43 @@
print *,'ccr4k (4K closed cycle), hef4c (TriCS 4circle cryo)'
print *,'sup4t (supra.magnet 4T)'
print *,'rdr11, rdr12 (LTF dilution 1 & 2, 20kOhm)'
1 ,', rdrn11_2, rdr12_2 (2kOhm)'
print *
elseif (cmd .eq. 'log') then
iret=tecs_get_par('logfile', file)
if (line(1:l) .eq. ' ') then
print '(x,a)'
1 ,char(27)//'[A'//char(13)//char(27)//'[K'//char(27)//'[2A'
endif
if (show_log(logarg) .le. 0) then
logarg='25'
print *,'-------- end of logfile --------'
goto 12
endif
defcmd='log'
logarg=' '
elseif (cmd .eq. 'watch') then
iret=tecs_watch_log('M')
if (iret .lt. 0) goto 19
call show_log(50, file)
else
iret=tecs_get_par(cmd, response)
iret=tecs_get_par(cmd, response, 2)
if (iret .lt. 0) goto 19
print '(7x,3a)',cmd(1:k),'=',response
endif
goto 1
3 if (cmd .eq. 'send') then
iret=tecs_send(par, response)
3 continue ! command with parameter
if (cmd .eq. 'log') then
if (show_log(par) .gt. 0) then
defcmd='log'
endif
logarg=' '
elseif (cmd .eq. 'plot') then
call tecs_plot('Tm Ts Tr '//par, 1)
elseif (cmd .eq. 'watch') then
iret=tecs_watch_log(par)
if (iret .lt. 0) goto 19
print '(7x,2a)','response: ',response
elseif (cmd .eq. 'log') then
i=50
read(par, *, err=31) i
31 iret=tecs_get_par('logfile', file)
if (iret .lt. 0) goto 19
call show_log(i, file)
else
iret=tecs_set_par(cmd, par)
iret=tecs_set_par(cmd, par, 2)
if (iret .lt. 0) goto 19
print '(7x,3a)',cmd(1:k),':=',par
endif
goto 1
@@ -182,27 +207,21 @@
99 end
subroutine show_log(lines, file)
integer function show_log(lines)
integer lines
character*(*) lines
integer i,l
character str*132, file*(*)
character str*8192
print *
print *
open(1, name=file, status='old', readonly, shared, err=39)
i=0
31 read(1,'(a)',end=32)
i=i+1
goto 31
32 rewind(1)
do i=1,i-lines
read(1,*,end=39)
enddo
33 read(1,'(q,a)',end=39) l,str
print *,str(1:min(len(str),max(1,l)))
goto 33
39 continue
close(1)
! functions
integer tecs_get_par, tecs_set_par
if (lines .ne. ' ') then
l=tecs_set_par('logstart', lines, 0)
print *,'line: ',lines
print *
endif
show_log=tecs_get_par('logline', str, 1)
end