sgcIndustrialModbus, OPC UAand serial ports.Native in Delphi and .NET.
Six components connect your applications to PLCs, SCADA servers, energy meters, drives and serial devices. TsgcModbusTCPClient and TsgcModbusRTUClient read and write coils and registers. TsgcModbusTCPServer and TsgcModbusRTUServer turn your application into a Modbus device. TsgcOPCUAClient reads, writes and subscribes over signed and encrypted connections, and TsgcSerialPort drives RS-232 and RS-485. Standalone, the sgcWebSockets Core runtime is included.
sgcIndustrial | Modbus, OPC UA and serial ports from one application
6Components on the SGC Industrial palette page, with the same names in .NET
2Modbus transports, TCP over TCP/IP and RTU over a serial line
6OPC UA security policies, up to Aes256_Sha256_RsaPss
3Languages, Delphi, C++Builder and .NET, with the same API
100%Source code included with every license
What is in the pack
Six components for the field level.
The protocols that PLCs, meters and drives speak, as non-visual components you drop on a form or create in code. Every Modbus request is a blocking call that returns the values or raises a clear exception, so reading a PLC looks like reading a local variable. The .NET classes carry the same names.
RS-232 and RS-485 serial ports
TsgcSerialPort opens RS-232 and RS-485 ports on Windows, Linux and macOS, writes data and receives it in an event or with blocking reads. ListPorts lists the ports of the machine, and RtsControl set to srcToggle switches the direction for adapters that use RTS. It is also the transport of the Modbus RTU components.
TsgcModbusTCPClient and TsgcModbusRTUClient read and write coils and registers over TCP/IP or a serial line, with function codes 01 to 08, 15, 16, 22, 23 and 43/14. The components handle framing, transaction ids, CRC checks, timeouts and retries for you, and the requests can be called from any thread.
ReadInt32, ReadUInt32, ReadFloat32 and ReadString have write twins, and WordOrder selects ABCD, DCBA, BADC or CDAB to match the device. An overload with a leading unit id reaches every device behind a Modbus TCP to RTU gateway. A device exception raises EsgcModbusException, and no answer raises EsgcModbusTimeout.
TsgcModbusTCPServer and TsgcModbusRTUServer answer from a thread-safe TsgcModbusDataModel with coils, discrete inputs, holding registers and input registers. OnReadRequest fires before a read to load live values, and OnWriteRequest fires before a write to change the values or reject the request with a Modbus exception code.
TsgcOPCUAClient speaks the OPC UA binary protocol over opc.tcp, with Basic256Sha256, Aes128_Sha256_RsaOaep and Aes256_Sha256_RsaPss in Sign or SignAndEncrypt mode. Users log in as Anonymous, with a user name and password, or with an X.509 certificate, and OnValidateServerCertificate decides which server certificates you trust.
GetEndpoints, Browse and BrowseNext follow continuation points for you. TranslateBrowsePath, Read and Write of any attribute and Call for methods cover the rest. ReadValue and WriteValue take a node id string and use the data type of the node.
Data change items with sampling interval, queue size and deadband, and event items with select and where clauses, are pushed by the server without polling. With WatchDog enabled, the client reconnects on its own and restores your subscriptions, and OnReconnect tells you which path was taken. Automatic reconnect is available in Delphi and .NET.
Delphi 7 to 13 and C++Builder on Windows Win32 and Win64, and Linux64. .NET 8, .NET 9, .NET 10 and .NET Standard 2.0, in the NuGet package esegece.sgcIndustrial. Serial ports work on Windows, Linux and macOS. Both run in desktop applications, console tools and services.
The clients follow one shape: set the address, connect, call a method. Each call blocks until the device or the server answers, so the values are there on the next line.
uses
sgcIndustrial;
procedure TForm1.ConnectAndRead;
begin
FClient := TsgcOPCUAClient.Create(Self);
FClient.EndpointUrl := 'opc.tcp://192.168.1.60:4840';
FClient.SecurityPolicy := opcspNone;
FClient.SecurityMode := opcsmNone;
FClient.OnError := OnOPCUAError;
FClient.Connect;
// read the Value attribute of a variable
Memo1.Lines.Add('Temperature: ' + VarToStr(FClient.ReadValue('ns=2;s=Line1.Temperature')));
// the data type of the node is read first and used for the written value
FClient.WriteValue('ns=2;s=Line1.Setpoint', 75.5);
end;
procedure TForm1.OnOPCUAError(Sender: TObject; aStatusCode: Cardinal; const aError: string);
begin
Memo1.Lines.Add('Error: ' + aError);
end;
using System;
using esegece.sgcWebSockets;
class PlcReader
{
TsgcModbusTCPClient FClient = new TsgcModbusTCPClient();
publicvoid ReadPLC()
{
FClient.Host = "192.168.1.50";
FClient.Port = 502;
FClient.UnitId = 1;
FClient.OnError += OnModbusError;
FClient.Active = true;
if (FClient.Active)
{
// holding registers 0..9 (40001..40010 in many device manuals)ushort[] vRegisters = FClient.ReadHoldingRegisters(0, 10);
Console.WriteLine("Register 0 = " + vRegisters[0]);
FClient.WriteSingleRegister(100, 1234);
}
}
void OnModbusError(object Sender, string aError)
{
Console.WriteLine("Error: " + aError);
}
}
The same Modbus code works against any Modbus TCP device or gateway, and the C++ Builder version of every sample is on the component pages. The industrial components overview →
Drop a component on a formThe six components sit on the SGC Industrial palette page, or create them in code in a console tool or a service.
Set the addressHost, Port and UnitId for Modbus TCP, a serial port for Modbus RTU, and EndpointUrl with the security policy and mode for OPC UA.
Call one methodReadHoldingRegisters and WriteSingleRegister for Modbus, ReadValue, WriteValue and CreateSubscription for OPC UA.
Or serve it yourselfTsgcModbusTCPServer and TsgcModbusRTUServer answer from TsgcModbusDataModel, with events to check every read and write.
Interoperability
Tested against implementations we did not write.
A protocol stack is only as good as its interoperability, so sgcIndustrial was tested against other implementations of both protocols, and the Delphi and .NET versions against each other.
OPC UA
The OPC Foundation reference server, Eclipse Milo, node-opcua, open62541 and asyncua, with every security policy and mode each server offers, Anonymous, UserName and Certificate authentication, subscriptions, events and reconnect.
Modbus
modpoll, diagslave, libmodbus, modbus_tk and pymodbus, as clients and as servers, over TCP and over RTU serial lines.
Delphi and .NET
The Delphi and .NET components were tested against each other, 35 of 35 cross tests passing.
Before you buy
Four things worth knowing first.
What sgcIndustrial includes, whether you already own these components, how the .NET version is sold, and how to start. The answers are short, and they are on this page rather than in the small print.
component protocol roleTsgcSerialPort RS-232, RS-485 serial port
TsgcModbusTCPClient Modbus TCP client
TsgcModbusRTUClient Modbus RTU client
TsgcModbusTCPServer Modbus TCP server, data model
TsgcModbusRTUServer Modbus RTU server, data model
TsgcOPCUAClient OPC UA, opc.tcp client
OPC UA security policiesNone, Basic128Rsa15, Basic256Basic256Sha256, Aes128_Sha256_RsaOaepAes256_Sha256_RsaPssmodesNone, Sign, SignAndEncryptloginsAnonymous, UserName, Certificate
sgcIndustrial is self-containedStandalone, the sgcWebSockets Core runtime is included, so there is nothing else to buy. Full source code ships with every license, so the protocol code steps through in your own debugger.
Already in your sgcWebSockets edition?All six industrial components ship inside sgcWebSockets Enterprise, for Delphi and for .NET, and All-Access includes everything.
.NET is a separate packagesgcIndustrial .NET ships as one zip from My Account, with the NuGet packages esegece.sgcWebSockets.Core, esegece.sgcIndustrial and esegece.sgcCrypto and their full source code.
Start with the demosThe Delphi demos are in Demos\Delphi\Industrial and the C++ Builder demos in Demos\CBuilder\Industrial. The Modbus TCP server demo lets you test a client and a server on one machine.
Framing, security, sessions and subscriptions are all handled by the components, and full source code means nothing in between is a black box. Every component and code sample →
Part of sgcWebSockets
Licensed on its own, or already in your edition.
sgcIndustrial is one package of the sgcWebSockets family. Buy it standalone from €249, with the Core runtime bundled in, or get all six components with sgcWebSockets Enterprise or All-Access.
sgcIndustrial
The serial port, the Modbus TCP and RTU clients and servers and the OPC UA client, standalone for Delphi and C++ Builder, with the sgcWebSockets Core runtime included.
If you own sgcWebSockets Enterprise or All-Access you already have all six components. sgcIndustrial is for Modbus, OPC UA and serial ports without licensing a full sgcWebSockets edition.
sgcIndustrial is one of the eSeGeCe component libraries for Delphi, C++ Builder and .NET. They share conventions, they ship with full source, and they deploy royalty-free.