7 posts in this topic

Hi everyone,

I need some help with my PLC programming. I am currently using a twincat 2 software and a Beckhoff CX 8090. Basically, the gist of my program is to send and receive data and datalog the input data received from the sensors and timestamp the received data for every 1 second. I want to create a boot up counter where it will count the number of times my data logging program has restarted(if it did). This boot up counter serves as a health monitoring check to ensure that my program is running perfectly and thus, not restarting randomly when it shouldn't. I am more familiar with structured text so if you have a solution, kindly post it in structured text form. Your help would be greatly appreciated.

Best regards,

DeadPool

Share this post


Link to post
Share on other sites

Hi

I think your program was restarted if there would be a power loss and the CX8090 turns off. But in CX8090, there is an integrated UPS and some Function blocks that you can monitor the state of your PLC. The function blocks are included in TcSystemCX80xx.lib library.

1 person likes this

Share this post


Link to post
Share on other sites
On 8/1/2016 at 6:02 PM, imankarimi said:

Hi

I think your program was restarted if there would be a power loss and the CX8090 turns off. But in CX8090, there is an integrated UPS and some Function blocks that you can monitor the state of your PLC. The function blocks are included in TcSystemCX80xx.lib library.

Hi Mr Iman,

 

Is it possible though, for me to record the number of times the system rebooted in a CSV file? Would there be sufficient time for the controller to record the number of times the system rebooted into a CSV file during a power failure mode?

Share this post


Link to post
Share on other sites

I'm not too familiar with TwinCAT software but most PLCs offer a "first scan" bit. If not, they are easy enough to create. Perhaps you could write system time and date to your file each time this bit is active.

1 person likes this

Share this post


Link to post
Share on other sites
On 8/6/2016 at 9:44 AM, pop29684 said:

I'm not too familiar with TwinCAT software but most PLCs offer a "first scan" bit. If not, they are easy enough to create. Perhaps you could write system time and date to your file each time this bit is active.

Shall try the part you mentioned above. Thanks a lot for helping! Much appreciated.

Share this post


Link to post
Share on other sites
On 8/5/2016 at 8:36 AM, DeadPool said:

Hi Mr Iman,

 

Is it possible though, for me to record the number of times the system rebooted in a CSV file? Would there be sufficient time for the controller to record the number of times the system rebooted into a CSV file during a power failure mode?

Sorry for  long delay,

You can add this function FB_S_UPS_CX80xx from the mentioned library. It has an output with this name bPowerFailDetect, which is binary value and when the power goes down this value goes to high. As a result you can make a counter which its enable is the bPowerFailDetect. For saving data you should define the counter value as persistent. Then after each power down up you can see the number of failure on the counter value. I think this method is good for you but if you want to save it on a txt file in the PLC memory you should use FBs like FB_FileOpen, FB_FileWrite and etc from TcSystem.lib.

I've also attached a sample logic which makes you understand the procedure better.logic.prologic.prologic.pro

logic.pro

2 people like this

Share this post


Link to post
Share on other sites
1 hour ago, imankarimi said:

Sorry for  long delay,

You can add this function FB_S_UPS_CX80xx from the mentioned library. It has an output with this name bPowerFailDetect, which is binary value and when the power goes down this value goes to high. As a result you can make a counter which its enable is the bPowerFailDetect. For saving data you should define the counter value as persistent. Then after each power down up you can see the number of failure on the counter value. I think this method is good for you but if you want to save it on a txt file in the PLC memory you should use FBs like FB_FileOpen, FB_FileWrite and etc from TcSystem.lib.

I've also attached a sample logic which makes you understand the procedure better.logic.prologic.prologic.pro

logic.pro

Wow. That is really a lot of useful information. Really beneficial and has helped me a lot definitely. Thank you for your time and your kind reply. I will try out as what you have mentioned. I am really close to finishing the boot-up counter now. Thank you very much Mr Iman. Have a great day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now