Commit 4b299253 authored by Marek Gumiński's avatar Marek Gumiński

Python packages installation added to install sctipt.

Removed unused imports from python.
Updated test09 (now renamed to 06).
parent 39f4f710
......@@ -26,6 +26,10 @@ then
fi
fi
apt-get install python-numpy python-scipy python-matplotlib ipython python2-pyro4
apt-get install python-psutil python-dnspython
apt-get install git gitk libusb-dev
# initialise and update repository
git submodule init
git submodule update
......
......@@ -136,7 +136,7 @@ do
echo " "
# run tests
sudo ${top}/pts/ptsFip.py -b FmcMasterFip -s $serial -e $extra_serial -t../python -l $LOGDIR 00 01 02 03 04 05 09
sudo ${top}/pts/ptsFip.py -b FmcMasterFip -s $serial -e $extra_serial -t../python -l $LOGDIR 00 01 02 03 04 05 06
# backup eeprom image
......
......@@ -19,7 +19,7 @@ abspath = util.find_prj_topdir(TOPDIRNAME);
# helper libraries
import numpy
import matplotlib.pyplot as plt
# import matplotlib.pyplot as plt
import shutil
import psutil
import subprocess
......
......@@ -10,7 +10,6 @@ import spec
import fmcmasterfip as fmc
import utilities as util
import ptsexcept
from sympy.physics.units import temperature
......
......@@ -13,6 +13,7 @@ import ptsexcept
import time
DEL = 0.5
NRSAMPLES = 10
def test_sync_output( dut, box ):
......@@ -38,54 +39,91 @@ def test_sync_output( dut, box ):
# connect ADC to secondary transformer side (connected to trigger)
dut.close_relay( 2 )
# wait
time.sleep(DEL)
util.info_msg("")
util.info_msg("Generating low output")
result['Trigger output verified to go low'] = 1
for i in xrange(10):
for i in xrange(NRSAMPLES):
adc_samples = dut.adc_single_sample()
if adc_samples[1] < util.test09_thd:
util.info_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
# util.info_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
util.info_msg("Value read by ADC: %d" %( adc_samples[1] ) )
else:
util.err_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
# util.err_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
util.err_msg("Value read by ADC: %d" %( adc_samples[1] ) )
result['Trigger output verified to go low'] = 0
time.sleep(0.1)
#
util.info_msg("")
util.info_msg("Generating high output")
dut.fipcore.write_regname('ext_sync.output_value', 1)
result['Trigger output verified to go high'] = 1
time.sleep(DEL)
for i in xrange(10):
adc_samples = dut.adc_single_sample()
# sample "1" output generated by sync buffer
# do that for termination enabled and disabled
# with termination enabled registered voltage should about 2x lower
sampled = [0, 0]
for t in xrange(2):
# set termination (0 or 1)
util.info_msg("")
util.info_msg( "Termination : %d" % t)
dut.fipcore.write_regname('ext_sync.term_en', t)
if adc_samples[1] >= util.test09_thd:
util.info_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
for i in xrange(NRSAMPLES):
adc_samples = dut.adc_single_sample()
sampled[t] += adc_samples[1];
else:
util.err_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
result['Trigger output verified to go high'] = 0
time.sleep(0.1)
if adc_samples[1] >= util.test09_thd:
util.info_msg("Value read by ADC: %d" % adc_samples[1] )
else:
util.err_msg("Value read by ADC: %d" % adc_samples[1] )
result['Trigger output verified to go high'] = 0
time.sleep(0.1)
time.sleep(DEL)
util.info_msg("")
util.info_msg("Mean value sampled without termination : %d" % (sampled[0]/NRSAMPLES) )
util.info_msg("Mean value sampled with termination : %d" % (sampled[1]/NRSAMPLES) )
output_ratio_term = float(sampled[0])/float(sampled[1])
if output_ratio_term < util.test09_thdratio :
util.err_msg("Ratio of output value with and without termination is %f. Should be over %f." % ( output_ratio_term, util.test09_thdratio ) )
result['External sync termination'] = 0
else :
util.info_msg("Ratio of output value with and without termination is %f. Should be over %f." % ( output_ratio_term, util.test09_thdratio ) )
result['External sync termination'] = 1
# set output value
dut.fipcore.write_regname('ext_sync.output_value', 0)
time.sleep(DEL)
util.info_msg("")
util.info_msg("Generating low output again")
result['Trigger output verified to go low for the second time'] = 1
for i in xrange(10):
for i in xrange(NRSAMPLES):
adc_samples = dut.adc_single_sample()
util.dbg_msg("Read ADC value: CH1=%d, CH2=%d low trigger output" %( adc_samples[0], adc_samples[1] ) )
if adc_samples[1] < util.test09_thd:
util.info_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
util.info_msg("Value read by ADC: %d" % adc_samples[1] )
else:
util.err_msg("Value read by ADC: CH1=%d, CH2=%d" %( adc_samples[0], adc_samples[1] ) )
util.err_msg("Value read by ADC: %d" % adc_samples[1] )
result['Trigger output verified to go low for the second time'] = 0
time.sleep(0.1)
......
......@@ -6,7 +6,6 @@ import string
import calibr_box
import find_usb_tty
import ptsexcept
from sympy.utilities import randtest
DEBUG = False
......@@ -25,6 +24,7 @@ test05_gensdbfs_path = "/software/fpga-config-space/sdbfs/userspace/gensdbfs"
test05_sdbfs_path = "/python/sdbfs/"
test09_thd = 2000;
test09_thdratio = 1.8
mintemp = 0
maxtemp = 80
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment