Supervisory Control And Data Acquisition

SCADA Systems

1 Introduction

Introduction (Video) + Assignment (PDF)

Note! You can choose the Programming Languages to use in the different parts, i.e., Visual Studio/C#, LabVIEW or MATLAB (or a mix of those). Choose what you like best or what is best suited to the various subtasks.

SCADA - Supervisory Control And Data Acquisition. In this assignment we will create a SCADA system from scratch. The Lab work includes creating a Database, Datalogging System, Control System, and Monitoring System, etc. More Videos.

Typically, the different Modules that the SCADA system consists of are distributed physically in a Network (local network or over Internet):

 

Previous Topics will be the foundation/backbone for the SCADA System:

 

SCADA Systems

SCADA (Supervisory Control And Data Acquisition) is a type of Industrial Automation and Control System (IACS). Industrial Automation and Control Systems (IACS) are computer-controlled systems that monitor and control industrial processes that exist in the physical world.

Industrial Automation and Control Systems, like PLC (Programmable Logic Controller), DCS (Distributed Control System) and SCADA (Supervisory Control And Data Acquisition) share many of the same features.

There exists many Industrial Automation and Control Systems (IACS) and SCADA systems on the market today, some examples are AVEVA (previously Wondarware), Siemens SIMATIC WinCC, Ignition from Inductive Automation, APIS/TGS (previously Prediktor from Norway), etc. You have also DCS systems like DeltaV from Emerson, etc. Emerson now also own NI and LabVIEW.

Integration with other Systems? Feel free to integrate your solution with existing industrial software like OPC software, PLC software or SCADA software. You can integrate with a system that your company is using today or systems that you want to learn more about or have special interest for.

An example of such SCADA system is Ignition. You can, e.g., create HMI or creare the Alarm Module in Ignition that is integrated with your system. You can download an unlimited trial version or the Ignition Maker Edition. You find also lots of free Ignition Training at Inductive University.

 

1.1 Topics

The following topics are covered in this assignment:

 

1.2 Hardware

You will need the following hardware:

 

1.3 Software

You will need the following software:

 

 

2 Control System

Below we see a basic Control System:

LabVIEW:

Simulation and Control in LabVIEW (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Control System in LabVIEW using "LabVIEW Control Design and Simulation Module". Note! "LabVIEW Control Design and Simulation Module" is no longer supported in the latest LabVIEW version. You need to use LabVIEW 2022 Q3 or earlier in order to use the "LabVIEW Control Design and Simulation Module". Even if the "LabVIEW Control Design and Simulation Module" is no longer supported, LabVIEW has still built-in PID controllers that you can use ("PID.vi" or "PID Advanced.vi"). An alternative and recommended approach is to make a discrete control system, see below.

Discrete Control Systems in LabVIEW (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Discrete Control System in LabVIEW from scratch. Here you find different Simulation Examples in LabVIEW (PDF).

 

Visual Studio/C#:

Simulation and Control with C# and WinForms (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Application in Visual Studio/C# using a Simulation and Control Example.

The built-in Chart Control for Windows Forms is no longer supported by Microsoft in the latest .NET versions. So, we may need to find and use alternative solutions. If you still want to use the built-in Chart Control for Windows Forms, you need to select the "Windows Forms App (.NET Framework)" Template. If you choose the newer "Windows Forms App" Template, the built-in Chart Control is no longer supported. In that case, you may use the ScottPlot Plotting Library which is explained in the Tutorial below.

Plotting Data in Windows Forms using ScottPlot - ScottPlot is a free and open-source Plotting Library for .NET

 

 

3 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 (YouTube)

 

3.1 Structured Query Language

SQL (Structured Query Language) is a database computer language designed for managing data in relational database management systems (RDBMS). 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.

 

Resources:

SQL Server and Structured Query Language (SQL) (YouTube) + PowerPoint (PDF)

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

Structured Query Language (SQL) (PDF)

 

 

4 Database Design

There exist hundreds of different tools for database design and modelling. Most of those cost a lot of money while others has some free alternatives. Some tools are specialized for Database Design and Modelling, etc. While other tools are just general-purpose diagram tools. The advantage with a specialized Database Design and Modelling tool is that you can generate SQL code for your tables.

Here are some examples of software for database design and modelling: DB Designer (YouTube), erwin Data Modeler (YouTube) and Lucidchart (YouTube).

 

 

5 SQL Server

SQL Server is a Database System from Microsoft. SQL Server comes in different editions, for basic, personal use SQL Server Express is recommended because it is simple to use and it is free.

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.

Download SQL Server Express Edition + Management Studio (You need to install both)

SQL Server Express Installation (YouTube)

 

Resources:

SQL Server and Structured Query Language (SQL) (YouTube) + PowerPoint (PDF)

Database Views and Stored Procedures (YouTube) + PowerPoint (PDF)

 

 

6 Visual Studio and C#

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It can be used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft Windows.

C# Tutorial (w3schools.com) (Website) - Learn basic C# programming and syntax.

 

6.1 Simulation and Control in Visual Studio/C#

C# is a multipurpose and powerful programming language and can be use for most applications. Though, if you want to create simulations and control applications in C#, you may need to create it from scratch or use 3. party packages or libraries.

 

Resources:

Simulation and Control with C# and WinForms (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Application in Visual Studio/C# using a Simulation and Control Example.

 

6.2 Database Communication in C#

To communicate with SQL Server from C# you typically use ADO.NET.

 

Resources:

SQL Server with C# Windows Forms App (YouTube) + PowerPoint (PDF) - This Tutorial goes through how to create a basic Windows Forms Database Application in Visual Studio/C# that communicates with an SQL Server.

Datalogging using SQL Server with C# (YouTube) + PowerPoint (PDF)

Datalogging and Monitoring Examples (YouTube) + PowerPoint (PDF)

Plotting Data in Windows Forms using ScottPlot - ScottPlot is a free and open-source Plotting Library for .NET

 

Connection String:

A Connection String may look like this:

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;

 

 

7 Data Acquisition (DAQ)

Data Acquisition (DAQ) is the process of collection data from different sensors into a computer. A DAQ System consists of 4 parts: Physical input/output signals, sensors DAQ device/hardware Driver software Your software application (Application software).

To use the USB-6008 DAQ from National Instruments, you need to install the NI-DAQmx driver.

Make sure to read the User Guide and Specifications for USB-6008 and USB-6008 Pinout.

 

7.1 DAQ with LabVIEW

LabVIEW is a powerful tool for making Data Acquisition applications. Below you find some useful resources.

 

Resources:

DAQmx in LabVIEW (YouTube) + PowerPoint (PDF) - Communicate with NI DAQ Devices in LabVIEW. The tutorial shows different ways to use the DAQmx functionality in LabVIEW with practical LabVIEW examples.

LabVIEW DAQ and I/O Modules (Website)

 

7.2 DAQ in Visual Studio/C#

To use the USB-6008 DAQ from National Instruments in Visual Studio/C#, you need to install the NI-DAQmx driver.

Make sure to read the User Guide and Specifications for USB-6008 and USB-6008 Pinout.

Note! The NI-DAQmx driver do not support the newer .NET Core or .NET 5/6/7/8, only NET Framework 4.x. Make sure to select "NI-DAQmx Support for .NET Framework 4.x" and "NI-DAQmx Support for Visual Studio 20xx" during the installation of DAQmx. When creating a new project in Visual Studio, make sure to select the template called "Windows Forms App (.NET Framework)".

Make sure to read the User Guide and Specifications for USB-6008 and USB-6008 Pinout.

 

Visual Studio/C# DAQ Resources:

Visual Studio/C# and DAQ - Exemplified using DAQ hardware and DAQmx from NI

 

 

8 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:

Below you see a typical OPC scenario with an OPC Server and different OPC Clients:

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

 

Resources:

OPC with Practical Examples (YouTube) + PowerPoint (PDF)

 

8.1 OPC DA

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" (so you may aready have it installed on your PC). This one can also be downloaded separately, see below.

Download NI OPC Servers

 

Resources:

OPC in Visual Studio 2019 and Measurement Studio 2019 (YouTube) + PowerPoint (PDF)

Distributed System Manager - Workaround (YouTube) + PowerPoint (PDF)

 

8.2 OPC UA

OPC UA (Unified Architecture) is the Next Generation OPC. It is Cross Platform. "Classic" OPC works only for Windows based systems. OPC UA uses a modern Software/Network Architecture (No DCOM problems!) and it makes it easier to transmit and receive data in a modern data network/Internet.

OPC UA Server Simulator may be a good option when developing and testing OPC UA solutions. This free OPC UA Server tool supports data access and historical access information models of OPC UA. It is also practical to have a OPC UA Client for test purposes. OPC UA Client is a free client tool that supports the main OPC Unified Architecture information models.

You can also use a LabVIEW OPC UA Demo Server.

 

Resources:

OPC UA Server Simulator (YouTube) + PowerPoint (PDF)

OPC UA with Visual Studio and C# (YouTube) + PowerPoint (PDF)

 

 

9 ASP.NET Core Web Applications

ASP.NET is an open source web framework, created by Microsoft, for building web apps and services using the .NET Framework or the .NET Core. We have both ASP.NET and ASP.NET Core. ASP.NET Core is the new approach built on .NET Core.

 

Introduction:

ASP.NET Core - Hello World Application (YouTube)

ASP.NET Core - Introduction (YouTube) + PowerPoint (PDF)

 

Database Communication in ASP.NET Core:

ASP.NET Core - Get Data from Database (YouTube) + PowerPoint (PDF) - Here you learn the basics when it comes to how to get/retrieve data from a SQL Server database.

ASP.NET Core - Database Communication (YouTube) + PowerPoint (PDF) - Here you learn how to get/retrieve data from a SQL Server and present the data in a table in a webpage. You also learn how we can put the Connection String into the cinfiguration file appSettings.json.

ASP.NET Core - CRUD Application (YouTube) + PowerPoint (PDF) - Here you will learn to create a "Data Management" Application that Creates/inserts, Reads, Updates and Deletes (CRUD) data from the database.

 

Monitor and View your Data with Charts:

ASP.NET Core - Charts (YouTube) + PowerPoint (PDF). In this tutorial Google Charts will be used. Google Charts is an API (or framework) for creating Charts in your web pages. It is free to use and it is easy to use (when you first know how to use it). Note! If the data contains decimals, you may get some trouble if your computer has “,” as a decimal symbol. An easy solution is to change the Decimal symbol to “.” in Windows. In Windows, goto the "Control Panel", then "Clock and Region". Select "Additional settings..." and then set the Decimal symbol to ".". A better solution may be to do some formatting in your code.

 

See here for more ASP.NET Core resources.