From 6939d43bd9fe5f9bb1b1a474623075e54683db2f Mon Sep 17 00:00:00 2001 From: David Lutton Date: Tue, 19 Mar 2024 23:57:56 +0000 Subject: [PATCH] Add TTI 1705 & HP 8116 NVRS add calibration data and sensor HW ID --- src/labtoolkit/DigitalMultimeter/TTI1705.py | 17 +++++ src/labtoolkit/PowerMeter/RohdeSchwarzNRVS.py | 22 ++++++- src/labtoolkit/WaveformGenerator/HP8116A.py | 62 ++++++++++++++++++- src/labtoolkit/__init__.py | 1 + 4 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 src/labtoolkit/DigitalMultimeter/TTI1705.py diff --git a/src/labtoolkit/DigitalMultimeter/TTI1705.py b/src/labtoolkit/DigitalMultimeter/TTI1705.py new file mode 100644 index 0000000..5d606a4 --- /dev/null +++ b/src/labtoolkit/DigitalMultimeter/TTI1705.py @@ -0,0 +1,17 @@ +from ..IEEE488 import IEEE488 + + +class TTI1705(IEEE488): + """TTI 1705.""" + + def __post__(self): + self.inst.read_termination = '\r\n' + + @property + def reading(self): + """.""" + read = self.query_float('READ?') + if 'OVLOAD' in read: + return read + else: + return float(read[0:10]), read[10:].strip() diff --git a/src/labtoolkit/PowerMeter/RohdeSchwarzNRVS.py b/src/labtoolkit/PowerMeter/RohdeSchwarzNRVS.py index 4801c29..26c1da7 100644 --- a/src/labtoolkit/PowerMeter/RohdeSchwarzNRVS.py +++ b/src/labtoolkit/PowerMeter/RohdeSchwarzNRVS.py @@ -47,5 +47,25 @@ def frequency(self, frequency): @property def amplitude(self): """.""" - # ' DBM 6.94910E+00' + # ' DBM 6.94910E+00' with N0 headers on return self.query_float('X3') + + @property + def calibration_data(self): + self.write('SI') + return [self.inst.read().strip() for i in range(1,32)] + + @property + def calibration_dates(self): + self.write('S4') + return [self.inst.read().strip() for i in range(1,6)] + + @property + def sensor(self): + # 'NRV-Z5 / nnnnnnnn/nnnnn.nn.nn 3X' + return self.query('SP') + + @property + def setup(self): + # 'A0,AV09,B1,G1,KA0,KF1,M0,N1,O1,Q0,RG0,RS3,SC1,U 1,W5' + return self.query('ST') \ No newline at end of file diff --git a/src/labtoolkit/WaveformGenerator/HP8116A.py b/src/labtoolkit/WaveformGenerator/HP8116A.py index fa64eae..8b5b479 100644 --- a/src/labtoolkit/WaveformGenerator/HP8116A.py +++ b/src/labtoolkit/WaveformGenerator/HP8116A.py @@ -1,6 +1,5 @@ from ..Instrument import Instrument from ..IEEE488 import IEEE488 -from ..SCPI import SCPI class HP8116A(Instrument): @@ -8,5 +7,64 @@ class HP8116A(Instrument): .. figure:: images/WaveformGenerator/HP8116A.jpg """ + """.""" - pass \ No newline at end of file + # self.amps = [0.01, 7] + # self.freqs = [0, 50e6] + + # ' NO MESSAGE' or ' SYNTAX' on inital or following comms + + def __post__(self): + self.inst.read_termination = '\r\n' + self.inst.write_termination = '\r\n' + + def state(self): + """.""" + print(f"Amplitude: {self.amplitude}") + print(f"Frequency: {self.frequency}") + print(f"Shape: {self.shape}") + # print(f"Load: {self.load}") + # print("Output: {}".format(self.output)) + + @property + def frequency(self): + """.""" + return self.query("IFRQ") + + @frequency.setter + def frequency(self, frequency): + self.write(f"FRQ {frequency} Hz") + + @property + def shape(self): + """.""" + # inst.query('W3') # 0, 1,2,3 DC, Sine, Tri, Square + return NotImplementedError # self.query("SOURce:FUNCtion:SHAPe?") + + @shape.setter + def shape(self, shape="SIN"): + # self.write(f"SOURce:FUNCtion:SHAPe {shape}") + pass + + @property + def amplitude(self): + return self.query("IAMP") + + @amplitude.setter + # @AmplitudeLimiter + def amplitude(self, amplitude: + self.write(f"AMP {amplitude} V") + + @property + def offset(self): + return self.query("IOFS") + + @offset.setter + # @AmplitudeLimiter + def offset(self, amplitude: + self.write(f"OFS {amplitude} V") + + @property + def setup(self): + # ' M1,CT0,T0,W0,H0,A0,L0,C0,D0,FRQ 55.0 HZ,DTY 50 %,WID 500 MS,AMP 1.00 V,OFS 7.50 V,' + return self.query('CST') \ No newline at end of file diff --git a/src/labtoolkit/__init__.py b/src/labtoolkit/__init__.py index 1021d8f..41c4a8c 100644 --- a/src/labtoolkit/__init__.py +++ b/src/labtoolkit/__init__.py @@ -296,6 +296,7 @@ def IDN_for_HP(self, inst, resource, mapping, number): ['Hewlett Packard', '34401A', 'DigitalMultimeter', 'HP34401A'], ['Hewlett Packard', '3457A', 'DigitalMultimeter', 'HP3457A'], + ['Thurlby Thandar', '1705', 'DigitalMultimeter', 'TTI1705'], ['Lumiloop', 'LSProbe', 'FieldStrength', 'LumiloopLSProbe'], ['Wandel Goltermann', 'EMC20', 'FieldStrength', 'WandelGoltermannEMC20'],