You are on the right road. Historical Log Configuration is designed exactly for what you are trying to do, i.e. Create a Batch Log File with historical data that is associated with a particular production run.
Apart from usual list of variables and common scan rate, the option also allows a start trigger variable and condition to be configured. PACDisplay will then scan the variable (at the same rate at a specified scan group rate, note it doesn’t have to be the same as the common scan rate) and check the condition. For digital values this can be ON or OFF, while analog values can be checked for >, >=, <, <= or =. Once the condition is met data will start being written to the file.
The next decision is when to stop writing to the file, through configuration of the Stop Trigger. Once again a variable and condition can be specified. Alternatively the file can be left open until a specified number of samples have been collected.
The files produced are basically logging files, so follow the usual rules of specifying a rollover period, filename, save directory and file cleanup. I would suggest you configure the rollover period from “Days” to “None”, You will need to judge how much data this will create in a single file, and also be responsible for file cleanup and deleting old files, but these files will not rollover.
I think the one trick you are missing is the use of a strategy sourced file name. Normally the automatically generated rollover files use an MSDOS automatic file name specifiying type of file (H) the file ID, and rollover date. To save data related to a specific batch, I would suggest you to use the “From Strategy” option for the filename. In this scenario, by preparing the BatchID as an Opto String Variable and having this available before starting logging, the data files will be saved as production files associated with the BatchID and not just the typical time based format.
This is a feature that is sadly missing on many SCADA and DCS systems costing thousands of dollars. Some sell the “feature” as a separate package (also costing several thousand dollars), just to relate normal historical data to specific production runs. I once worked with a DCS that required a special hardware costing UD$20,000 and a special software licence that cost UD$5,000 and a lot of required "DoItYourself" software programming to do just that. (Those were the days, before the world got warmer). Needless to say the customer had no idea that he would have to pay this when he initially selected and bought the system. With Opto22, its all included in the price, which in the case of PAC Project Basic is less than one cent.