[COM] Communication issue with Tektronix MDO4054C using for loop
See original GitHub issueInstrument details
- Model: Tektronix MDO4054C Mixed Domain Oscilloscope
- Communication: TCPIP
- Link to the documentation (if available):
Output of pyvisa-info
C:\Users\englocal>pyvisa-info Machine Details: Platform ID: Windows-10-10.0.10586-SP0 Processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
Python: Implementation: CPython Executable: c:\users\englocal\appdata\local\programs\python\python38-32\python.exe Version: 3.8.5 Compiler: MSC v.1926 32 bit (Intel) Bits: 32bit Build: Jul 20 2020 15:43:08 (#tags/v3.8.5:580fbb0) Unicode: UCS4
PyVISA Version: 1.10.1
Backends: ni: Version: 1.10.1 (bundled with PyVISA) #1: C:\windows\system32\visa32.dll: found by: auto bitness: 32 Vendor: Tektronix Impl. Version: 4194816 Spec. Version: 4194304
Hi, I am trying to write a program that will take the measurement of the current every minute over 48 hours. However, after a certain amount of time (anywhere between 4 to 60 minutes) the program stops and I get a miscellaneous error. In the code you will notice that I open and close the resource every loop, this is because when I didn’t I would get an I/O error. I appreciate any help I can get. The code:
import pyvisa
import time
import pandas as pd
visa
visa.ResourceManager
from visa import ResourceManager
rm = visa.ResourceManager()
ip_address = "TCPIP0::169.254.4.23::inst0::instr"
test_time = 1
for i in range(172800):
tek = rm.get_instrument(ip_address)
current = tek.query('measurement:meas1:value?')
data = {
'Time': [test_time],
'Current': [current]
}
time.sleep(60)
test_time = test_time + 1
results = pd.DataFrame(data)
results
results.to_csv(r'C:\Users\englocal\Documents\LUNAR\Results.csv', index = False, header = False, mode = 'a')
tek.close
I would like to reiterate that the code works fine but only for a limited amount of time. I should note I have tried modifying the read and write terminations in the get_instrument command but it did not seem to help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (6 by maintainers)
Top GitHub Comments
@IntegralWorks @MatthieuDartiailh hi all, right before leaving work on friday I set the IP address to a permanent address and let it run over the long weekend, and it worked! Thanks for the help, @IntegralWorks I think we caught it at about the same time.
Thanks for sharing @IntegralWorks . Honestly I never use DHCP with instruments only a local network. But indeed a randomly changing IP could make sense in the context of DHCP.