Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: RBPLC on June 02, 2021, 05:22:36 PM
-
I have an application where I'm trying to log 12 real values at 100ms sample rate. In general, I need to log for about one hour once logging begins. I set up a FILELOG instruction with edge triggering and am using a FLASHER at 50ms for the edge trigger. I'm using the tickms() to get a relative timestamp when logging starts for each of the log entries. I noticed today that for a while (until about 10 minutes into logging) the samples were at approximately 100ms (within a few ms of 100ms, which is fine for this application). After this time, it looks like the sample rate jumped to about 200ms. My question is this: what is the optimal way to do "high speed" data logging. I assume the FILELOG instruction is not the preferred method and that the FILEWRITE is preferred. Assuming that the FILEWRITE is the preferred method, is there any issue with leaving the file open for "long" periods of time while being written to. I assume the logic flow would be FILEOPEN, write parameters for an hour and then FILECLOSE. Is this the preferred method?
-
I have an application where I'm trying to log 12 real values at 100ms sample rate. In general, I need to log for about one hour once logging begins. I set up a FILELOG instruction with edge triggering and am using a FLASHER at 50ms for the edge trigger. I'm using the tickms() to get a relative timestamp when logging starts for each of the log entries. I noticed today that for a while (until about 10 minutes into logging) the samples were at approximately 100ms (within a few ms of 100ms, which is fine for this application). After this time, it looks like the sample rate jumped to about 200ms. My question is this: what is the optimal way to do "high speed" data logging. I assume the FILELOG instruction is not the preferred method and that the FILEWRITE is preferred. Assuming that the FILEWRITE is the preferred method, is there any issue with leaving the file open for "long" periods of time while being written to. I assume the logic flow would be FILEOPEN, write parameters for an hour and then FILECLOSE. Is this the preferred method?
The SDCard has a limited access rate. You could log to the RAM disk, then copy the file to the SDCard.
-
Is there a performance difference between the FILELOG vs. FILEOPEN/FILEWRITE approach or is the SD card the limiting factor regardless of the instruction? Also, the files are > 1MB so I'd have to split the files if writing to RAM and do intermediate copies over to SD.
-
Flash is extremely slow compared to RAM. FILELOG is faster than doing the steps manually since it does everything internally. The other instructions have to be synchronized with the PLC scan.
Try the RAM drive idea first and let us know if that is sufficient.
-
One other method is a circular queue in memory, depending on how much memory you have available. Use 2 pointers, one to store the time stamp and data. Another to read the data and log it. When the 2 are equal all data is logged.