06-20-2011 07:05 PM
I'm wondering how to manage the safe shutdown of a cRIO application on a portable unit where the user will be removing power (probably via an physical power switch) during normal operation. Normally, I would design an application with a Initialize_Running_Shutdown state machine, where the shutdown is initiated by the HMI sending a shutdown command, but this will not be the case here.
On a side note, I've also be wondering how to deal with this during extended power outages (once UPS power runs out, the control system dies).
How can we ensure that when power is removed, the cRIO sends the application into the proper shutdown routine?
Any input would be appreciated. Thanks
06-20-2011 10:08 PM
Hi JimMacD,
I would recommend connecting a backup power supply to the secondary connection on the CompactRIO, and then using the following set of VIs to monitor which connection is in use (http://digital.ni.com/public.nsf/allkb/3F83FB05752ACA698625754E007CFABF). When the secondary power supply is in use, execute a safe shut down routine and write data to disk, set I/O outputs to a safe state, etc.
An alternative is including some sort of local power storage (e.g. large capacitor), and monitoring the power switch or supply voltage with I/O. The I/O could then be read in to dictate the transition to a safe shut down routine.
Best Regards,
Casey Weltzin
Product Manager, LabVIEW Real-Time
06-20-2011 11:07 PM
JimMacD,
Check out this article:
http://zone.ni.com/devzone/cda/tut/p/id/6546
If you scroll down most of the way, it talks about adding a capacitor into the second power supply input. I have done this in other installations and it works pretty well. The 10,000 microfarad capacitor that they recommend will provide only about a one second run time in a fully loaded CRIO 902x, so make sure you size it appropriately.
If you are using a UPS, a lot of them have serial connections that you could monitor with the CRIO.
Rob
06-21-2011 06:16 PM
I was thinking it would involve monitoring either UPS or Line status directly. I've been spec'ing out a new type of UPS for my control systems (the one I had been using had no communications options) with a relay output card option for 24V logic.
What got me thinking about this was working on an OLD Allen Bradley PLC5 recently. It was all ladder-logic, and just had a power ON/OFF switch. Very low tech. I wanted to see if perhaps the lower-end PLCs aren't as sensitive to just loosing power as the cRIO might be, simply because the application is much simpler.
06-21-2011 06:51 PM
I that document you posted, a little before the capacitor part, I read the following:
"Many times CompactRIO and FieldPoint applications are written without considering how to safely shutdown the application and instead are stopped abruptly. In rare occasions shutting down abruptly can cause a FAT corruption which in some cases can cause parts of the Real-Time OS or drivers to become corrupted. A corruption would be cause the need to reinstall Software and the application to the Real-Time device. One easy means of avoiding this potential failure is to have a procedure for safe shutdowns. Using hardware (Digital IO or a DIP switch) to trigger the stop button of the program's while loops are simple ways to insure safe shutdowns. Alternatively, use of a UPS (uninterruptible power supply) coupled with DIO (to read a line which indicates whether the UPS is on battery power) could automatically power the machine, trigger the stop condition and keep power on until the VI has exited."
I have experienced corrupted OS/drivers due to just removing power. After that I implemented a software shutdown for the cRIO from the HMI. I see how they also talk about using some DIO line to initiate this shutdown
06-21-2011 08:23 PM
JimMacD,
A couple of notes on this situation:
I think the UPS/capacitor is a viable solution, depending on the run time that you need from the system to execute a safe shutdown.
Rob
06-22-2011 03:45 PM
Rob,
I remember reading about the Reliance files system as you described, and thought it was odd that the cRIO was getting corrupted in the OS drivers.I experienced this issue about a year and 1/2 ago when using NI RIO 3.1.1 (I have since upgraded to NI RIO 3.5.1 on most systems). Perhaps it is something that has been fixed since then, but I have not been willing to try it. Like I mentioned earlier, I have been stopping the cRIO application via an HMI command, or the user DIP switch on the cRIO, in response to this issue I saw.
As far as the UPS situation goes, all of my systems that are stationary have a UPS, but currently there is no communication of status to the cRIO. I am planning to change that soon with a new UPS model.
05-10-2014 03:10 PM
Hi Rob,
need small info, we are trying to setup a system that will run compactRIO 24/7 generating thousands of files.
can you tell me how to implement such a system, what kind of files that will write to and is it a a excel, sql, tdms type of database, which one is better. how to develop a crash proof file storage.
Thanks in advance for any help
05-11-2014 07:07 PM
Freemason,
A lot of it depends on the type, number of channels, and speed of the data you are storing. I think it has less to do with the type of files than with how you write those files.
There are a couple of good resources on ni.com:
http://www.ni.com/white-paper/10435/en/
and you can check out a presentation I did at NIWeek on pushing the CRIO to the limits:
https://decibel.ni.com/content/docs/DOC-17417
What CRIO model are you using? Feel free to message me or email me at hoffman@signalxtech.com and we can discuss details further.
Rob