We have a machine running Codesys on a Windows IPC (CODESYS Control Win v3 - x64). When we hard shutdown the machine, the code on the PLC sometimes becomes "corrupted" after a power on (When trying to login to the PLC, we get the message "The application 'Application' does not exist on device."). I've noticed these errors in the logs, but I'm not sure what to make of them. We are not using any RETAIN variables in our code, although I'm not sure about referenced librairies. (we are using the persistence manager). I'm pretty sure that not doing a graceful shutdown is the root cause of this. This being said, what is the proper way of doing a graceful shutdown? Is putting the Codesys application in "stop" sufficient? I know how to implement this, so if it works then it would be a quick fix. However, I think we need to add a UPS, which would detect power loss and inform the PLC that it needs to initiate its shutdown, and then the PLC would shutdown gracefully. Any help with this will be greatly appreciated :)
I think that the .err file is the .app file renamed by Codesys, so it is compiled.
We met this behaviour one time, it was because the runtime goes in exception due to bad Ethercat cables.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This explanation aligns with the issues weβre experiencing with our machines. The scenario I described is happening with one of them (letβs call it Machine A). This machine is identical to another one (Machine B), except for some custom code that facilitates communication with an external Beckhoff PLC for MES integration in the production line.
Machine B has been powered on and off daily for at least three months and has never had this problem. Given that, I highly doubt the MES custom code is the cause of the code corruption.
This being said, your explanation does seem plausible. However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown?
One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown?
I don't have the answer to this question.
One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task
Yes. It was the exeption you can see in attached file.
Hi,
We have a machine running Codesys on a Windows IPC (CODESYS Control Win v3 - x64). When we hard shutdown the machine, the code on the PLC sometimes becomes "corrupted" after a power on (When trying to login to the PLC, we get the message "The application 'Application' does not exist on device."). I've noticed these errors in the logs, but I'm not sure what to make of them. We are not using any RETAIN variables in our code, although I'm not sure about referenced librairies. (we are using the persistence manager). I'm pretty sure that not doing a graceful shutdown is the root cause of this. This being said, what is the proper way of doing a graceful shutdown? Is putting the Codesys application in "stop" sufficient? I know how to implement this, so if it works then it would be a quick fix. However, I think we need to add a UPS, which would detect power loss and inform the PLC that it needs to initiate its shutdown, and then the PLC would shutdown gracefully. Any help with this will be greatly appreciated :)
Last edit: egau 2024-10-03
Hi,
Runtime goes in exception before the shutdown ?
Do you have a .err file which is created ? (located in the folder of the .app and .crc)
Hi, thanks for the fast response :)
Yes I Have a .err file. Sorry I forgot to upload it. It is a binary file though...
"Runtime goes in exception before the shutdown ?"
I think it goes into exception at the same time as the power is lost...
I think that the .err file is the .app file renamed by Codesys, so it is compiled.
We met this behaviour one time, it was because the runtime goes in exception due to bad Ethercat cables.
This explanation aligns with the issues weβre experiencing with our machines. The scenario I described is happening with one of them (letβs call it Machine A). This machine is identical to another one (Machine B), except for some custom code that facilitates communication with an external Beckhoff PLC for MES integration in the production line.
Machine B has been powered on and off daily for at least three months and has never had this problem. Given that, I highly doubt the MES custom code is the cause of the code corruption.
This being said, your explanation does seem plausible. However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown?
One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task?
However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown?
I don't have the answer to this question.
One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task
Yes. It was the exeption you can see in attached file.
Excellent merci pour ton aide!