#!/usr/bin/kermit + set line /dev/ttyS0 set speed 9600 set flow

Anuncio
#!/usr/bin/kermit +
set
set
set
set
set
set
line /dev/ttyS0
speed 9600
flow-control xon/xoff
carrier-watch off
receive timeout 7
retry 1
;definiciones
if defined \%1 {.\%b := \%1} else {.\%b
echo tiempo de muestreo \%b
if defined \%2 {.\%a := \%2} else {.\%b
echo incremento del volaje \%a
if defined \%3 {.\%c := \%3} else {.\%c
echo Voltaje maximo aplicado \%c V
if defined \%4 {.\%d := \%4} else {.\%d
echo threshold \%d
if defined \%5 {.\%f := \%5} else {.\%f
echo entrada pmt \%f
if defined \%6 {.\%e := \%6}
echo directorio /datos/\%e
:= }
:= 100}
:= 1500}
:= 10}
:= 1}
mkdir /home/lago/datos/\%e
cd /home/lago/datos/\%e
;!touch Parametros
;run echo 'Tiempo de muestreo '\%b' seg' >> Parametros
;run echo 'Voltaje aplicado al PTM '\%c' V' >> Parametros
;run echo 'Threshold '\%d >> Parametros
;run echo 'Entrada PMT '\%f >> Parametros
;este macro se encarga de la comprobacion de que el login este en pantalla
define usuario {
echo buscando el user
for \%k 1 10 1 {
; Try up to 10 times to get login prompt
input 2 {User name?:}
; Wait 1 sec for it to appear
if success break
; Got it - proceed...
lineout
; Send a carriage return and try again
}
if ( < \%k 10 ) {
lineout super
lineout auger
for \%t 1 5 1 {
; Try up to 5 times to get lago.tar
lineout dir -u
input 1 {calib.tar}
; Wait 1 sec for it to appear
if success break
; Got it - proceed...
lineout
; Send a carriage return and try again
}
if ( > \%t 5 ) {
lineout kermit ri
msend /home/lago/calib.tar
lineout tar xvf calib.tar
lineout attr -e *
} else {
echo calib.tar ya esta
}
}
}
define vpmtup {
for \%u 1 5 1 {
lineout pm -p \%f
input 2 {= 2 V}
if success break
}
if ( < \%u 5 ) {
echo subiendo voltaje
lineout pm -p \%2 -s 20
input 1 {pm -p}
SLEEP 2
lineout pm -p \%2 -s 70
input 1 {pm -p}
SLEEP 2
.\%j := 100
while ( <= \%j \%1 ) {
lineout pm -p \%2 -s \%j
input 1 {pm -p}
SLEEP 2
incr \%j 100
}
if ( != \%j \%1 ) {
.\%j := \%1
echo \%j
lineout pm -p \%2 -s \%j
input 1 {pm -p}
}
}
}
define vpmtdw{
echo bajando voltaje
.\%j := \%1
while ( >= \%j 100 ) {
lineout pm -p \%2 -s \%j
input 1 {pm -p}
SLEEP 2
incr \%j -100
}
lineout pm -p \%2 -s 80
input 1 {pm -p}
SLEEP 2
lineout pm -p \%2 -s 20
input 1 {pm -p}
}
.\%z := 800
mkdir charge
;
!touch charge/charge_tiempos
;
run echo 'medida fecha seg' >> charge/charge_tiempos
mkdir peak
;
!touch peak/peak_tiempos
;
run echo 'medida fecha seg' >> peak/peak_tiempos
mkdir trace
;
!touch trace/trace_tiempos
;
run echo 'medida fecha seg' >> trace/trace_tiempos
echo empezando
while <= \%z \%c {
usuario
echo voltaje hasta \$z
vpmtup \%z \%f
lineout del *.dat
lineout calib -z
lineout calib -x calib.rbf
echo comenzando a tomar datos
lineout calib -p \%f -t \%d -e 10000000 -s \%b -v
for \%k 0 \%b 1 {
input 1 {calib -p}
}
echo enviando charge-\%z
lineout kermit s charge.dat
receive
echo enviando peak-\%z
lineout kermit s peak.dat
receive
for \%j 1 4 1 {
input 1 {Auger LS :}
if success break
lineout
; Try up to 4 times to get Auger LS
; Wait 1 sec for it to appear
; Got it - proceed...
; Send a carriage return and try again
}
if ( < \%j 4 ) {
lineout del *.dat
lineout calib -p \%f -t \%d -e 1000 -d -v
for \%q 1 80 1 {
; Try up to 4 times to get Auger LS
input 1 {Done}
; Wait 1 sec for it to appear
if success break
; Got it - proceed...
lineout
; Send a carriage return and try again
sleep 5
}
echo enviando trace-\%z
lineout kermit s trace.dat
receive
sleep 5
echo moviendo la data
mv charge.dat charge/charge_\%z_V.dat
mv peak.dat peak/peak_\%z.dat
mv trace.dat trace/trace_\%z.dat
vpmtdw \%z \%f
incr \%z \%a
echo reiniciando
lineout reboot
sleep 60
}
}
quit
Descargar