|
Data Manipulation Using DataHub Scripting
Modifying data as it passes from one program to another
A consulting company needed a quick and easy way to modify data as it passed from one system to another. They were using the OPC DataHub to connect from an OPC server
to a Java based Web display, but due to problems with some of the sensors reading data from the field devices, certain values needed to be cleaned up before they were displayed on the web. A simple DataHub script
was written that watches for changes in point values and if any of them read a max off-scale value of say -524455, then the script replaces the value with a zero. This helped to clean up the web display of data and
provided the company with a fast and effective way of conditioning the process data to meet their requirements.
Logging data to a CSV file for off-line analysis
A company in Europe is using the OPC DataHub Scripting capability to collect data from an OPC server and store it as a
comma separated value (csv) file. The DataHub script was developed to simply write a new line to the file every time a set of
point values changed in the OPC server. The script also does some conditioning on the data before it is written to file, so that
alarm event numbers are converted into plain text strings to make it easier to analyze later.
Writing OPC data to an Access database
A manufacturing company is using the OPC DataHub to write end-of-day statistics into an MS-Access database. A DataHub
script is used to write production values to various tables in the Access database. The script is scheduled to run in the
middle of the night to avoid conflicts with other database users. Management personnel can now open the Access database and see up-to-date reports based on the previous nights totals.
|