Exporting an array of 100 elements but can't see the value

backendcode

Member
Join Date
Aug 2017
Location
brampton
Posts
249
Hello Everyone,

Note: Using Allen Bradley Studio 5000

I have an array of 100 elements which i am using to record some data. I used FIFO method to fill that array. Now FIFO is done and I want to export the value of my array.

When I clicked on Tools -> Export -> tags and comments, I was able to export my tags and comments and I can see my array tag too but I can't see the value of my tags. I am not sure if I am doing something wrong or do I have to use another way to get the value of my array

I would appreciate if someone can help me to figure this out.

Thank you,
 
Unfortunately I don't think it works that way.

If you don't mind using Python, I can help you get the data out to a text file or something like that. If you're interested, I'd just need to know the IP address of the PLC and the tag name. If the tag is some data structure, I'd need to know about that too.
 
The Export Tags took only exports the tag structure, not the tag values.

It's possible to extract your data by right clicking on the rung with your "FIFO" and selecting "Export Rung", and open the resulting L5K file with a text editor. In the middle of a lot of "junk", the "CDATA" for your FIFO tag will be there, as a bunch of csv numbers. You could extract those out, paste those to a csv file, and open that in Excel.

Good luck.
 
Last edited:
Unfortunately I don't think it works that way.

If you don't mind using Python, I can help you get the data out to a text file or something like that. If you're interested, I'd just need to know the IP address of the PLC and the tag name. If the tag is some data structure, I'd need to know about that too.

Hey Dmroeder,

Do you have any python Module to access the PLC tag value? I have python 3.6 installed on my work machine and I can try and this would be great learning too.

I am sorry, I can't share the IP address of PLC because my work place is pretty strict in term of sharing any such information and I hope you understand :)

I would appreciate if you won't mind to share some knowledge to access tag value with python.

Thank you for the help again

Thank you
 
Hey Dmroeder,

Do you have any python Module to access the PLC tag value? I have python 3.6 installed on my work machine and I can try and this would be great learning too.

I am sorry, I can't share the IP address of PLC because my work place is pretty strict in term of sharing any such information and I hope you understand :)

I would appreciate if you won't mind to share some knowledge to access tag value with python.

Thank you for the help again

Thank you

Give me a bit, I'll get you something. The module or accessing the tags is for python 2.7.x, but I do have an updated version that adds python3 support, though I haven't pushed the commits to github yet.
 
You could just install the Tag upload/download tool that should be included with the Logix install. You may even have it already, menu bar --> Tools --> Tag Upload Download Tool

An alternative to python would be vba in Excel, look for VBA in the RSLinx help file and it will give you the code required to read/write data to the PLC as well.
 
Aardwizz, Great! It worked and gave me XML file and all the information I needed. Much appreciated :)

dmroeder, I am still interested to learn how can I get the same information by using Python. If you can help that would be awesome!

Thank you guys.
 
You're welcome.

It sounds like dmroeder has python script that can read live PLC data, the same way that RSLinx OEM or Gateway does (which is why the IP address would be needed). That would be cool to see.

If you do have OPC enabled RSLinx (unlikely, unless you're an integrator), then as Pauley suggested, the live data can be read in Excel, either as OPC linked cells, or with VBA scripting.

That's if you're pulling this data regularly. For one-off, the L5K suffices. If more frequent, python could parse the data out of the L5K for you, a half-automated solution.
 
Last edited:
There's also the excel DDE method that will grab live data from a PLC and put it directly into any excel spreadsheet. It requires an RSLinx Classic Gateway activation, but if you have one of those handy it's a great tool.

Search the forum and/or the RA knowledgebase and/or google for it, there are a heap of examples out there.
 
You're welcome.

It sounds like dmroeder has python script that can read live PLC data, the same way that RSLinx OEM or Gateway does (which is why the IP address would be needed). That would be cool to see.

If you do have OPC enabled RSLinx (unlikely, unless you're an integrator), then as Pauley suggested, the live data can be read in Excel, either as OPC linked cells, or with VBA scripting.

That's if you're pulling this data regularly. For one-off, the L5K suffices. If more frequent, python could parse the data out of the L5K for you, a half-automated solution.

Thank you guys for the OPC server suggestion and definitely its a great tool to get live data from PLC.

For my last data collection I used in built OPC server of RSLinx to connect my Excel sheet and then wrote VBA script to record tag value every time it updates, The only drawback I found in such data collection, I needed to keep my laptop ON to record the live data or I could either use server to connect with PLC and store information on my server.

But for this application, I have enough capacity on controller and I just needed 100 values to do some cycle time analysis. So that's why I stored the data in FIFO. But i am definitely interested in learning or using python to connect with PLC to access any specific tag to read or write and definitely it could be pretty handy.

you guys are great and I love this forum because you get so many ideas from experienced people and everyone is ready to help and I wish I could have such co workers lol (Joking, my team is good too but i am at afternoon shift and alone :/)

Thank you again
 
I wouldn't mind to download python 2.7 and If i am not wrong, are you talking about this? https://github.com/dmroeder/pylogix

Thank you again for the help.

That's the one. And if you are fine with 2.7, that will be easy, if anything comes up though (like blocked by IT), let me know.

So download that code from your link. Create a new python file, say read_data.py. Copy and paste the following code into your new file:

Code:
from eip import PLC

# some parameters, edit as needed
IP_ADDRESS = '192.168.1.20'
PLC_TAG = 'DataArray[0]'
ELEMENTS = 100

# read the data form the PLC
with PLC() as comm:
    comm.IPAddress = IP_ADDRESS
    vals = comm.Read(PLC_TAG, ELEMENTS)

# dump the values read to a text file
with open('plc_values.txt', 'w') as f:
    for val in vals:
        f.write(str(val) + '\n')

This is a very down and dirty simple example. We can get fancier if you want. I PM'd you my email address.

Others have provided some good ways to get the values as well. Try them out, they all can be handy tools to have.
 
That's the one. And if you are fine with 2.7, that will be easy, if anything comes up though (like blocked by IT), let me know.

So download that code from your link. Create a new python file, say read_data.py. Copy and paste the following code into your new file:

Code:
from eip import PLC

# some parameters, edit as needed
IP_ADDRESS = '192.168.1.20'
PLC_TAG = 'DataArray[0]'
ELEMENTS = 100

# read the data form the PLC
with PLC() as comm:
    comm.IPAddress = IP_ADDRESS
    vals = comm.Read(PLC_TAG, ELEMENTS)

# dump the values read to a text file
with open('plc_values.txt', 'w') as f:
    for val in vals:
        f.write(str(val) + '\n')

This is a very down and dirty simple example. We can get fancier if you want. I PM'd you my email address.

Others have provided some good ways to get the values as well. Try them out, they all can be handy tools to have.

Awesome, thank you for the help. I will download 2.7 tomorrow because IT'S TIME TO GO HOME!!

Btw, I got your email address and will shot you my email as well.

Thank you brother from another mother :)

Thanks,
 
...Now FIFO is done and I want to export the value of my array...
An alternative solution is just to copy the rows from the Monitor tab. Be sure to select the root tag otherwise the copy option will be disabled. Then you can paste the data in your favorite text or spreadsheet editor.

copypastearray.jpg
 
An alternative solution is just to copy the rows from the Monitor tab. Be sure to select the root tag otherwise the copy option will be disabled. Then you can paste the data in your favorite text or spreadsheet editor.

Dang nhatsen, I never noticed this before! Thanks.
 

Similar Topics

I have a tag i created in Studio 5000 for some recipes. The tag is named Recipes and it has an array size of 4 and within the Recipes there is...
Replies
3
Views
1,591
I am very familiar with Studio 5000 PLC programming. And I'm very familiar with C-More HMI programming. But this is my first time using a C-More...
Replies
2
Views
300
As the title says, I'm trying to figure out a way to import and export recipe files from an external CF card to a USB drive and vice versa. I've...
Replies
1
Views
482
Can anyone tell me how to export tags from PC Worx to a .csv file?
Replies
0
Views
322
Hello Everyone, Happy 4th of July to my neighbors! Is there a way to edit Alarms in Excel? The native export is XML, and there is always...
Replies
3
Views
763
Back
Top Bottom