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.
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:
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.
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.
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.
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.
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.
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.
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.
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!"