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.
8
Typical flow:
PLC → OPC UA → SCADA → Backend Services → RabbitMQ → MES / ERP
Each layer has a different responsibility.
| Layer | Responsibility |
|---|---|
| PLC | Controls machines |
| OPC UA | Standardized communication |
| SCADA | Monitoring & visualization |
| Backend Services | Business logic |
| RabbitMQ | Event distribution |
| MES | Manufacturing execution |
| ERP | Enterprise 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
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.ClientConnecting to OPC UA Server
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:
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
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#
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
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
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
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:
SELECT
MachineId,
Temperature,
CreatedUtc
FROM Telemetry
WHERE MachineId = 10
AND CreatedUtc >= @from
AND CreatedUtc < @toThis becomes catastrophic on large tables.
Better:
SELECT
MachineId,
Temperature,
CreatedUtc
FROM Telemetry
WHERE MachineId = 10
AND CreatedUtc >= @from
AND CreatedUtc < @toAnd 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
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
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
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://www.rabbitmq.com/tutorials?utm_source=chatgpt.com
More Info
We implement this in real production systems.
If you need help → contact us