Monthly logging file name change


Recommended Posts

There is an example in the Help file to run a sequence which changes the logging file each month.

The query that I have about this is that when I invoke that sequence to write the logging file name which has the current month and year in it, where the sequence "waitsuntil" the next month it hangs my laptop which is an XP pro 1.8Ghz 1GB machine. Not the greatest nor latest but good enough for development.

I have a stress test example which I wrote to try to establish how to get this feature to run. Reads 400 channels every 2 seconds and logs 140 channels every 15 seconds with the instantaneous value. The logging works fine on the laptop with this and one is able to use the machine. When the change-of-name-sequence is started it all goes in to hang mode.

I have just tried this stress test example on my PC which is duo-core, 2.8GHz 4Gb DDR3 etc and it works OK.

What causes that Help file example sequence (which changes the logging file name every month) to consume resources to hang a machine? Is that to be expected? Is there a way to prevent this?


The second question with this Help file example is that I tried to write the next date that the sequence is waiting for and using the format that the sequence has - to write that next date to a vChannel and then display it using FormatDate it shows that it is going to wait for 1 year and not 1 month???

Link to comment
Share on other sites

I actually don't like the example in the help and probably need to push to get it removed. It is far easier to change the file name at the end of the month by simply adding a single line of script in the Channel Event for one of your channels. The script line would be something like:

Logging.MyLogging.strFileName = "MyData_" + FormatDateTime("%y_%m.csv",systime())

which is identical to one of the lines in the example except for the use of systime(). What this does is change the file name every time the channel updates, but since the name doesn't actually change until either the month or year change, it does nothing 99.99999% of the time, but changes the name at the end of the month.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.