Hello! I'm currently developing a historian feature for a PLC project, and I need the data being stored to reset at a specific date and time. However, I've encountered a potential issue: if the machine or PLC is powered off at the designated reset time, my concern is that when it is turned back on, the PLC may not carry out the reset logic because the current date and time won't align with my preset conditions. For example, if I want the data to reset on December 31st at 23:59:00, the machine may remain inactive throughout the holiday. If it's powered back on later, say January 2nd at 07:00:00, the PLC won’t recognize that it has passed the reset time, and then I would have to wait nearly an entire year for the reset to occur again! Has anyone tackled a similar challenge or have any suggestions for managing this scenario effectively? I primarily work with ControlLogix and CompactLogix processors. Thank you in advance for your insights!
Upon system shutdown, initiate a task to record the real-time clock. During startup, assess the shutdown time against the current time to decide if a reset is necessary. Best regards.
Thank you, Garry! I’ll look into that right away. I even have a few processors I can experiment with. My plan is to reset the system in about an hour, then conduct an overnight test, and finally monitor it over a few days to see if the changes are effective. By the way, do you have any sample code available for managing a shutdown task?
There's no need to stress about a shutdown task; it can be effectively managed within a startup task. Since all CLX memory retains its data, if you have stored your date and time in a tag, that tag will hold the last recorded timestamp just before the PLC powers down. It won't refresh the date and time to the current settings until the PLC begins executing code again. Therefore, during the first scan after startup, capture the "current" value of your date/time tag (which will represent the shutdown time), then proceed to update this tag. After updating, compare the new value with the previous one to determine any changes, and take the necessary actions based on that comparison. This approach not only enhances your PLC’s efficiency but also ensures accurate data logging.
Hello ASF, I'm revisiting our previous conversation regarding the process. While your explanation was straightforward, I'm still a bit unclear on how to effectively capture the last updated timestamp before the processor was powered down or switched to Program Mode. Could you please elaborate on your proposed approach for this? Thank you!
To optimize your approach, I recommend monitoring the month of the year rather than tracking hours and minutes. Instead of resetting at the very last second of the year, consider triggering the reset at the start of January. Utilize the month to set a "January Bit." This January Bit can then be activated to perform a one-time reset. After January concludes, you can release the January Bit in February. This method ensures that your January Bit remains inactive until the next year. Furthermore, the one-time reset will not trigger again in January, even if there is a power cycle. In fact, you might not even need to use a latch—simply verify whether the month equals 1 to initiate the one-time reset.
That’s a great question! One way to handle this scenario is by implementing a "last reset" timestamp in your data storage. When the PLC starts up, you can check the current date and time against your predefined reset schedule. If the machine has been off and the current time has passed your reset time, you can trigger the reset logic right away, regardless of when the machine comes back online. This way, you won’t miss the reset, and you can avoid the long wait until the next planned reset. You could also consider using a calendar-based approach where you check if the current date exceeds the reset date during the startup routine. This adds some flexibility in managing these scenarios. Hope this helps!
Hey there! That’s a tricky scenario, but I’ve faced similar challenges with time-based resets. One approach you could consider is implementing a "last reset" timestamp in your PLC's memory. When the reset time passes, you can check if the current time is beyond your specified reset time and also see if the machine has been powered off. If it was powered down, the PLC could run a check on startup to see if the current date is past the reset date and, if so, initiate the reset process immediately. This way, you ensure that even if it’s been offline, the reset happens as soon as it's back online. Hope that helps!
âś… Work Order Management
âś… Asset Tracking
âś… Preventive Maintenance
âś… Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.