We would like to be able to Store and Retrieve Historical Trend Data by associating it with a Batch Code for a Product Run. As an example, lets say we have 10 Tags we are saving historical trend data for. When an operator starts a new product run we would like to have him enter a “Batch Code” before the run can start, and then once the run is started we would like to be able to associate the trend data collected (for those 10 Tags) during the product run to the batch code that was entered. We would like to be able to do this for several reasons:
- Recall the associated block of historical trend data by searching for a batch code or picking a batch code from a list so as to view the specific data for the product run.
- For reporting purposes, bring the associated block of historical data into a report so as to print a report with the specific trend data associated with the batch code.
Transaction groups are your best bet here. You can add a memory tag that will contain your batch code to the transaction group, then run it as long as necessary. Each row of data generated by the group will have the batch code as one of the columns, and then that batch code can be used as a retrieval filter on the Easy Chart (using a DB pen to query the transaction group table).
We have done something like this using only the historical data being stored from our process.
If you query the batch number tag history and query it for “On Change” then you will get a dataset that provides the time stamp for the beginning of each batch. You can find the end time of the batch by looking at the timestamp for the next row in the dataset.
We have then built navigation buttons that will update our EasyChart StartDate and EndDate based on the batch number selected in a ComboBox. So our users can select a batch number and the Easy Chart automatically updates to show the complete batch for whatever tags we have in the chart.
Has anything changed to help with this query? I didn’t want to store data twice (Database Table and Historian)
Do you have an example on how you did this? I am currently looking for an example on doing this same thing.
Thanks! I know this is an old post, but I haven't found a more recent relevant one that addresses my needs to find a way to do a "batch report" where I set the start time when a batch number changes and the end time when it changes again.
- Set your Batch ID to store history OnChange (Tag Group or OnChange)
- Add a PowerTable to a Vision Window and Bind the Data to Tag History
- Binding Sample Size will be OnChange
The data in the table will have two columns:
- Time Stamp (t_stamp) - which is the starting time for the batch
- Batch ID
You can then use Scripting to extract Batch ID, batch start time, and batch end time (start time for the following batch)