I am currently logging all or our run time hour and minutes and starts on gas compressors and motors and trending as well. I just need to be able to to grab the [color=#BF0000]Run Time And Starts for Yesterday[/color] every day and put it in an excel spreadsheet that date and time stamps the values of the tags. What would be best approach to do this. The owner has currently just been logging in every day and manually writing down yesterdays total run time hours and minutes and starts. I have tried a few things with tables, but I just need it to update his excel spreadsheet every day.
Basically I just need to grab the 3 tag values once a day. Since the run hours/minutes and starts are stored in my PLC the values for Yesterday run time will not reset till the following day, so If I can just grab those 3 tag values and store them once a day say at 9:00 am each day or even 3:00PM doesn’t really matter as the value will remain the same all day long, but I didnt think using a trending chart was the right way to approach it.
[attachment=0]Compressor Run Times.JPG[/attachment]
Well, if it were me, I would put all the data in a SQL table, then use Ignition to query what you want each day from that table’s contents into a dataset, and then out to Excel. Look in help under Appendix C and the system.dataset group for the dataSetToExcel function. The example there is pretty much exactly what you need.
Also possible to use a database connection from within Excel.
Depending on where the database resides, you might be able to run a query that will export to CSV, such as MySQL’s select into…outfile
But like mentioned, I think the easiest first step is to use a transaction group to store the data you want in the right format (if you’re not doing that already). Then it’s really just an issue of either exporting that, or querying it.
Wouldn’t the system.dataset group for the dataSetToExcel function make a separate spreadsheet in an excel work book every time it was updated though? I basically just need to get the “Run Hours for Yesterday Tag” “Run Minutes for Yesterday Tag” and “Starts for Yesterday Tag” and just add one row to the spreadsheet every day that has a date stamp so they can see how long it ran and how many starts it had every day. Basically just add a new row with the new information every day.
The function dataSetToExcel is only going to add a new workbook. This function will not add a new row to an existing spreadsheet.
The suggestion Colby made would be the route you should go in. Use a transaction group to get the data into the database and then use the database to export the data to your spreadsheet.