Pylogix Local UDT

Taylor Turner

Member
Join Date
Sep 2020
Location
Midwest
Posts
78
Can I not access locally defined UDT data?


Scope..
Task>Prog1>Parameters and Local Tags(Test1 = real)(UTD.Test2 = real)



Code:
#To access the local tag.. (Works)
$PLC.Read('Program:Prog1.Test1').Value


#To access the UDT tag.. (Does not work)
$PLC.Read('Program:Prog1.UDT.Test2').Value
 
That appears to be a response from "GetProgramTagList()", not a read.

Edit: So somewhere you are calling GetProgramTagList("Program Name") and it is not finding that program name.


Thanks a ton...



Stat info: My program runs ~180ms faster by reading the tags as a dictionary. (09_multi_read_faster.py)
 
Thanks a ton...



Stat info: My program runs ~180ms faster by reading the tags as a dictionary. (09_multi_read_faster.py)

Yes, lists are much faster because multiple reads are packed into a single packet, where if you call Read one at a time, they each get their own packet. I have a couple of new things to hopefully further increase performance, it's just a matter of finding the time.
 
Yes, lists are much faster because multiple reads are packed into a single packet, where if you call Read one at a time, they each get their own packet. I have a couple of new things to hopefully further increase performance, it's just a matter of finding the time.


Another note:

I have an application using Pylogix as middleware amung three devices. This application uses the asyncio, transports and Protocol module to talk to one of the devices(not the PLC). The data_received runs when there is a change for me. I'm working a second project where I need to observe tag changes from the PLC. I don't want to poll pylogix constantly, are there any alternatives you can think of? Currently looking into a MSG instruction and PyDispatcher.
 
Another note:

I have an application using Pylogix as middleware amung three devices. This application uses the asyncio, transports and Protocol module to talk to one of the devices(not the PLC). The data_received runs when there is a change for me. I'm working a second project where I need to observe tag changes from the PLC. I don't want to poll pylogix constantly, are there any alternatives you can think of? Currently looking into a MSG instruction and PyDispatcher.

Pylogix doesn't have a "listen" function, thought that is an interesting idea, a few people have asked for over the years.

What is your concern with constantly polling the tag? How frequently would you be polling it?
 
Yes, lists are much faster because multiple reads are packed into a single packet, where if you call Read one at a time, they each get their own packet. I have a couple of new things to hopefully further increase performance, it's just a matter of finding the time.

Pylogix doesn't have a "listen" function, thought that is an interesting idea, a few people have asked for over the years.

What is your concern with constantly polling the tag? How frequently would you be polling it?


Ideally a script would run only when the plc tells it to. I have yet to test the performance by polling, your 06_read_loop.py. My only concern right now is in theory. Polling hogs a thread and voids RTOS principals, eventually I need to account for a battery powered system. I'll code it up and get an application point of view though.
 

Similar Topics

Hey everyone, I am looking for a tool to parse PLC data and I believe pylogix may be the best approach. I am very new with python but can see its...
Replies
1
Views
864
If anyone is interested, I have an experimental branch on github that adds an “adapter” module to pylogix, which will allow you to interface to a...
Replies
1
Views
1,141
I am not the best in python... "What is a library?" Said structured text. I am trying to make a simple plot by grabbing tag values from pylogix...
Replies
30
Views
6,445
I am trying to use pylogix to write to a string array ID_Data_Table_Name. In the array there are 200 possible entries. For...
Replies
13
Views
4,028
I'm currently working with pylogix and have no trouble reading and writing tags. My problem is, I would like to be able to read (and write) I/O...
Replies
5
Views
3,703
Back
Top Bottom