Code Monkey home page Code Monkey logo

Comments (17)

dmroeder avatar dmroeder commented on July 18, 2024

So multi-read doesn't work with the Micro8xx because they don't support that feature. Keep in mind, there is a limit to how many tags you can read at once. This limit is packet size so the data type matters. I usually suggest reading 10 tags at a time.

Since we rule out the Micro8xx, let's discuss the L18. Can you share some details about the tags you are reading, how many, types, etc? Maybe a snippet of your code?

Also, I was going to remove .MultiRead() at some point since .Read() will now do the same thing if you pass it a list.

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

Thank you for the fast reply!
It's good to be sure that Micro8xx really doesn't suport multi-read.
So, about the CompactLogix, I was trying to read 4 tags at the same time ["bool01", "int01", "float01", "string01"], and the string has 82 characters. My connection code looks like this:

from pylogix.eip import PLC
class PLCMonitor:
	def __init__(self):
		self.pylogixPLC = PLC()
		self.pylogixPLC.IPAddress = "192.168.1.1"
		self.pylogixPLC.ProcessorSlot = 1
		self.pylogixPLC.Micro800 = False
		self.multiread = True

And my reading code looks like this:

if self.multiread:
	connected = False
	try:
		values = self.pylogixPLC.Read(["bool01", "int01", "float01", "string01"])
		connected = True
	except Exception as err:
		print("ERROR [" + self.pylogixPLC.IPAddress + "]: " + str(err))
		if "Multi-read failed" in str(err):
			self.multiread = False
		elif str(err) == "timed out":
			self.connected = False

if not self.multiread or not values:
	# Read tags individually

Whenever I run the code, multi-read fails and my code falls back to individual reading.

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

I just did a quick test and it does in fact work. My test looked like this:

from eip import PLC
tags = ['bool01', 'int01', 'float01', 'string01']

p = PLC()
p.IPAddress = '192.168.1.9'
values = p.Read(tags)
print(values)

Now when you say your string is 82 characters, I assume you mean the default STRING data type, not a custom created string with 82 characters right?

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

Exactly. The default size is 82 characters, but it actually have something about 20 characters written.
So, most likely the problem is some configuration on the PLC itself and not the code?

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

Are you running the latest pylogix code form github? Back in June, I had a few problems reading multiple tags of mixed data types.

I ran your code exactly (from your other opened issue) and it works fine.

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

Yes, I'm running the latest code, and the last commit shown by git log is from Jan 31st 2019, which matches with github's commits page.
I'm wondering what are the odds of been some misconfiguration on the PLC...

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

Since you say that you can read the tags individually, I don't think there is any kind of configuration issue. Could you capture this problem with wireshark and email it to me?

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

Sure thing, I will schedule a visit with the company that owns the CompactLogix so I can capture the problem with wireshark. As soon as I get it, I'll send it to you.
What is your email, please?

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

Thanks,

[email protected]

We'll discuss your other issue once we work through this one, I think they are going to end up being related.

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

About the Micro8xx, do you have any documentation that shows that the PLC itself really doesn't support multi-reading?

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

OK, thank you for your help!

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

The PLC is telling you that the multi-read service is not supported, not my code. I just translate the error code into text.

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

Got it, that's all I needed to know. Thank you once again!

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

Did you happen to ever get this working, or get any details?

from pylogix.

Lucasrsv1 avatar Lucasrsv1 commented on July 18, 2024

No, the company that owns the PLC hasn't schedule a visit for me yet. I'm still waiting for theirs disponibility. But, probably, it will take place next month.

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

Ok, sounds good, I didn't want to leave you hanging.

from pylogix.

TheFern2 avatar TheFern2 commented on July 18, 2024

Closing as per #38 details.

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.