Possibly related, on the PLC where I have the large file numbers I noticed that sometimes an index value that I am logging (Incremented after each log entry) was sometimes recorded as zero, but then later on would record correctly. The index value is not being set to zero anywhere in the program, and the count picks back up where it should so it is still incrementing correctly even though it is being logged as a zero.
This has me worried as it is intermittent and sometimes log correctly after having logged as zeros. Part of the same instruction has a timestamp and those do update correctly with each record. Any idea why this would be happening?
I find it more than a little alarming as it means I can't trust the data being logged. Second pic is of the data sent to the server, the red lines show where the data had been coming in with a 0 index (first column) and so aren't shown.
We will do a bit of stress testing, but the large number of files is well outside the intent of this feature. These PLCs are small memory constrained devices, and despite our best efforts to cram more and more in them, there is a limit to how much work they can do and still efficiently run your machine. When testing the SDCard file system, I did notice a significant slowdown on creating new files, and determined that the length of an individual directory was where the issue was. I was thinking the limit was 1000 files, but looking at the code, the comment says 1000 but the code says 3000. Either way, that's there because there was a big slowdown.
It should be more efficient to use less/bigger files, and it isn't necessary to open and close every time. The log instruction does that to simplify the implementation and keep it cleaner for the user, but if you plan to log something continuously, you can keep the file open. This will require that you write your own logging code, but that's just STRPRINT and FILEWRITE.
As I said, we'll do some stress testing and see what we can learn, but please understand, this isn't a PC or a cell phone with virtually unlimited RAM and processor performance, there are definitely some compromises there.