Absolute Monster (slight rant)

Wizards,

Came across very nice-looking machine this weekend. I asked to come to this plant to actually see it, because the code left me with more questions than answers and that is why I am here.

Everything, and I mean everything, is indirect addressing EVERYTHING.
They pass data around via function block, ladder, and structured text.
I have never seen anything quite like this, I've seen some monsters before, but this one takes the cake.

Apparently, this machine has had 5-6 different programmer just give up trying to increase cycle time.
It has 5 stations, and if all 5 stations are complete and ready to index, it takes 45 seconds for station 1 to achieve cycle start.

I have learned way too much about this thing and about 15 hours of my life digging through the code line by line because any search option or cross reference will come up with 30 different OTE.

I finished my day with ops trying to index all at once, success... however, I need to locate a delay timer for a sensor fault.
I can find the controller tag for the fault, but a cross reference produced 127 OTE results and I figured it was a good time to end the day.
Please tell me there is a way to locate this without spending another 6 hours digging.

Edit: guess I should have added that this is an Allen Bradly PLC.

Gad
 
Lot to be said for direct addressing and ladder hey? I hardly ever re-map anything these days - makes things too hard. Pretty poor programming if it takes that long to achieve a cycle start. I would expect milliseconds.
 
I feel your pain, many years ago I was asked to support a UK subsidery company (part of the Italian company who produce these machines) This was a strapping machine, the design was to have something like 25 programs that would strap the pallet with different strapping patterns based on size, pallet type this included cross straps etc. The company who ordered the machine wanted these patterns to be automatically selected rather than an operator to select the pattern type, the UK side of the supplier added some star wheels & sensors to measure the pallet length, width & if the pallet had bottom runner boards or not, this determined if the number of straps, if swords were used to guide the straps between the bottom runner or not.
They sent an engineer over from Italy & we started to modify the code, the guy who wrote it had used hundreds of set/reset tags all over the code, we struggled but got something like, however, because this was at the UK supplier offices difficult to test everything, I did notice occassionaly the machine would throw a wobbler, it went to site & within a week the customer complained & I was sent down again with another Italian engineer, we spent a week trying to get it right, every time we tried to modify it the code would throw a wobbler the Italian engineer was pulling his teeth out.
In the end the customer pulled it out of the production line & I was asked to completely re-write it. I spent 10 days writing the code in our offices & simulated it as best I could with the spare PLC & HMI. Went to site & got it working very well, now there was some problems I could not overcome to make it totally automatic as occassionaly a bad pallet had been used i.e. the bottom runner may be in place but broken etc. It was in production for about 3 years before the company ceased trading & it was sold to another company, I was asked to go & re-commission it & this time it was direct for this other company as the works engineer from the existing company had been employed by them. indeed I was also asked by the UK supplier to modify two other machines installed in another company. So from what was a simple support function to make some mods I ended up with 4 jobs on daywork. Incidently, these machines had an extension keypad on the HMI for the selection of the strapping pattern, I also arranged it so when the pallet had been automatically selected the LED on the keys for that pattern would flash for a time allowing the operator to change the pattern in the case of a bad pallet or the actual pattern could be changed.
To sum it up the use of probably a couple of hundred set/reset bits spread over the program was very bad practice, indeed I had seperate routines for each pattern, I could have enabled smaller routines grouped together which would have made sense & reduced code for me but thinking about others who might end up having to modify it decided to make each pattern a seperate routine.
 
Glad to hear I am not the only one who comes across **** like this.
The fact that we got it to start to do what we wanted, after rewriting a bunch of ****, made all the "bobs" supper happy.
Getting this to work will prevent them from having to run on the weekends and the operators are excited to get a full weekend off.
Wish us luck today guys.

Gad
 
I have had machines that were programmed way too complicated for a simple machine.

I have decided more than once to start from scratch, look at the schematic and write a completely new program myself - one that could be 20% the size of the original and easier to follow and troubleshoot. Plus writing the new program was hours shorter than trying to find what the issue was in the program.
 
I can recall two personal experiences, one on each side of the debate between, "do I figure out how to understand the original programmers methods" or "do I reprogram from scratch.
In the case where I took the time to understand the OP's methods I found a program that could easily be adapted to changing needs and even accommodate mission creep gracefully. It helped that the OP was generous in the use of rung comments explaining what was going on. It's a lot easier to decipher a confusing sequence of logic when there's a comment that says, "The next five rungs do this".
In the other case, the machine was in a GE plant and the PLC was specified as GE, This was the first time the OEM's controls person had worked with a GE PLC, and he attempted a translation from what he was accustomed to. To make thing even more confusing, they were adapting their machine to a different process than their standard. It also didn't help that while tasked with the controls for this particular machine, he was also seeking a different job. I got called when he found one, and quit in the middle of commissioning. I got called because of my familiarity with GE PLCs, not because of my familiarity with the machinery. It was always a juggling act to decide whether the OP's awkward logic was due to his unfamiliarity with the PLC or because he had already quit weeks before his last day of work. In the end I rewrote probably 75% of the logic.
 
I ended up just creating new routines for the sections they want modified.
Got her to go, just cleaning up the stop so it doesnt drive into the next station.
She a bit angry at the moment, she probably needs food... :ROFLMAO:
 
Wizards,

Please tell me there is a way to locate this without spending another 6 hours digging.
Typically by asking the programmer for the manual deetailing how it's done.

The most beautiful/daunting and easiest piece of PLC software I've seen used S7 and the entire system (a control chair with joysticks, numeric keypads (about 20 buttons on each side), and a clicking spin wheel were all defined in DBs.
You could program what signal each function would send and also what the button would do as you had click, double click, click + confirm and doubleclick + confirm. The configuration allowed you to select the telegram, word and bit of the signal being sent and the confirmation it was received as well as function in progress or function active so the button could animate differently.

By now, I estimate about 600 to 700 of those are out in the world and no code needs developing from system to system, just updating the DB values.

Of course, without the manual detailing the configuration one would spend a lifetime to understand.

The other example was in a plant I worked at that had pointers to operate all valves and motors of the plant. Really genious bit of coding but was a pain to understand... until I found an old word document detailing it perfectly.

I think you see where I'm getting at here... ;)
 
Been there, we had a machine programmed in STL (Siemens S5) we did not have the time to take it out and start over, the machine ran great in manual so we ran the S5 in manual with an AB PLC, we just needed to add an extension to the machine and only needed it to run for a couple months before we were replacing it anyway, so running the S5 in manual was an easy solution
 
Typically by asking the programmer for the manual deetailing how it's done.
This is generally not an option, in classic style this integrator is no longer available, there is no user's manual, and these are custom built machines designed to run for no more than 10 years.

I had a machine come to a plant many years back and it had a 3 ring binder inside that was magnificent.
I still have that binder on my shelf as I have never seen anything like it before or after.
Color pictures, detailed parts list, wiring diagrams.... bring a tear to your eye kinda thing, machine ran like ****, but that manual was perdy.
 
Our plant standard is to use ladder logic for coding so everyone from mechanics to engineers can read and understand. We had a machine from a machine vendor and it was indeed programmed in ladder logic. However, the main functions were all programmed as function blocks and the logic inside each were written in structured text (hundreds of lines and indirect addressing, etc.). These function blocks were so large that some had 50 inputs! The function blocks couldn't even fit on one screen and you had to scroll up/down to see what inputs are on or off. It was a total nightmare. We asked the vendor to rewrite it because nobody can debug anything.

After this experience, we had to change our specifications to say that function blocks are only allowed for one function. Running an entire station or process with one function block isn't allowed. Also, embedded function blocks aren't allowed. That was another nightmare that we found. Function blocks inside function blocks.
 
The best one I came across was when I was commissioning a large batching system, the site engineers came to me as they had a large Hydrostatic cooker for cans, it was a Siemens S5-155H, someone had pulled the memory card (19" rack type) & lost the memory, cannot remember how much ram but fully populated so perhaps 128mb (large for it's time), They had tried to load the backup project but kept saying not enough memory, I then noticed that in one of the startup OB's the original programmer was generating a Datablock on a start, not a problen except this was different, the guy obviously knew S5 inside out as he was using S5 code to check how much memory was available & generating a DB as big as spare memory, the problem is the old S5 used the ram as a sort of load memory, when a block is downloaded when it already exists it loads it into ram & then removes the header (sort of entry in a FAT table) & replaces it with the updated blocks address, the problem is there must be enough memory to use as the load memory of a block before it's downloaded.
So answer was to not download this enormous DB as it would be generated, eventually after many frustrating tries it turns out there was a procedure you had to follow i.e. download all blocks but not the large DB, do a cold start & then a warm re-start, it would then check how much ram was left & generate the a DB the size of the spare memory.
A couple of weeks later I was asked to do a small mod on the system, well, it meant I had to delete all the PLC, download the blocks without that large DB & do the re-starts again, one other nasty was in S5 FB's you could not do a symbolic type jump over code of more than 255 words (one segment), the whole program had reletive jumps i.e. jump to an actual memory address so deleting or adding just one instruction would cause jumps to the wrong address, answer was to write down all jump addresses in the block with the instruction it jumped to, add your mods, go down the code & change the jump address manually, what a pain..
So in all, just to add even one instruction meant fiding all reletive jumps in that block, write the instruction & address down, add or subtract the address & re-code the jump location, that was also on top of stopping the plc, deleting the code, downloading all blocks without the large db & doing the cold & warm re-starts.
By the way, this enourmous Datablock was a printer buffer so if the printer was off line or out of paper the critical printouts of the temperatures/times was buffered until the printer came back on-line.
 
By the way, this enourmous Datablock was a printer buffer so if the printer was off line or out of paper the critical printouts of the temperatures/times was buffered until the printer came back on-line.
My first thought was it was a way of source/job protection. Glad it was less nefarious.

Probably the biggest pain I saw was on an S7-400 system programmed in Austria. The programmer had multiple FBs/FCs running different parts of the machine, but they all used the same M memory. The program would read a global DB into M memory, execute the code on that M memory, then write the M memory back to the DB. Then, the next section of code would read another DB into the same M memory, execute its code, then save the results back to the M memory.

Most of the DB references were not fully defined, so there would be an OPN DBx in one FB, then subsequent nested FBs/FCs would just reference the elements of the open DB without specifying the DB. The cross-reference was full of a LOT of uses/reuses of the same M memory and a bunch of DB???.DB* references. If you were trying to trace a signal in code, you would have to back track to the top of the FB/FC looking for the most recent reference to a full DB address or an OPN instruction, which often wasn't there. Then you would have to figure out where the FB/FC was called from, only to find that it was called multiple times from multiple other FB/FCs.
 
I can recall two personal experiences, one on each side of the debate between, "do I figure out how to understand the original programmers methods" or "do I reprogram from scratch.

I run into this A LOT, always have to try and understand their programming "concept"(?).

Its interesting because at times you run across stuff thats just $hit, and other times its a great learning experience and you find something you can add to your mental tool-bag.
 

Similar Topics

I am programming a Rotary axis on a ControlLogix 1756-M02AS using a 12 bit multi-turn/17 bit single turn Hengstler absolute encoder. My problem is...
8
Replies
2,122
Views
Hey guys, I have a paying project here that honestly first time and not getting much help from the engineers that sold the product to me. I am at...
4
Replies
832
Views
I am reprogramming a German Machine. I have some info, not all info, but what I don't have I can somewhat gather. Absolute Encoder, no longer...
18
Replies
3,052
Views
Hello. An absolute encoder on a rotary axis gives values in range -2147483648 to 2147483648. When value is > 2147483648 , the encoder value is...
20
Replies
5,405
Views
I have 2 Absolute Encoders 8192 steps per Rev. (Model TR Electronic CEV65m-11003) These Encoders communicate to the PLC5-60 via Parallel push/pull...
3
Replies
2,553
Views
Top