diff --git a/cfg/psi_nmr_setup_cfg.py b/cfg/psi_nmr_setup_cfg.py index 02f57fc2..3089ea44 100644 --- a/cfg/psi_nmr_setup_cfg.py +++ b/cfg/psi_nmr_setup_cfg.py @@ -1,19 +1,34 @@ import frappy.core as fc +enabled_modules = [ 'TNMR', 'Razorbill', 'Capacitance', 'NetAnalyser' ] # default +#enabled_modules = [ 'Capacitance' ] + Node('uniaxial_nmr.psi.ch', - 'The NMR system running the Scout and controlled with TNMR. Also contains a uniaxial cell (Razorbill RP100), and a network analyser (ZVL)', + 'The NMR system running the Scout and controlled with TNMR. Also contains a uniaxial cell (Razorbill RP100), a network analyser (ZVL), and a capacitance reader (for more direct measurements of the strain cell\'s status) (TSSOP16 with Arduino Nano V3)', interface='tcp://5000') # TNMR -#Mod('tnmr_otf_module', 'frappy_psi.tnmr.OTFModule.ProgrammedSequence', 'NMR Sequence') +if('TNMR' in enabled_modules): + Mod('tnmr_otf_module', 'frappy_psi.tnmr.OTFModule.ProgrammedSequence', 'NMR Sequence') # Razorbill RP100 -Mod('io1', - 'frappy_psi.uniaxial_cell.RP100.RP100IO', - 'communication', - uri='serial://COM10?baudrate=9600+bytesize=8+parity=none+stopbits=1') -Mod('RP100Node_CH1', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH1)', channel=1, io='io1') -Mod('RP100Node_CH2', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH2)', channel=2, io='io1') +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') + 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') + +# Capacitance readings (TSSOP16 with Arduino Nano V3) +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') + + Mod('TSSOP16', 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16', 'Capacitance-reading Arduino (with TSSOP16)', io='io_capacitance') # ZVL Network Analyser -#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 \ No newline at end of file +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 \ No newline at end of file diff --git a/cfg/tssop16_cfg.py b/cfg/tssop16_cfg.py new file mode 100644 index 00000000..8a3a477a --- /dev/null +++ b/cfg/tssop16_cfg.py @@ -0,0 +1,11 @@ +import frappy.core as fc +import serial + +Node('example_TSSOP16.psi.ch', 'A demo system showing how to connect the TSSOP16 Arduino', interface='tcp://5000') + +Mod('io1', + 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16_IO', + 'communication', + uri='serial://COM11?baudrate=9600+bytesize=8+parity=none+stopbits=1') + +Mod('TSSOP16', 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16', 'Capacitance-reading Arduino (with TSSOP16)', io='io1') \ No newline at end of file diff --git a/frappy_psi/capacitance_readings/TSSOP16.py b/frappy_psi/capacitance_readings/TSSOP16.py new file mode 100644 index 00000000..2d35e63d --- /dev/null +++ b/frappy_psi/capacitance_readings/TSSOP16.py @@ -0,0 +1,20 @@ +import serial + +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' + 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) + pollinterval = Parameter(default=0.1) + + def read_value(self): + l = self.communicate('readCVT') + vals = l.split(',') + vals = [ float(v) for v in vals ] + return vals[0] \ No newline at end of file diff --git a/frappy_psi/tnmr/OTFModule.py b/frappy_psi/tnmr/OTFModule.py index d240f6bf..164d484f 100644 --- a/frappy_psi/tnmr/OTFModule.py +++ b/frappy_psi/tnmr/OTFModule.py @@ -232,6 +232,7 @@ class ProgrammedSequence(fc.Readable): filename = filepath + '/sequences/' + filename.replace('.','') seq_gen.save_sequence(filename, seq) seq_gen.save_sequence_cfg(filename, seq) + print(filename) dashboard_params = { 'Observe Freq.': self.read_obs_freq(), 'Scans 1D': self.read_num_scans(), @@ -247,6 +248,7 @@ class ProgrammedSequence(fc.Readable): # then, load the thing into TNMR self.tnmr().load_sequence(filename) + print(filename) # load some parameters back to TNMR for key, val in dashboard_params.items():