Exploring File Spanning with OPC Data Logger

6 min read

Sep 14, 2023 2:00:00 PM

Storing process data almost always comes with varying project requirements, making it difficult for users to find solutions that cater to specific configuration needs. Luckily, the wide variety of configurable functionality in OPC Data Logger allows for creating unique projects to fit your needs.

OPC Data Logger is designed around the simple requirement of accessing the data when you need it and getting it to where you need it. This simple principle is built upon with the additional components of triggers, data presentations, and writebacks provided in the software.

If you’re already familiar with OPC Data Logger, you likely know how quickly you can configure a Data Source and start logging to a standard Text or CSV file. User requirements rarely stop there. Project specific needs for file naming conventions, when to create new files and more are the reasons OPC Data Logger is not just a basic logging solution. This post will take a deeper look into the File Spanning options for Text & CSV data logging and how you can make the best use of these features in your next project, or current one.

What is File Spanning?

This feature allows for the current file being logged to be closed and automatically open a new file for logging to continue. Spanning can be controlled by the various Triggers already available in OPC Data Logger, including: Recurring Triggers, Specified Date & Times utilizing the Scheduled Triggers, and condition based on OPC values with Monitored Item Triggers. File spanning is built into both editions of OPC Data Logger, though it is specifically for use with Text/CSV files, not with database storage.

Introduced in recent releases, improvements have been made to the File Spanning feature to allow new file creation or spanning, to also be automatically controlled with defined record counts or file size. This provides for even more control over how your files are created and managed directly from OPC Data Logger.

Configuring the File Spanning options is done in the Text-File Data Storage component of your project. Opening the properties of your Data Storage will offer various options, you will find a dedicated tab for Spanning within.

By default, Spanning will be disabled. Once turned on, the options below will become available for selection. The File Naming Options will determine how the subsequent files will be organized when a File Spanning event occurs prompting OPC Data Logger to create a new file.   Example filenames can be seen at the bottom, so users know exactly what to expect.

OPC Data Logger Spanning Naming Options

The following fields are available for configuration:

  • Overwrite Self: Configured to overwrite the existing file by using the same original name (Caution - Data will be lost from the previous file)
  • Incremental: A new file is created when a file-spanning event occurs, and an incremental number is appended to the file name (e.g., TextLog_1.txt, TextLog_2.txt, TextLog_3.txt)
  • Date and Time: Appends the date and (optional) time to the file name (e.g., TextLog_01_09_2023_15_29_02.txt, TextLog_01_09_2023_16_29_05.txt)
  • Specified Item Value: Appends the value of the specified item from the OPC Data Source to the file name every time the file is spanned (e.g., textfile_PlcTagValue1.txt, textfile_PlcTagValue2.txt)
    • Prepend Item Value: When checked, the OPC Data Logger will append the selected value to the beginning of the file name. The default setting will place the value at the end.

Once you’ve configured the desired naming options for your file, you’ll want to explore the Spanning Trigger Options. Here is where the criteria needed for a spanning event will be configured:

OPC Data Logger Spanning Trigger Options

The following options can be selected:

  • Use Triggers: Enable to use trigger type (Scheduled, Recurring or Monitored Item)
  • Span when record count reaches: When enabled, set a maximum record count value to trigger the file spanning. When the record count matches the specified value, a file spanning event will occur What happens on that event is defined next.  
  • Spanning by file size: Sets a limit on the file size. When the file size matches the set value, a file spanning event will occur.

If using a trigger to control File Spanning, you can navigate to the Triggers tab to extend the configuration. Here you can add a selected Trigger from the dialog box in the following ways: Either select an existing trigger or create a new trigger directly. In this example, I’m adding a Recurring Trigger that was already configured to run every 60 minutes.

OPC Data Logger Spanning Assign Trigger

The Trigger effect is also customizable for the selected trigger. You can choose between two options:

  1. Triggers file spanning event: This option will close the current file and automatically create a new one to continue logging into.
  2. Cause file to close: This option will simply close the open file being logged to and not create any additional files.

Why is File Spanning useful for me?

With every project comes unique requirements to fulfill, including the type of data needed, its speed, and how/where it will be stored for use. File spanning in OPC Data Logger offers multiple options for customizing how your data will be organized.

Through our time helping implement OPC Data Logger projects we have encountered many of these unique requirements. Here are a few examples that were successfully implemented:

  • Created a new file based on a Boolean tag every time it equaled ‘true’. After linking this to an HMI, this allowed for direct control over the spanning of files.
  • Spanned to a new file at the start of the shift time using a scheduled trigger. Each file  was representative of a full day of production.
  • Stored hourly report files with the Recurring trigger, which produced easily manageable files.

The power of File-Spanning is amplified by the modular configuration of OPC Data Logger. Individual Data Storages and Logging Tasks can be created to generate both daily and hourly files to share with various groups across the organization. The ability to combine and modify these outcomes to fit multiple requirements in one project empowers users to make the most out of their implementations.

Where can I get more information?

You can learn more about the OPC Data Logger’s other functionality including triggered and confirmed logging, store and forward, and database logging on the OPC Data Logger dedicated website.

The latest version of OPC Data Logger is available on our the OPC Data Logger website for download. The software will run for a 2-hour trial period that can be reset for up to 30 days. After 30 days you must purchase a license to keep using the product. Our OPC Data Logger video resources are a great place to get started.

You can also email us at support@softwaretoolbox.com with your questions and we encourage you to subscribe to our blog for more quick and easy OPC Data Logger tutorials and tips, as well as other helpful information for all of our solutions.

Download Latest OPC Data Logger Free Trial

 

Connor Mason
Written by Connor Mason

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all