Dump solenoid plc archive data
From GlueXWiki
Revision as of 12:02, 9 August 2013 by Wolin (Talk | contribs) (Created page with "Currently the solenoid test PLC archive data resides on gluon01 (Aug-2013). At some point we will move it to a more accessible area. The script below will be modified appropria...")
Currently the solenoid test PLC archive data resides on gluon01 (Aug-2013). At some point we will move it to a more accessible area. The script below will be modified appropriately.
You can dump PLC archive data using the following script from any account on gluon01:
/home/halld/solenoid/DumpPLCArchiveChannel.py
To run the script you have to give it the database name, tag number within the database and a time range. The output file contains a time (unix time + msec), value, and ascii time per line (you can suppress the ascii time to save space, see below). Be sure to carefully follow the date format convention shown below.
Use the "--index" option to get an index of all database names and tag numbers.
$ /home/halld/solenoid/DumpPLCArchiveChannel.py --help Usage: DumpPLCArchiveChannel.py [options] Dumps selected PLC archive data from database into file. Based on database name, tag index and date range. Example: $ DumpPLCArchvieChannel --tag=26 --db=Solenoid_OnChange --start='2013:08:01 00:00' --end='2013:08:01 00:10' Options: -h, --help show this help message and exit Database Options: --tag=TAG Tag index --db=DATABASE Solenoid_OnChange, Solenoid_100ms, Solenoid_1s --host=HOST Database host name --user=USER User name --pwd=PWD Password --start=START Start time, "yyyy:mm:dd hh:mm" --end=END End time, "yyyy:mm:dd hh:mm" Miscellaneous Options: --index Just print tag index for all three databases --noTime Suppress ascii times in output file --debug Turn on debug options
Example:
$ /home/halld/solenoid/DumpPLCArchiveChannel.py --tag=26 --db=Solenoid_OnChange --start='2013:08:01 00:00' --end='2013:08:01 00:10' database: Solenoid_OnChange tag index: 26 tag name: [Logix5562]Coil2.TCR2 start time: 2013:08:01 00:00 end time: 2013:08:01 00:10 MySQL version: 5.1.61 output file: Logix5562Coil2TCR2.txt noTime: False $ more Logix5562Coil2TCR2.txt 1375329603.017 2795.738770 2013-08-01 00:00:03 0.017 1375329604.110 2795.113281 2013-08-01 00:00:04 0.110 1375329605.161 2791.985107 2013-08-01 00:00:05 0.161 1375329605.379 2794.331299 2013-08-01 00:00:05 0.379 1375329606.428 2795.269775 2013-08-01 00:00:06 0.428 1375329607.473 2790.421143 2013-08-01 00:00:07 0.473 1375329608.516 2796.833740 2013-08-01 00:00:08 0.516 1375329609.563 2793.862061 2013-08-01 00:00:09 0.563 1375329610.608 2794.487549 2013-08-01 00:00:10 0.608 1375329611.612 2794.018311 2013-08-01 00:00:11 0.612 etc.
You can suppress the ascii times in the output file:
$ /home/halld/solenoid/DumpPLCArchiveChannel.py --tag=26 --db=Solenoid_OnChange --start='2013:08:01 00:00' --end='2013:08:01 00:10' --noTime database: Solenoid_OnChange tag index: 26 tag name: [Logix5562]Coil2.TCR2 start time: 2013:08:01 00:00 end time: 2013:08:01 00:10 MySQL version: 5.1.61 output file: Logix5562Coil2TCR2.txt noTime: True $ more Logix5562Coil2TCR2.txt 1375329603.017 2795.738770 1375329604.110 2795.113281 1375329605.161 2791.985107 1375329605.379 2794.331299 1375329606.428 2795.269775 1375329607.473 2790.421143 1375329608.516 2796.833740 1375329609.563 2793.862061 1375329610.608 2794.487549 1375329611.612 2794.018311 1375329612.641 2791.985107 1375329613.689 2795.113281 etc.