I'm interested in opinions and application success and failure with CoDeSys, as well as any good things or gothca's.
Back to the original topic, I think the main gotcha with CoDeSys is when people try to use the wrong programming language for a task. With 5 or 6 to choose from, there is no reason to limit yourself but invariably, someone only familiar with ladder will try to do everything in ladder in CoDeSys which can cause problems.
Ladder (LD) is excellent at working with Bit type data. Inputs & Outputs and Boolean Logic.
Structured Text (ST) is excellent at calculations and procedures. Need to do a complicated scaling of analog signals? ST is your go to language. Try to shoe horn it into ladder and you're asking for trouble.
Function Blocks (FB) are just aching to help organize repetitive tasks. Have a 10 station machine where all the stations are identical? Make one Function block for a station and use it 10 times. If the functionality changes, just change the definition of the one function block and Voila; All stations updated.
the objective is to have transportability and enable sourcing hardware in several locations while maintaining the "same" program code in all.
W.R.T. transportability, that is a trickier subject. Keeping away from any hardware specific instructions or constructs would help but probably won't be 100% bulletproof. You would likely end up with an abstraction layer between the logic and the hardware. So for instance if you have a pump motor function block with Inputs & Outputs such as NoOverload, SuctionValveOpen, noEstop, RunningIndication, ContactorON you would connect these to internal symbols instead of physical hardware points. Then this file could be portable. Each hardware platform would need a custom POU to connect the internal symbols to physical points. This may not be a bad way to go in any case but Connecting I/O is simple. When it comes to specific devices like analog cards, High Speed I/O, PWM cards and advanced communications it can get a little more complex.
Or maybe, just have all the I/O on CanOpen or ProfiBus/Net drops and then maybe it's a more standardized system?