Comments (6)
You are most likely getting error when using the GetTagList result directly because there are probably a few items that aren’t really tags, like program names. I should look into better filtering the reply. You can try something like this:
for t in tags:
if t.DataType:
value = comm.Read(t.TagName)
Some of those nonsense things in the “tag list” won’t have a data type, so that should filter them out.
You need to keep in mind, that anything which is a structure (UDT) will not be parsed into something useful, it will be a list (array) of bytes. Although Pylogix does understand that something is a UDT, it does not understand the structure of it. This would be up to you to handle. There are two main ways that I think people can handle reading UDT’s:
- Write a class that matches the structure of the UDT and unpack the array of bytes in that class. My example 40_read_timer.py is a simple example of this. This requires knowing in detail how data structures are packed.
- Write a parser that will parse L5X/L5K exports of the UDT from your program so that you know the makeup of the UDT ahead of time. When you see a tag of that UDT, you can use your parser to know how it is made up and read the individual elements. The advantage of this is that you don’t really have to know how data is going to be packed into a byte array from the PLC.
from pylogix.
Thank you very much for the quick reply. I will try this.
from pylogix.
Hello
Thank you very much for this high quality work that is now serving lot of users around the world.
I have small issue with GetTagList (), after starting the program it take maybe a while (2 seconds) trying to collect the tags and after it says that connexion lost.
I know that i have some thousands of tags that should be returned and maybe the PLC close the connection before Pylogix get the full list ?
Any solution for this please ?
from pylogix.
Hmm, I haven't experienced that before.
Can you send me a wireshark of it happening?
Can you send me your exact code?
from pylogix.
Hello, Thank you for your feedback,
i used the same code as the examples you provide with documentation:
import sys
sys.path.append('..')
from pylogix import PLC
with PLC() as comm:
comm.IPAddress = '192.168.1.9' # Here i put the IP of my PLC
tags = comm.GetTagList()
for t in tags:
print(t.TagName, t.DataType)
I will try to capture a wireshark next time and send it to you.
I tested other examples for simple tag read and it's working fine.
from pylogix.
@KHDOUDI Hey did you get it sorted out? Please send screenshot of this connection lost error or paste exact error here. Run below ping command, and try to run GetTagList().
ping 192.168.1.9 -t
Another question is what PLC model do you have, it sounds like you might have a different slot for the PLC. Can you confirm your CPU is on slot 0?
from pylogix.
Related Issues (20)
- Unknown Error 255 on Multi-Write when including a string HOT 6
- read tag from 80 sets of plc HOT 22
- Double read packets? HOT 6
- cannot import name 'Adapter' from 'pylogix' HOT 23
- Tag Write falsely reports Success HOT 7
- "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
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.