pkey
.Net

SCADA Integration in C# – Enterprise Architecture, OPC UA, Telemetry and Production Systems

SCADA integration in C#. Modern industrial systems are no longer isolated environments running independently inside factories. Today, SCADA systems are deeply integrated with MES platforms, ERP systems, telemetry pipelines, cloud services, distributed backends, SQL Server databases, and real-time monitoring infrastructure.

Factories generate massive amounts of production data every second:

  • machine states,
  • temperatures,
  • alarms,
  • production counters,
  • energy usage,
  • telemetry values,
  • operator actions,
  • maintenance information.

Without proper integration architecture, industrial systems quickly become unstable, slow, and difficult to maintain.

This is where C# and .NET become extremely valuable.

The .NET ecosystem provides:

  • enterprise-grade backend development,
  • OPC UA connectivity,
  • asynchronous processing,
  • RabbitMQ integration,
  • SQL Server support,
  • telemetry pipelines,
  • distributed systems architecture,
  • cloud integration,
  • Windows services,
  • REST APIs,
  • real-time dashboards.

This article explains how SCADA integration works in real production environments and demonstrates practical C# examples used in industrial systems.


What is SCADA?

SCADA stands for:

Supervisory Control And Data Acquisition

SCADA systems are responsible for:

  • monitoring machines,
  • collecting telemetry,
  • controlling industrial processes,
  • visualizing production data,
  • generating alarms,
  • storing historical values,
  • supervising production lines.

Typical SCADA systems include:

  • Siemens WinCC
  • AVEVA Wonderware
  • Inductive Automation Ignition
  • Rockwell Automation FactoryTalk
  • GE Vernova iFIX

Modern SCADA systems typically expose:

  • OPC UA endpoints,
  • SQL databases,
  • REST APIs,
  • MQTT brokers,
  • proprietary drivers,
  • event streams.

Typical Industrial Architecture

A modern industrial environment usually contains several layers.

https://images.openai.com/static-rsc-4/S5vYnWwIDL7hg6H8q4PQ8JbsaaiJbWuoGfiTstvhWV7CzR5C_ulUgbXl7dwHhr5xPgbAEeLH7zi8RZ7_n0YVGOSMbTOO5r0kpssEGnFPiW_1cy8j5kAd6AkHQdFeDPeDxgFfu82ghp15RQeImN0FAhVfygwdxGhE4yTlZMJn734cMya5L4kqVZKuZTe0FZr_?purpose=fullsize
https://images.openai.com/static-rsc-4/tIHW0JmmOvpSgIS513cZsZMiS7YDkcHiFzGjBJ6ePSX6pXxlO0O1RL5e7sZDqI4V_ZPE45mK9osSRTIAp5h9perqGSyRBZsJVihbys7rpbQOcI-19neD9ZN0IysXjbQhnKrEI---azpMXNcOAJ1TBkbf2YKQMAVP3VkcBW6DN7c5bdpouSqSK8WDEvtL3mLB?purpose=fullsize
https://images.openai.com/static-rsc-4/yntWDWJw7qw95hTOi6KOWIvgpFTHhqm2ePsUTPSl0SFzK7RwqSkTOeBxRLfMlhxOOu2WbhApwdhdvsQ6UqgcjH8Vpa8mctuhzaND4OpLNlznhpyJeMLU32_O2t0MXoINiOHFzG8RNVO_INni_uUuP74RWTVNGyDGKIiVWs_62YHZUyCO_9ENohaJn515m5lH?purpose=fullsize

8

Typical flow:

PLC → OPC UA → SCADA → Backend Services → RabbitMQ → MES / ERP

Each layer has a different responsibility.

LayerResponsibility
PLCControls machines
OPC UAStandardized communication
SCADAMonitoring & visualization
Backend ServicesBusiness logic
RabbitMQEvent distribution
MESManufacturing execution
ERPEnterprise planning

The biggest mistake in industrial systems is tightly coupling everything together.

Bad architecture creates:

  • unstable integrations,
  • slow systems,
  • impossible deployments,
  • telemetry bottlenecks,
  • production downtime.

Why C# is Popular in Industrial Systems

C# is heavily used in manufacturing and enterprise environments because it combines enterprise reliability with strong integration capabilities.

Advantages:

  • mature ecosystem,
  • excellent async support,
  • SQL Server integration,
  • OPC UA libraries,
  • RabbitMQ libraries,
  • ASP.NET Core APIs,
  • Windows and Linux support,
  • telemetry processing,
  • cloud compatibility.

Many industrial companies already use:

  • Windows Server,
  • Active Directory,
  • SQL Server,
  • Azure,
  • .NET services.

This makes .NET a natural technology choice.


OPC UA Integration in C#

OPC UA is one of the most important industrial communication standards.

It allows applications to communicate with:

  • PLCs,
  • SCADA systems,
  • industrial gateways,
  • telemetry systems.

In most factories, OPC UA becomes the bridge between industrial hardware and enterprise software.


Installing OPC UA Packages

C#
dotnet add package OPCFoundation.NetStandard.Opc.Ua
dotnet add package OPCFoundation.NetStandard.Opc.Ua.Clientdotnet add package OPCFoundation.NetStandard.Opc.Ua
dotnet add package OPCFoundation.NetStandard.Opc.Ua.Client

Connecting to OPC UA Server

C#
using Opc.Ua;
using Opc.Ua.Client;
using Opc.Ua.Configuration;

public class OpcUaReader
{
    public async Task ReadMachineData()
    {
        var config = new ApplicationConfiguration()
        {
            ApplicationName = "ScadaClient",
            ApplicationType = ApplicationType.Client,
            SecurityConfiguration = new SecurityConfiguration
            {
                AutoAcceptUntrustedCertificates = true
            }
        };

        await config.Validate(ApplicationType.Client);

        var endpoint =
            CoreClientUtils.SelectEndpoint(
                "opc.tcp://192.168.0.50:4840",
                false);

        var endpointConfig =
            EndpointConfiguration.Create(config);

        var configuredEndpoint =
            new ConfiguredEndpoint(
                null,
                endpoint,
                endpointConfig);

        using var session = await Session.Create(
            config,
            configuredEndpoint,
            false,
            "SCADA Session",
            60000,
            null,
            null);

        var node = new NodeId("ns=2;s=Machine.Speed");

        var value = session.ReadValue(node);

        Console.WriteLine($"Speed: {value}");
    }
}

This example:

  • connects to OPC UA,
  • opens a session,
  • reads machine telemetry,
  • retrieves production data.

Real Production Problems

Industrial systems are very different from normal CRUD applications.

Typical industrial problems:

  • unstable network connections,
  • intermittent PLC communication,
  • telemetry spikes,
  • long-running operations,
  • hardware failures,
  • distributed systems,
  • real-time processing,
  • production pressure.

In enterprise systems:
a slow request is annoying.

In industrial systems:
a slow request can stop production.


Reading Telemetry Continuously

Factories usually require continuous telemetry collection.

Example:

C#
public class TelemetryWorker : BackgroundService
{
    private readonly ILogger<TelemetryWorker> _logger;

    public TelemetryWorker(
        ILogger<TelemetryWorker> logger)
    {
        _logger = logger;
    }

    protected override async Task ExecuteAsync(
        CancellationToken stoppingToken)
    {
        while (!stoppingToken.IsCancellationRequested)
        {
            try
            {
                var temperature = await ReadTemperature();

                _logger.LogInformation(
                    $"Temperature: {temperature}");

                await SaveTelemetry(temperature);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex,
                    "Telemetry collection failed");
            }

            await Task.Delay(
                TimeSpan.FromSeconds(2),
                stoppingToken);
        }
    }

    private Task<decimal> ReadTemperature()
    {
        return Task.FromResult(22.5m);
    }

    private Task SaveTelemetry(decimal value)
    {
        return Task.CompletedTask;
    }
}

This approach:

  • runs continuously,
  • collects telemetry,
  • handles failures,
  • stores production data.

SCADA integration in C#. Saving SCADA Data to SQL Server

Most industrial environments eventually store telemetry inside relational databases.

Common databases:

  • Microsoft SQL Server
  • Oracle Corporation Oracle
  • PostgreSQL Global Development Group PostgreSQL

Example SQL Schema

SQL
CREATE TABLE Telemetry
(
    Id BIGINT IDENTITY PRIMARY KEY,
    MachineId INT NOT NULL,
    Temperature DECIMAL(10,2),
    Pressure DECIMAL(10,2),
    CreatedUtc DATETIME2 NOT NULL
);

CREATE INDEX IX_Telemetry_CreatedUtc
ON Telemetry(CreatedUtc);

CREATE INDEX IX_Telemetry_MachineId_CreatedUtc
ON Telemetry(MachineId, CreatedUtc);

Factories often generate:

  • millions of telemetry rows,
  • high write throughput,
  • continuous inserts.

Without indexing:
performance collapses very quickly.


SCADA integration in C#. Saving Telemetry Using C#

C#
using Microsoft.Data.SqlClient;

public async Task SaveTelemetryAsync(
    decimal temperature,
    decimal pressure)
{
    var connectionString =
        "Server=localhost;Database=ScadaDb;Trusted_Connection=True;";

    await using var connection =
        new SqlConnection(connectionString);

    await connection.OpenAsync();

    var command = new SqlCommand(
        @"
        INSERT INTO Telemetry
        (
            Temperature,
            Pressure,
            CreatedUtc
        )
        VALUES
        (
            @temperature,
            @pressure,
            GETUTCDATE()
        )",
        connection);

    command.Parameters.AddWithValue("@temperature", temperature);
    command.Parameters.AddWithValue("@pressure", pressure);

    await command.ExecuteNonQueryAsync();
}

RabbitMQ in Industrial Systems

One of the biggest architectural improvements in modern SCADA systems is moving toward event-driven architectures.

Instead of direct integrations:

SCADA → ERP
SCADA → MES
SCADA → Analytics
SCADA → Reporting

companies increasingly use message brokers.

Popular technologies:

  • VMware RabbitMQ
  • Apache Software Foundation Kafka
  • Azure Service Bus

Why RabbitMQ Matters

RabbitMQ provides:

  • buffering,
  • decoupling,
  • retry handling,
  • asynchronous processing,
  • event distribution.

This is extremely important in industrial systems.

Because:
production systems cannot stop when ERP becomes unavailable.


SCADA integration in C#. Publishing SCADA Events

C#
using RabbitMQ.Client;
using System.Text;

public class AlarmPublisher
{
    public void PublishAlarm(string alarm)
    {
        var factory = new ConnectionFactory()
        {
            HostName = "localhost"
        };

        using var connection =
            factory.CreateConnection();

        using var channel =
            connection.CreateModel();

        channel.ExchangeDeclare(
            "scada.events",
            ExchangeType.Topic,
            durable: true);

        var body =
            Encoding.UTF8.GetBytes(alarm);

        channel.BasicPublish(
            exchange: "scada.events",
            routingKey: "alarm.high",
            basicProperties: null,
            body: body);
    }
}

Typical Event-Driven Flow

https://images.openai.com/static-rsc-4/2k-ER98rMlfhvh3hdcabyXAwPrQeKTVJkwCabM9s4YK9rJ4d3-ZDLJLVTmPBe0jRmaOmWg-g4i8glhyCMiVAIvLYfbv73eaGC_qTpKzlpBVAaK_6HcAFZLBbkOcmwDKunR_FUR0LKxmUhQVY87BwHgaKqLJD8w2j8n8OeVdW4zyntoikCIm_GORcRxaCkrwT?purpose=fullsize
https://images.openai.com/static-rsc-4/_OTVFYO9p9RXbYSjBD1F-PiCyEp_yeqnoAgQbVmcHvoVMsENbfiMyO08057BGd0GBg6IFsoFb_AAApi3tT5r5ji4fThuca-4TgrL_YbmXm2E3rf6Ffg_gl6TvHElQPecpqd0WGVaijGopmuFVIt2nhJS69BlrBprNqBtIwsrzoUFQrDfOETrh9PJR72N-2cJ?purpose=fullsize
https://images.openai.com/static-rsc-4/aGoV_LeEMn9ft8E5nImVRukpyHF4bgti5yA12dgYysyPAELSzHeNZL9hP9THQK6VNR3roap5jnAfjLTgJHYizT76Cq4Jup1rdKUJ2XEg2RlFzJFEeGNrJsOORWLSUVHhu6rTJCDD3FV-RkwJoujDmVMyPgDLXGC6E-w8Y2p1ehZcLRI8ZMUE4xT957TYKl8m?purpose=fullsize

6

Typical flow:

PLC → OPC UA → SCADA → RabbitMQ

MES / ERP / Analytics

This architecture:

  • improves scalability,
  • isolates failures,
  • simplifies integrations,
  • increases reliability.

Building ASP.NET Core SCADA APIs

Modern factories often expose telemetry through APIs.

Typical consumers:

  • dashboards,
  • MES systems,
  • mobile apps,
  • analytics platforms,
  • cloud services.

Example ASP.NET Core API

C#
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

var app = builder.Build();

app.MapGet("/api/machines", async () =>
{
    return new[]
    {
        new
        {
            Id = 1,
            Name = "Line A",
            Status = "Running"
        },
        new
        {
            Id = 2,
            Name = "Line B",
            Status = "Stopped"
        }
    };
});

app.Run();

SCADA Dashboards

Industrial dashboards usually display:

  • machine states,
  • production counts,
  • alarms,
  • temperatures,
  • energy usage,
  • telemetry trends,
  • downtime information.

Typical frontend technologies:

  • Angular,
  • React,
  • Blazor,
  • WPF,
  • WinForms.

Real Enterprise Architecture

Large factories rarely have a single SCADA application.

Instead, they contain:

  • MES,
  • ERP,
  • telemetry pipelines,
  • historians,
  • cloud analytics,
  • maintenance systems,
  • quality systems,
  • reporting services.

This creates integration complexity.


Common Industrial Integration Mistakes

The most common problems:

  • direct database access,
  • synchronous integrations,
  • shared schemas,
  • tight coupling,
  • missing retries,
  • no buffering,
  • blocking PLC reads,
  • bad SQL queries,
  • no telemetry partitioning.

These systems work initially.

Then production scale destroys them.


SQL Server Performance Problems

SCADA systems often suffer from:

  • table scans,
  • missing indexes,
  • blocking,
  • lock escalation,
  • slow aggregations,
  • huge telemetry tables.

Typical anti-pattern:

SQL
SELECT
    MachineId,
    Temperature,
    CreatedUtc
FROM Telemetry
WHERE MachineId = 10
AND CreatedUtc >= @from
AND CreatedUtc < @to

This becomes catastrophic on large tables.

Better:

SQL
SELECT
    MachineId,
    Temperature,
    CreatedUtc
FROM Telemetry
WHERE MachineId = 10
AND CreatedUtc >= @from
AND CreatedUtc < @to

And properly indexed.


Async Processing in Industrial Systems

Synchronous processing creates bottlenecks.

Bad approach:

PLC → SCADA → ERP → SQL → Analytics

One slow component blocks everything.

Better:

PLC → SCADA → RabbitMQ

Independent Consumers

This improves:

  • resilience,
  • scalability,
  • observability.

Monitoring and Observability

Modern industrial systems require:

  • logging,
  • telemetry tracing,
  • metrics,
  • alerting,
  • performance monitoring.

Typical tools:

  • Grafana Labs Grafana
  • Elastic NV Elasticsearch
  • Datadog Datadog
  • Microsoft Application Insights

Without observability:
production debugging becomes nearly impossible.


Security Considerations

Industrial environments often contain:

  • legacy PLCs,
  • old protocols,
  • insecure networks,
  • shared credentials.

Security is critical.

Important practices:

  • isolated networks,
  • VPN access,
  • certificate-based OPC UA,
  • encrypted communication,
  • least privilege access,
  • telemetry auditing.

SCADA + Cloud Integration

Many companies integrate SCADA with cloud systems.

Typical scenarios:

  • predictive maintenance,
  • machine learning,
  • centralized monitoring,
  • telemetry analytics,
  • energy optimization.

Popular cloud platforms:

  • Microsoft Azure
  • Amazon AWS
  • Google Google Cloud

Example Telemetry DTO

SQL
public class TelemetryDto
{
    public int MachineId { get; set; }

    public decimal Temperature { get; set; }

    public decimal Pressure { get; set; }

    public DateTime CreatedUtc { get; set; }
}

Example Minimal API Endpoint

C#
app.MapPost(
    "/api/telemetry",
    async (
        TelemetryDto dto,
        TelemetryService service) =>
{
    await service.SaveAsync(dto);

    return Results.Ok();
});

Why Enterprise Architecture Matters

Industrial systems often survive for:

  • 10 years,
  • 15 years,
  • sometimes decades.

Bad architecture becomes extremely expensive over time.

Common symptoms:

  • impossible deployments,
  • fragile integrations,
  • slow debugging,
  • production incidents,
  • unstable telemetry,
  • difficult scaling.

Architecture erosion kills industrial systems slowly.


Recommended Architecture

https://images.openai.com/static-rsc-4/qg9M9yLsc5V4E7_V1D4cI3NoRrid1UmXsDeHaujMDvwGOEiIHqJIxHSbvRkGw1nE-ixtt6H_DjApRh8jyQRNae0acvDrSSuitwd5ZT7uTGPnf9QPywxGQaCT2LTN6LnrRxC1BpM0aGqX7xiDLuMYl2Pq8z8VGkisBS-uR_yoZ5p25RNp7W-ViJJ7F4H7LQog?purpose=fullsize
https://images.openai.com/static-rsc-4/lN1u7EgYwl273DKvD3TQg9ZVElu66_YJbH6Be1V9C403HD7leF3mx97wvtYsankV0AhadoAHGzCm5lbt6gqGPDjKYVq6wSjiCO7pn9C4l8i7QHjje9Z-3EyNnrg4zXVZIQTxZpGItq2fLgZFhJbT7qOVkadTsmcZD_b3bJCPVWkUjigCH6vThJkpoGhaFzht?purpose=fullsize
https://images.openai.com/static-rsc-4/y_MJ5vPgVssupQZzTqMusCsyNJKUA0GAprr5L8Xs7JzoRuutboSul3b3GfZkoaZv8wzFH4Usn8-FX050Hhqz0sikGVconqJ1Il18ibZLOUaEXzOb_xJOgR4hHAprszc5Ls9CBXp9hQWXEiKALZSAKBebw4oMdWk81I27pnqQMKcQC6orsPfEs51QN1V9cUCZ?purpose=fullsize

7

Recommended stack:

  • PLCs,
  • OPC UA,
  • SCADA,
  • ASP.NET Core,
  • RabbitMQ,
  • SQL Server,
  • Angular dashboards,
  • telemetry workers,
  • monitoring systems.

This architecture scales much better than tightly coupled systems.


Conclusion

SCADA integration is no longer just about machine visualization.

Modern industrial environments require:

  • distributed systems,
  • telemetry pipelines,
  • asynchronous processing,
  • cloud integration,
  • enterprise architecture,
  • scalable SQL storage,
  • resilient messaging infrastructure.

C# and .NET provide an excellent platform for building industrial software systems capable of surviving real production conditions.

Companies that treat SCADA as part of enterprise architecture gain:

  • better observability,
  • higher reliability,
  • improved scalability,
  • easier integrations,
  • faster diagnostics,
  • lower production risk.

The future of industrial software belongs to:

  • connected systems,
  • event-driven architecture,
  • reliable telemetry pipelines,
  • scalable backend services,
  • enterprise-grade integrations.

Source

https://github.com/rafalkukuczka/ScadaCSharpIntegrationDemo

References

https://akpolatcem.medium.com/getting-started-with-opc-ua-building-your-first-client-server-application-in-python-6107fb4cafec

https://www.rabbitmq.com/tutorials?utm_source=chatgpt.com

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-10.0&utm_source=chatgpt.com

More Info

We implement this in real production systems.
If you need help → contact us

Contact