Datalogging and Monitoring in LabVIEW

Hans-Petter Halvorsen

Delivery  

Introduction

Video: LabVIEW in Automation - Datalogging and Monitoring in LabVIEW + PowerPoint (PDF)

SQL Server Express Installation (Video)

Prerequisites: Basic LabVIEW Programming

 

Data Logging and Monitoring in LabVIEW

Datalogging and Monitoring is important within Industrial IT and Automation Systems, IoT Applications, etc.

 

Below you find some videos that give some examples how you can use Data Logging and Monitoring.

Examples

Example 1

Data Logging and Monitoring in LabVIEW Example (Video)

Read more (including downloading the LabVIEW Code)

 

Example 2

LabVIEW Application Examples (Video)

Read more (including downloading the LabVIEW Code)

 

Note! These videos are shown only to get you inspired, and to see what LabVIEW is capable of.

 

The examples given above give an overview of Data Logging and Monitoring in LabVIEW. We will focus only on some basic datalogging applications:

 


OPC

OPC is a standard that defines the communication of data between devices from different manufactures.

OPC requires an OPC server that communicates with one or more OPC clients. OPC allows “plug-and-play”, gives benefits as reduces installation time and the opportunity to choose products from different manufactures.

We have different OPC standards:

We will focus on OPC DA and OPC UA. The organization OPC Foundation maintains the OPC standards.

Introduction to OPC with Examples (Video)

PowerPoint used in the Video (Tutorial)

 

 

MatrikonOPC Simulation Server

MatrikonOPC Simulation Server is free and can be used for testing OPC DA.

Download MatrikonOPC Simulation Server

Problems with installing or using the software?

An alternative to Matrikon is NI OPC Servers. If you for some reason are not able to install MatrikonOPC Simulation Server (or prefer NI OPC Servers) you can install NI OPC Servers instead.

A Demo version is included with "LabVIEW DSC Module" or "LabVIEW Real-Time module". This one can also be downloaded separately, see below.

Download NI OPC Servers 2016

LabVIEW OPC with NI OPC Servers

 

 

OPC DA in LabVIEW

OPC DA in LabVIEW (Video)

PowerPoint used in the Video (Tutorial)

 

 

 

OPC UA in LabVIEW

OPC UA – Unified Architecture is the Next Generation OPC. It is Cross Platform. “Classic“ OPC works only for Windows. OPC UA supports a modern software/network architecture (No DCOM problems!) It makes it easier to transmit and receive data in a modern data network/Internet.

The LabVIEW OPC UA Toolkit provides support for creating OPC UA Clients and OPC UA Servers in LabVIEW.

 

OPC UA in LabVIEW (Video)

PowerPoint used in the Video (Tutorial)

 

Download LabVIEW OPC UA Toolkit (This software requires a different Serial Number that you may not have, but you can use and test the software for a limited time without entering licence information)

 


Database Systems

A Database is a structured way to store lots of information. The information is stored in different tables. We have many different database systems today, such as SQL Server, MySQL, etc. We will use SQL Server from Microsoft.

Introduction to Database Systems (Video)

PowerPoint used in the Video (PDF)

Note! This videos is shown only to get you inspired, and to see what Database System are capable of (Don't hang up in too much details).

Note! We dont need to use ERwin in this Module. We only need to create a very simple database directly in SQL Server.

 

Structured Qery Language (SQL)

SQL (Structured Query Language) is a database computer language designed for managing data in relational database management systems (RDBMS) such as SQL Server. We can use SQL to insert data into the database, retrieve data that is stored in the database, we can update the data that is stored in the database, and we can delete it.

We only need to know the very basics, such as inserting som data using the INSERT statement and retrieve data using basic SELECT statements.

Tutorials:

Structured Query Language (SQL) (PDF)

SQL Tutorial - Basic SQL Training from w3schools.com (Recommended!)

 

SQL Server

SQL Server is a Database System from Microsoft. SQL Server consists of a Database Engine and a Management Studio. The Database Engine has no graphical interface - it is just a service running in the background of your computer. The Management Studio is graphical tool for configuring and viewing the information in the database.

Introduction to SQL Server (Video)

PowerPoint used in the Video (PDF)

 

Install SQL Server Express

Download SQL Server Express Note! You need to install both "SQL Server" + "SQL Server Management Studio".

SQL Server Express Installation (Video)

 

Using Databases with LabVIEW

Database Communication using LabVIEW (Video)

PowerPoint used in the Video

 

LabVIEW Database Connectivity Toolkit is included with LabVIEW professional, but it is cumbersome to use. We should use the LabVIEW SQL Toolkit instead. This Toolkit is very simple to use.

 

Below we see a practical example:

In the example above, an ODBC connection has been configured in advance.

ODBC:

ODBC (Open Database Connectivity) is a standardized interface (API) for accessing the database from a client. You can use this standard to communicate with databases from different vendors, such as Oracle, SQL Server, etc. The designers of ODBC aimed to make it independent of programming languages, database systems, and operating systems.

In Windows 10 you find the "ODBC Data Source Administrator" tool here: Control Panel → Administrative Tools → Data Sources (ODBC). Then click the "Add..." button in order to create an ODBC connection to your database.

Note! Make sure to use the 32 bit version of the ODBC Tool!

 

Connection String:

An alternative to ODBC is to type directly type ypur Connection String for your Database. The Connection String looks like this (just replace the text MyODBC with the text below):

PROVIDER=SQLOLEDB;DATA SOURCE=<SQL Server Name>;DATABASE=<Database Name>;UID=sa;PWD=<Your Password>;

Replace <SQL Server Name> with the name of your SQL Server, typically "<YourComputerName>\SQLEXPRESS" if you are using SQL Server Express.

UID is a SQL Server user, here you can create your own SQL Server user inside SQL Server Management Studio or use the built-in sa user (sa = System Administrator). During the setup of SQL Server you need to select "Mixed Mode" and enter the password for your sa user.

It may look something like this:

PROVIDER=SQLOLEDB;DATA SOURCE=DELLPCWORK\SQLEXPRESS;DATABASE=MEASUREMENTS;UID=sa;PWD=Password123;

 

LabVIEW Database Logging Example

Here we will create a simple Database used for Logging in SQL Server and a basic LabVIEW Application for Logging Data from LabVIEW into SQL Server.

LabVIEW Database Logging Tutorial

LabVIEW Database Logging Code Example

 

 

LabVIEW Programming Guidelines

Typically engineers often create simple LabVIEW VIs that eventually grow out of control, because they don't have the proper structure and best practices. The solution to this problem is organizing your code and data in a way that enables modularity, readability, and reuse.

Some examples are:

 

For more details, see the video below.

Video: LabVIEW Programming Guidelines

PowerPoint used in the Video

 

LabVIEW Programming using State Machine

Video: LabVIEW State Machine

Tutorial

Download Code

 

 

Delivery

Create a Datalogging and Monitoring System. Extend your Level Tank system with Datalogging and Monitoring Features, i.e., send the process value to an OPC Server and then save it to a Text File and to a Database. Make sure that you have also updated your Level Tank system based on feedback given in previous Modules and include your latest LabVIEW skills.

You should create 2 LabVIEW Applications:

Make sure to create a proper GUI. You decide if you want to use OPC DA or OPC UA.

Make .exe files of your LabVIEW Applications.

You should open the Data from either the Database or the Text File in MS Excel. Make a simple plot and do some basic analytics (e.g., find the average, etc.).

The code should be well structured and intuitive. It should contain basic LabVIEW features like While Loop, Case Structure, SubVIs, Arrays, Property Nodes and Clusters, etc. You should use the Project Explorer.

Please follow the "LabVIEW Programming Guidelines" as shown and explained in this video: LabVIEW Programming Guidelines.



Submission: Create a short Video (about 5-10 minutes long and use .mp4 video format) where you explain and demonstrate your Applications (both GUI and code). Note! The video needs to have sound, i.e., you need to talk and explain during the video.

 

You can use Screencast-O-Matic (SOM). SOM is a Video Creation Tool (Screen & Webcam Recording Tool). 

 

Where should you deliver? Canvas

What should you deliver? Only mp4 Video - No LabVIEW Code

The video should primarily be reflective and not descriptive. The video should not merely describe what has been done, but also why and how and what the results are. The outcome needs to be put into relevant context.

The Video (mp4) can be built up as follows (the so-called IMRaD model):

  1. Introduction: Start with a brief introduction, i.e. describe what you have made, what is the purpose with the program, etc. Typically, you should also include a System Sketch. A System sketch is an illustration/figure of your system, the different parts the system consists of, and how they relate to each other.
  2. Methods and Results (Overview of the Work that has been done and the Results): Give a Demonstration of the User Interface (Front Panel) and Code (Block Diagram).
  3. Discussions and Conclusion/Summary: Discuss your Results. Finally, summary/conclusion of your work. Does you program work as expected? Why/Why Not, any improvements that needs to be made with your program, etc.

If you prefer you can combine showing/explaining your code and give a demo of your application with some PowerPoint slides which you use in your Video.

More information about IMRaD.

Make sure to insert Figures, Tables and Equations correctly, please see the video Equations in Word and PowerPoint.

Referencing: If you have used external sources, you need to use referencing. In scientific documents we typically use the IEEE standard, see Kildekompasset for details. Citation and Referencing with Microsoft Word (YouTube)

Remember to have focus on the technical work that has been done , i.e., you should NOT tell how much you have learned, that the assignment was interesting and such things. Pretend that you make this documentation for a Customer that have asked you to make this program and document the Methods used and the Results achieved.