on the fly

This commit is contained in:
2025-07-21 17:10:50 +02:00
parent 730aa61789
commit 7adf4bf452
6 changed files with 30 additions and 9 deletions

7
cfg/frappy_test_cfg.py Normal file
View File

@@ -0,0 +1,7 @@
import frappy.core as fc
import TNMRExt.FlexibleModule as mod
Node('example_TNMR.psi.ch', 'The NMR system running the Scout and controlled with TNMR', interface='tcp://5000')
Mod('sequence0', mod.flexible_module('D:\\Users\\Garrad\\sequence_0.tps', 's0'), 'The zeroth sequence')
Mod('sequence1', mod.flexible_module('D:\\Users\\Garrad\\sequence_1.tps', 's1'), 'The first sequence')

View File

@@ -16,7 +16,7 @@ if('Razorbill' in enabled_modules):
Mod('io_razorbill',
'frappy_psi.uniaxial_cell.RP100.RP100IO',
'communication',
uri='serial://COM10?baudrate=9600+bytesize=8+parity=none+stopbits=1')
uri='serial://COM3?baudrate=9600+bytesize=8+parity=none+stopbits=1')
Mod('RP100Node_CH1', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH1)', channel=1, io='io_razorbill')
Mod('RP100Node_CH2', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH2)', channel=2, io='io_razorbill')
@@ -25,10 +25,10 @@ if('Capacitance' in enabled_modules):
Mod('io_capacitance',
'frappy_psi.capacitance_readings.TSSOP16.TSSOP16_IO',
'communication',
uri='serial://COM11?baudrate=9600+bytesize=8+parity=none+stopbits=1')
uri='serial://COM4?baudrate=9600+bytesize=8+parity=none+stopbits=1')
Mod('TSSOP16', 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16', 'Capacitance-reading Arduino (with TSSOP16)', io='io_capacitance')
# ZVL Network Analyser
if('NetAnalyser' in enabled_modules):
Mod('ZVLNode', 'frappy_psi.network_analysers.ZVL.ZVLNode.ZVLNode', 'ZVL Network Analyser', analyser_ip=Param('169.254.150.182')) # must be connected on the same ethernet network
Mod('ZVLNode', 'frappy_psi.network_analysers.ZVL.ZVLNode.ZVLNode', 'ZVL Network Analyser', analyser_ip=Param('129.129.156.201')) # must be connected on the same ethernet network

View File

@@ -1,17 +1,19 @@
import serial
import time
import traceback
from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Property, IntRange, IDLE, BUSY, WARN, ERROR, Drivable, BoolType, Attached
class TSSOP16_IO(StringIO):
end_of_line = '\r'
wait_before = 3.0
wait_before = 0.0 #3.0
identification = [ ('*IDN?', r'0x48,ACM1219,.*') ]
class TSSOP16(HasIO, Readable):
'''only configured for channel 1'''
ioClass = TSSOP16_IO
value = Parameter('capacitance', FloatRange(unit='pF'), readonly=True)
value = Parameter('value', FloatRange(unit='pF'), readonly=True)
pollinterval = Parameter(default=0.1)
def read_value(self):
@@ -19,8 +21,10 @@ class TSSOP16(HasIO, Readable):
l = self.communicate('readCVT')
vals = l.split(',')
vals = [ float(v) for v in vals ]
#print(vals)
return vals[0]
except:
traceback.print_exc()
self.io.closeConnection()
self.io.connectStart()
time.sleep(3.0)

View File

@@ -31,7 +31,8 @@ class ZVLNetAnalyzer():
self.base_data = self.get_data()[1]
def reset(self):
self.instrument.write('*RST')
#self.instrument.write('*RST')
#self.instrument.write('SYST:PRES') # reloads current setup.
self.instrument.write('*CLS')
self.instrument.write('INST:NSEL 2')
self.instrument.write('DISPlay:WINDow1:STATe ON')
@@ -112,7 +113,10 @@ class ZVLNetAnalyzer():
data = self.format_data(data)
freqs = self.format_data(freqs, complex=False)
total_data += data
try:
total_data += data
except:
total_data = data
total_data /= averaging_passes
self.base_data = data

View File

@@ -36,7 +36,8 @@ class ZVLNode(fc.Readable):
self.NA = ZVLNetAnalyzer(self.analyser_ip)
self.NA.reset()
self.acq()
@fc.Command(description="Update data")
def acq(self):
self.status = ('BUSY', 'acquiring')
self.NA.set_freq_span(self.central_freq, self.freq_span)
@@ -56,4 +57,8 @@ class ZVLNode(fc.Readable):
def write_analyser_ip(self, ip):
self.analyser_ip = ip
self.connect()
return self.read_analyser_ip()
return self.read_analyser_ip()
def read_value(self):
#self.acq()
return self.value

View File

@@ -178,6 +178,7 @@ class TNMR:
print('ZG completed')
else:
print('An acquisition is already running')
return
if(CHECK_MODE == 'data'):
elapsed = 0