Red Lion Logging and FIFO

Nick517

Member
Join Date
Jun 2012
Location
Aberdeen
Posts
19
I have a system set up with different states for a drive to run. I have all data logging at 60 seconds. I understand that between logs the data is buffered in the modular control. If say the drive changes from Normal Operation state to a Shutdown state between one of the 60 second logs, i want to dump all data in the buffer to file. I have tried using the Logsave function but appears to do nothing. The data logs are still showing data on a 60 second interval. I assumed when Logsave was called it would write to log and show a time stamp when the function was called and the buffer was dumped.

I have also tried to create, open and write to a file upon shutdown, but when i have tried this the system crashes, the CF light flashes rapidly and the CF view in windows explorer shows not responding and i have to do a DUMMY start to get control back.

If anyone can help with this or offer another solution i would be grateful .
Thanks
Nick
 
Try having a second Data-log, that is logging at 1s intervals, with maybe Logsave to snap-shot the most recent set of readings to your Shutdown Log.

I haven't tried this.
But it may be a way at least minimise the amount of lost data.
 
If your logging is set for 60 seconds that means we only take a snapshot of the data every 60 seconds. The buffer is 2 minutes so in your case each time we write to the CF card there will be two snapshots included in the update to the file on the CF card. The logsave() function will bypass the 2 minute buffer and log any data to the CF at the time you call the function.

If you want to see data in between the 60 second updates you will need to lower your update rate

Thanks
Jeremy
 
Hello Jeremy thanks for that. I dont think the logsave will do what i want but i have made the following code.

CreateFile("/logs/myfile.csv");

Testing.test = int(DriveConstant.PresetReference);
Testing.test2 = int(Sensor.Thermo);
Testing.test3 = int(Sensor.Volts);
Testing.test4 = int(Sensor.Thermo2);

cstring Ref;
cstring Thermo;
cstring Voltage;
cstring Calc;

Ref = IntToText(Testing.test, 10,3);
Thermo = IntToText(Testing.test2, 10,3);
Voltage = IntToText(Testing.test3, 10,3);
Calc = IntToText(Testing.test4, 10,3);

FileIndex = OpenFile("/logs/myfile.csv", 2);
WriteFileLine(FileIndex,"ShutDown Log at," + Timer.CurentTimeString() + "," + Timer.CurrentDateString()
+ "," + Ref + "," + Thermo + "," + Voltage + "," + Calc + ",");
CloseFile(FileIndex);

This is working fine except the data being read in from the tags are floats. As they need to be converted to integer before being converted to string i am losing data so for example the data from Sensor.Volts is writing to file as 2 when it should be 2.7. Any ideas how i can get this to work?
 
Hello Jeremy thanks for that. I dont think the logsave will do what i want but i have made the following code.

CreateFile("/logs/myfile.csv");

Testing.test = int(DriveConstant.PresetReference);
Testing.test2 = int(Sensor.Thermo);
//Testing.test3 = int(Sensor.Volts);
Testing.test4 = int(Sensor.Thermo2);

cstring Ref;
cstring Thermo;
cstring Voltage;
cstring Calc;

Ref = IntToText(Testing.test, 10,3);
Thermo = IntToText(Testing.test2, 10,3);

//DECTOTEXT(DATA, SIGNED, BEFORE, AFTER, LEADING, GROUP )

Voltage = DecToText(Sensor.Volts, 1, 5, 3, 0, 0);
Calc = IntToText(Testing.test4, 10,3);

FileIndex = OpenFile("/logs/myfile.csv", 2);
WriteFileLine(FileIndex,"ShutDown Log at," + Timer.CurentTimeString() + "," + Timer.CurrentDateString()
+ "," + Ref + "," + Thermo + "," + Voltage + "," + Calc + ",");
CloseFile(FileIndex);

This is working fine except the data being read in from the tags are floats. As they need to be converted to integer before being converted to string i am losing data so for example the data from Sensor.Volts is writing to file as 2 when it should be 2.7. Any ideas how i can get this to work?

Try the above (changes colored)...If you like the way this works for your Voltage variable, do the same changes for the other floats.
 

Similar Topics

Hey everyone! Pretty new to Red Lion, and am setting up a data logger on my HMI application. My boss is logging data on another HMI and I've...
Replies
7
Views
2,335
Hello everyone! I'm needing some help with the data logging feature. I have set up a data logging to monitor a series of faults and will be using...
Replies
3
Views
3,324
I'm thinking about how to help a customer tonight and I've got an idea, but I don't know if it's possible. I've used the Data Logger on a Red...
Replies
2
Views
3,035
Hey guys, I'm working with a PTV and am wondering if somebody knows of a way to log the info in the alarm/event viewer into a file other than...
Replies
2
Views
1,712
I'm wondering if anyone has any suggestions as to software / utility to view trends (graphed data) from .CSV files, in specific those recorded by...
Replies
5
Views
2,204
Back
Top Bottom