Get It Your Way with DataHub

6 min read

Nov 2, 2017 2:00:00 PM


What's "It"?  The "it" can mean a lot of things. What we mean is solving software and information integration challenges the way YOU want to solve them, and not being totally limited by the fill in the blank configuration settings in software. 

Whether you are a system integrator or a sophisticated user, you know there are times where fill-in-the form software configuration makes things easy, but can also constrain you.  Whether it's scability of large configurations, enhancing existing product features to satisfy YOUR NEEDS, or even adding functionality to a product, you don't like being limited by fill-in-the blank software.  

The most powerful functionality of the Cogent DataHub is its balance between fill-in the blank quick configuration for most users, and the freedom to "Get it YOUR WAY" for others.  Cogent DataHub does this through the free scripting engine that is included in every license. 

Scripting Can Be Easier Than You Think

For those who aren’t developers, just the word scripting can sound intimidating.  This blog post will teach you about some of the tasks you can accomplish through scripting to get it YOUR WAY. 

We also want to make it easy for you to get started with scripting.  We will link you to many of the examples we have in our knowledgebase to help you understand the syntax and get off to a quick start.

Let’s cover some of the more common uses of scripting:  

Configuration Scalability & Flexibility 

There might be times when you want the DataHub to operate differently, based on the current state of your process.  If DataHub is monitoring that state through it's myriad of inputs including OPC DA, OPC A&E, Modbus, DDE, Historian and Bridging points, then you have the information you need to allow DataHub to make decisions.

If you can draw on your whiteboard or write down the logic for how you want DataHub to operate differently based on process state, then you can use DataHub's scripting engine to make it happen. 

The DataHub exposes many of its configuration settings through the scripting interface.  For example, you can add or remove points from many of the DataHub features.  There are events that fire in DataHub when points change values.  The parts are there to make it happen. 

What about huge configurations? Loading up large configurations that you've built in Excel or other tools? We offer pre-made scripts for importing OPC DA, DDE and Bridged points into the DataHub to help speed up configuration time.

Pre-configured Script Samples for Importing Items

Many DataHub features can be enabled or disabled through a script as well.  I have seen users:

  • Turn on or off specific OPC connections through a script if they know the remote OPC server is offline for maintenance. 
  • The same can be done for tunnel connections, individual point bridges, DDE connections, redundant pairs, and Modbus connections.

All of these scripting functions allow you to not only build a configuration from the ground up programmatically, but then also have a dynamic DataHub configuration that can change as needed when process events occur.

Enhancing Existing Features

Scripting can also be used to enhance the existing out-of-the-box DataHub features, to do things that are specific to YOUR WAY, YOUR WORLD.

Say, for example, you want to monitor your tunnel connection to know when it is online or offline.  Without scripting, it’s necessary to check for a point quality of “Not Connected” or manually look in the DataHub to see if the tunnel was working.

Using scripting you can monitor the status of a tunnel connection and write its status to an OPC item that can be used elsewhere.  Some users display this tunnel status tag in their HMI and others use the DataHub’s email feature to send an email alert if the status goes to disconnected.  The tunnel status is not the only status you can read through scripting; every client that is connected to DataHub exposes the status of that connection through scripting.

Access to status for virtually any connection

The DataHub also has the ability to launch other applications through a script.  We have users who have implemented this ability in conjunction with the System Monitor feature.

Scripting and System Monitor Offer Powerful Functionality

The System Monitor feature provides access to useful information about the health of a computer or server, the operating system, and applications running on it.  For example, one user was monitoring if a critical application was running or not.  If that application stopped, they would restart the application using DataHub scripting.

Features Not Built Into DataHub

When the functionality built into the DataHub’s user interface is not enough to accomplish your task, the next option you should consider is scripting.    And if the scripting engine isn't enough DataHub also has API's for .NET, Java, and C++ where the limits really only become your imagination.  
 
Here are just a few examples of things that can be done in DataHub scripting: 
 

The first two use cases are pretty self-explanatory as to why you would need to do this.  It’s common for users to have CSV output from some other application that they would like to expose via OPC to an HMI or SCADA application.  It’s also common to want to perform calculations on raw data to provide useful information about a process.

What's Your Power Cost? DataHub can tell you

The third use case is easier to understand if we give you a real world use case.  We had a user whose power prices were wildly fluctuating month to month and sometimes even day to day.  This created situations where it was not cost effective to continue running production until the energy prices dropped.

The user’s power company published the current price and estimated future price per kilowatt hour on a web page, but this user had no way to automate the collection and processing of these power prices.  They used DataHub scripting to perform a WGET on the web page with all of the pricing.  WGET will retrieve the entire HTML data packet from any web URL you request.

Integrating Power Pricing Data for Smart Manufacturing

Once the user had the HTML from the page, they parsed the text to find the power price and expose it through a tag.

We hope this blog post has enlightened you to some of the powerful functions you can accomplish using scripting in the Cogent DataHub even with no prior development experience. 

The DataHub offers a wide range of functionality for accomplishing an extremely diverse set of challenges many users, like you, may experience on different integration projects.  For those of you not familiar, some of that built-in functionality includes bridging data between different sources, sending email or SMS text reports or notifications, acting as a gateway solution between different types of OPC and other data sources and more.

Don’t have DataHub yet?  Click to Download Your Free Trial Software

Get Answers to Your Automation Questions

About the Author:  Win studied software engineering and has been working at Software Toolbox since 2007.  Win started out in product support and has worked with hundreds of users around the world with about every product in Software Toolbox's mix. Win currently is responsible for product management of the Cogent DataHub offering within Software Toolbox's range of products. Got questions about DataHub scripting, click above to "ask Win!" 

Win Worrall
Written by Win Worrall

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