I once re-hashed an old wrapping machine, the "PLC" as such was a Zilog Z80 processor, it was a single board system, the customer managed to contact the original installer, he told them the company who manufactured it made their own boards, however, he was able to send me some drawings so it was easy to see what the I/O was, the original company no longer traded & the customer wanted some extra functionality, I replaced it with an S5-95U had it running in about 16 hours including writing the code. I have done a number of upgrades to existing bespoke systems ranging from relays to PC based or bespoke controllers & it is often better to start from scratch, however, having drawings makes it a lot easier. One of the worst was a cutting press with 9 cutting programs, it was all relays probably about 100 + my boss took the project on but we could not find any documentation & the operator who used to run it had retired & moved abroad, no one had any idea how it worked, the only thing we managed to find out was some idea of the programs from very well worn out switch labels & we guessed the rest based on the order we could see how the patterns seemed to work.
The biggest problem was a replacement hydraulic solenoid system, the replacement unit supposed to be identical the ports were out by quite a bit, we had an adapter plate made, struggled to get it to work until we found out that because it was some form of multiple hyd feed solenoid system the porting was different, turned out it was just a matter of moving grub screws on the ports to get it to drive the relevant valves, this was on new years eve, ended up there till 4:00 in the morning so missed the celebrations.