Skip to content
Snippets Groups Projects
Commit 380190e7 authored by Alexandros Asonitis's avatar Alexandros Asonitis
Browse files

class test hp3497a

parent d618a835
Branches
No related tags found
No related merge requests found
...@@ -232,7 +232,7 @@ class hp3497a(object): ...@@ -232,7 +232,7 @@ class hp3497a(object):
Description Description
----------- -----------
The Digital Close (DC) command is used with the actuator assemblies. The Digital Close (DC) command is used with the actuator assemblies.
For the actuator/digital assembly (Option 110) DC connects the normal open (NO) position relay to common For the actuator/digital assembly (Option 110) DC connects the normal open (NO) position relay to common (bit 1)
Notes Notes
----- -----
...@@ -240,9 +240,9 @@ class hp3497a(object): ...@@ -240,9 +240,9 @@ class hp3497a(object):
2) Up to 16 channels may be included in the DC command 2) Up to 16 channels may be included in the DC command
3) Power On State : All relays in Normal Closed position 3) Power On State : All relays in Normal Closed position
""" """
command = "DC" command = f"DC{slot},"
for i,channel in enumerate(channels): for i,channel in enumerate(channels):
if i != len(channels-1): if i != len(channels)-1:
command = command + f"{channel}," command = command + f"{channel},"
else: else:
command = command + f"{channel}" command = command + f"{channel}"
...@@ -269,7 +269,7 @@ class hp3497a(object): ...@@ -269,7 +269,7 @@ class hp3497a(object):
Description Description
---------- ----------
DO connects the normal open position of the channel relay(s) addressed to common DO connects the normal closed position of the channel relay(s) addressed to common (bit 0)
Channel relays not specified in the DO command remain in the previous state Channel relays not specified in the DO command remain in the previous state
Notes Notes
...@@ -279,13 +279,14 @@ class hp3497a(object): ...@@ -279,13 +279,14 @@ class hp3497a(object):
3) Power On State : All relays in Normal Closed position 3) Power On State : All relays in Normal Closed position
""" """
command = "DO" command = f"DO{slot},"
for i,channel in enumerate(channels): for i,channel in enumerate(channels):
if i != len(channels-1): if i != len(channels)-1:
command = command + f"{channel}," command = command + f"{channel},"
else: else:
command = command + f"{channel}" command = command + f"{channel}"
print(command)
self.inst.write(command) self.inst.write(command)
...@@ -420,7 +421,7 @@ class hp3497a(object): ...@@ -420,7 +421,7 @@ class hp3497a(object):
""" """
VT1 = INTERNAL (auto from hp3497a (power on)) VT1 = INTERNAL (auto from hp3497a (power on))
VT2 = EXTERNAL (external from trigger pulses) VT2 = EXTERNAL (external from trigger pulses)
VT3 = SOFTWARE (Trigger and get the number of readings set by Vn) VT3 = SOFTWARE (Trigger and get the number of readings set by VNn)
VT4 = HOLD VT4 = HOLD
""" """
self.inst.write(f"VT{mode}") self.inst.write(f"VT{mode}")
......
...@@ -35,6 +35,12 @@ class keithley224(object): ...@@ -35,6 +35,12 @@ class keithley224(object):
self.inst.timeout = None self.inst.timeout = None
self.inst.control_ren(5) #local lockout blocks the tool self.inst.control_ren(5) #local lockout blocks the tool
self.inst.clear() #reset the device
self.operate = False
self.current = 0
self.voltage = 3
self.time = 50e-3
def display(self,number): def display(self,number):
""" """
Change the front display panel Change the front display panel
...@@ -92,6 +98,7 @@ class keithley224(object): ...@@ -92,6 +98,7 @@ class keithley224(object):
sci_value = "{:.4E}".format(value) #according to tool manual for current sci_value = "{:.4E}".format(value) #according to tool manual for current
self.inst.write(f"I{sci_value}X") self.inst.write(f"I{sci_value}X")
self.current = value
def set_voltage_limit(self,value): def set_voltage_limit(self,value):
""" """
...@@ -105,6 +112,7 @@ class keithley224(object): ...@@ -105,6 +112,7 @@ class keithley224(object):
""" """
sci_value= "{:.2E}".format(value) #manual format for voltage sci_value= "{:.2E}".format(value) #manual format for voltage
self.inst.write(f"V{sci_value}X") self.inst.write(f"V{sci_value}X")
self.voltage = value
def set_time(self,value): def set_time(self,value):
""" """
...@@ -117,6 +125,7 @@ class keithley224(object): ...@@ -117,6 +125,7 @@ class keithley224(object):
""" """
sci_value = "{:.3E}".format(value) # manual format for dwell time sci_value = "{:.3E}".format(value) # manual format for dwell time
self.inst.write(f"W{sci_value}X") self.inst.write(f"W{sci_value}X")
self.time = value
def __del__(self): def __del__(self):
""" """
...@@ -139,6 +148,18 @@ class keithley224(object): ...@@ -139,6 +148,18 @@ class keithley224(object):
return I,V,W return I,V,W
def change_operation_mode(self):
"""
Changes the operation mode
Standby -> On
On -> Standby
"""
if self.operate == True:
self.set_operation(0)
self.operate = False
else:
self.set_operation(1)
self.operate = True
......
%% Cell type:code id:4d4cbcef-908f-4cd0-89be-790fccb51cb3 tags: %% Cell type:code id:4d4cbcef-908f-4cd0-89be-790fccb51cb3 tags:
``` python ``` python
import keithley224_lib import keithley224_lib
import time
k224 = keithley224_lib.keithley224() k224 = keithley224_lib.keithley224()
time.sleep(5)
``` ```
%% Cell type:code id:0c6838bc tags: %% Cell type:code id:0c6838bc tags:
``` python ``` python
k224.set_current(50e-3) k224.set_current(50e-3)
``` ```
%% Cell type:code id:b8ed02bc tags: %% Cell type:code id:b8ed02bc tags:
``` python ``` python
k224.set_time(999e-3) k224.set_time(999e-3)
``` ```
%% Cell type:code id:d01b65c4 tags: %% Cell type:code id:d01b65c4 tags:
``` python ``` python
k224.display(0) k224.display(2)
``` ```
%% Cell type:code id:0f0ae471 tags: %% Cell type:code id:0f0ae471 tags:
``` python ``` python
k224.set_operation(1) k224.set_operation(1)
``` ```
%% Cell type:code id:077207eb tags: %% Cell type:code id:077207eb tags:
``` python ``` python
k224.set_range(0) k224.set_range(0)
``` ```
%% Cell type:code id:871f6c1c tags: %% Cell type:code id:871f6c1c tags:
``` python ``` python
k224.set_voltage_limit(5) k224.set_voltage_limit(5)
``` ```
%% Cell type:code id:ae19a392 tags: %% Cell type:code id:ae19a392 tags:
``` python ``` python
i,v,w = k224.read_parameters() i,v,w = k224.read_parameters()
``` ```
%% Cell type:code id:da3d49f4 tags: %% Cell type:code id:da3d49f4 tags:
``` python ``` python
print(i) print(i)
print(v) print(v)
print(w) print(w)
``` ```
%% Output %% Output
0.05 0.05
5.0 5.0
0.999 0.999
%% Cell type:code id:80ea11ce tags: %% Cell type:code id:f742d0fc-e66d-4c28-a3eb-9d69b9c88326 tags:
``` python ``` python
time.sleep(10)
del k224 del k224
``` ```
%% Cell type:code id:89c69ed9-d327-4718-9db3-e6a652965808 tags:
``` python
k224.change_operation_mode()
```
%% Cell type:code id:2c453ade-c9d3-440b-9a10-c25b880f7093 tags:
``` python
```
......
%% Cell type:code id:49a73163-c563-41e6-92fd-7b96fa3a9543 tags:
``` python
import hp3497a_lib
```
%% Cell type:code id:7caab834-2486-4f97-ad31-d8c78c4fb5f0 tags:
``` python
daq = hp3497a_lib.hp3497a()
```
%% Cell type:code id:2bc34995-c7e4-4280-86f1-fdc0f7f112c7 tags:
``` python
print(daq.__doc__)
```
%% Output
This is a the control class of hp3497a based on the command directory that can be found in the manual HP3497A Operating Programming and Configuration Chapter 6
Commands That are not stil present in this library:
1) Analog External Increment (page 287)
2) Counter Functions (Pages 291-295)
3) Digital Interrupt commands (Page 297,page 299)
4) Service Request Enable (Pages 303-304)
5) System Lock (Page 305)
6) Status Register Read (Page 308)
7) System Write (Page 310)
7) Timer Commands (Page 310-314)
8) Irrelevant Voltmeter Commands
%% Cell type:code id:424cb55d-ccf0-4ec7-b0e4-2d22bf30f35d tags:
``` python
daq.digital_viewed_slot(3)
```
%% Cell type:code id:77514d49-5d12-45e8-99b3-411b12ed0ee6 tags:
``` python
"""import time
t1 = time.time()
print(t1)
for i in range(2**16):
octal = format(i,'o')
daq.digital_write(3,octal)
t2= time.time()
print(t2-t1)
963s to test all combinations instantely
"""
```
%% Output
"import time\nt1 = time.time()\nprint(t1)\nfor i in range(2**16):\n octal = format(i,'o')\n daq.digital_write(3,octal)\n\nt2= time.time()\n\nprint(t2-t1)\n\n963s to test all combinations instantely\n"
%% Cell type:code id:a1c4949a-08c9-4989-b70c-1ddb16cad226 tags:
``` python
daq.digital_close(3,1,2,3)
```
%% Cell type:code id:e25d363d-96ed-426f-a62c-62dcfc5d4e1b tags:
``` python
daq.voltmeter_trigger(1)
```
%% Cell type:code id:6f5a44fb-266a-4ca3-b4d5-1697c7460822 tags:
``` python
daq.analog_input(0)
```
%% Cell type:code id:a68427e3-04b3-4e5f-b2d8-9176fb47aa19 tags:
``` python
daq.analog_reset()
```
%% Cell type:code id:4f2238db-7813-4bde-af6d-cd756caa8751 tags:
``` python
daq.digital_viewed_slot("")
```
%% Cell type:code id:58990b95-64e8-42e6-b9c2-e888f65119be tags:
``` python
import time
t_end = time.time() + 30
while time.time()<=t_end:
print(daq.inst.read().strip())
```
%% Output
+0.39157E+0
+0.39171E+0
+0.39184E+0
+0.39198E+0
+0.39211E+0
+0.39224E+0
+0.39238E+0
+0.39251E+0
+0.39264E+0
+0.39278E+0
+0.39290E+0
+0.39304E+0
+0.39316E+0
+0.39330E+0
+0.39342E+0
+0.39355E+0
+0.39369E+0
+0.39382E+0
+0.39395E+0
+0.39409E+0
+0.39422E+0
+0.39436E+0
+0.39449E+0
+0.39462E+0
+0.39476E+0
+0.39489E+0
+0.39501E+0
+0.39515E+0
+0.39528E+0
+0.39542E+0
+0.39554E+0
+0.39568E+0
+0.39580E+0
+0.39593E+0
+0.39607E+0
+0.39619E+0
+0.39632E+0
+0.39646E+0
+0.39659E+0
+0.39673E+0
+0.39686E+0
+0.39699E+0
+0.39712E+0
+0.39725E+0
+0.39739E+0
+0.39753E+0
+0.39765E+0
+0.39779E+0
+0.39792E+0
+0.39806E+0
+0.39819E+0
+0.39833E+0
+0.39845E+0
+0.39859E+0
+0.39872E+0
+0.39886E+0
+0.39899E+0
+0.39913E+0
+0.39925E+0
+0.39939E+0
+0.39952E+0
+0.39965E+0
+0.39978E+0
+0.39991E+0
+0.40005E+0
+0.40018E+0
+0.40031E+0
+0.40044E+0
+0.40057E+0
+0.40070E+0
+0.40083E+0
+0.40096E+0
+0.40109E+0
+0.40122E+0
+0.40136E+0
+0.40149E+0
+0.40162E+0
+0.40175E+0
+0.40188E+0
+0.40202E+0
+0.40215E+0
+0.40228E+0
+0.40241E+0
+0.40254E+0
+0.40268E+0
+0.40281E+0
+0.40294E+0
+0.40307E+0
+0.40320E+0
+0.40334E+0
+0.40346E+0
+0.40360E+0
+0.40372E+0
+0.40386E+0
+0.40399E+0
+0.40412E+0
+0.40425E+0
+0.40439E+0
+0.40451E+0
+0.40466E+0
+0.40479E+0
+0.40492E+0
+0.40505E+0
+0.40518E+0
+0.40531E+0
+0.40545E+0
+0.40558E+0
+0.40572E+0
+0.40584E+0
+0.40598E+0
+0.40611E+0
+0.40624E+0
+0.40638E+0
+0.40651E+0
+0.40664E+0
+0.40677E+0
+0.40690E+0
+0.40705E+0
+0.40718E+0
+0.40731E+0
+0.40744E+0
+0.40758E+0
+0.40771E+0
+0.40785E+0
+0.40798E+0
+0.40811E+0
+0.40824E+0
+0.40837E+0
+0.40850E+0
+0.40863E+0
+0.40876E+0
+0.40889E+0
+0.40903E+0
+0.40916E+0
+0.40928E+0
+0.40942E+0
+0.40954E+0
+0.40968E+0
+0.40981E+0
+0.40995E+0
+0.41008E+0
+0.41021E+0
+0.41034E+0
+0.41047E+0
+0.41060E+0
+0.41074E+0
+0.41086E+0
+0.41101E+0
+0.41113E+0
+0.41126E+0
+0.41140E+0
+0.41152E+0
+0.41166E+0
+0.41179E+0
+0.41192E+0
+0.41206E+0
+0.41218E+0
+0.41232E+0
+0.41244E+0
+0.41257E+0
+0.41271E+0
+0.41283E+0
+0.41297E+0
+0.41309E+0
+0.41322E+0
+0.41337E+0
+0.41348E+0
+0.41362E+0
+0.41374E+0
+0.41388E+0
+0.41401E+0
+0.41414E+0
+0.41427E+0
+0.41440E+0
+0.41453E+0
+0.41467E+0
+0.41480E+0
+0.41493E+0
+0.41506E+0
+0.41520E+0
+0.41534E+0
+0.41547E+0
+0.41560E+0
+0.41573E+0
+0.41586E+0
+0.41598E+0
+0.41610E+0
+0.41623E+0
+0.41636E+0
+0.41649E+0
+0.41662E+0
+0.41676E+0
+0.41689E+0
+0.41703E+0
+0.41716E+0
+0.41729E+0
+0.41742E+0
+0.41756E+0
+0.41768E+0
+0.41783E+0
+0.41796E+0
+0.41809E+0
+0.41822E+0
+0.41836E+0
+0.41849E+0
+0.41863E+0
+0.41875E+0
+0.41888E+0
+0.41900E+0
+0.41913E+0
+0.41926E+0
+0.41939E+0
+0.41952E+0
+0.41965E+0
+0.41978E+0
+0.41992E+0
+0.42004E+0
+0.42019E+0
+0.42032E+0
+0.42046E+0
+0.42059E+0
+0.42073E+0
+0.42086E+0
+0.42099E+0
+0.42112E+0
+0.42126E+0
+0.42138E+0
+0.42151E+0
+0.42165E+0
+0.42177E+0
+0.42191E+0
+0.42202E+0
+0.42215E+0
+0.42229E+0
+0.42241E+0
+0.42256E+0
+0.42268E+0
+0.42281E+0
+0.42294E+0
+0.42306E+0
+0.42319E+0
+0.42332E+0
+0.42344E+0
+0.42358E+0
+0.42370E+0
+0.42383E+0
+0.42396E+0
+0.42410E+0
+0.42424E+0
+0.42436E+0
+0.42450E+0
+0.42463E+0
+0.42476E+0
+0.42491E+0
+0.42503E+0
+0.42516E+0
+0.42530E+0
+0.42543E+0
+0.42557E+0
+0.42569E+0
+0.42582E+0
+0.42596E+0
+0.42609E+0
+0.42622E+0
+0.42635E+0
+0.42649E+0
+0.42662E+0
+0.42675E+0
+0.42688E+0
+0.42701E+0
+0.42714E+0
+0.42728E+0
+0.42740E+0
+0.42754E+0
+0.42766E+0
+0.42779E+0
+0.42792E+0
+0.42805E+0
+0.42818E+0
+0.42831E+0
+0.42844E+0
+0.42857E+0
+0.42870E+0
+0.42883E+0
+0.42896E+0
+0.42910E+0
+0.42922E+0
+0.42935E+0
+0.42948E+0
+0.42961E+0
+0.42973E+0
+0.42987E+0
+0.43000E+0
+0.43013E+0
+0.43025E+0
+0.43039E+0
+0.43052E+0
+0.43065E+0
+0.43078E+0
+0.43091E+0
+0.43104E+0
+0.43118E+0
+0.43130E+0
+0.43143E+0
+0.43156E+0
+0.43169E+0
+0.43183E+0
+0.43195E+0
+0.43208E+0
+0.43221E+0
+0.43234E+0
+0.43248E+0
+0.43261E+0
+0.43274E+0
+0.43287E+0
+0.43301E+0
+0.43314E+0
+0.43327E+0
+0.43340E+0
+0.43354E+0
+0.43366E+0
+0.43381E+0
+0.43393E+0
+0.43407E+0
+0.43420E+0
+0.43432E+0
+0.43445E+0
+0.43458E+0
+0.43471E+0
+0.43484E+0
+0.43497E+0
+0.43511E+0
+0.43523E+0
+0.43537E+0
+0.43550E+0
+0.43563E+0
+0.43576E+0
+0.43589E+0
+0.43602E+0
+0.43615E+0
+0.43628E+0
+0.43641E+0
+0.43654E+0
+0.43667E+0
+0.43681E+0
+0.43693E+0
+0.43706E+0
+0.43719E+0
+0.43732E+0
+0.43745E+0
+0.43758E+0
+0.43771E+0
+0.43783E+0
+0.43797E+0
+0.43810E+0
+0.43823E+0
+0.43836E+0
+0.43848E+0
+0.43861E+0
+0.43875E+0
+0.43887E+0
+0.43900E+0
+0.43912E+0
+0.43926E+0
+0.43939E+0
+0.43952E+0
+0.43964E+0
+0.43977E+0
+0.43991E+0
+0.44004E+0
+0.44016E+0
+0.44029E+0
+0.44042E+0
+0.44055E+0
+0.44067E+0
+0.44080E+0
+0.44093E+0
+0.44106E+0
+0.44119E+0
+0.44133E+0
+0.44145E+0
+0.44159E+0
+0.44171E+0
+0.44184E+0
+0.44198E+0
+0.44211E+0
+0.44224E+0
+0.44237E+0
+0.44250E+0
+0.44263E+0
+0.44276E+0
+0.44289E+0
+0.44302E+0
+0.44315E+0
+0.44328E+0
+0.44341E+0
+0.44354E+0
+0.44367E+0
+0.44380E+0
+0.44393E+0
+0.44405E+0
+0.44418E+0
+0.44430E+0
+0.44444E+0
+0.44457E+0
+0.44469E+0
+0.44482E+0
+0.44495E+0
+0.44508E+0
+0.44521E+0
+0.44533E+0
+0.44546E+0
+0.44559E+0
+0.44572E+0
+0.44585E+0
+0.44597E+0
+0.44610E+0
+0.44623E+0
+0.44637E+0
+0.44650E+0
+0.44662E+0
+0.44675E+0
+0.44688E+0
+0.44701E+0
+0.44714E+0
+0.44727E+0
+0.44740E+0
+0.44753E+0
+0.44766E+0
+0.44779E+0
+0.44792E+0
+0.44805E+0
+0.44817E+0
+0.44830E+0
+0.44843E+0
+0.44856E+0
+0.44869E+0
+0.44882E+0
+0.44894E+0
+0.44908E+0
+0.44921E+0
+0.44934E+0
+0.44947E+0
+0.44959E+0
+0.44972E+0
+0.44985E+0
+0.44997E+0
+0.45012E+0
+0.45024E+0
+0.45037E+0
+0.45050E+0
+0.45063E+0
+0.45076E+0
+0.45089E+0
+0.45102E+0
+0.45115E+0
+0.45127E+0
+0.45141E+0
+0.45153E+0
+0.45167E+0
+0.45179E+0
+0.45192E+0
+0.45205E+0
+0.45218E+0
+0.45231E+0
+0.45245E+0
+0.45257E+0
+0.45270E+0
+0.45283E+0
+0.45296E+0
+0.45309E+0
+0.45322E+0
+0.45335E+0
+0.45347E+0
+0.45360E+0
+0.45373E+0
+0.45385E+0
+0.45398E+0
+0.45411E+0
+0.45425E+0
+0.45437E+0
+0.45450E+0
+0.45463E+0
+0.45476E+0
+0.45489E+0
+0.45502E+0
+0.45514E+0
+0.45527E+0
+0.45540E+0
+0.45553E+0
+0.45565E+0
+0.45578E+0
+0.45591E+0
+0.45604E+0
+0.45617E+0
+0.45629E+0
+0.45642E+0
+0.45655E+0
+0.45667E+0
+0.45680E+0
+0.45693E+0
+0.45705E+0
+0.45718E+0
+0.45731E+0
+0.45744E+0
+0.45759E+0
+0.45771E+0
+0.45784E+0
+0.45797E+0
+0.45810E+0
+0.45823E+0
+0.45835E+0
+0.45848E+0
+0.45862E+0
+0.45874E+0
+0.45888E+0
+0.45900E+0
+0.45913E+0
+0.45927E+0
+0.45939E+0
+0.45952E+0
+0.45964E+0
+0.45977E+0
+0.45990E+0
+0.46002E+0
+0.46016E+0
+0.46028E+0
+0.46042E+0
+0.46054E+0
+0.46067E+0
+0.46081E+0
+0.46093E+0
+0.46106E+0
+0.46119E+0
+0.46131E+0
+0.46145E+0
+0.46158E+0
+0.46171E+0
+0.46184E+0
+0.46197E+0
+0.46210E+0
+0.46222E+0
+0.46235E+0
+0.46248E+0
+0.46261E+0
+0.46274E+0
+0.46286E+0
+0.46300E+0
+0.46312E+0
+0.46325E+0
+0.46338E+0
+0.46351E+0
+0.46363E+0
+0.46377E+0
+0.46389E+0
+0.46402E+0
+0.46414E+0
+0.46428E+0
+0.46441E+0
+0.46453E+0
+0.46466E+0
+0.46478E+0
+0.46491E+0
+0.46506E+0
+0.46518E+0
+0.46531E+0
+0.46543E+0
+0.46557E+0
+0.46570E+0
+0.46583E+0
+0.46595E+0
+0.46608E+0
+0.46621E+0
+0.46635E+0
+0.46647E+0
+0.46660E+0
+0.46672E+0
+0.46686E+0
+0.46699E+0
+0.46712E+0
+0.46724E+0
+0.46737E+0
+0.46750E+0
+0.46763E+0
+0.46776E+0
+0.46789E+0
+0.46802E+0
+0.46814E+0
+0.46828E+0
+0.46840E+0
+0.46853E+0
+0.46866E+0
+0.46878E+0
+0.46892E+0
+0.46904E+0
+0.46917E+0
+0.46930E+0
+0.46943E+0
+0.46956E+0
+0.46968E+0
+0.46981E+0
+0.46994E+0
+0.47006E+0
+0.47019E+0
+0.47031E+0
+0.47045E+0
+0.47057E+0
+0.47070E+0
+0.47082E+0
+0.47094E+0
+0.47107E+0
+0.47121E+0
+0.47133E+0
+0.47146E+0
+0.47158E+0
+0.47171E+0
+0.47184E+0
+0.47197E+0
+0.47209E+0
+0.47222E+0
+0.47235E+0
+0.47248E+0
+0.47261E+0
+0.47273E+0
+0.47286E+0
+0.47299E+0
+0.47312E+0
%% Cell type:code id:268fd007-4458-4ad9-a600-a72e34adbe17 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment