fabiano.batista

What is the best way to "save" image files in PI?

Blog Post created by fabiano.batista on Oct 26, 2018

Introduction

 

Images can be very useful for quality control and process troubleshooting. Process engineers expect to be able to easily correlate image files with a specific production event (by using proper file names/path and file creation time stamp). Those images can be captured either automatically (by cameras mounted in the production line, triggered by a sensor) or manually by an operator.

 

Several customers have asked me the same question: how can I store image files in PI? The simple answer is: don’t store it in PI. This answer may not seem obvious to everyone. Instead of trying to save a picture file in PI, the recommended approach is simply to save a reference to the picture file (i.e., path and name) in PI, and keep the picture file stored in a network folder. The same approach can be applied to other type of files (e.g., audio files used in CBM applications).

 

 

Implementation

 

There are several possibilities to implement a solution for this problem. However, my recommendation is to keep the solution simple. Just create a PI ACE calculation to monitor the folder containing the image file, allowing it to capture file attributes in PI. The necessary PI ACE calculation would have to perform these operations:

  • To periodically scan a network folder where the picture files are saved by the camera (ex: once a minute)
  • For each new file detected in the folder:
    • To extract file creation date and file name, append with the file destination folder name and store the result in a PI tag
    • To move the processed file to a separate folder (destination folder)
  • To store the number of processed files each time the calculation was triggered

 

This GitHub repository contains a very basic example of PI ACE code to illustrate how it can be done.

One of my customers has had a slightly different use case. He wanted to associate a picture file with the batch number (entered manually through PI Manual Logger), which was set as the calculation trigger. The image file information (available in an AF attribute set with PI Point DR) has been synchronized with PI Integrator and made available to users through Tableau. The image file metadata has been captured by a PI ACE calculation.

 

Consuming the Data

 

You can add into a PI Vision display the PI tag (or the corresponding AF attribute DR) which contains the link to the image file. Please check Jerome’s blog for details (thanks to Jerome Lefebvre のブログ).

 

If using PI Datalink (Excel), retrieve the values from File Path PI tag (or corresponding attribute set with PI Point DR), and use the function HYPERLINK to format the result as a hyperlink. Usually BI tools allow setting string fields as hyperlink as well.

 

Conclusion

 

Although there might be variations for each use case, the general idea for the solution is the same: store in PI the reference to file, and make the necessary configuration in the chosen client application to make it possible to render the file content to the users.

 

If you have questions or comments, please feel free to post them below.

Outcomes