what we did so far is:
We use a RedPitaya STEMIlab 125-10 a measuring amplifier and a acceleration sensor from Wilcoxon 731A. We changed configuration of the RedPitaya so the SCPI Server is part of the autostart procedure. The measuring amplifier amplifies the signal up to +/- 10V. This Signla goes into the RF input 1 (we changed the jumper to the +/- 20V). With the python script beneath we´d like to log the amplitude of the Floor Vibration, the script itself works mostly fine, we have just one problem left. After a irregular time-span the script crashes.
Code: Select all
#Importing Modules
import redpitaya_scpi as scpi
import sys
import time
import os
import subprocess
#Global Variabls
#Defining the Functions
#Update Loop Function
def updating(counter, lastbuffer):
counter=counter
lastbuffer=lastbuffer
#collecting data
rp_s.tx_txt('ACQ:SOUR1:DATA?')
buff_string=rp_s.rx_txt()
#working with data
buff_string=buff_string.replace("{","")
buff_string=buff_string.replace("}","")
buff_list = buff_string.split(",")
buff_string=buff_string.replace(",",", \n")
buff_list=[float(i) for i in buff_list]
average=sum(buff_list)/len(buff_list)
maximum=max(buff_list)
minimum=min(buff_list)
amplitude=maximum-minimum
#collecting cernel temp
coretemp=subprocess.check_output("/home/redpitaya/bin/get_temp.sh", shell=True)
#Saving amplitude
timestamp=time.strftime("%d:%m:%Y %H:%M:%S" , time.localtime())
save=""
save=timestamp + "\t" + str(amplitude) + "\t" + coretemp[6:11] + "\n"
AMPLITUDE.write(save)
# saving one buffer
# if amplitude>0.5 and counter-lastbuffer>3:
# BUFFERTIMESTAMP=time.strftime("%d_%m_%Y %H_%M_%S" , time.localtime())
# BUFFERNAMESTAMP=BUFFERTIMESTAMP + " Buffer"
# BUFFERFULLPATHNAME="/home/redpitaya/guest_share/" + BUFFERNAMESTAMP
# BUFFER=open(BUFFERFULLPATHNAME, mode="w", buffering=1)
# BUFFER.write(buff_string)
# BUFFER.close()
# print("Its over 9000!")
# lastbuffer=counter
#display
print(amplitude)
TIMESTAMP=time.strftime("%d_%m_%Y %H_%M_%S" , time.localtime())
print(TIMESTAMP)
print(coretemp)
#Sleep
time.sleep(2)
counter=counter+1
return (counter, lastbuffer)
#closing one log
def closeLog():
AMPLITUDE.close()
#main
#mounting guestshare
mount=subprocess.Popen("mount_guest_share.sh")
mount.wait()
#Configuring Aquistion
rp_s = scpi.scpi(sys.argv[1])
rp_s.tx_txt('ACQ:DEC 65536')
rp_s.tx_txt('ACQ:START')
#starting the mainloop
print("Please enter your amplification factor:")
GAIN=input()
GAIN=str(GAIN)
while True:
#Oeffnen der Logdatei
TIMESTAMP=time.strftime("%d_%m_%Y %H_%M_%S" , time.localtime())
NAMESTAMP=TIMESTAMP + " Amplitudes"
FULLPATHNAME="/home/redpitaya/guest_share/" + NAMESTAMP
AMPLITUDE=open(FULLPATHNAME, mode="w", buffering=1 )
#Schreiben des Header
AMPLITUDE.write("timestamp [dd:mm:yyyy HH:MM:SS] \t amplitude [V] \t coretemp [C] \t Gain: "+ GAIN +"\n")
AMPLITUDE.write("\n")
counter=0
lastbuffer=0
while counter<40000:
(counter, lastbuffer)=updating(counter, lastbuffer)
AMPLITUDE.close()
We log the cortemp because we thought it could be a heading problem. We changed the passiv cooling of the aluminium case to an active one. But that was not the central issue.
Feel free to comment our work or maybe better help us with the debugging.
I am looking forward fore your tip and comments
Regards from Germany
P L