Title: Support for "TCPIPx::aaa.bbb.ccc.ddd::ppppp::SOCKET" resources · Issue #75 · python-ivi/python-ivi · GitHub
Open Graph Title: Support for "TCPIPx::aaa.bbb.ccc.ddd::ppppp::SOCKET" resources · Issue #75 · python-ivi/python-ivi
X Title: Support for "TCPIPx::aaa.bbb.ccc.ddd::ppppp::SOCKET" resources · Issue #75 · python-ivi/python-ivi
Description: Hi, ethernet/wireless based remote control using the LXI interface allows for three different types of connection. The classic VXI-11 mode uses ONC/Sun RPC mechanism and multiple TCP ports for parallel data and control channels. This is ...
Open Graph Description: Hi, ethernet/wireless based remote control using the LXI interface allows for three different types of connection. The classic VXI-11 mode uses ONC/Sun RPC mechanism and multiple TCP ports for para...
X Description: Hi, ethernet/wireless based remote control using the LXI interface allows for three different types of connection. The classic VXI-11 mode uses ONC/Sun RPC mechanism and multiple TCP ports for para...
Opengraph URL: https://github.com/python-ivi/python-ivi/issues/75
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support for \"TCPIPx::aaa.bbb.ccc.ddd::ppppp::SOCKET\" resources","articleBody":"Hi, \r\n\r\nethernet/wireless based remote control using the LXI interface allows for three different types of connection.\r\n\r\nThe classic VXI-11 mode uses ONC/Sun RPC mechanism and multiple TCP ports for parallel data and control channels. This is either implemented by a VISA driver or by a dedicated VXI-11 driver.\r\nThe instrument resource string in this case has a format like \"TCPIP0::192.168.0.1::INSTR\".\r\n\r\nHowever, the dedicated control channel and handshaking causes quite some protocol and implementation overhead and thus performance is poor on many instruments.\r\n\r\nThe LXI standard however also allows for raw TCP sockets and a newer HiSLIP protocol.\r\n\r\nQuoting:\r\n[http://lxistandard.org \"HiSLIP for Fast Remote Control of LXI Instruments\"](http://lxistandard.org/Documents/Articles/HiSLIP%20for%20Fast%20Remote%20Control%20of%20LXI%20Instruments_final.pdf):\r\n\r\n\"Sockets and HiSLIP provide a 2-5 times faster interface to LXI instruments than VXI-11.\"\r\n\r\nFor instruments with poor implementation, the difference can be much more, e.g. reading 50 megasamples of an oscilloscope can take fifteen minutes or so.\r\n\r\nI can confirm the speed difference for some popular oscilloscopes like the Rigol DS1054Z or portable Rohde+Schwarz oscilloscopes.\r\n\r\nWhile pyvisa and pyvisa-py support the TCP sockets OK, I ran into quite some issues with python-ivi.\r\n\r\nI tried today using a Rigol DS1104Z with the following code:\r\n```\r\nimport ivi\r\nscope = ivi.rigol.rigolDS1104Z(\"TCPIP0::192.168.0.1::5555::SOCKET\", prefer_pyvisa=True)\r\nprint(rds.trigger.type)\r\n```\r\nExpected output in this case is a string representing the trigger type, e.g. 'edge'.\r\nThis works when using the VXI-11 \"[...]::INSTR\" resource, but not using a socket, where a VI_ERROR_TMO timeout error is generated.\r\n\r\nAfter some investigation, I found out this is because of missing support for terminating characters for this resource class in python-ivi.\r\n\r\nI.e.: pyvisa supports automatic appending and stripping of the appropriate control characters by setting the respective device instance attributes or directly when instantiating the device class:\r\n[PyVISA: Termination Characters](https://pyvisa.readthedocs.io/en/master/resources.html#termination-characters)\r\n\r\nBecause python-ivi uses a reimplementation of the pyvisa device query methods (i.e. separate device write/write_raw and read/read_raw calls), the easiest way I could make above SOCKET resource string work with python-ivi, for testing purposes, was the following monkey-patch in \r\n[ivi/interface/pyvisa.py#L64](https://github.com/python-ivi/python-ivi/blob/cfa45ceade0758debe4bc24ba4c8195222cad1e2/ivi/interface/pyvisa.py#L64) and after [line 54](https://github.com/python-ivi/python-ivi/blob/cfa45ceade0758debe4bc24ba4c8195222cad1e2/ivi/interface/pyvisa.py#L54):\r\n```\r\n--- orig/pyvisa.py 2019-02-17 04:53:09.790285795 +0100\r\n+++ socket/pyvisa.py 2019-02-17 04:52:41.326355206 +0100\r\n@@ -52,6 +52,7 @@\r\n def __init__(self, resource, *args, **kwargs):\r\n if type(resource) is str:\r\n self.instrument = visa_instrument_opener(resource, *args, **kwargs)\r\n+ self.instrument.read_termination = \"\\n\"\r\n # For compatibility with new style PyVISA\r\n if not hasattr(self.instrument, 'trigger'):\r\n self.instrument.trigger = self.instrument.assert_trigger\r\n@@ -61,7 +62,7 @@\r\n \r\n def write_raw(self, data):\r\n \"Write binary data to instrument\"\r\n- self.instrument.write_raw(data)\r\n+ self.instrument.write_raw(data + b\"\\n\")\r\n \r\n def read_raw(self, num=-1):\r\n \"Read binary data from instrument\"\r\n```\r\n\r\nFor a universal fix, python-ivi could offer passing arguments to the device constructor, alongside the \"prefer_pyvisa=True\", e.g. `scope = ivi.rigol.rigolDS1104Z(resource, prefer_pyvisa=True, read_termination=\"\\n\", write_termination=\"\\n\")` . Or via the respective instance properties.\r\n\r\nAlso perhaps a good idea to use the pyvisa read(), write() and ask/query() methods for the respective methods in python-ivi.\r\n\r\nHTH, Ulrich","author":{"url":"https://github.com/ul-gh","@type":"Person","name":"ul-gh"},"datePublished":"2019-02-17T04:18:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/75/python-ivi/issues/75"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e889d79b-1b99-7b26-ed0e-f6155e7ff52c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B30E:14207:E0885F3:1229A027:697713E6 |
| html-safe-nonce | 8c9f5797f173c07e288a5ea68f452d5a8ae943d77c3a2160b52c7bd16787386c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzBFOjE0MjA3OkUwODg1RjM6MTIyOUEwMjc6Njk3NzEzRTYiLCJ2aXNpdG9yX2lkIjoiNTAxMjcyMTI0Mjc3MTc1NjAwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b5fc71e6515ee6bdaa6cf2e102c91a08764966a94b589eda49f9e2e395fa4d82 |
| hovercard-subject-tag | issue:411146766 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-ivi/python-ivi/75/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7d6b4ecf2fd334843e93a4a4df70b4f1cc62f41b79136b2fbee9129426eb3b95/python-ivi/python-ivi/issues/75 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7d6b4ecf2fd334843e93a4a4df70b4f1cc62f41b79136b2fbee9129426eb3b95/python-ivi/python-ivi/issues/75 |
| og:image:alt | Hi, ethernet/wireless based remote control using the LXI interface allows for three different types of connection. The classic VXI-11 mode uses ONC/Sun RPC mechanism and multiple TCP ports for para... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ul-gh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-ivi/python-ivi git https://github.com/python-ivi/python-ivi.git |
| octolytics-dimension-user_id | 6889594 |
| octolytics-dimension-user_login | python-ivi |
| octolytics-dimension-repository_id | 6012233 |
| octolytics-dimension-repository_nwo | python-ivi/python-ivi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 6012233 |
| octolytics-dimension-repository_network_root_nwo | python-ivi/python-ivi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f752335dbbea672610081196a1998e39aec5e14b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width