Comments (5)
Interesting. So you can read each of those tags individually, but it fails using MultiRead?
What PLC model are you using?
What data types are those tags?
Can you email me a wireshark trace when this happens?
from pylogix.
So I couldn't get wireshark running in my linux VM quickly, but I'll get back to that if we find it ends up being necessary. For your other questions:
PLC: CompactLogix
Datatypes: Int, Int, Float
I did some additional troubleshooting, trying some other things I thought might be diagnostic and here's what I found:
Python 2.7.15 (default, May 1 2018, 20:16:04)
[GCC 7.3.1 20180406] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import eip
>>> tags = ['HEDS.Shift_Number', 'HEDS.Status', 'HEDS.Shift_Hours']
>>> test1 = eip.PLC()
>>> test1.IPAddress = '10.24.5.68'
>>> for i in range(len(tags)):
... value = test1.Read(tags[i])
... print(value)
...
2
1
2.46288371086
>>> values = test1.MultiRead(*tags)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "eip.py", line 109, in MultiRead
return _multiRead(self, args)
File "eip.py", line 285, in _multiRead
status = unpack_from('<h', retData, 48)[0]
struct.error: unpack_from requires a buffer argument
>>> values = test1.MultiRead('HEDS.Shift_Number', 'HEDS.Status', 'HEDS.Shift_Hours')
>>> values
[2, 1, 2.5986595153808594]
>>> values = test1.MultiRead('HEDS.Shift_Number', 'HEDS.Status', 'HEDS.Shift_Hours')
>>> values
[2, 1, 2.6017134189605713]
>>> values = test1.MultiRead(*tags)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "eip.py", line 109, in MultiRead
return _multiRead(self, args)
File "eip.py", line 285, in _multiRead
status = unpack_from('<h', retData, 48)[0]
struct.error: unpack_from requires a buffer argument
So to me it looks like MultiRead is actually working, but it can't handle list unpacking for some reason. I can work around this if I have to, but it's strange to me because I thought that with the way list unpacking worked, the recieving function shouldn't be able to tell the difference between a directly entered list and an unpacked one.
Interested to hear what you think of this.
Thanks!
from pylogix.
The error you are getting doesn't have to do with you passing the list of tags to MultiRead(), it has to do with the amount of data that is coming back in the packet. It's trying to unpack the status of the reply at byte 48, but the packet isn't that long for some reason.
I think wireshark would be helpful if it would be possible for you to capture it. I cannot recreate your problem. Passing the list of tags the way you are works just fine. I wrote a script that mimicked yours, multiread every 100ms and ran it for an hour.
If you can get a wireshark of it, you can email it to me and I'll take a look.
from pylogix.
Disregard, you don't need to send me a wireshark trace. If you get time, try the latest commits. I was able to recreate what I think was a similar problem. If that doesn't fix it, let me know.
from pylogix.
So far all the tests I've done are working just fine. I think you've solved it! Thanks for your help.
from pylogix.
Related Issues (20)
- "Forward open failed" when trying to read tags from Berghof PLC HOT 8
- .GetDeviceProperties always returns DeviceType of "None" HOT 5
- Issues connecting to emulate HOT 7
- micro850 connection HOT 5
- Return data gets jumbled up on a multi write when the tags don't exist. HOT 13
- The return value is different when using a multi write compared to a single write for a string. HOT 4
- cannot get a tag list HOT 3
- Is it possible to inhibit a periodic task? HOT 2
- pylogix - returning a tag list as a row of values HOT 7
- PLC REAL values HOT 5
- Pylogix - compare a previously acquired tag list with the current one HOT 5
- Discover does not work while running pylogix in docker HOT 10
- Invalid Continuation Byte HOT 5
- Abnormal code termination. HOT 8
- Do I need to use routing? HOT 20
- PLC connection best practice HOT 8
- Forward Open Failed HOT 22
- Connection Issues HOT 9
- PLC read does not run when called from a function HOT 5
- documentation on the CIP protocol HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylogix.