09-13-2009 05:23 AM
Hello everyone,
An RT target (desktop PC) is running a machine vision inspection. The number of inspected and failed parts are counted. My problem is to keep this data in case of power loss.
I guess that my only chance is to write this two values to harddisk from time to time so in case of power loos or pc restart I can read the last written values and use them as initial values.
If we don't take into account access time to harddisk, I am concern about the physical stress to HD of re-writing these two values over and over again.
- Am I writing to the same physical sectors of the HD everytime?. I think this can be dangerous.
- How often should I save the data?
Any alternative idea is wellcome.
Thanks in advance.
09-14-2009 05:56 AM
The datarecording to hard disk can be done in a low priority loop than in the loop that does primary task. Just pass the data in a queue and write the data in other loop. Take care to flush the data in regular intervals @ 5000ms approx to ensure that data is written into hard drive.
Hope this helps.
09-14-2009 08:52 AM
It's you are writing in the same physical sector if you are REwriting the same amount of data (same data type, format and value range) in a file every XXX seconds. If you want to be sure you are writing in different HD position, delete your actual file and generate a new one each XXX minutes.
Another option can be create a logging of values instead of just a single value. I mean, write a list of data instead of a single data in the file. After XXX lines, open a new file and delete the old one (or just delete the old one and star again).
09-14-2009 08:49 PM
It's pretty hard to wear down a harddisk by re-writing the same sector. Harddisks also run sanity checks and will automatically exclude defective sectors, so the next re-write would go to a sane sector if the existing one appears to be damaged.
Herbert