Code Monkey home page Code Monkey logo

Comments (5)

dmroeder avatar dmroeder commented on August 17, 2024

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.

allyn-bottorff avatar allyn-bottorff commented on August 17, 2024

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.

dmroeder avatar dmroeder commented on August 17, 2024

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.

dmroeder avatar dmroeder commented on August 17, 2024

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.

allyn-bottorff avatar allyn-bottorff commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.