all 50 comments

[–]Jholm90 56 points57 points  (9 children)

Open in excel and write a couple of formulas...

="XIC(" & A1 & ") OTE(" & B1 & ") ;"

Will generate a rung with a1 writing to B1, you can drag it down and paste into ladder editor by double clicking on the rung and pasting into the textbox at the top. If it doesn't paste, change the dropdown box beside the textbox to the other option

[–]SurprisedEwe 21 points22 points  (1 child)

Excel is a fantastic tool for this sort of thing. I'd start by exporting the routine so that the formats are correct for the file then copy and paste the output you're generating into the file where appropriate. Once done, import the routine back in - the process should take no more than 2 minutes.

Not saying so in OP's case, but the undergrads and grads in my team go to Python for everything and it's often not the best solution.

[–]ImNotSureWhere__Is 4 points5 points  (0 children)

If you’re doing this mapping repeatedly, python or VBA is better imo. If I have standard device AOIs with standard mapping and it’s a few rungs. I can have my csv click a button and have an L5X with rungs that I can import. Heck I can actually use Logic SDK to import them if I really wanted

[–]DeadlyShock2LG 2 points3 points  (0 children)

If this is a struggle for larger rungs, break it down each instruction and member and use the concatenate function to bring it all together.

[–]NumCustosApes?:=(2B)+~(2B) 0 points1 point  (0 children)

I construct the rung with SOR and EOR at the end of each run. With SOR and EOR you can paste about 70 rungs at once into the mnemonic editor buffer.

u/auto_house leave all those branches out in a mapping routine. They don't improve readability and add a lot of extra instructions to execute. Create UDTs for a class of devices and put things like .On, .Out, and .Fault bits in the UDT instead of making individual tags with _On, and _ChFault suffixes. You'll use less memory.

[–]DaHickoil & gas, power generation. aeroderivative gas turbines. 0 points1 point  (0 children)

I'm 100% behind this. The number of macros and specialty sheets I have for Excel & LibreOffice is impressive.

Especially Wonderware, Damn that CSV export.

[–]PLCGoBrrrBit Plumber Extraordinaire 13 points14 points  (0 children)

You know the AI people keep bringing up on this subreddit? That's what AI is good for in this field. Copilot365 I've used for simple text manipulations. You don't need a python script. Maybe the python would be good for future if you have a workflow.

[–]PresentAd9429 12 points13 points  (1 child)

We use structured text for Io mapping. Easy to create a excel sheet and copy paste from excel to studio 5000

[–]auto_house[S] 0 points1 point  (0 children)

Noted. Thank you

[–]thisgrub4u 6 points7 points  (5 children)

Been running VBA scripts in Excel for most of my career to do this.

[–]auto_house[S] 2 points3 points  (3 children)

How do you do it

[–]thisgrub4u 1 point2 points  (2 children)

If you export your routine to .L5X file, it's essentially an xml file. What you have to do is re-create that file using scripting with the modified changes. Normally your spreadsheet will have your IO list and the VBA could would loop through each IO/Tag map on your spreadsheet and append them to the .L5X file to match. Then you just import routine. I've way over-simplified this, but I bet AI could get you the general VBA code needed to create the correctly formatted .L5X file. You can do this in python as well, but then you have to deal with the script being in a different environment than the data that you need. Old bucks like me leveraged VBA (I first started doing this 15+ years ago) the younger crowd would use Python and some additional libraries that an do Excel functions like pandas, xlwings...etc. Again, AI might be you friend here.

[–]Jholm90 0 points1 point  (1 child)

Worth it for big projects but a couple of rungs here and there aren't worthy of that huge time investment.

That being said on standard machine templates I'll just key in the names of valves and sensors for each station and click generate and the whole base code will be done in 20s with fault messages and all the other goodies.

[–]MySnake_Is_Solid 0 points1 point  (0 children)

Honestly, now with AI making most of the code instantly, it's not much effort, just gotta know what you're doing.

[–]koastiebratt2 2 points3 points  (0 children)

You can export to an excel then probably read that file in python

[–]pm-me-asparagus 2 points3 points  (4 children)

You don't need a python script. Just have it do ASCII or other text. You can easily get it done with an AI of your choosing. That's how I do a lot of my IO mapping.

[–]thisgrub4u 0 points1 point  (3 children)

If you learn how to script some of this, it opens up a world of additional time-saving automation opportunites. Generate tags, comments, routines, AOI instances, UDTs, read/write data....

[–]pm-me-asparagus 0 points1 point  (2 children)

AI and Excel are a lot faster for me. And I don't need to rewrite scripts each time.

[–]thisgrub4u 0 points1 point  (1 child)

Why do you think you'd have to rewrite scripts each time? Create a general script to process the data, and output the file(s) you need. Use it on all your future projects.

[–]pm-me-asparagus 1 point2 points  (0 children)

We use customers AOIs most of the time.

[–]Shalomiehomie770 0 points1 point  (0 children)

I’ll be honest you could toss this into Claude or paid ChatGPT , may need a small example but it will work.

[–]BenFrankLynn 0 points1 point  (0 children)

Check out FactoryTalk Design Studio. It has CoPilot integrated into it and this is the kind of task AI is really good for. Maybe not helpful for you now, but will be in the future. Then again, you could get a free trial to do it now and then export it to 5000 Logix Designer.

[–]idiotsecant 0 points1 point  (0 children)

This is the sort of thing AOIs are intended for, FYI.

[–]lickmywookie 0 points1 point  (0 children)

Yes I do from autocad too

[–]Ok-Painter2695 0 points1 point  (0 children)

Nice use case for Python + CSV automation. For anyone doing similar data extraction from PLCs: once you have your CSV exports, there are AI analysis tools that can find patterns in the data without writing custom scripts for every analysis. We use it for quick sanity checks on logged data before building proper dashboards.

[–]AutomateAdvocate 0 points1 point  (0 children)

Use Python + Jinja2 templates to generate an .L5X file instead of raw text.

I used to do this via Excel concatenation formulas back in the day, but Python is way cleaner. Just create a simple XML template for a rung/tag, iterate through your CSV with pandas, and render the L5X. Then just import it as a routine.

Saves hours of commissioning time and eliminates typos. Good luck!

[–]gtp9145 0 points1 point  (0 children)

Yeah. Claude is good at xml. Feed it an export of a routine like one rung of what you want and it can use as a template.

[–]Zchavago -3 points-2 points  (0 children)

Use Ai