How to Efficiently Store and Retrieve PLC Data from a Database: Direct Connection vs. HMI Solutions

Question:

How can you effectively store and retrieve PLC (Programmable Logic Controller) data from a database? Should you connect the PLC directly to the database, or is it necessary to utilize a Human-Machine Interface (HMI) for this process? For example, if you are using FactoryTalk to manage and retrieve recipe data for batch production, what steps would you take to achieve this? Additionally, if your goal is to log data from PLC devices, such as sensor information, what method would be most efficient? Thank you!

Top Replies

The brief answer is that it varies based on your specific circumstances. The longer explanation hinges on the constraints you are facing. Sometimes, you may only require additional space in PLC registers or HMI memory registers. In other cases, you might need to connect to an external relational database. Please provide us with some background information for better assistance.

When considering the answer "it depends," I recommend utilizing FactoryTalk Historian for storing analog data for future trend analysis. This software is specifically designed to integrate seamlessly with FactoryTalk View trends, assuming you are using the Site Edition (SE) rather than the Machine Edition (ME). Regarding batch processing, the decision becomes more nuanced. Key factors include the complexity of your recipes: do they involve simple parameter adjustments, or do they also require sequence modifications? Additionally, consider the flexibility of your physical model—can the product be manufactured through multiple streams, or is everything rigidly hard-piped? Furthermore, assess the strictness of your historical documentation requirements, especially in terms of 21 CFR Part 11 compliance. Answering these questions will help determine whether FactoryTalk Batch is the right enhancement to complement FactoryTalk View.

I am eager to gain a deeper understanding of how to implement database storage and retrieval. Currently, I lack any foundational knowledge on this topic. If you have any helpful resources, such as links or tutorials, I would greatly appreciate it. Thank you!

Understanding database integration can be quite challenging, which is why many users opt for pre-built solutions like Historian or Batch. However, if you're determined to create a custom solution, it's essential to familiarize yourself with how database engines, particularly SQL Server and others, operate and connect with external systems, often through ODBC (Open Database Connectivity). You’ll be using VBA scripts in FT View SE (as opposed to ME) to establish ODBC connections and execute SQL queries, such as "SELECT * FROM X WHERE ...." or "INSERT INTO...." for data retrieval and updates. Additionally, utilizing Stored Procedures within the database can significantly ease the complexities of data management. For beginners, a resource like a "SQL Server for Dummies" book can be an excellent starting point to help you navigate this topic effectively.

Aardwizz mentioned that you will be developing VBA scripts specifically in FactoryTalk View SE (as opposed to ME). This raises the question: Why should you use FactoryTalk View SE instead of ME? Does FactoryTalk View ME lack database functionality?

When it comes to storing and retrieving PLC data, it often makes sense to use an HMI as an intermediary between the PLC and the database. This setup allows for more complex data handling and visualization before sending it to your database. In the case of FactoryTalk for managing recipe data, you would first ensure that your PLC is correctly configured to communicate with FactoryTalk, then set up the necessary tags in FactoryTalk that correspond to your recipe parameters. For logging sensor data, a common approach would be to schedule periodic updates from the PLC to the HMI, which can then batch insert the data into your database, utilizing efficient SQL queries to minimize load times. Implementing data validation checks in your HMI can also prevent data errors from reaching your database, thus enhancing data integrity.

When it comes to storing and retrieving PLC data from a database, using an HMI like FactoryTalk can be beneficial, especially for managing complex processes like batch production. It essentially acts as a bridge that simplifies the communication between the PLC and the database. For example, you’d typically set up your PLC to send relevant data to the HMI, where you can then configure it to map this data to database fields. This way, not only do you gain a user-friendly interface for monitoring and management, but you also make data logging simpler. To log sensor information efficiently, consider implementing a structured logging approach with timestamps and data tagging, and utilize an export function that regularly sends data to your database — maybe even at set intervals or based on specific events to keep it updated. Overall, leveraging both the HMI and the database together can streamline your system considerably!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.

Frequently Asked Questions (FAQ)

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’