Skip to content

ChrisPulman/S7PlcRx

Repository files navigation

License Build Nuget NuGet

S7PlcRx

S7PlcRx

Reactive Siemens S7 PLC communication for .NET. S7PlcRx provides tag-based S7 reads/writes, Rx observables, optimized batch helpers, caching, diagnostics, production reliability helpers, high-availability helpers, PLC byte conversion utilities, and source-generator assisted property bindings.

Siemens and S7 are trademarks of Siemens AG. This project is independent and is not affiliated with or endorsed by Siemens AG. Test all automation code against a simulator or safe test rig before using production equipment.

Contents

Supported PLCs and frameworks

PLC family API
S7-1500 CpuType.S71500, S71500.Create(...)
S7-1200 CpuType.S71200, S71200.Create(...)
S7-400 CpuType.S7400, S7400.Create(...)
S7-300 CpuType.S7300, S7300.Create(...)
S7-200 CpuType.S7200, S7200.Create(...)
Logo 0BA8 enum support where supported by the protocol path

S7PlcRx targets net462, net472, net481, net8.0, net9.0, and net10.0.

S7PlcRx.SourceGenerators targets netstandard2.0 and runs as a Roslyn analyzer/source generator.

PLC prerequisites

For absolute DB addressing such as DB1.DBD0 on modern Siemens CPUs:

  1. Enable PUT/GET communication.
  2. Use non-optimized DB layout for directly addressed DBs.
  3. Confirm IP address, rack, and slot.
  4. Keep write tests away from live actuators until proven safe.
  5. For source-generated byte-array batching, place related tags in the same DB and adjacent byte ranges.

Installation

Install-Package S7PlcRx
dotnet add package S7PlcRx

Repository/analyzer usage for the source generator:

<ProjectReference Include="..\S7PlcRx.SourceGenerators\S7PlcRx.SourceGenerators.csproj"
                  OutputItemType="Analyzer"
                  ReferenceOutputAssembly="false"
                  PrivateAssets="all" />

Quick start

using System.Reactive.Linq;
using S7PlcRx;
using S7PlcRx.Enums;

using var plc = new RxS7(CpuType.S71500, "192.168.1.100", rack: 0, slot: 1, interval: 100);

plc.AddUpdateTagItem<float>("Temperature", "DB1.DBD0");
plc.AddUpdateTagItem<bool>("Running", "DB1.DBX4.0");
plc.AddUpdateTagItem<float>("TemperatureSetPoint", "DB1.DBD8");

using var connected = plc.IsConnected
    .DistinctUntilChanged()
    .Subscribe(x => Console.WriteLine($"Connected: {x}"));

using var temperature = plc.Observe<float>("Temperature")
    .Where(x => x.HasValue)
    .Subscribe(x => Console.WriteLine($"Temperature: {x:F1} °C"));

plc.Value("TemperatureSetPoint", 72.5f);

Factory equivalent:

using IRxS7 plc = S71500.Create("192.168.1.100", rack: 0, slot: 1, interval: 100);

Addressing and data types

Area Examples Notes
DB bit DB1.DBX0.0, DB1.DBX4.7 Bit index must be 0-7.
DB byte DB1.DBB0 byte, byte[], generated raw ranges.
DB word DB1.DBW2 short, ushort.
DB double word DB1.DBD4 int, uint, float; double uses 8 bytes from the start offset.
Inputs I0.0, IB0, IW0, ID0; E aliases Input area.
Outputs Q0.0, QB0, QW0, QD0; A aliases Output area.
Memory M0.0, MB0, MW0, MD0 Marker memory.
Timers T1 S7 timers.
Counters C1, Z1 S7 counters.
S7 representation C# type Address example Bytes
BOOL bool DB1.DBX0.0 bit in byte
BYTE byte DB1.DBB1 1
BYTE array byte[] DB1.DBB100, arrayLength: 64 length
INT short DB1.DBW2 2
WORD ushort DB1.DBW4 2
DINT int DB1.DBD6 4
DWORD uint DB1.DBD10 4
REAL float DB1.DBD14 4
LREAL double DB1.DBD18 8
STRING string DB1.DBB40 variable
Arrays short[], ushort[], int[], uint[], float[], double[] first element address plus arrayLength element size x length

Core tag API

Register tags:

plc.AddUpdateTagItem<float>("Temperature", "DB1.DBD0");
plc.AddUpdateTagItem<bool>("Running", "DB1.DBX4.0");
plc.AddUpdateTagItem<byte[]>("RecipeBytes", "DB10.DBB0", arrayLength: 64);
plc.AddUpdateTagItem<float[]>("Curve", "DB20.DBD0", arrayLength: 16);

Fluent registration and polling control:

plc.AddUpdateTagItem<float>("Temp1", "DB1.DBD0")
   .AddUpdateTagItem<float>("Temp2", "DB1.DBD4")
   .AddUpdateTagItem<bool>("Alarm", "DB1.DBX8.0")
   .SetTagPollIng(false); // disables polling on the last tag

plc.GetTag("Temp1").SetTagPollIng(false);
plc.GetTag("Temp1").SetTagPollIng(true);
plc.RemoveTagItem("Temp1");

Tag stream projections:

using S7PlcRx;

using var dictionary = plc.ObserveAll
    .TagToDictionary<object>()
    .Subscribe(values => Console.WriteLine(values.Count));

using var namedValue = plc.Observe<float>("Temperature")
    .ToTagValue("Temperature")
    .Subscribe(item => Console.WriteLine($"{item.Tag}={item.Value}"));

Reactive reading

using System.Reactive.Linq;

using var highTemp = plc.Observe<float>("Temperature")
    .Where(x => x > 80.0f)
    .Subscribe(x => Console.WriteLine($"High temperature: {x:F1}"));

using var sampledPressure = plc.Observe<float>("Pressure")
    .Sample(TimeSpan.FromSeconds(5))
    .Subscribe(x => Console.WriteLine($"Pressure: {x:F2}"));

using var averageFlow = plc.Observe<float>("FlowRate")
    .Buffer(TimeSpan.FromMinutes(1))
    .Where(values => values.Count > 0)
    .Select(values => values.Average())
    .Subscribe(avg => Console.WriteLine($"Average flow: {avg:F2}"));

Connection and diagnostic streams:

plc.IsConnected.Subscribe(x => Console.WriteLine($"Connected: {x}"));
plc.LastError.Subscribe(Console.WriteLine);
plc.LastErrorCode.Subscribe(code => Console.WriteLine($"Error code: {code}"));
plc.Status.Subscribe(Console.WriteLine);
plc.IsPaused.Subscribe(paused => Console.WriteLine($"Paused: {paused}"));
plc.ReadTime.Subscribe(ticks => Console.WriteLine($"Read ticks: {ticks}"));

CPU information:

using System.Reactive.Linq;

var cpuInfo = await plc.GetCpuInfo().FirstAsync();
Console.WriteLine($"AS name: {cpuInfo[0]}, Module: {cpuInfo[1]}");

Manual reads and writes

var temperature = await plc.Value<float>("Temperature");

using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
var pressure = await plc.ValueAsync<float>("Pressure", cts.Token);

plc.Value("SetPoint", 72.5f);
plc.Value("Enabled", true);
plc.Value("RecipeNumber", (short)12);
plc.Value("RecipeBytes", new byte[] { 0x01, 0x02, 0x03 });

Watchdog:

using var plcWithWatchdog = new RxS7(
    CpuType.S71500,
    "192.168.1.100",
    rack: 0,
    slot: 1,
    watchDogAddress: "DB100.DBW0",
    interval: 100,
    watchDogValueToWrite: 4500,
    watchDogInterval: 10);

plcWithWatchdog.ShowWatchDogWriting = true;

Batch, async, and optimized APIs

Advanced batch helpers:

using S7PlcRx.Advanced;

var values = await plc.ValueBatch<float>("Temp1", "Temp2", "Temp3");

await plc.ValueBatch(new Dictionary<string, float>
{
    ["SetPoint1"] = 70.0f,
    ["SetPoint2"] = 75.0f,
});

using var batchSub = plc.ObserveBatch<float>("Temp1", "Temp2")
    .Subscribe(snapshot => Console.WriteLine(snapshot.Count));

Dictionary batch helpers:

var tagMap = new Dictionary<string, string>
{
    ["Temperature"] = "DB1.DBD0",
    ["Pressure"] = "DB1.DBD4",
};

var read = await plc.ReadBatchOptimized<float>(tagMap, timeoutMs: 5000);
var write = await plc.WriteBatchOptimized(
    new Dictionary<string, float> { ["Temperature"] = 22.5f },
    verifyWrites: false,
    enableRollback: false);

Async-first ValueTask helpers:

using S7PlcRx.Advanced;

var current = await plc.ReadValueAsync<float>("Temperature");
var many = await plc.ReadValuesAsync<float>("Temp1", "Temp2");

await plc.WriteValuesAsync(new Dictionary<string, float>
{
    ["SetPoint1"] = 72.5f,
    ["SetPoint2"] = 73.0f,
});

.NET 8+ async observable helpers:

using ReactiveUI.Extensions.Async;
using S7PlcRx.Advanced;

await using var sub = await plc.ObserveValueAsync<float>("Temperature")
    .SubscribeAsync(
        async (value, cancellationToken) =>
        {
            Console.WriteLine($"Async temperature: {value}" );
            await Task.CompletedTask;
        },
        CancellationToken.None);

Source generator property binding

S7PlcRx.SourceGenerators generates PLC-bound properties from attributes. It removes repetitive tag registration, polling assignment, and setter write hooks.

Generated compile-time attributes

The generator injects this namespace into the consuming compilation:

namespace S7PlcRx.SourceGeneration;

[AttributeUsage(AttributeTargets.Class)]
public sealed class S7PlcBindingAttribute : Attribute;

[AttributeUsage(AttributeTargets.Property)]
public sealed class S7TagAttribute : Attribute
{
    public S7TagAttribute(string address);
    public string Address { get; }
    public int PollIntervalMs { get; set; } = 100;
    public S7TagDirection Direction { get; set; } = S7TagDirection.ReadWrite;
    public int ArrayLength { get; set; } = 1;
}

public enum S7TagDirection
{
    ReadWrite,
    ReadOnly,
    WriteOnly
}

Generated binding example

using S7PlcRx;
using S7PlcRx.SourceGeneration;

[S7PlcBinding]
public partial class MachineTags
{
    [S7Tag("DB1.DBD0", PollIntervalMs = 100)]
    public partial float Temperature { get; set; }

    [S7Tag("DB1.DBX4.0", PollIntervalMs = 100)]
    public partial bool Running { get; set; }

    [S7Tag("DB1.DBW6", PollIntervalMs = 250, Direction = S7TagDirection.ReadOnly)]
    public partial short ActualSpeed { get; set; }

    [S7Tag("DB1.DBD8", Direction = S7TagDirection.WriteOnly)]
    public partial float SetPoint { get; set; }
}

using var plc = S71500.Create("192.168.1.100");
var tags = new MachineTags();
using var binding = tags.Bind(plc);

tags.SetPoint = 72.5f; // queues a PLC write

Generator rules and behavior

  • The class must be partial and marked with [S7PlcBinding].
  • Each bound property must be partial and marked with [S7Tag("...")].
  • The generator emits backing fields, property implementations, a write hook, a read-apply hook, and IDisposable Bind(IRxS7 plc).
  • Property setters call the runtime write hook when the value changes.
  • PLC reads update backing fields without creating write-back loops.
  • PollIntervalMs > 0 enables interval reads; PollIntervalMs = 0 disables interval reads.
  • ReadOnly disables property writes; WriteOnly disables interval reads; ReadWrite enables both.
  • ArrayLength defines array/string/byte range length.
  • Generated byte-array batching supports DB addresses: DBX, DBB, DBW, DBD.

Efficient byte-array DB grouping

For same-DB nearby tags, the runtime reads one DB byte range and decodes properties locally:

DB1.DBD0   Temperature  float  bytes 0..3
DB1.DBD4   Pressure     float  bytes 4..7
DB1.DBX8.0 Running      bool   byte 8 bit 0

Runtime range tag:

plc.AddUpdateTagItem<byte[]>("__s7_binding_db1_0_9", "DB1.DBB0", arrayLength: 9);

Writes are coalesced on a short flush timer. The runtime performs read-modify-write byte-array writes so unrelated bytes/bits in the same range are preserved.

Manual runtime binding API

using S7PlcRx.Binding;

var definitions = new[]
{
    new S7TagDefinition("Temperature", "DB1.DBD0", typeof(float), 100, S7TagDirection.ReadWrite),
    new S7TagDefinition("Running", "DB1.DBX4.0", typeof(bool), 100, S7TagDirection.ReadWrite),
};

using var runtime = S7TagRuntimeBinding.Bind(
    plc,
    definitions,
    (name, value) => Console.WriteLine($"{name}={value}"));

runtime.Write("Temperature", 25.5f);

Performance and cache features

using S7PlcRx.Optimization;
using S7PlcRx.Performance;

var cached = await plc.ValueCached<float>("Temperature", TimeSpan.FromSeconds(1));
var cacheStats = plc.GetCacheStatistics();
plc.ClearCache("Temperature");

using var smart = plc.MonitorTagSmart<float>("Temperature", changeThreshold: 0.5, debounceMs: 100)
    .Subscribe(change => Console.WriteLine($"{change.TagName}: {change.PreviousValue} -> {change.CurrentValue}"));

using var perf = plc.MonitorPerformance(TimeSpan.FromSeconds(30))
    .Subscribe(metrics => Console.WriteLine($"{metrics.OperationsPerSecond:F1} ops/sec"));

var optimizedReads = await plc.ReadOptimized<float>(new[] { "Temp1", "Temp2" });
var optimizedWrite = await plc.WriteOptimized(new Dictionary<string, float>
{
    ["SetPoint1"] = 72.5f,
    ["SetPoint2"] = 73.0f,
});

var benchmark = await plc.RunBenchmark(new BenchmarkConfig
{
    LatencyTestCount = 10,
    ThroughputTestDuration = TimeSpan.FromSeconds(10),
    ReliabilityTestCount = 20,
});

var stats = plc.GetPerformanceStatistics();

High-performance tag groups:

using S7PlcRx.Advanced;
using S7PlcRx.Performance;

using var group = plc.CreateTagGroup<float>("Process", "Temperature", "Pressure", "Flow");
using var groupSub = group.ObserveGroup().Subscribe(snapshot => Console.WriteLine(snapshot.Count));

var allValues = await group.ReadAll();
await group.WriteAll(new Dictionary<string, float>
{
    ["Temperature"] = 21.0f,
    ["Pressure"] = 1.2f,
});

Enterprise features

Symbol tables:

using S7PlcRx.Enterprise;

var csv = """
Name,Address,DataType,Length,Description
Temperature,DB1.DBD0,REAL,1,Process temperature
Running,DB1.DBX4.0,BOOL,1,Machine running
Recipe,DB10.DBB0,ARRAY,64,Recipe bytes
""";

var table = await plc.LoadSymbolTable(csv, SymbolTableFormat.Csv);
var temperature = await plc.ReadSymbol<float>("Temperature");
plc.WriteSymbol("Running", true);

High availability:

using S7PlcRx.Enterprise;

using var primary = S71500.Create("192.168.1.100");
var backups = new List<IRxS7>
{
    S71500.Create("192.168.1.101"),
    S71500.Create("192.168.1.102"),
};

using var ha = EnterpriseExtensions.CreateHighAvailabilityConnection(primary, backups, TimeSpan.FromSeconds(10));
using var failoverSub = ha.FailoverEvents.Subscribe(evt => Console.WriteLine(evt.Reason));
IRxS7 active = ha.ActivePLC;
await ha.TriggerFailover();

Connection pool:

using S7PlcRx.Core;
using S7PlcRx.Enterprise;
using S7PlcRx.Enums;

using var pool = EnterpriseExtensions.CreateConnectionPool(
    new[]
    {
        new PlcConnectionConfig
        {
            PLCType = CpuType.S71500,
            IPAddress = "192.168.1.100",
            Rack = 0,
            Slot = 1,
            ConnectionName = "Line1Primary",
        },
    },
    new ConnectionPoolConfig
    {
        MaxConnections = 10,
        EnableConnectionReuse = true,
        HealthCheckInterval = TimeSpan.FromMinutes(1),
    });

IRxS7 connection = pool.GetConnection;

Production reliability and diagnostics

using S7PlcRx.Advanced;
using S7PlcRx.Production;

var diagnostics = await plc.GetDiagnostics();
Console.WriteLine($"Connected: {diagnostics.IsConnected}, latency: {diagnostics.ConnectionLatencyMs:F0} ms");

var analysis = await plc.AnalyzePerformance(TimeSpan.FromMinutes(5));
Console.WriteLine($"Total changes: {analysis.TotalTagChanges}" );

var validation = await plc.ValidateProductionReadiness(new ProductionValidationConfig
{
    MaxAcceptableResponseTime = TimeSpan.FromMilliseconds(500),
    MinimumReliabilityRate = 0.95,
    ReliabilityTestCount = 10,
    MinimumProductionScore = 80.0,
});

var result = await plc.ExecuteWithErrorHandling(
    () => plc.Value<float>("CriticalSensor"),
    new ProductionErrorConfig
    {
        MaxRetryAttempts = 3,
        BaseRetryDelayMs = 1000,
        UseExponentialBackoff = true,
        CircuitBreakerThreshold = 5,
        CircuitBreakerTimeout = TimeSpan.FromMinutes(1),
    });

var handler = plc.EnableProductionErrorHandling(new ProductionErrorConfig());
var guarded = await handler.ExecuteAsync(() => plc.Value<float>("Temperature"));

PLC type conversion helpers

All conversion helpers use Siemens S7 byte ordering and are useful for codecs, tests, and generated/runtime byte-array binding logic.

Type/helper Purpose Common functions
Bit Bit extraction/mutation from byte spans FromByte, FromSpan, ToBitArray, SetBit, GetBits, SetBits
Boolean Single byte bit helpers GetValue, SetBit, ClearBit
Byte Byte conversion ToByteArray, ToSpan, FromByteArray, FromSpan
ByteArray Growable pooled byte buffer Add, Clear, TryCopyTo, Span, Memory, Array, Length
Int / Word 16-bit signed/unsigned FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
DInt / DWord 32-bit signed/unsigned FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
Real / LReal 32/64-bit floating point FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
Counter / Timer S7 counter/timer formats FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
DateTime / DateTimeLong S7 date/time formats FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
TimeSpan S7 time span conversion FromByteArray, FromSpan, ToArray, ToByteArray, ToSpan
String, S7String, S7WString String encodings FromByteArray, FromSpan, ToByteArray, ToSpan, TryToSpan
Struct, Class Reflection-based complex type conversion GetStructSize/GetClassSize, FromBytes, ToBytes
using S7PlcRx.PlcTypes;

Span<byte> bytes = stackalloc byte[4];
Real.ToSpan(12.5f, bytes);
float roundTrip = Real.FromSpan(bytes);

Error handling

plc.LastError.Subscribe(message => Console.WriteLine(message));
plc.LastErrorCode.Subscribe(code => Console.WriteLine(code));
  • PlcException carries an ErrorCode for PLC communication failures.
  • S7Exception is a general S7 exception type.
  • TagAddressOutOfRangeException is thrown for invalid tag addresses.
  • Production error handling adds retries and circuit-breaker behavior.

Public API reference

This section is generated from the public C# surface in src/S7PlcRx and src/S7PlcRx.SourceGenerators, then paired with the usage guidance above. It is intended to make this README a single documentation source for the repository.

Source generator generated API

The source generator emits these compile-time-only types into consumer projects:

  • S7PlcRx.SourceGeneration.S7PlcBindingAttribute — marks a partial class for PLC property binding generation.
  • S7PlcRx.SourceGeneration.S7TagAttribute — marks a partial property with an S7 address; properties: Address, PollIntervalMs, Direction, ArrayLength.
  • S7PlcRx.SourceGeneration.S7TagDirectionReadWrite, ReadOnly, WriteOnly.
  • Generated instance method: public IDisposable Bind(IRxS7 plc) on each [S7PlcBinding] class.

Runtime public surface

All public types and members

Namespace S7PlcRx

S7PlcRx.IRxS7

Source: IRxS7.cs:19

Defines an interface for reactive communication with a Siemens S7 PLC, providing observable access to connection status, errors, tag values, and PLC information, as well as methods for reading and writing variables asynchronously. The IRxS7 interface exposes members for monitoring and interacting with a PLC in a reactive manner using observables. It supports observing connection state, errors, and tag values, as well as reading and writing variables with optional cancellation support. Implementations are expected to handle connection management and provide up-to-date PLC information. Thread safety and subscription management depend on the specific implementation.

Member Summary
public string IP get; } Gets the IP address associated with the current instance.
public IObservable<bool> IsConnected get; } Gets an observable sequence that indicates whether the connection is currently established. Subscribers receive updates whenever the connection state changes. The sequence emits when connected and when disconnected.
public bool IsConnectedValue get; } Gets a value indicating whether the connection is currently established.
public IObservable<string> LastError get; } Gets an observable sequence that provides error messages encountered during operation. Subscribers receive error messages as they occur. The sequence completes when the underlying process completes or is disposed. No errors are pushed after completion.
public IObservable<ErrorCode> LastErrorCode get; } Gets an observable sequence that provides notifications of the most recent error code encountered by the component. Subscribers receive updates whenever a new error occurs. The sequence completes when the component is disposed or no longer reports errors. Thread safety and emission timing depend on the implementation of the observable.
public IObservable<Tag?> ObserveAll get; } Gets an observable sequence that emits all tag updates as they occur. Subscribers receive notifications for every tag, including additions, updates, and removals. The sequence emits a value of when a tag is removed.
public CpuType PLCType get; } Gets the type of programmable logic controller (PLC) associated with this instance.
public short Rack get; } Gets the rack number associated with the device or connection.
public short Slot get; } Gets the slot number associated with the current instance.
public IObservable<bool> IsPaused get; } Gets an observable sequence that indicates whether the operation is currently paused. Subscribers receive a value of when the operation is paused and when it is active. The sequence emits updates whenever the paused state changes.
public IObservable<string> Status get; } Gets an observable sequence that provides status updates as strings. Subscribers receive status notifications as they occur. The sequence may complete or error depending on the underlying implementation.
public Tags TagList get; } Gets the collection of tags associated with the current instance.
public bool ShowWatchDogWriting get; set; } Gets or sets a value indicating whether WatchDog writing operations are displayed.
public string? WatchDogAddress get; } Gets the network address of the WatchDog service, if configured.
public ushort WatchDogValueToWrite get; set; } Gets or sets the value to be written to the watchdog register.
public int WatchDogWritingTime get; } Gets the time interval, in milliseconds, used by the watchdog for writing operations.
public IObservable<long> ReadTime get; } Gets an observable sequence that provides the current read time in ticks. Subscribers receive updates whenever the read time changes. The value represents the number of ticks elapsed, where one tick equals 100 nanoseconds.
public IObservable<T?> Observe<T>(string? variable); Observes changes to the specified variable and returns a sequence of its values as they are updated. The type of the variable to observe. The name of the variable to observe. Can be null to observe the default variable, if applicable. An observable sequence that emits the current and subsequent values of the specified variable. The value is null if the variable does not exist or has not been set.
public Task<T?> Value<T>(string? variable); Asynchronously retrieves the value of the specified variable, if it exists. The type of the value to retrieve. The name of the variable whose value is to be retrieved. Can be null to indicate the default variable. A task that represents the asynchronous operation. The task result contains the value of the variable if found; otherwise, null.
public Task<T?> ValueAsync<T>(string? variable, CancellationToken cancellationToken); Asynchronously retrieves the value of the specified variable, if it exists. The type of the value to retrieve. The name of the variable to retrieve. Can be null to indicate the default variable, if supported. A cancellation token that can be used to cancel the asynchronous operation. A task that represents the asynchronous operation. The task result contains the value of the variable if found; otherwise, null.
public void Value<T>(string? variable, T? value); Sets the value of a variable with the specified name and value. The type of the value to assign to the variable. The name of the variable to set. Can be null to indicate an unnamed or default variable. The value to assign to the variable. Can be null if the variable type allows null values.
public IObservable<string[]> GetCpuInfo(); Retrieves an observable sequence containing information about the system's CPU. Subscribers receive updates as the CPU information changes. The format and content of each string array may vary depending on the platform or implementation. An observable sequence of string arrays, where each array contains details about the CPU. The sequence emits new arrays when CPU information is updated.
S7PlcRx.ITag

Source: Tags/ITag.cs:9

Represents a tag that can be configured to control polling behavior.

Member Summary
public void SetDoNotPoll(bool value); Sets whether the object should be excluded from polling operations. true to prevent the object from being polled; otherwise, false.
S7PlcRx.PlcException

Source: PlcException.cs:16

Member Summary
public PlcException(ErrorCode errorCode) : this(errorCode, $"PLC communication failed with error '{errorCode}'.") Initializes a new instance of the class. The error code.
public PlcException(ErrorCode errorCode, Exception? innerException) : this(errorCode, innerException?.Message, innerException) Initializes a new instance of the class. The error code. The inner exception.
public PlcException(ErrorCode errorCode, string? message) : base(message) => ... Initializes a new instance of the class. The error code. The message.
public PlcException(ErrorCode errorCode, string? message, Exception? inner) : base(message, inner) => ... Initializes a new instance of the class. The error code. The message. The inner.
public ErrorCode ErrorCode get; } Gets the error code. The error code.
S7PlcRx.RxS7

Source: RxS7.cs:32

Provides an observable, reactive interface for reading from and writing to Siemens S7 PLCs, supporting tag-based access, status monitoring, and asynchronous operations. The RxS7 class enables integration with Siemens S7 programmable logic controllers (PLCs) using a tag-based model and reactive programming patterns. It exposes observables for PLC data, connection status, errors, and operational metrics, allowing clients to subscribe to real-time updates. The class supports both synchronous and asynchronous read/write operations, as well as advanced features such as watchdog monitoring and batch variable access. Thread safety is maintained for concurrent operations. Dispose the instance when no longer needed to release resources and terminate background operations.

Member Summary
public RxS7(CpuType type, string ip, short rack, short slot, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 10) Initializes a new instance of the class and establishes a connection to a Siemens S7 PLC with optional. watchdog monitoring and periodic tag reading. If a valid watchdog address is provided, the constructor enables periodic writing to the specified address to support external watchdog monitoring. Tag reading and connection status monitoring are started automatically upon construction. The type of the PLC CPU to connect to. The IP address of the PLC to connect to. The rack number of the PLC hardware configuration. The slot number of the PLC CPU module. The address of the watchdog tag in the PLC memory. Must be a DBW address or null to disable watchdog monitoring. The interval, in milliseconds, at which tag values are read from the PLC. Must be greater than 0. The value to write to the watchdog address during each watchdog cycle. The interval, in seconds, at which the watchdog value is written. Must be greater than 0 if watchdog monitoring is enabled. Thrown if watchDogAddress is provided and is not a valid DBW address. Thrown if watchDogInterval is less than 1 when watchdog monitoring is enabled.
public IObservable<Tag?> ObserveAll => ... Gets an observable sequence that emits all tag updates as they occur. Each observer receives tag updates in real time as they are published. The sequence is shared among all subscribers, and subscriptions are managed automatically. Observers may receive null values if a tag is removed or unavailable.
public IObservable<bool> IsPaused => ... Gets an observable sequence that indicates whether the operation is currently paused. The returned observable emits a value of when the operation enters a paused state, and when it resumes. Subscribers receive updates only when the paused state changes. The sequence is shared among all subscribers.
public string IP get; } Gets the IP address associated with the current instance.
public IObservable<bool> IsConnected get; } Gets an observable sequence that indicates whether the connection is currently established. Subscribers receive updates whenever the connection state changes. The sequence emits when connected and when disconnected.
public bool IsConnectedValue get; private set; } Gets a value indicating whether the connection is currently established.
public IObservable<string> LastError => ... Gets an observable sequence that provides the most recent error messages encountered by the component. Subscribers receive error messages as they occur. The sequence is shared among all subscribers, and each subscriber receives messages from the point of subscription onward.
public IObservable<ErrorCode> LastErrorCode => ... Gets an observable sequence that emits the most recent error code reported by the system. Subscribers receive updates whenever a new error code is reported. The sequence is shared among all subscribers and only remains active while there is at least one active subscription.
public CpuType PLCType get; } Gets the type of PLC (Programmable Logic Controller) associated with this instance.
public short Rack get; } Gets the rack number associated with the device or component.
public bool ShowWatchDogWriting get; set; } Gets or sets a value indicating whether WatchDog writing output is displayed.
public short Slot get; } Gets the slot number associated with this instance.
public IObservable<string> Status => ... Gets an observable sequence that provides status updates as strings. Subscribers receive status updates as they occur. The observable sequence is shared among all subscribers, and subscriptions are managed automatically. Status updates are pushed to observers in real time.
public Tags TagList get; } = []; Gets the collection of tags associated with the current instance.
public string? WatchDogAddress get; } Gets the network address of the WatchDog service, if configured.
public ushort WatchDogValueToWrite get; set; } = 4500; Gets or sets the value to be written to the watchdog timer.
public int WatchDogWritingTime get; } = 10; Gets the interval, in seconds, that the watchdog uses when writing status updates.
public bool IsDisposed get; private set; } Gets a value indicating whether gets a value that indicates whether the object is disposed.
public IObservable<long> ReadTime => ... Gets an observable sequence that emits the current read time in ticks whenever a read operation occurs. The observable sequence is shared among all subscribers. Each subscriber receives notifications when a read operation is performed, with the value representing the read time in ticks. The sequence completes when the underlying source completes.
public IObservable<T?> Observe<T>(string? variable) => ... Returns an observable sequence that emits the current and future values of the specified variable, cast to the specified type. The returned observable is hot and shared among all subscribers. Subscribers receive the most recent value and all subsequent updates. If the variable does not exist or its value cannot be cast to the specified type, the observable emits null. The type to which the variable's value is cast in the observable sequence. The name of the variable to observe. If null, all variables are observed. An observable sequence of values of type T, or null if the variable's value is not present or cannot be cast to T. The sequence emits a new value each time the variable changes.
public async Task<T?> Value<T>(string? variable) Asynchronously retrieves the value of the specified variable, cast to the specified type, if available. If the variable's type is not known, it is set to the requested type before retrieving the value. The method waits for an internal pause condition to be met before proceeding. The type to which the variable's value is cast and returned. The name of the variable whose value is to be retrieved. Can be null. A value of type if the variable exists and can be cast to the specified type; otherwise, .
public async Task<T?> ValueAsync<T>(string? variable, CancellationToken cancellationToken) Asynchronously retrieves the value of the specified variable, pausing polling operations during the read. Polling is temporarily paused while the value is being read to ensure consistency. If no polling is active, the method may wait briefly before proceeding. The method is cancellation-friendly and will respond promptly to cancellation requests. The expected type of the variable's value to retrieve. The name of the variable whose value is to be retrieved. Cannot be null, empty, or consist only of white-space characters. A cancellation token that can be used to cancel the operation. A task that represents the asynchronous operation. The task result contains the value of the specified variable cast to type T, or the default value of T if the variable is not found or cannot be cast. Thrown if variable is null, empty, or consists only of white-space characters. Thrown if the operation is canceled via the cancellation token.
public void Value<T>(string? variable, T? value) Sets the value of the specified variable if it exists and the value is compatible with the variable's type. If the variable does not exist or the value is null, this method does nothing. The value is only set if its type matches the variable's expected type or if the type parameter is object. The type of the value to assign to the variable. The name of the variable whose value is to be set. Cannot be null. The value to assign to the variable. Must be compatible with the variable's type.
public void Dispose() Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public IObservable<string[]> GetCpuInfo() => ... Retrieves detailed information about the connected CPU as an observable sequence. The method waits until a connection is established before retrieving CPU information. If the required data is not immediately available, the method will retry until successful or until the subscription is disposed. The order and content of the returned string array correspond to specific CPU information fields. This method is intended for use in reactive programming scenarios where CPU information is needed asynchronously. An observable sequence that emits a string array containing CPU information fields, such as the AS name, module name, copyright, serial number, module type name, order code, and version numbers. The sequence completes after emitting the data.
S7PlcRx.S71200

Source: Create/S71200.cs:9

Provides factory methods for creating connections to Siemens S7-1200 PLC devices.

Member Summary
public static IRxS7 Create(string ip, short rack = 0, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 100) Creates a new instance of an S7 PLC connection with the specified configuration parameters. The IP address of the S7 PLC to connect to. The rack number of the PLC. Must be between 0 and 7. The default is 0. The address of the watchdog variable in the PLC memory. If null, the watchdog feature is disabled. The polling interval, in milliseconds, for reading data from the PLC. The default is 100 milliseconds. The value to write to the watchdog variable, if specified. The default is 4500. The interval, in milliseconds, at which the watchdog value is written. The default is 100 milliseconds. An object implementing the IRxS7 interface that represents the configured PLC connection. Thrown if the value of rack is less than 0 or greater than 7.
S7PlcRx.S71500

Source: Create/S71500.cs:9

Provides factory methods for creating connections to Siemens S7-1500 PLC devices.

Member Summary
public static IRxS7 Create(string ip, short rack = 0, short slot = 1, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 10) Creates a new instance of an S7 PLC client configured for the specified IP address, rack, slot, and optional watchdog monitoring. If is specified, the client will periodically write to the given address at the specified . This can be used to implement a heartbeat or keep-alive mechanism with the PLC. The IP address of the S7 PLC to connect to. The rack number of the PLC. Must be between 0 and 7. The slot number of the PLC CPU module. Must be between 1 and 31. The address of the watchdog variable in the PLC memory to monitor. If null, watchdog monitoring is disabled. The polling interval, in milliseconds, for communication with the PLC. Must be positive. The value to write to the watchdog variable when monitoring is enabled. The interval, in seconds, at which the watchdog value is written. Must be positive. An IRxS7 instance configured to communicate with the specified S7 PLC and optional watchdog monitoring. Thrown when the value of is not between 0 and 7, or is not between 1 and 31.
S7PlcRx.S7200

Source: Create/S7200.cs:9

Provides factory methods for creating connections to Siemens S7-200 PLC devices.

Member Summary
public static IRxS7 Create(string ip, short rack, short slot, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 100) => ... Creates a new instance of an S7-200 PLC client for communication over TCP/IP with optional watchdog monitoring. If a watchdog address is specified, the client will periodically write the specified value to the PLC at the given interval to support connection monitoring or fail-safe logic. Ensure that the PLC is configured to handle the watchdog mechanism as expected. The IP address of the S7-200 PLC to connect to. Cannot be null or empty. The rack number of the PLC CPU module. Typically 0 for S7-200 devices. The slot number of the PLC CPU module. Typically 0 or 1 for S7-200 devices. The address in the PLC memory to use for the watchdog mechanism, or null to disable watchdog monitoring. The polling interval, in milliseconds, for regular communication with the PLC. Must be greater than 0. The value to write to the watchdog address during each watchdog cycle. The interval, in milliseconds, at which the watchdog value is written. Must be greater than 0. An IRxS7 instance configured to communicate with the specified S7-200 PLC, with optional watchdog monitoring enabled.
S7PlcRx.S7300

Source: Create/S7300.cs:9

Provides factory methods for creating connections to Siemens S7-300 PLC devices.

Member Summary
public static IRxS7 Create(string ip, short rack, short slot, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 100) Creates a new instance of an S7 PLC connection with the specified configuration parameters. The IP address of the S7 PLC to connect to. The rack number of the PLC. Must be between 0 and 7, inclusive. The slot number of the PLC. Must be between 1 and 31, inclusive. The address in the PLC memory to use for the watchdog mechanism, or null to disable the watchdog. The polling interval, in milliseconds, for communication with the PLC. Must be greater than 0. The value to write to the watchdog address during each interval. The interval, in milliseconds, at which the watchdog value is written. Must be greater than 0. An object implementing the IRxS7 interface that represents the configured PLC connection. Thrown when the value of is not between 0 and 7, or when the value of is not between 1 and 31.
S7PlcRx.S7400

Source: Create/S7400.cs:9

Provides factory methods for creating S7-400 PLC connections.

Member Summary
public static IRxS7 Create(string ip, short rack, short slot, string? watchDogAddress = null, double interval = 100, ushort watchDogValueToWrite = 4500, int watchDogInterval = 100) Creates a new instance of an S7 PLC client configured for the specified IP address, rack, slot, and optional watchdog monitoring parameters. If watchdog monitoring is enabled by specifying a non-null watchDogAddress, the client will periodically write the specified value to the given address at the defined interval. This can be used to implement a heartbeat or keep-alive mechanism with the PLC. The IP address of the S7 PLC to connect to. The rack number of the PLC. Must be between 0 and 7. The slot number of the PLC CPU. Must be between 1 and 31. The address in the PLC memory to use for the watchdog mechanism, or null to disable watchdog monitoring. The polling interval, in milliseconds, for reading data from the PLC. Must be greater than 0. The value to write to the watchdog address during each interval if watchdog monitoring is enabled. The interval, in milliseconds, at which the watchdog value is written if watchdog monitoring is enabled. Must be greater than 0. An IRxS7 instance configured to communicate with the specified S7 PLC and optional watchdog monitoring. Thrown if rack is not between 0 and 7, or if slot is not between 1 and 31.
S7PlcRx.S7Exception

Source: S7Exception.cs:13

Member Summary
public S7Exception() Initializes a new instance of the class.
public S7Exception(string message) : base(message) Initializes a new instance of the class. The message that describes the error.
public S7Exception(string message, Exception innerException) : base(message, innerException) Initializes a new instance of the class. The error message that explains the reason for the exception. The exception that is the cause of the current exception, or a null reference ( in Visual Basic) if no inner exception is specified.
S7PlcRx.Tag

Source: Tags/Tag.cs:15

Member Summary
public Tag() Initializes a new instance of the class.
public Tag(string address, Type type) Initializes a new instance of the class. The address. The type.
public Tag(string address, Type type, int arrayLength) Initializes a new instance of the class. The address. The type. Length of the array.
public Tag(string name, string address, Type type) Initializes a new instance of the class. The name. The address. The type.
public Tag(string name, string address, Type type, int arrayLength) Initializes a new instance of the class. The name. The address. The type. Length of the array.
public Tag(string name, string address, object value, Type type) Initializes a new instance of the class. The name. The address. The value. The type.
public string? Address get; set; } Gets or sets the address associated with the entity.
public string? Name get; set; } Gets or sets the name associated with the object.
public object? Value get; set; } Gets or sets the value associated with this instance.
public object? NewValue get; internal set; } Gets the new value associated with the change event.
public Type Type get; internal set; } Gets the runtime type information associated with the current instance.
public int? ArrayLength get; internal set; } Gets the length of the array, if known.
public bool DoNotPoll get; internal set; } Gets a value indicating whether polling operations should be suppressed for this instance.
public void SetDoNotPoll(bool value) => ... Sets a value indicating whether polling operations should be disabled. true to disable polling; otherwise, false.
S7PlcRx.TagAddressOutOfRangeException

Source: Tags/TagAddressOutOfRangeException.cs:15

No public instance/static members declared directly on this type.

S7PlcRx.TagExtensions

Source: Tags/TagExtensions.cs:18

Provides extension methods for managing and interacting with tag items in IRxS7-based PLC systems. These methods enable adding, updating, retrieving, and removing tags, as well as converting tag streams to dictionary representations. The TagExtensions class offers a fluent API for working with tags in Siemens S7 PLC communication scenarios. It includes methods for adding tags with type and array support, controlling polling behavior, and transforming tag data streams. All methods are implemented as extension methods to enhance usability and integration with IRxS7 and related types. Thread safety and error handling depend on the underlying IRxS7 and Tag implementations.

Member Summary
public static (ITag? tag, IRxS7? plc) AddUpdateTagItem<T>(this IRxS7 @this, string tagName, string address, int? arrayLength = null) Adds or updates a tag item of the specified type in the PLC and returns the created tag and the PLC instance. If the specified type parameter is a string or an array type and an array length is provided, the tag will be created as an array with the given length. Otherwise, the tag will be created as a single value. This method is an extension method for IRxS7 implementations that support tag management. The data type of the tag to add or update. This determines the type of value the tag will hold. The PLC instance to which the tag item will be added or updated. The name to assign to the tag item. The address in the PLC where the tag item is located. The length of the array for the tag item, if the tag represents an array type. Specify null for non-array types. A tuple containing the created or updated tag as the first element and the PLC instance as the second element. The tag will be null if the PLC instance does not support tag operations.
public static (ITag? tag, IRxS7? plc) AddUpdateTagItem(this IRxS7 @this, Type type, string tagName, string address, int? arrayLength = null) Adds or updates a tag item in the specified PLC instance and returns the created tag and the PLC reference. If the specified type is an array or a string, the array length must be provided. If the PLC instance does not support adding or updating tags, the returned tag will be null. The PLC instance to which the tag item will be added or updated. The data type of the tag to add or update. Must not be null. The name of the tag to add or update. The address in the PLC where the tag is located. The length of the array if the tag type is an array or a string; otherwise, null. A tuple containing the created tag (or null if the operation was not successful) and the PLC reference.
public static (ITag? tag, IRxS7? plc) AddUpdateTagItem<T>(this (ITag? _, IRxS7? plc) @this, string tagName, string address, int? arrayLength = null) Adds or updates a tag item of the specified type in the PLC and returns the created tag along with the PLC instance. If the PLC instance is not of type , no tag is added or updated and the returned tag will be null. When adding a string or array tag, must be specified to define the size of the tag. The data type of the tag to add or update. This can be a primitive type, string, or array type. A tuple containing the current tag (which may be null) and the PLC instance in which to add or update the tag. The name to assign to the tag item. The address in the PLC where the tag is located. The length of the array if the tag represents an array type. This parameter is required when is a string or an array type; otherwise, it is ignored. A tuple containing the created or updated tag as and the PLC instance as . If the PLC instance is null, the tag will also be null.
public static (ITag? tag, IRxS7? plc) AddUpdateTagItem(this (ITag? _, IRxS7? plc) @this, Type type, string tagName, string address, int? arrayLength = null) Adds or updates a tag item in the specified PLC instance using the provided type, tag name, and address. If the tag type is a string or an array, the array length must be specified. The method does not modify the PLC instance if it is null or if the type is null. A tuple containing the current tag (ignored) and the PLC instance in which to add or update the tag item. The type of the tag to add or update. Must not be null. The name of the tag to add or update in the PLC. The address in the PLC where the tag is located. The length of the array if the tag type is an array or a string. Optional. A tuple containing the created or updated tag and the PLC instance. The tag is null if the PLC instance or type is null.
public static (ITag? tag, IRxS7? plc) SetTagPollIng(this (ITag? tag, IRxS7? plc) @this, bool polling = true) Enables or disables polling for the specified tag by setting its polling state. If the tag is null, this method has no effect. This method does not modify the PLC instance. A tuple containing the tag and PLC instance to update. true to enable polling for the tag; false to disable polling. The default is true. A tuple containing the original tag and PLC instance.
public static (ITag? tag, IRxS7? plc) GetTag(this IRxS7 @this, string tagName) => ... Retrieves the tag with the specified name from the PLC's tag list, along with the associated PLC instance. If the specified tag name does not exist in the PLC's tag list, the method returns a tuple with a null tag and the original PLC instance. This method is an extension method for the IRxS7 interface. The PLC instance from which to retrieve the tag. The name of the tag to retrieve. Cannot be null. A tuple containing the tag that matches the specified name and the PLC instance. If the tag is not found, the tag element of the tuple is null.
public static void RemoveTagItem(this IRxS7 @this, string tagName) Removes the tag item with the specified name from the underlying RxS7 instance, if applicable. If the underlying object is not an RxS7 instance, this method has no effect. The IRxS7 instance from which to remove the tag item. The name of the tag item to remove. Cannot be null.
public static IObservable<IDictionary<string, TValue>> TagToDictionary<TValue>(this IObservable<Tag?> source) Projects a sequence of nullable Tag objects into a stream of dictionaries containing the most recent values for each tag name, filtered by the specified value type. Each emitted dictionary contains all tag names encountered so far whose values are of type TValue and are not null. The dictionary is updated with each new matching tag in the source sequence. The same dictionary instance is reused and updated for each emission; callers should not modify the returned dictionary. The type to which tag values are filtered and cast. Only tags whose values are of this type are included in the resulting dictionaries. The observable sequence of nullable Tag objects to process. An observable sequence of dictionaries mapping tag names to their most recent non-null values of type TValue. Each dictionary reflects the accumulated state up to that point in the source sequence.
public static IObservable<(string Tag, TValue Value)> ToTagValue<TValue>(this IObservable<TValue?> source, string tag) => ... Projects each non-null value in the source sequence into a tuple containing the specified tag and the value. Null values in the source sequence are filtered out. The resulting sequence will not contain any tuples with a null value. The type of the values in the source sequence. The observable sequence of nullable values to process. Only non-null values are included in the result. The tag to associate with each value in the resulting sequence. This value is included in each emitted tuple. An observable sequence of tuples, where each tuple contains the specified tag and a non-null value from the source sequence.
S7PlcRx.Tags

Source: Tags/Tags.cs:18

Member Summary
public Tags() Initializes a new instance of the class.
public object? this[object key, bool isEnd = false] #pragma warning restore RCS1163 // Unused parameter.
public Tag? this[string name] => ... Gets the tag with the specified name, if it exists. The name of the tag to retrieve. The comparison may be case-sensitive depending on the implementation. The tag associated with the specified name, or null if no tag with that name exists.
public Tag? this[Tag? tag] => ... Gets the tag from the collection that matches the specified tag's name, if present. This indexer performs a lookup based on the name of the provided tag. If the specified tag is null, the result is null. The tag whose name is used to locate the corresponding tag in the collection. Can be null. The tag from the collection that has the same name as the specified tag, or null if no such tag exists.
public new void Add(object key, object value) Adds an element with the specified key and value to the collection in a thread-safe manner. This method ensures that the add operation is thread-safe. If an element with the same key already exists, an exception is thrown. The key of the element to add. Cannot be null. The value of the element to add. Can be null.
public void Add(object key, Tag tag) Adds the specified tag to the collection with the associated key. If the collection already contains an element with the same key, an exception may be thrown depending on the underlying implementation. This method is thread-safe. The key with which the specified tag is to be associated. Cannot be null. The tag to add to the collection. Cannot be null.
public void Add(Tag tag) Adds the specified tag to the collection. The tag to add to the collection. Cannot be null.
public void Add(object key, Tags tags) Adds the specified key and associated tags to the collection. The key with which the specified tags are to be associated. Cannot be null. The tags to associate with the specified key. Cannot be null.
public void AddRange(IEnumerable<Tag> tags) Adds a collection of tags to the current instance, including only those tags whose values are not null. The collection of objects to add. Only tags with non-null values are added. Thrown if is null.
public Tags GetTags() Retrieves a collection of tags that have non-null values. A collection containing all tags with non-null values. The collection will be empty if no such tags exist.
public List<Tag> ToList() Returns a list containing all tags in the collection. The returned list is a snapshot of the collection at the time of the call. Subsequent modifications to the collection are not reflected in the returned list. This method is thread-safe. A list of objects representing the tags in the collection. The list is empty if the collection contains no tags or if an error occurs while retrieving the tags.

Namespace S7PlcRx.Advanced

S7PlcRx.Advanced.AdvancedExtensions

Source: Advanced/AdvancedExtensions.cs:22

Provides advanced extension methods for efficient batch operations, diagnostics, and performance analysis on PLC (Programmable Logic Controller) instances using the IRxS7 interface. These extension methods enable high-performance reading, writing, monitoring, and analysis of PLC variables, supporting scenarios such as batch updates, optimized data access, and system diagnostics. Methods are designed to simplify complex PLC interactions and provide recommendations for optimization. All methods require a valid IRxS7 instance and may throw exceptions if invalid arguments are supplied. Thread safety and performance considerations are addressed where relevant in individual method documentation.

Member Summary
public static IObservable<Dictionary<string, T?>> ObserveBatch<T>(this IRxS7 plc, params string[] variables) Observes the values of multiple PLC variables as a batch and emits updates as a dictionary when any of the specified variables change. The returned observable is hot and shared among all subscribers. If a specified variable is not already being polled, polling is automatically enabled for that variable. The sequence emits a new dictionary only when the set of variable values changes. The type of the variable values to observe. Must be compatible with the PLC variable types. The PLC instance that provides access to the variables to observe. Cannot be null. The names of the PLC variables to observe. If empty, an empty dictionary is emitted. An observable sequence that emits a dictionary mapping each specified variable name to its most recent value. The dictionary is updated and emitted whenever any of the observed variables change. Thrown if the parameter is null.
public static async Task<Dictionary<string, T?>> ValueBatch<T>(this IRxS7 plc, params string[] variables) Asynchronously reads the values of multiple variables from the PLC and returns a dictionary mapping variable names to their values. If a variable name does not exist in the PLC or cannot be read, its value in the returned dictionary will be the default value for type T. The order of the returned dictionary corresponds to the order of the requested variable names. This method may perform the reads in parallel for efficiency. The type of the variable values to read from the PLC. The PLC instance from which to read the variable values. Cannot be null. An array of variable names to read from the PLC. Each name must correspond to a valid variable in the PLC. A task that represents the asynchronous operation. The task result contains a dictionary mapping each requested variable name to its value of type T, or to the default value of T if the variable could not be read or does not exist. If no variables are specified, returns an empty dictionary. Thrown if the plc parameter is null.
public static async Task ValueBatch<T>(this IRxS7 plc, Dictionary<string, T> values) Writes a batch of values to the PLC asynchronously using the specified tag-value pairs. If the underlying PLC implementation supports batch writing, the method attempts to write all values in a single operation for improved performance. Otherwise, values are written individually in parallel. No action is taken if the dictionary is null or empty. The type of the values to write to the PLC. The PLC interface to which the values will be written. A dictionary containing tag names as keys and the corresponding values to write. Cannot be null or empty. A task that represents the asynchronous write operation.
public static async Task<BatchReadResult<T>> ReadBatchOptimized<T>( this IRxS7 plc, Dictionary<string, string> tagMapping, int timeoutMs = 5000) Reads a batch of tags from the PLC in an optimized manner, grouping reads by data block to improve performance. If the tagMapping dictionary is null or empty, the method returns a successful result with no values. Tags are grouped by data block to minimize communication overhead. If a tag does not exist in the PLC's tag list, it is added before reading. Each tag read is subject to the specified timeout. The type of the values to read from the PLC tags. The PLC instance that provides access to the tags to be read. Cannot be null. A dictionary mapping logical tag names to their corresponding PLC addresses. Each key is the tag name, and each value is the PLC address to read. The maximum time, in milliseconds, to wait for each tag read operation before timing out. The default is 5000 milliseconds. A task that represents the asynchronous operation. The task result contains a BatchReadResult{T} with the values read, per-tag success status, and any errors encountered. Thrown if the plc parameter is null.
public static async Task<BatchWriteResult> WriteBatchOptimized<T>( this IRxS7 plc, Dictionary<string, T> values, bool verifyWrites = false, bool enableRollback = false) Writes a batch of values to the specified PLC in an optimized manner, with optional write verification and rollback support. If enableRollback is set to true and any write fails, the method attempts to restore all affected PLC addresses to their original values. Write verification, if enabled, reads back each value after writing to ensure correctness. This method is asynchronous and should be awaited to ensure completion of all write and verification operations. The type of the values to write to the PLC. The PLC instance to which the values will be written. Cannot be null. A dictionary mapping PLC variable addresses to the values to write. Each key represents a PLC address, and each value is the data to write to that address. If the dictionary is null or empty, no write operations are performed. true to verify each write by reading back the value after writing; otherwise, false. Verification may increase operation time. true to enable rollback of all written values to their original state if any write fails; otherwise, false. Rollback is attempted only if an error occurs during the batch write. A BatchWriteResult object containing the outcome of the batch write operation, including per-address success and error information. If no values are provided, the result indicates overall success. Thrown if plc is null.
public static async Task<ProductionDiagnostics> GetDiagnostics(this IRxS7 plc) Asynchronously collects diagnostic information and performance metrics from the specified PLC instance. If the PLC is not connected, only basic information is included in the diagnostics. For S7-1500 PLCs, additional CPU information and connection latency are measured. Any errors encountered during diagnostic collection are recorded in the Errors property of the returned ProductionDiagnostics object. The PLC instance from which to retrieve diagnostics. Must implement the IRxS7 interface. A task that represents the asynchronous operation. The task result contains a ProductionDiagnostics object with collected diagnostic data, tag metrics, and optimization recommendations. Thrown if the plc parameter is null.
public static async Task<PerformanceAnalysis> AnalyzePerformance(this IRxS7 plc, TimeSpan monitoringDuration) Analyzes tag change performance on the specified PLC over a given monitoring duration and returns a summary of tag change frequencies and recommendations. This method subscribes to all tag changes on the PLC and tracks the frequency of changes for each tag during the specified monitoring period. The analysis includes total tag changes, per-tag change counts, and suggestions for optimizing performance based on observed activity. The method is thread-safe and does not block the calling thread. The PLC instance to monitor for tag changes. Cannot be null. The length of time to observe tag changes. Must be a positive time span. A task that represents the asynchronous operation. The task result contains a PerformanceAnalysis object with tag change statistics and performance recommendations for the monitored period. Thrown if the plc parameter is null.
public static HighPerformanceTagGroup<T> CreateTagGroup<T>(this IRxS7 plc, string groupName, params string[] tagNames) => ... Creates a new high-performance tag group for batch reading or writing of multiple tags from the specified PLC connection. Use this method to efficiently manage and operate on multiple tags as a single group, which can improve performance for batch operations. The data type of the tag values in the group. The PLC connection used to access the tags. Cannot be null. The name assigned to the tag group. Used to identify the group within the PLC context. An array of tag names to include in the group. Each name must correspond to a valid tag in the PLC. A new instance of HighPerformanceTagGroup{T} containing the specified tags, associated with the given PLC connection.
S7PlcRx.Advanced.AsyncExtensions

Source: Advanced/AsyncExtensions.cs:18

Provides additional async-first helpers for reading, writing, and observing PLC values without changing the base API surface. These helpers layer and async-observable patterns over the existing PLC API. Where possible, they complete synchronously from cached tag values or the existing multi-variable read/write paths to reduce avoidable allocations.

Member Summary
public static ValueTask<T?> ReadValueAsync<T>(this IRxS7 plc, string? variable, CancellationToken cancellationToken = default) Reads a PLC value using a , returning synchronously when a compatible cached tag value is already available. The expected PLC value type. The PLC instance. The tag name to read. The cancellation token for the read operation. A that resolves to the current PLC value.
public static ValueTask<Dictionary<string, T?>> ReadValuesAsync<T>(this IRxS7 plc, params string[] variables) => ... Reads multiple PLC values using a , preferring cached values and the optimized multi-variable read path where available. The expected PLC value type. The PLC instance. The tag names to read. A that resolves to a dictionary of tag values keyed by tag name.
public static ValueTask<Dictionary<string, T?>> ReadValuesAsync<T>(this IRxS7 plc, IReadOnlyList<string> variables, CancellationToken cancellationToken = default) Reads multiple PLC values using a , honoring cancellation for deferred reads. The expected PLC value type. The PLC instance. The tag names to read. The cancellation token for deferred reads. A that resolves to a dictionary of tag values keyed by tag name.
public static ValueTask WriteValuesAsync<T>(this IRxS7 plc, IReadOnlyDictionary<string, T> values, CancellationToken cancellationToken = default) Writes multiple PLC values using a , preferring the optimized multi-variable write path where available. The PLC value type. The PLC instance. The tag values to write. The cancellation token. A completed when the writes have been issued.
public static IObservableAsync<T?> ObserveValueAsync<T>(this IRxS7 plc, string? variable) Exposes a PLC variable as an async observable sequence. The expected PLC value type. The PLC instance. The tag name to observe. An that emits tag value updates asynchronously.
public static IObservableAsync<Dictionary<string, T?>> ObserveValuesAsync<T>(this IRxS7 plc, params string[] variables) Exposes a batch PLC observation as an async observable sequence. The expected PLC value type. The PLC instance. The tag names to observe. An that emits dictionaries of tag values asynchronously.
S7PlcRx.Advanced.DictionaryEqualityComparer<TKey, TValue>

Source: Advanced/DictionaryEqualityComparer.cs:15

Provides an equality comparer for dictionaries that determines equality based on their key-value pairs. This comparer considers two dictionaries equal if they contain the same number of key-value pairs and each key in one dictionary exists in the other with an equal value, as determined by the default equality comparer for the value type. The order of key-value pairs does not affect equality. This comparer can be used to compare dictionaries in collections such as hash sets or as keys in other dictionaries. The type of keys in the dictionaries. Must be non-nullable. The type of values in the dictionaries.

No public instance/static members declared directly on this type.

Namespace S7PlcRx.BatchOperations

S7PlcRx.BatchOperations.BatchOperationResult

Source: BatchOperations/BatchOperationResult.cs:14

Represents the result of executing a batch operation, including summary statistics and details for each operation. Use this class to access aggregate information such as the number of successful and failed operations, processing times, and detailed results for each operation in the batch. The class provides both summary properties and collections for per-operation and error details.

Member Summary
public DateTime StartTime get; set; } Gets or sets the operation start time.
public DateTime EndTime get; set; } Gets or sets the operation end time.
public int OperationCount get; set; } Gets or sets the number of operations in the batch.
public int SuccessfulOperations get; set; } Gets or sets the number of successful operations.
public int FailedOperations get; set; } Gets or sets the number of failed operations.
public TimeSpan ProcessingTime => ... Gets the total processing time.
public double AverageTimePerOperation => ... Gets the average time per operation.
public List<OperationDetail> OperationDetails get; } = []; Gets operation details.
public List<string> ErrorDetails get; } = []; Gets error details for failed operations.
S7PlcRx.BatchOperations.BatchReadResult<T>

Source: BatchOperations/BatchReadResult.cs:17

Represents the result of a batch read operation, including the values read, per-tag success status, error messages, and overall success information. Use this class to access the outcome of a batch read, including which tags succeeded, which failed, and any associated error messages. The dictionaries provide per-tag details, while the overall success and count properties offer summary information. This class is typically used in scenarios where multiple items are read in a single operation and individual results must be tracked. The type of the values returned for each tag in the batch read operation.

Member Summary
public Dictionary<string, T> Values get; } = []; Gets the successfully read values.
public Dictionary<string, bool> Success get; } = []; Gets the success status for each tag.
public Dictionary<string, string> Errors get; } = []; Gets error messages for failed reads.
public bool OverallSuccess get; set; } Gets or sets a value indicating whether gets whether all reads were successful.
public int SuccessCount => ... Gets the count of successful reads.
public int ErrorCount => ... Gets the count of failed reads.
S7PlcRx.BatchOperations.BatchWriteResult

Source: BatchOperations/BatchWriteResult.cs:15

Represents the result of a batch write operation, including per-item success status, error messages, and overall outcome. Use this class to inspect which items in a batch write succeeded or failed, retrieve error details for failed items, and determine whether the entire batch was successful or if a rollback was performed. The dictionaries map item identifiers (such as tag names) to their respective statuses and error messages.

Member Summary
public Dictionary<string, bool> Success get; } = []; Gets the success status for each tag.
public Dictionary<string, string> Errors get; } = []; Gets error messages for failed writes.
public bool OverallSuccess get; set; } Gets or sets a value indicating whether gets whether all writes were successful.
public bool RollbackPerformed get; set; } Gets or sets a value indicating whether gets whether rollback was performed.
public int SuccessCount => ... Gets the count of successful writes.
public int ErrorCount => ... Gets the count of failed writes.

Namespace S7PlcRx.Binding

S7PlcRx.Binding.S7TagDefinition

Source: Binding/S7TagDefinition.cs:9

Describes a generated PLC tag/property binding.

Member Summary
public S7TagDefinition(string name, string address, Type valueType, int pollIntervalMs, S7TagDirection direction, int arrayLength = 1) Initializes a new instance of the class. The property and PLC tag name. The S7 DB address. The .NET value type. The read polling interval in milliseconds. The tag access direction. The array/string element length.
public string Name get; } Gets the property and PLC tag name.
public string Address get; } Gets the S7 DB address.
public Type ValueType get; } Gets the .NET value type.
public int PollIntervalMs get; } Gets the read polling interval in milliseconds.
public S7TagDirection Direction get; } Gets the tag access direction.
public int ArrayLength get; } Gets the array/string element length.
public bool CanRead => ... Gets a value indicating whether this tag should be read on polling intervals.
public bool CanWrite => ... Gets a value indicating whether this tag can write property changes to the PLC.
S7PlcRx.Binding.S7TagDirection

Source: Binding/S7TagDirection.cs:9

Defines the PLC access direction for a generated tag binding.

Enum values: ReadWrite, ReadOnly, WriteOnly.

S7PlcRx.Binding.S7TagRuntimeBinding

Source: Binding/S7TagRuntimeBinding.cs:15

Runtime engine used by generated tag bindings to poll and write PLC DB values in byte-array batches.

Member Summary
public static S7TagRuntimeBinding Bind(IRxS7 plc, IReadOnlyList<S7TagDefinition> definitions, Action<string, object?> applyRead) => ... Creates and starts a runtime binding for generated PLC tag definitions. The PLC instance. The tag definitions emitted by the source generator. A generated callback that assigns PLC values to backing fields without re-writing them. A disposable runtime binding.
public void Write(string name, object? value) Queues a generated property change for a grouped byte-array write. The generated tag/property name. The new property value.
public void Dispose() Releases timers and pending write state.

Namespace S7PlcRx.Cache

S7PlcRx.Cache.CacheStatistics

Source: Cache/CacheStatistics.cs:13

Provides statistical information about the state and performance of a cache, including entry counts, hit rates, and entry timestamps. Use this class to monitor cache usage patterns and effectiveness. The statistics can help identify cache performance issues or guide tuning decisions. All values represent a snapshot at the time the object is created or updated; they do not update automatically.

Member Summary
public int TotalEntries get; set; } Gets or sets the total number of cached entries.
public long TotalHits get; set; } Gets or sets the total number of cache hits.
public double HitRate get; set; } Gets or sets the cache hit rate (0.0 to 1.0).
public DateTime OldestEntry get; set; } Gets or sets the timestamp of the oldest cache entry.
public DateTime NewestEntry get; set; } Gets or sets the timestamp of the newest cache entry.
public int CachedValueCount get; internal set; } Gets the cached value count. The cached value count.
public int PendingRequestCount get; internal set; } Gets the pending request count. The pending request count.
public double CacheHitRatio get; internal set; } Gets the cache hit ratio. The cache hit ratio.
S7PlcRx.Cache.CachedTagValue

Source: Cache/CachedTagValue.cs:12

Represents a cached value along with metadata about its storage and usage. This class is typically used to store a value retrieved from a data source, along with the time it was cached and the number of times it has been accessed. It is intended for use in caching scenarios where tracking cache usage and freshness is important.

Member Summary
public object? Value get; set; } Gets or sets the cached value.
public DateTime Timestamp get; set; } Gets or sets when the value was cached.
public long HitCount get; set; } Gets or sets the number of cache hits.

Namespace S7PlcRx.Core

S7PlcRx.Core.ConnectionPool

Source: Core/ConnectionPool.cs:17

Manages a pool of PLC connections, providing load-balanced access and connection reuse according to the specified configuration. The ConnectionPool enables efficient management of multiple PLC connections by reusing and balancing requests across available connections. It supports configurable pool size and connection reuse strategies. This class is thread-safe for concurrent access. Call Dispose to release all connections when the pool is no longer needed.

Member Summary
public ConnectionPool(ConnectionPoolConfig config) => ... Initializes a new instance of the class. The pool configuration.
public ConnectionPool( IEnumerable<PlcConnectionConfig> connectionConfigs, ConnectionPoolConfig poolConfig) Initializes a new instance of the class. The connection configurations. The pool configuration.
public int MaxConnections => ... Gets the maximum number of connections in the pool.
public int ActiveConnections => ... Gets the number of active connections.
public IRxS7 GetConnection Gets a connection from the pool using load balancing. An available PLC connection.
public IEnumerable<IRxS7> GetAllConnections() => ... Gets all connections in the pool. All connections.
public void Dispose() Disposes all connections in the pool.
S7PlcRx.Core.ConnectionPoolConfig

Source: Core/ConnectionPoolConfig.cs:12

Represents the configuration settings for a connection pool, including limits, timeouts, and behavior options. Use this class to specify parameters that control the size, performance, and health monitoring of a connection pool. Adjusting these settings can help optimize resource usage and connection reliability for applications that manage multiple concurrent connections.

Member Summary
public int MaxPoolSize get; set; } = 10; Gets or sets the maximum pool size.
public int MaxConnections get; set; } = 10; Gets or sets the maximum number of connections in the pool.
public TimeSpan ConnectionTimeout get; set; } = TimeSpan.FromSeconds(30); Gets or sets the connection timeout.
public bool EnableLoadBalancing get; set; } = true; Gets or sets a value indicating whether to enable load balancing.
public bool EnableConnectionReuse get; set; } = true; Gets or sets a value indicating whether to enable connection reuse.
public TimeSpan HealthCheckInterval get; set; } = TimeSpan.FromMinutes(1); Gets or sets the health check interval.
S7PlcRx.Core.DataBlockInfo

Source: Core/DataBlockInfo.cs:14

Represents metadata and configuration information for a data block, including its identifier, size, tag details, access frequency, and optimization settings. Use this class to describe the characteristics of a data block, such as its block number, size in bytes, and associated tag names. The properties provide information useful for managing, analyzing, or optimizing data storage and access patterns. Instances of this class are typically used in scenarios where data blocks are processed, monitored, or configured for batch operations.

Member Summary
public int BlockNumber get; set; } Gets or sets the data block number.
public int SizeBytes get; set; } Gets or sets the total size in bytes.
public int TagCount get; set; } Gets or sets the number of tags in this block.
public double AccessFrequency get; set; } Gets or sets the access frequency.
public bool IsBatchOptimized get; set; } Gets or sets a value indicating whether gets or sets whether the block is optimized for batch operations.
public List<string> TagNames get; } = []; Gets the tags in this data block.
S7PlcRx.Core.OperationDetail

Source: Core/OperationDetail.cs:9

Represents the details of an operation, including its type, status, duration, and related metadata.

Member Summary
public string TagName get; set; } = string.Empty; Gets or sets the tag name.
public string OperationType get; set; } = string.Empty; Gets or sets the operation type.
public bool Success get; set; } Gets or sets a value indicating whether gets or sets whether the operation succeeded.
public TimeSpan Duration get; set; } Gets or sets the operation duration.
public string? ErrorMessage get; set; } Gets or sets any error message.
public int DataBlockNumber get; set; } Gets or sets the data block number.
S7PlcRx.Core.RequestPriority

Source: Core/RequestPriority.cs:9

Request priority levels for batch processing.

Enum values: Low, Normal, High, Critical.

Namespace S7PlcRx.Enterprise

S7PlcRx.Enterprise.EnterpriseExtensions

Source: Enterprise/EnterpriseExtensions.cs:19

Provides extension methods for enhanced PLC connectivity, symbolic addressing, high-availability management, and connection pooling in enterprise automation scenarios. The EnterpriseExtensions class offers advanced features for working with PLCs, including loading and caching symbol tables for symbolic access, reading and writing values by symbol name, creating high-availability connections with automatic failover, and managing connection pools for high-throughput applications. These methods are designed to simplify integration with industrial automation systems and improve reliability and scalability in production environments.

Member Summary
public static async Task<SymbolTable> LoadSymbolTable( this IRxS7 plc, string symbolTableData, SymbolTableFormat format = SymbolTableFormat.Csv) Loads and caches a symbol table for symbolic addressing support. Enables reading/writing using symbolic names instead of absolute addresses. The PLC instance. Symbol table data (CSV format supported). The format of the symbol table data. The loaded symbol table.
public static async Task<T?> ReadSymbol<T>(this IRxS7 plc, string symbolName) Asynchronously reads the value of the specified symbol from the PLC and returns it as the specified type. The type to which the symbol's value is converted and returned. The PLC connection used to access the symbol table and read the symbol value. Cannot be null. The name of the symbol to read from the PLC. Must correspond to a symbol present in the PLC's symbol table. A task that represents the asynchronous read operation. The task result contains the value of the symbol as type , or if the symbol's value is null. Thrown if is null. Thrown if a symbol with the specified does not exist in the PLC's symbol table.
public static void WriteSymbol<T>(this IRxS7 plc, string symbolName, T value) Writes a value to the specified PLC symbol by name. The type of the value to write to the symbol. The PLC instance to which the symbol value will be written. Cannot be null. The name of the symbol in the PLC to write the value to. Must correspond to a valid symbol in the PLC's symbol table. The value to write to the specified symbol. Thrown if is null. Thrown if does not correspond to a symbol in the PLC's symbol table.
public static HighAvailabilityPlcManager CreateHighAvailabilityConnection( IRxS7 primaryPlc, IList<IRxS7> backupPlcs, TimeSpan? healthCheckInterval = null) Creates a high-availability connection manager that coordinates failover between a primary PLC and one or more backup PLCs. The returned manager automatically monitors the health of the primary and backup PLCs and handles failover as needed. The order of backupPlcs determines the failover priority. The primary PLC instance to be used for initial communication and operations. Cannot be null. A list of backup PLC instances to be used for failover if the primary PLC becomes unavailable. Cannot be null or empty. The interval at which the health of the PLCs is checked. If null, a default interval is used. A HighAvailabilityPlcManager instance that manages high-availability communication across the specified PLCs. Thrown if primaryPlc or backupPlcs is null.
public static ConnectionPool CreateConnectionPool( IEnumerable<PlcConnectionConfig> connectionConfigs, ConnectionPoolConfig poolConfig) Creates a new connection pool using the specified PLC connection configurations and pool settings. A collection of PLC connection configurations to include in the pool. Must contain at least one configuration. The configuration settings to apply to the connection pool. Cannot be null. A new instance of initialized with the provided connection configurations and pool settings. Thrown if or is null. Thrown if does not contain at least one configuration.
S7PlcRx.Enterprise.HighAvailabilityPlcManager

Source: Enterprise/HighAvailabilityPlcManager.cs:17

Provides high-availability management for a set of PLC (Programmable Logic Controller) connections, automatically handling failover to backup PLCs in case of connection loss. The HighAvailabilityPlcManager monitors the health of the primary PLC and automatically switches to a backup PLC if the primary becomes unavailable. It exposes an observable stream of failover events for monitoring and allows manual triggering of failover. This class is thread-safe for typical usage scenarios. Dispose the manager when it is no longer needed to release resources.

Member Summary
public HighAvailabilityPlcManager( IRxS7 primaryPlc, IList<IRxS7> backupPlcs, TimeSpan? healthCheckInterval = null) Initializes a new instance of the class with a primary PLC, a list of backup PLCs,. and an optional health check interval. The primary PLC is always treated as the first PLC in the managed list, regardless of its position in the provided backupPlcs collection. Health checks are performed at the specified interval to monitor PLC availability and facilitate failover if necessary. The primary PLC to be managed. Cannot be null. A list of backup PLCs to use for failover. The primary PLC will be inserted as the first element in this list. The interval at which health checks are performed on the PLCs. If null, a default interval of 30 seconds is used. Thrown if primaryPlc is null.
public IRxS7 ActivePLC get; private set; } Gets the currently active PLC connection.
public IObservable<PlcFailoverEvent> FailoverEvents => ... Gets observable stream of failover events.
public async Task<bool> TriggerFailover() => ... Manually triggers a failover to the next available backup. A value indicating whether failover was successful.
public void Dispose() Disposes the high-availability manager.
S7PlcRx.Enterprise.PlcConnectionConfig

Source: Enterprise/PlcConnectionConfig.cs:14

Represents the configuration settings required to establish a connection to a programmable logic controller (PLC). Use this class to specify connection parameters such as PLC type, network address, rack, slot, and an optional connection name when initializing or managing PLC connections. This configuration is typically used by PLC communication libraries to open and maintain a session with the target device.

Member Summary
public CpuType PLCType get; set; } Gets or sets the PLC type.
public string IPAddress get; set; } = string.Empty; Gets or sets the IP address.
public short Rack get; set; } Gets or sets the rack number.
public short Slot get; set; } Gets or sets the slot number.
public string ConnectionName get; set; } = string.Empty; Gets or sets the connection name.
S7PlcRx.Enterprise.PlcFailoverEvent

Source: Enterprise/PlcFailoverEvent.cs:12

Represents an event that occurs when a failover between programmable logic controllers (PLCs) takes place. This class encapsulates information about a PLC failover event, including the time of occurrence, the reason for the failover, and the identifiers of the PLCs involved. Instances of this class are typically used for logging, monitoring, or auditing failover activities within PLC-based systems.

Member Summary
public DateTime Timestamp get; set; } Gets or sets the timestamp of the failover.
public string Reason get; set; } = string.Empty; Gets or sets the reason for failover.
public string OldPlc get; set; } = string.Empty; Gets or sets the old PLC identifier.
public string NewPlc get; set; } = string.Empty; Gets or sets the new PLC identifier.
S7PlcRx.Enterprise.SecurityContext

Source: Enterprise/SecurityContext.cs:14

Represents the security context for a session, including encryption settings, session timing, and certificate information. The SecurityContext class encapsulates all security-related parameters required to manage and validate a secure session. It provides properties for encryption keys, session validity, and certificate details, allowing consumers to configure and query the security state of a session. This class is sealed and cannot be inherited.

Member Summary
public string PLCKey get; set; } = string.Empty; Gets or sets the PLC key identifier.
public string EncryptionKey get; set; } = string.Empty; Gets or sets the encryption key.
public DateTime SessionStartTime get; set; } Gets or sets the session start time.
public TimeSpan SessionTimeout get; set; } Gets or sets the session timeout.
public bool IsEnabled get; set; } Gets or sets a value indicating whether security is enabled.
public bool IsSessionValid => ... Gets a value indicating whether the session is still valid.
public bool EnableEncryption get; internal set; } Gets a value indicating whether [enable encryption]. true if [enable encryption]; otherwise, false.
public string? CertificatePath get; internal set; } Gets the certificate path. The certificate path.
public string? CertificatePassword get; internal set; } Gets the certificate password. The certificate password.
S7PlcRx.Enterprise.Symbol

Source: Enterprise/Symbol.cs:13

Represents a programmable logic controller (PLC) symbol, including its name, address, data type, length, and description. Use the Symbol class to define and manage metadata for PLC variables, such as their symbolic name, address, and data type. This class is typically used in applications that interact with PLCs for automation or monitoring purposes.

Member Summary
public string Name get; set; } = string.Empty; Gets or sets the symbol name.
public string Address get; set; } = string.Empty; Gets or sets the PLC address.
public string DataType get; set; } = string.Empty; Gets or sets the data type.
public int Length get; set; } = 1; Gets or sets the length for array types.
public string Description get; set; } = string.Empty; Gets or sets the description.
S7PlcRx.Enterprise.SymbolTable

Source: Enterprise/SymbolTable.cs:9

Represents a read-only table of named symbols and the time at which it was loaded.

Member Summary
public Dictionary<string, Symbol> Symbols get; } = []; Gets the collection of symbols indexed by name.
public DateTime LoadedAt get; } = DateTime.UtcNow; Gets the timestamp when the symbol table was loaded.
S7PlcRx.Enterprise.SymbolTableFormat

Source: Enterprise/SymbolTableFormat.cs:9

Specifies the supported formats for serializing or deserializing a symbol table.

Enum values: Csv, Json, Xml.

Namespace S7PlcRx.Enums

S7PlcRx.Enums.CpuType

Source: Enums/CpuType.cs:13

Specifies the supported CPU types for Siemens programmable logic controllers (PLCs). Use this enumeration to indicate the model of CPU when configuring or communicating with Siemens PLC devices. The available values correspond to common Siemens PLC families, such as LOGO!, S7-200, S7-300, S7-400, S7-1200, and S7-1500. Selecting the correct CPU type ensures compatibility with device-specific protocols and features.

Enum values: Logo0BA8, S7200, S7300, S7400, S71200, S71500.

S7PlcRx.Enums.ErrorCode

Source: Enums/ErrorCode.cs:12

Specifies error codes that indicate the result of an operation or the type of error encountered. Use this enumeration to identify specific error conditions when handling operation results. The values represent distinct error types, such as connection failures, invalid data formats, or communication issues. The meaning of each code is defined by the context in which it is used.

Enum values: NoError, WrongCPUType, ConnectionError, IPAddressNotAvailable, WrongVarFormat, WrongNumberReceivedBytes, SendData, ReadData, WriteData.

S7PlcRx.Enums.S7StringType

Source: Enums/S7StringType.cs:12

Specifies the string encoding type used for S7 PLC string variables. Use this enumeration to indicate whether a string variable should be interpreted as an ASCII (S7String) or Unicode (S7WString) string when communicating with Siemens S7 PLCs. The encoding type determines how string data is read from or written to the PLC.

Enum values: S7String, S7WString.

Namespace S7PlcRx.Optimization

S7PlcRx.Optimization.OptimizationExtensions

Source: Optimization/OptimizationExtensions.cs:18

Provides extension methods for IRxS7 to enable optimized tag monitoring, intelligent value caching, and cache management for PLC data access. These extensions enhance performance and usability when interacting with PLC tags by offering adaptive polling, caching strategies, and cache statistics. All methods require a valid IRxS7 instance and are designed to be thread-safe. Use these methods to reduce unnecessary network traffic, improve responsiveness, and monitor tag changes efficiently.

Member Summary
public static IObservable<SmartTagChange<T>> MonitorTagSmart<T>( this IRxS7 plc, string tagName, double changeThreshold = 0.0, int debounceMs = 100) Observes changes to a specified PLC tag and emits significant value changes as a stream of smart change events. The returned observable emits a new event only when the tag value changes by at least the specified threshold and after the debounce interval has elapsed. This method uses a publish/subscribe mechanism to share the observable sequence among multiple subscribers. The type of the tag value to monitor. The PLC instance that provides access to the tag to be monitored. Cannot be null. The name of the tag to observe for changes. Cannot be null or empty. The minimum change required between consecutive tag values to consider the change significant. Use 0.0 to report all changes. The minimum interval, in milliseconds, between emitted change events. Used to debounce rapid changes. An observable sequence of smart tag change events containing details about each significant change detected in the tag value. Thrown if is null. Thrown if is null or empty.
public static async Task<T?> ValueCached<T>( this IRxS7 plc, string tagName, TimeSpan? cacheTimeout = null) Asynchronously retrieves the value of the specified PLC tag, using a cached value if available and not expired. If a cached value for the specified tag exists and has not expired, it is returned immediately. Otherwise, the method reads a fresh value from the PLC and updates the cache. This method is thread-safe. The type of the value to retrieve from the PLC tag. The PLC interface used to access the tag value. Cannot be null. The name of the PLC tag to read. Cannot be null or empty. The maximum duration for which a cached value is considered valid. If null, a default of one second is used. A task that represents the asynchronous operation. The task result contains the value of the specified tag, or the cached value if it is still valid. Returns null if the tag value cannot be retrieved. Thrown if is null. Thrown if is null or empty.
public static void ClearCache(this IRxS7 plc, string? tagName = null) Clears cached values for the specified PLC instance, optionally restricting the operation to a single tag. This method is thread-safe. Clearing the cache may affect subsequent read operations, which will retrieve fresh values from the PLC rather than cached results. The PLC instance whose cache entries will be cleared. Cannot be null. The name of the tag to clear from the cache. If null or empty, all cache entries for the specified PLC are cleared. Thrown if is null.
public static CacheStatistics GetCacheStatistics(this IRxS7 plc) Retrieves cache usage statistics for the specified PLC instance, including entry count, hit count, hit rate, and entry timestamps. This method provides insight into the cache performance and usage for a particular PLC. The statistics can be used to monitor cache effectiveness or diagnose caching issues. The method is thread-safe. The PLC instance for which to obtain cache statistics. Cannot be null. A CacheStatistics object containing aggregated cache metrics for the specified PLC. If no cache entries exist for the PLC, the statistics will reflect zero entries and hits. Thrown if is null.
S7PlcRx.Optimization.OptimizationRequestPriority

Source: Optimization/OptimizationRequestPriority.cs:11

Specifies the priority level for an optimization request. Use this enumeration to indicate the relative importance of an optimization request. Higher priority values may be processed before lower ones, depending on the scheduling or queuing logic of the system.

Enum values: Low, Normal, High, Critical.

S7PlcRx.Optimization.ReadOptimizationConfig

Source: Optimization/ReadOptimizationConfig.cs:13

Provides configuration options for optimizing read operations, including parallelism, delays, concurrency limits, and timeouts within data block groups. Use this class to fine-tune the performance characteristics of read operations in scenarios where data is organized into block groups. Adjusting these settings can help balance throughput, latency, and resource usage based on application requirements.

Member Summary
public bool EnableParallelReads get; set; } = true; Gets or sets a value indicating whether gets or sets whether to enable parallel reads within data block groups.
public int InterGroupDelayMs get; set; } Gets or sets the delay between data block groups in milliseconds.
public int MaxConcurrentReads get; set; } = 10; Gets or sets the maximum number of concurrent reads.
public int ReadTimeoutMs get; set; } = 5000; Gets or sets the read timeout in milliseconds.
S7PlcRx.Optimization.SmartTagChange<T>

Source: Optimization/SmartTagChange.cs:16

Represents a change to a smart tag, including its name, previous and current values, the time of change, the amount of change for numeric types, and associated metadata. Use this class to track changes to smart tags in applications that require auditing, history, or notification of tag value updates. The property is intended for numeric types; for non-numeric types, its value may be ignored. The dictionary can be used to store additional context or information relevant to the change. The type of the value associated with the smart tag. This can be any type representing the tag's value before and after the change.

Member Summary
public string TagName get; set; } = string.Empty; Gets or sets the tag name.
public T? PreviousValue get; set; } Gets or sets the previous value.
public T? CurrentValue get; set; } Gets or sets the current value.
public DateTimeOffset ChangeTime get; set; } Gets or sets the change timestamp.
public double ChangeAmount get; set; } Gets or sets the amount of change for numeric types.
public Dictionary<string, object> Metadata get; set; } = new(); Gets or sets additional metadata about the change.
S7PlcRx.Optimization.WriteOptimizationConfig

Source: Optimization/WriteOptimizationConfig.cs:13

Provides configuration options for optimizing write operations, including parallelism, verification, timing, and concurrency settings. Use this class to customize the behavior of write operations, such as enabling parallel writes, specifying verification requirements, and controlling delays and timeouts. Adjusting these settings can help balance performance and reliability based on application needs.

Member Summary
public bool EnableParallelWrites get; set; } Gets or sets a value indicating whether gets or sets whether to enable parallel writes within data block groups.
public bool VerifyWrites get; set; } Gets or sets a value indicating whether gets or sets whether to verify writes by reading back.
public int InterGroupDelayMs get; set; } = 50; Gets or sets the delay between data block groups in milliseconds.
public int MaxConcurrentWrites get; set; } = 5; Gets or sets the maximum number of concurrent writes.
public int WriteTimeoutMs get; set; } = 5000; Gets or sets the write timeout in milliseconds.
S7PlcRx.Optimization.WriteOptimizationResult

Source: Optimization/WriteOptimizationResult.cs:14

Represents the result of a write optimization operation, including timing information, per-write outcomes, and overall error details. Use this class to access detailed results of a write optimization process, such as the start and end times, lists of successful and failed writes, and aggregate metrics like total duration and success rate. The dictionaries provide per-write information, with keys typically representing write identifiers. This type is immutable except for properties explicitly marked as settable.

Member Summary
public DateTime StartTime get; set; } Gets or sets the operation start time.
public DateTime EndTime get; set; } Gets or sets the operation end time.
public Dictionary<string, TimeSpan> SuccessfulWrites get; } = []; Gets successful writes with their durations.
public Dictionary<string, string> FailedWrites get; } = []; Gets failed writes with error messages.
public string? OverallError get; set; } Gets or sets any overall error message.
public TimeSpan TotalDuration => ... Gets the total operation duration.
public double SuccessRate => ... Gets the success rate.

Namespace S7PlcRx.Performance

S7PlcRx.Performance.BenchmarkConfig

Source: Performance/BenchmarkConfig.cs:12

Represents the configuration settings for benchmark tests, including parameters for latency, throughput, and reliability measurements. Use this class to specify the number and duration of various benchmark tests when running performance evaluations. All properties are configurable to tailor the benchmarking process to specific requirements.

Member Summary
public int LatencyTestCount get; set; } = 10; Gets or sets the number of latency tests to perform.
public TimeSpan ThroughputTestDuration get; set; } = TimeSpan.FromSeconds(10); Gets or sets the duration for throughput testing.
public int ReliabilityTestCount get; set; } = 20; Gets or sets the number of reliability tests to perform.
S7PlcRx.Performance.BenchmarkResult

Source: Performance/BenchmarkResult.cs:15

Represents the results of a performance benchmark, including timing, latency, throughput, reliability, and any errors encountered during execution. Use this class to access detailed metrics and diagnostic information from a completed benchmark run. The properties provide summary statistics such as average, minimum, and maximum latency, as well as overall reliability and score. Errors encountered during benchmarking are available in the collection for troubleshooting. This type is immutable except for its settable properties; thread safety is not guaranteed if modified concurrently.

Member Summary
public DateTime StartTime get; set; } Gets or sets the benchmark start time.
public DateTime EndTime get; set; } Gets or sets the benchmark end time.
public string PLCIdentifier get; set; } = string.Empty; Gets or sets the PLC identifier.
public double AverageLatencyMs get; set; } Gets or sets the average latency in milliseconds.
public double MinLatencyMs get; set; } Gets or sets the minimum latency in milliseconds.
public double MaxLatencyMs get; set; } Gets or sets the maximum latency in milliseconds.
public double OperationsPerSecond get; set; } Gets or sets the operations per second.
public double ReliabilityRate get; set; } Gets or sets the reliability rate (0.0 to 1.0).
public double OverallScore get; set; } Gets or sets the overall benchmark score (0 to 100).
public List<string> Errors get; } = []; Gets any errors encountered during benchmarking.
public TimeSpan TotalDuration => ... Gets the total benchmark duration.
S7PlcRx.Performance.HighPerformanceTagGroup<T>

Source: Performance/HighPerformanceTagGroup.cs:18

Provides high-performance batch operations for reading, writing, and observing a group of PLC tags as a single unit. This class is designed to optimize communication with a PLC by grouping related tags and minimizing individual polling. It supports efficient batch reads and writes, and exposes an observable stream for monitoring group state changes. Instances of this class are not thread-safe; external synchronization may be required if accessed concurrently. The type of value associated with each PLC tag in the group.

Member Summary
public HighPerformanceTagGroup(IRxS7 plc, string groupName, string[] tagNames) Initializes a new instance of the class, associating a set of tag names with a specified. PLC for optimized group operations. Tag names starting with "DB" that are not already present in the PLC's tag list will be added with individual polling disabled to improve performance when accessing the group. The PLC connection used to manage and access the specified tags. The name assigned to this tag group. Cannot be null or whitespace. An array of tag names to include in the group. Cannot be null or empty. Thrown if is null. Thrown if is null, whitespace, or if is null or empty.
public string GroupName get; } Gets the name of the group associated with this instance.
public IReadOnlyDictionary<string, T?> CurrentValues => ... Gets a read-only dictionary containing the current values associated with each key.
public IObservable<Dictionary<string, T?>> ObserveGroup() Observes changes to the group of tags and provides a stream of their current values. Individual polling is enabled for each tag in the group to ensure timely updates. The returned observable emits only when the values of the tags change, and subscribers receive the most recent state of all tags in the group. The sequence is shared among all subscribers and remains active as long as there is at least one subscription. An observable sequence that emits a dictionary containing the latest values for each tag in the group. Each dictionary maps tag names to their corresponding values of type T. The sequence emits a new dictionary whenever any tag value changes.
public async Task<Dictionary<string, T?>> ReadAll() => ... Asynchronously reads the values of all configured PLC tags and returns a dictionary mapping tag names to their corresponding values. The returned dictionary includes an entry for each tag in the configured set, regardless of whether the value was successfully read. This method is thread-safe and can be awaited. The order of entries in the dictionary is not guaranteed. A dictionary containing the tag names as keys and their associated values of type as values. If a tag value cannot be read, its value will be .
public async Task WriteAll(Dictionary<string, T> values) Writes all specified values to the PLC in a single batch operation. Entries in the dictionary with tag names not recognized by the PLC are ignored. This method performs the write operation asynchronously and does not block the calling thread. A dictionary containing tag names as keys and their corresponding values to be written. Only entries with tag names recognized by the PLC will be processed. A task that represents the asynchronous write operation.
public void Dispose() Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
S7PlcRx.Performance.PerformanceAnalysis

Source: Performance/PerformanceAnalysis.cs:13

Represents the results and metrics of a performance analysis, including time intervals, tag change statistics, and optimization recommendations. Use this class to encapsulate data collected during a performance monitoring session, such as the frequency of tag changes and suggested improvements. The properties provide access to both raw metrics and calculated values, enabling further reporting or decision-making based on the analysis.

Member Summary
public DateTime StartTime get; set; } Gets or sets the start time of the analysis.
public DateTime EndTime get; set; } Gets or sets the end time of the analysis.
public TimeSpan MonitoringDuration get; set; } Gets or sets the monitoring duration.
public Dictionary<string, int> TagChangeFrequencies get; set; } = []; Gets or sets the tag change frequencies.
public int TotalTagChanges get; set; } Gets or sets the total tag changes observed.
public double AverageChangesPerTag get; set; } Gets or sets the average changes per tag.
public List<string> Recommendations get; set; } = []; Gets or sets the optimization recommendations.
S7PlcRx.Performance.PerformanceExtensions

Source: Performance/PerformanceExtensions.cs:19

Provides extension methods for IRxS7 PLC instances to enable advanced performance monitoring, optimized read and write operations, and benchmarking capabilities. The methods in this class facilitate efficient interaction with PLCs by offering features such as real-time performance metrics, automatic grouping and batching of read/write operations, and comprehensive benchmarking. These extensions are designed to improve throughput, reliability, and observability when working with industrial automation systems. All methods require a valid IRxS7 instance and may throw exceptions if invalid arguments are supplied. Thread safety is ensured for performance data collection and metrics aggregation.

Member Summary
public static IObservable<PerformanceMetrics> MonitorPerformance( this IRxS7 plc, TimeSpan? monitoringInterval = null) Monitors the performance of the specified PLC and provides periodic updates as an observable sequence of performance metrics. The returned observable begins emitting metrics immediately and continues at the specified interval. Metrics include connection status, tag counts, operation rates, and error rates. The observable is hot and shared among subscribers; unsubscribing from all observers will stop monitoring until a new subscription is made. The PLC instance to monitor. Cannot be null. The interval at which performance metrics are sampled. If null, defaults to 30 seconds. An observable sequence of objects containing performance data for the PLC, emitted at each monitoring interval. Thrown if is null.
public static async Task<Dictionary<string, T?>> ReadOptimized<T>( this IRxS7 plc, IEnumerable<string> tagNames, Optimization.ReadOptimizationConfig? optimizationConfig = null) Reads the specified tags from the PLC using optimized grouping and optional parallelization, returning a dictionary of tag names and their corresponding values. Tags are grouped by data block for efficient reading. When parallel reads are enabled in the optimization configuration, tag groups are read concurrently to improve performance. The method records performance metrics and errors for diagnostic purposes. If an error occurs while reading a tag, the operation is aborted and an exception is thrown. The type of the value to read for each tag. The PLC instance from which to read tag values. Cannot be null. A collection of tag names to read from the PLC. Cannot be null. If empty, an empty dictionary is returned. An optional configuration that controls read optimization behavior, such as enabling parallel reads and setting inter-group delays. If null, default optimization settings are used. A dictionary mapping each requested tag name to its read value. If a tag cannot be read, an exception is thrown and the dictionary may be incomplete. Thrown if or is null. Thrown if reading a tag fails due to a PLC communication error or invalid tag name.
public static async Task<Optimization.WriteOptimizationResult> WriteOptimized<T>( this IRxS7 plc, Dictionary<string, T> values, Optimization.WriteOptimizationConfig? optimizationConfig = null) Writes multiple values to the PLC in an optimized manner, grouping operations and optionally verifying writes for accuracy. Writes are grouped by data block for performance optimization. If parallel writes are enabled in the configuration, write operations within each group are performed concurrently. When write verification is enabled, each value is read back after writing to ensure accuracy. Delays between groups can be configured to control write pacing. The method is thread-safe and intended for batch write scenarios to improve throughput and reliability. The type of the values to be written to the PLC. The PLC interface to which the values will be written. Cannot be null. A dictionary containing tag names and their corresponding values to write. Cannot be null. An optional configuration object that controls optimization behavior, such as enabling parallel writes, write verification, and inter-group delays. If null, default optimization settings are used. A task that represents the asynchronous operation. The result contains details about successful and failed writes, timing information, and any overall errors encountered during the operation. Thrown if or is null. Thrown if write verification is enabled and a written value does not match the value read back from the PLC.
public static async Task<BenchmarkResult> RunBenchmark( this IRxS7 plc, BenchmarkConfig? benchmarkConfig = null) Runs a set of benchmark tests on the specified PLC, measuring latency, throughput, and reliability. The returned includes timing information, test scores, and any errors encountered during benchmarking. The method performs multiple tests and aggregates results to provide an overall score. This method does not throw on benchmark failures; errors are recorded in the result. The PLC instance to benchmark. Cannot be null. An optional configuration object specifying benchmark parameters. If null, default settings are used. A task that represents the asynchronous operation. The result contains detailed benchmark metrics and scores for the PLC. Thrown if is null.
public static PerformanceStatistics GetPerformanceStatistics(this IRxS7 plc) Retrieves aggregated performance statistics for the specified PLC connection, including operation counts, error rates, response times, and connection metrics. The returned statistics reflect metrics collected since the application started or since the PLC connection was first established. This method is thread-safe and can be called concurrently from multiple threads. The PLC connection for which to obtain performance statistics. Cannot be null. A PerformanceStatistics object containing metrics such as total operations, error rate, average response time, connection uptime, and reconnection count for the specified PLC. Thrown if is null.
S7PlcRx.Performance.PerformanceMetrics

Source: Performance/PerformanceMetrics.cs:13

Represents a set of performance metrics for a programmable logic controller (PLC) at a specific point in time. This class provides properties for tracking key operational statistics of a PLC, including connection status, tag activity, performance rates, and error metrics. It is typically used to monitor and analyze PLC performance in industrial automation scenarios. All properties are read-write, allowing metrics to be set or updated as needed.

Member Summary
public string PLCIdentifier get; set; } = string.Empty; Gets or sets the PLC identifier.
public DateTime Timestamp get; set; } Gets or sets the timestamp of these metrics.
public bool IsConnected get; set; } Gets or sets a value indicating whether gets or sets whether the PLC is connected.
public int TagCount get; set; } Gets or sets the total number of tags.
public int ActiveTagCount get; set; } Gets or sets the number of active tags.
public double OperationsPerSecond get; set; } Gets or sets the operations per second.
public double AverageResponseTime get; set; } Gets or sets the average response time in milliseconds.
public double ErrorRate get; set; } Gets or sets the error rate (0.0 to 1.0).
public TimeSpan ConnectionUptime get; set; } Gets or sets the connection uptime.
public int ReconnectionCount get; set; } Gets or sets the number of reconnections.
S7PlcRx.Performance.PerformanceStatistics

Source: Performance/PerformanceStatistics.cs:14

Represents a set of performance statistics for a programmable logic controller (PLC) connection, including operation counts, error metrics, response times, and connection status information. Use this class to track and analyze the operational performance and reliability of a PLC connection over time. The statistics provided can assist in monitoring system health, diagnosing issues, and optimizing performance. All properties are read-write, allowing for aggregation and updating of statistics as needed. This class is not thread-safe; synchronize access if used concurrently.

Member Summary
public string PLCIdentifier get; set; } = string.Empty; Gets or sets the PLC identifier.
public long TotalOperations get; set; } Gets or sets the total number of operations.
public long TotalErrors get; set; } Gets or sets the total number of errors.
public double AverageResponseTime get; set; } Gets or sets the average response time in milliseconds.
public double OperationsPerSecond get; set; } Gets or sets the operations per second.
public double ErrorRate get; set; } Gets or sets the error rate (0.0 to 1.0).
public TimeSpan ConnectionUptime get; set; } Gets or sets the connection uptime.
public int ReconnectionCount get; set; } Gets or sets the number of reconnections.
public DateTime LastUpdated get; set; } Gets or sets when these statistics were last updated.
S7PlcRx.Performance.TagPerformanceMetrics

Source: Performance/TagPerformanceMetrics.cs:12

Represents performance metrics for a specific tag, including operation counts, timing statistics, and success rates. Use this class to track and analyze the performance of tag-related operations, such as reads and writes, over time. The metrics provided can help identify bottlenecks, monitor reliability, and optimize system performance. All properties are intended to be updated as new operation data becomes available.

Member Summary
public string TagName get; set; } = string.Empty; Gets or sets the tag name.
public long ReadOperations get; set; } Gets or sets the total number of read operations.
public long WriteOperations get; set; } Gets or sets the total number of write operations.
public double AverageReadTimeMs get; set; } Gets or sets the average read time in milliseconds.
public double AverageWriteTimeMs get; set; } Gets or sets the average write time in milliseconds.
public long FailedOperations get; set; } Gets or sets the number of failed operations.
public double SuccessRate get; set; } Gets or sets the success rate (0.0 to 1.0).
public DateTime LastOperationTime get; set; } Gets or sets the last operation timestamp.

Namespace S7PlcRx.PlcTypes

S7PlcRx.PlcTypes.Bit

Source: PlcTypes/Bit.cs:11

Contains the conversion methods to convert Bit from S7 plc to C#.

Member Summary
public static bool FromByte(byte v, byte bitAdr) => ... Determines whether the specified bit in a byte value is set. If bitAdr is outside the range 0 to 7, the result may not be meaningful. This method does not validate the bit position. The byte value to examine. The zero-based position of the bit to check. Must be in the range 0 to 7. true if the bit at the specified position is set; otherwise, false.
public static bool FromSpan(ReadOnlySpan<byte> bytes, int byteIndex, int bitIndex) Determines whether the specified bit is set in a byte within a read-only span of bytes. A read-only span of bytes from which the target byte is selected. The zero-based index of the byte within to examine. Must be less than the length of . The zero-based index of the bit within the selected byte to check. Must be in the range 0 to 7. true if the specified bit is set; otherwise, false. Thrown if is greater than or equal to the length of , or if is less than 0 or greater than 7.
public static BitArray ToBitArray(byte[] bytes) => ... Converts the specified byte array to a BitArray, where each bit in the array represents a bit in the input bytes. The byte array to convert. Each byte is interpreted in order, with the least significant bit first in each byte. A BitArray containing the bits from the input byte array. If the input array is null or empty, returns an empty BitArray.
public static BitArray ToBitArray(ReadOnlySpan<byte> bytes) => ... Creates a new BitArray representing the bits contained in the specified read-only span of bytes. A read-only span of bytes whose bits will be copied into the resulting BitArray. Each byte is interpreted in little-endian order, with the least significant bit first. A BitArray containing the bits from the input span. The length of the BitArray will be equal to the total number of bits in the input.
public static BitArray ToBitArray(byte[] bytes, int? length) => ... Converts the specified byte array to a BitArray, optionally limiting the number of bits included. The array of bytes to convert to a BitArray. Cannot be null. The optional number of bits to include in the BitArray. If specified, only the first length bits are included; otherwise, all bits from the byte array are used. Must be non-negative and not greater than the total number of bits in the array. A BitArray containing the bits from the specified byte array, limited to the specified length if provided.
public static BitArray ToBitArray(ReadOnlySpan<byte> bytes, int? length) Converts a span of bytes to a BitArray containing the specified number of bits. The returned BitArray contains bits in the same order as they appear in the input bytes, starting from the least significant bit of the first byte. This method is compatible with .NET Standard 2.0 by converting the span to an array before constructing the BitArray. The span of bytes to convert to a BitArray. The span must not be empty and must contain enough data to represent the requested number of bits. The number of bits to include in the resulting BitArray. Must not be null and must not exceed the total number of bits available in the input bytes. A BitArray containing the first length bits from the input bytes. Thrown if length is null. Thrown if bytes is empty or if length is greater than the total number of bits available in bytes.
public static void SetBit(Span<byte> bytes, int byteIndex, int bitIndex, bool value) Sets the value of a specific bit within a byte in the provided span. A span of bytes in which the bit will be set or cleared. The zero-based index of the byte within whose bit will be modified. Must be less than the length of . The zero-based index of the bit to modify within the specified byte. Must be in the range 0 to 7. The value to assign to the specified bit. If , the bit is set; if , the bit is cleared. Thrown when is greater than or equal to the length of , or when is less than 0 or greater than 7.
public static bool[] GetBits(ReadOnlySpan<byte> bytes, ReadOnlySpan<(int byteIndex, int bitIndex)> bitPositions) Extracts the values of specified bits from a sequence of bytes. If a specified bit position refers to an index outside the bounds of the input span, an exception may be thrown. The span of bytes from which bits will be read. A span of tuples specifying the positions of bits to extract. Each tuple contains the zero-based index of the byte and the zero-based index of the bit within that byte. An array of Boolean values indicating the state of each requested bit. Each element is if the corresponding bit is set; otherwise, .
public static void SetBits(Span<byte> bytes, ReadOnlySpan<(int byteIndex, int bitIndex, bool value)> bitUpdates) Sets the specified bits in the provided byte span according to the given updates. Each tuple in must reference a valid byte and bit index within . Modifying bits outside the bounds of may result in undefined behavior. The span of bytes in which bits will be set or cleared. Each update modifies a bit within this span. A read-only span of tuples specifying the byte index, bit index, and value to set for each bit. Each tuple indicates which bit to update and whether to set it to or .
S7PlcRx.PlcTypes.Boolean

Source: PlcTypes/Boolean.cs:13

Provides static methods for manipulating individual bits within a byte value. This class includes utility methods for reading, setting, and clearing specific bits in a byte. All bit indices are zero-based, ranging from 0 (least significant bit) to 7 (most significant bit). These methods are useful for low-level operations such as flag management, bitmasking, or protocol handling where direct bit manipulation is required.

Member Summary
public static bool GetValue(byte value, int bit) => ... Determines whether the specified bit is set in the given byte value. The byte value to examine for the specified bit. The zero-based position of the bit to check. Must be in the range 0 to 7. true if the bit at the specified position is set; otherwise, false.
public static byte SetBit(byte value, int bit) Sets the value of a bit to 1 (true), given the address of the bit. Returns a copy of the value with the bit set. The input value to modify. The index (zero based) of the bit to set. The modified value with the bit at index set.
public static void SetBit(ref byte value, int bit) => ... Sets the value of a bit to 1 (true), given the address of the bit. The value to modify. The index (zero based) of the bit to set.
public static byte ClearBit(byte value, int bit) Resets the value of a bit to 0 (false), given the address of the bit. Returns a copy of the value with the bit cleared. The input value to modify. The index (zero based) of the bit to clear. The modified value with the bit at index cleared.
public static void ClearBit(ref byte value, int bit) => ... Resets the value of a bit to 0 (false), given the address of the bit. The input value to modify. The index (zero based) of the bit to clear.
S7PlcRx.PlcTypes.Byte

Source: PlcTypes/Byte.cs:13

Provides utility methods for converting and manipulating byte values and byte arrays. This static class includes methods for converting between single byte values and arrays or spans, as well as writing byte data to spans. All members are static and designed for efficient, low-level byte operations. Methods in this class do not perform validation beyond basic length checks and do not handle multi-byte conversions or encoding.

Member Summary
public static byte[] ToByteArray(byte value) => ... Converts the specified byte value to a single-element byte array. The byte value to include in the returned array. A byte array containing the specified value as its only element.
public static void ToSpan(byte value, Span<byte> destination) Writes the specified byte value into the first position of the provided destination span. The byte value to write to the destination span. The span of bytes that will receive the value. Must have a length of at least 1. Thrown when has a length less than 1.
public static byte FromByteArray(byte[] bytes) => ... Creates a byte value from the specified byte array. If the array contains more than one element, only the first element is used. If the array is empty, an exception may be thrown. The array of bytes to convert. Must contain at least one element. A byte value created from the first element of the specified array.
public static byte FromSpan(ReadOnlySpan<byte> bytes) Returns the first byte from the specified read-only span. A read-only span of bytes from which to retrieve the first byte. Must contain at least one byte. The first byte in the span. Thrown when does not contain at least one byte.
public static void ToSpan(ReadOnlySpan<byte> values, Span<byte> destination) Copies the contents of the specified read-only byte span to the destination span. The read-only span containing the bytes to copy. The span that receives the copied bytes. Must be at least as large as . Thrown when is smaller than .
S7PlcRx.PlcTypes.ByteArray

Source: PlcTypes/ByteArray.cs:14

Provides a dynamically sized buffer for accumulating bytes, with efficient memory management using array pooling. The buffer automatically grows as data is added. The internal array is rented from the shared array pool and returned when disposed. This class is not thread-safe. The initial capacity of the internal buffer, in bytes. Must be greater than zero.

Member Summary
public ByteArray() : this(32) Initializes a new instance of the class with a default capacity of 32 bytes. This constructor is useful when the required initial capacity is not known in advance. The internal buffer will automatically expand as needed when additional bytes are added.
public ReadOnlySpan<byte> Span => ... Gets the current data as a span. The current data as a span.
public ReadOnlyMemory<byte> Memory => ... Gets the current data as memory. The current data as memory.
public byte[] Array => ... Gets the array. Use Span property for better performance when possible. The array.
public int Length => ... Gets the current position (length of data).
public void Add(byte item) Adds a byte value to the end of the buffer. The byte value to add to the buffer.
public void Add(ReadOnlySpan<byte> items) Adds the specified sequence of bytes to the buffer. The buffer is automatically resized if necessary to accommodate the new items. The method does not throw an exception if the span is empty; in that case, the buffer remains unchanged. A read-only span containing the bytes to add. If empty, no action is taken.
public void Add(byte[] items) => ... Adds the specified array of bytes to the collection. An array of bytes to add. Cannot be null.
public void Add(ByteArray byteArray) Adds the contents of the specified to the collection. The instance whose contents will be added. Cannot be null.
public void Clear() => ... Resets the current position to the beginning, effectively clearing any progress or state tracked by the instance.
public bool TryCopyTo(Span<byte> destination) Attempts to copy the written bytes to the specified destination buffer. No data is copied if the destination buffer is too small. The method does not modify the destination buffer if it returns false. The buffer to which the written bytes will be copied. Must have a length greater than or equal to the number of bytes written. true if the copy operation succeeds; otherwise, false.
public void Dispose() Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
S7PlcRx.PlcTypes.Class

Source: PlcTypes/Class.cs:19

Provides static methods for serializing and deserializing class and struct instances to and from byte arrays, as well as calculating the size of a class in bytes for serialization purposes. This class is intended for scenarios where objects need to be converted to a byte representation, such as communication with PLCs or other systems requiring structured binary formats. All methods operate statically and require the caller to supply instances and byte arrays as needed. Properties within serialized classes must be accessible and, for string fields, decorated with the appropriate S7StringAttribute. Methods may throw exceptions if required attributes are missing or if input values are invalid. Thread safety is not guaranteed; callers should ensure appropriate synchronization if accessing shared objects.

Member Summary
public static double GetClassSize(object instance, double numBytes = 0.0, bool isInnerProperty = false) Calculates the total size, in bytes, of the specified object's accessible properties, including arrays and nested properties as applicable. This method inspects the public properties of the object's type to determine the total size. Array properties must have a non-null value and a length greater than zero. The calculation accounts for S7-Struct alignment by rounding up to the next even byte count unless calculating for an inner property. The object instance whose class size is to be calculated. Cannot be null. The initial byte count to start the calculation from. Typically set to 0.0 for a new calculation. Indicates whether the calculation is for an inner property. If , the result is rounded up to the next even byte count to match S7-Struct alignment requirements. The total size, in bytes, of the object's accessible properties. The value is rounded up to the next even number if is . Thrown if is null. Thrown if an array property on has a null value. Thrown if an array property on has a length less than or equal to zero.
public static double FromBytes(object sourceClass, byte[] bytes, double numBytes = 0, bool isInnerClass = false) Populates the properties of the specified object instance from the provided byte array, deserializing each property value according to its type. Properties that are arrays are deserialized element by element. The method updates numBytes to reflect the number of bytes read. If bytes is shorter than required for all properties, only the available bytes are used. The object instance whose properties will be set from the byte array. Must not be null. The byte array containing serialized property values to be assigned to the object. If null, no properties are set and the method returns the value of numBytes. The starting offset, in bytes, within the byte array from which to begin deserialization. This value is incremented as properties are read. Indicates whether the object instance represents an inner class. This may affect how properties are deserialized. The total number of bytes consumed from the byte array during deserialization. Thrown if sourceClass is null. Thrown if a property on sourceClass that is expected to be an array is not initialized.
public static double ToBytes(object sourceClass, byte[] bytes, double numBytes = 0.0) Serializes the accessible properties of the specified source object into the provided byte array, starting at the given offset. If a property of the source object is an array, its elements are serialized sequentially into the byte array. Serialization stops if the end of the byte array is reached before all properties are written. The object whose properties will be serialized into the byte array. Cannot be null. All accessible properties must have non-null values. The byte array that receives the serialized property values. Cannot be null. The starting offset, in bytes, within the array at which serialization begins. If not specified, serialization starts at the beginning of the array. The total number of bytes written to the array after serialization is complete. Thrown if or is null. Thrown if any accessible property of is null.
S7PlcRx.PlcTypes.Counter

Source: PlcTypes/Counter.cs:15

Provides static methods for converting between S7 Counter byte representations and values. The class supports parsing and serializing S7 Counter values, which are commonly used in Siemens S7 PLC communication protocols. All methods use big-endian byte order, with the high byte first, to match the S7 Counter format. This class is thread-safe as it contains only static methods and does not maintain any internal state.

Member Summary
public static ushort FromByteArray(byte[] bytes) => ... Converts a byte array to a 16-bit unsigned integer. The byte array containing the bytes to convert. Must contain at least two bytes representing the value in the expected byte order. A 16-bit unsigned integer represented by the first two bytes of the array.
public static ushort FromSpan(ReadOnlySpan<byte> bytes) Converts the first two bytes of the specified read-only span to a 16-bit unsigned integer, interpreting the bytes in little-endian order. A read-only span of bytes containing at least two elements. The first two bytes are used to construct the 16-bit unsigned integer. A 16-bit unsigned integer formed from the first two bytes of the span, with the first byte as the least significant and the second as the most significant. Thrown when contains fewer than two bytes.
public static ushort FromByteArray(byte[] bytes, int start) => ... Converts a sequence of bytes from the specified array, starting at the given index, to a 16-bit unsigned integer. The byte array containing the data to convert. Cannot be null. The zero-based index in the array at which to begin reading bytes. Must be within the bounds of the array. A 16-bit unsigned integer represented by the bytes at the specified position in the array.
public static ushort FromBytes(byte loVal, byte hiVal) => ... Creates a 16-bit unsigned integer from two bytes, using the specified low and high byte values. The returned value is constructed by placing in the high-order position and in the low-order position. This is commonly used when converting from little-endian byte representations. The low-order byte of the resulting 16-bit unsigned integer. The high-order byte of the resulting 16-bit unsigned integer. A 16-bit unsigned integer composed from the specified low and high bytes.
public static ushort[] ToArray(byte[] bytes) => ... Converts a byte array to an array of 16-bit unsigned integers. Each pair of bytes in the input array is interpreted as a single 16-bit unsigned integer. The conversion uses the default byte order of the platform. The byte array to convert. The length must be a multiple of 2. An array of values representing the converted data from the input byte array.
public static ushort[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of 16-bit unsigned integers. Each pair of bytes in is interpreted as a single 16-bit unsigned integer. If the length of is not a multiple of 2, any remaining bytes are ignored. A read-only span of bytes containing the data to convert. The length must be a multiple of 2. An array of values parsed from the specified byte span. The array length is half the length of .
public static byte[] ToByteArray(ushort value) Converts the specified 16-bit unsigned integer to a byte array in little-endian order. The 16-bit unsigned integer to convert to a byte array. A two-element byte array containing the little-endian representation of the specified value.
public static void ToSpan(ushort value, Span<byte> destination) Writes the specified 16-bit unsigned integer value to the provided span in big-endian byte order. This method encodes the value in big-endian format, with the most significant byte first. This is consistent with the representation used by S7 types. The 16-bit unsigned integer to write to the destination span. The span of bytes that receives the big-endian representation of the value. Must have a length of at least 2 bytes. Thrown when is less than 2 bytes in length.
public static void ToSpan(ReadOnlySpan<ushort> values, Span<byte> destination) Copies the contents of a span of 16-bit unsigned integers into a span of bytes, encoding each value as two bytes in little-endian order. Each value in is encoded as two bytes in little-endian format and written sequentially to . The method does not allocate additional memory. The read-only span of 16-bit unsigned integers to copy from. The span of bytes to copy the encoded values into. Must be at least twice the length of . Thrown when is not large enough to hold the encoded bytes.
public static byte[] ToByteArray(ushort[] value) Converts an array of 16-bit unsigned integers to a byte array. An array of values to convert. Cannot be . A byte array representing the binary data of the input array. Thrown if is .
S7PlcRx.PlcTypes.DInt

Source: PlcTypes/DInt.cs:17

Provides static methods for converting between Siemens S7 DInt (32-bit signed integer) representations and .NET int values. This class supports conversion between S7 DInt values, which use big-endian byte order, and .NET int values. Methods are provided for reading and writing single or multiple DInt values from and to byte arrays and spans. All methods assume S7 DInt format and handle endianness as required. This class is intended for internal use when working with S7 PLC data structures.

Member Summary
public static int CDWord(long value) Converts a 64-bit signed integer to a 32-bit signed integer, applying a custom transformation for values greater than . If is greater than , the method applies a specific transformation before casting to . This is not a standard cast and may produce negative results for large input values. The 64-bit signed integer value to convert. A 32-bit signed integer representing the converted value. For values greater than , a custom transformation is applied before conversion.
public static int FromByteArray(byte[] bytes) => ... Creates an integer value from the specified byte array. The byte array containing the bytes to convert to an integer. The array must contain at least the number of bytes required to represent an integer. An integer value represented by the specified byte array.
public static int FromByteArray(byte[] bytes, int start) => ... Creates an integer value from a byte array starting at the specified index. The byte array containing the data to convert. The zero-based index in the array at which to begin reading bytes. The integer value represented by the bytes starting at the specified index.
public static int FromSpan(ReadOnlySpan<byte> bytes) Creates a 32-bit signed integer from the first four bytes of the specified read-only byte span, interpreting the bytes as big-endian. This method interprets the byte order as big-endian, regardless of the system's endianness. Additional bytes in the span beyond the first four are ignored. A read-only span of bytes containing at least four bytes to convert to a 32-bit signed integer. The first four bytes are used for the conversion. A 32-bit signed integer represented by the first four bytes of the span, interpreted as big-endian. Thrown when the length of is less than 4.
public static int FromBytes(byte v1, byte v2, byte v3, byte v4) => ... Creates a 32-bit signed integer from four bytes, using little-endian byte order. The bytes are combined such that v1 is the least significant byte and v4 is the most significant byte. This method is useful for reconstructing an integer from a byte array, such as when reading binary data from a stream. The least significant byte of the resulting integer. The second byte of the resulting integer. The third byte of the resulting integer. The most significant byte of the resulting integer. A 32-bit signed integer composed from the specified bytes in little-endian order.
public static int[] ToArray(byte[] bytes) => ... Converts a byte array to an array of 32-bit integers. The byte array to convert. The length must be a multiple of 4. An array of 32-bit integers representing the converted values from the input byte array.
public static int[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of 32-bit integers. Each group of four consecutive bytes in the input span is interpreted as a single 32-bit integer. The conversion uses the byte order expected by the FromSpan method. If the length of the span is not a multiple of 4, any remaining bytes are ignored. The input span containing the bytes to convert. The length must be a multiple of 4. An array of 32-bit integers parsed from the input byte span.
public static byte[] ToByteArray(int value) Converts the specified 32-bit signed integer to a byte array in little-endian order. The returned array represents the integer in little-endian format, with the least significant byte at index 0. This method is useful for serialization or interoperability with systems that require byte-level representations of integers. The 32-bit signed integer to convert to a byte array. A 4-element byte array containing the little-endian representation of the specified integer.
public static void ToSpan(int value, Span<byte> destination) Writes the specified 32-bit integer value to the provided span in big-endian byte order. This method writes the integer in big-endian format, regardless of the system's native endianness. The first four bytes of the destination span will be overwritten. The 32-bit integer value to write to the span. The span of bytes that will receive the big-endian representation of the value. Must be at least 4 bytes in length. Thrown if destination is less than 4 bytes in length.
public static void ToSpan(ReadOnlySpan<int> values, Span<byte> destination) Writes the binary representation of each 32-bit integer in the specified read-only span to the provided destination span of bytes. A read-only span of 32-bit integers to convert to their binary representation. A span of bytes that receives the binary data. Must be at least four times the length of . Thrown if is not large enough to contain the binary representations of all values.
public static byte[] ToByteArray(int[] value) Converts an array of 32-bit integers to its equivalent byte array representation. An array of 32-bit integers to convert. Cannot be null. A byte array containing the binary representation of the input integer array. The length of the returned array is four times the length of the input array.
S7PlcRx.PlcTypes.DWord

Source: PlcTypes/DWord.cs:16

Provides utility methods for converting between S7 DWord (4-byte) representations and unsigned 32-bit integers (uint). All conversions assume S7 DWord format, which uses big-endian byte order. These methods are intended for working with Siemens S7 PLC data or other protocols that represent 32-bit unsigned integers in big-endian format. Methods throw exceptions if provided buffers are too small to contain a DWord value.

Member Summary
public static uint FromByteArray(byte[] bytes) => ... Creates a 32-bit unsigned integer from a byte array. The byte array containing the bytes to convert. Must contain at least four bytes starting at the beginning of the array. A 32-bit unsigned integer represented by the first four bytes of the array.
public static uint FromByteArray(byte[] bytes, int start) => ... Converts a sequence of bytes from the specified array, starting at the given index, to a 32-bit unsigned integer. The array containing the bytes to convert. The zero-based index in the array at which to begin reading bytes. A 32-bit unsigned integer representing the converted value from the specified byte sequence.
public static uint FromSpan(ReadOnlySpan<byte> bytes) Creates a 32-bit unsigned integer from the first four bytes of the specified read-only byte span, interpreting the bytes as big-endian. This method interprets the input bytes using big-endian byte order, regardless of the system's endianness. If the span contains more than four bytes, only the first four are used. A read-only span of bytes containing at least four bytes to convert to a 32-bit unsigned integer. The first four bytes are used in the conversion. A 32-bit unsigned integer represented by the first four bytes of the span, interpreted as big-endian. Thrown when the length of is less than 4.
public static uint FromBytes(byte v1, byte v2, byte v3, byte v4) => ... Creates a 32-bit unsigned integer from four individual bytes, using little-endian byte order. The bytes are combined such that v1 is the lowest-order byte and v4 is the highest-order byte. This method is useful for reconstructing a UInt32 value from a sequence of bytes, such as when reading binary data from a stream. The least significant byte of the resulting 32-bit unsigned integer. The second byte, which becomes the second least significant byte of the resulting value. The third byte, which becomes the third least significant byte of the resulting value. The most significant byte of the resulting 32-bit unsigned integer. A 32-bit unsigned integer composed from the specified bytes in little-endian order.
public static uint[] ToArray(byte[] bytes) => ... Converts the specified byte array to an array of 32-bit unsigned integers. The conversion uses the default byte order of the system architecture. If the length of the input array is not a multiple of 4, an exception may be thrown. The byte array to convert. The length must be a multiple of 4. An array of 32-bit unsigned integers representing the converted values from the input byte array.
public static uint[] ToArray(ReadOnlySpan<byte> bytes) Converts the specified read-only span of bytes to an array of 32-bit unsigned integers. Each group of four consecutive bytes in the input span is interpreted as a single 32-bit unsigned integer. The conversion uses the byte order expected by the FromSpan method. If the length of the span is not a multiple of 4, any remaining bytes are ignored. The read-only span of bytes to convert. The length must be a multiple of 4. An array of 32-bit unsigned integers representing the converted values from the input byte span.
public static byte[] ToByteArray(uint value) Converts the specified 32-bit unsigned integer to a byte array in little-endian order. The 32-bit unsigned integer to convert to a byte array. A 4-element byte array containing the bytes of the specified value in little-endian order.
public static void ToSpan(uint value, Span<byte> destination) Writes the specified 32-bit unsigned integer value to the provided span in big-endian byte order. This method writes the value in big-endian format, regardless of the system's native endianness. The first byte in the span will contain the most significant byte of the value. The 32-bit unsigned integer value to write to the span. The span of bytes that receives the big-endian representation of the value. Must be at least 4 bytes in length. Thrown if the length of destination is less than 4 bytes.
public static void ToSpan(ReadOnlySpan<uint> values, Span<byte> destination) Converts each 32-bit unsigned integer in the specified read-only span to its byte representation and writes the result to the provided destination span. A read-only span of 32-bit unsigned integers to convert to bytes. A span of bytes that receives the byte representations of the input values. Must be at least four times the length of . Thrown when is not large enough to contain the byte representations of all elements in .
public static byte[] ToByteArray(uint[] value) Converts the specified array of 32-bit unsigned integers to a byte array. An array of 32-bit unsigned integers to convert. Cannot be null. A byte array containing the binary representation of the input values. The length of the returned array is four times the length of the input array.
S7PlcRx.PlcTypes.DateTime

Source: PlcTypes/DateTime.cs:11

Contains the methods to convert between and S7 representation of datetime values.

Member Summary
public static readonly System.DateTime SpecMinimumDateTime = new(1990, 1, 1); The minimum value supported by the specification.
public static readonly System.DateTime SpecMaximumDateTime = new(2089, 12, 31, 23, 59, 59, 999); The maximum value supported by the specification.
public static System.DateTime FromByteArray(byte[] bytes) => ... Parses a value from bytes. Input bytes read from PLC. A object representing the value read from PLC.
public static System.DateTime FromSpan(ReadOnlySpan<byte> bytes) Parses a value from a span. Input bytes span read from PLC. A object representing the value read from PLC.
public static System.DateTime[] ToArray(byte[] bytes) => ... Parses an array of values from bytes. Input bytes read from PLC. An array of objects representing the values read from PLC.
public static System.DateTime[] ToArray(ReadOnlySpan<byte> bytes) Parses an array of values from a span. Input bytes span read from PLC. An array of objects representing the values read from PLC.
public static byte[] ToByteArray(System.DateTime dateTime) Converts a value to a byte array. The DateTime value to convert. A byte array containing the S7 date time representation of .
public static void ToSpan(System.DateTime dateTime, Span<byte> destination) Converts a value to a span. The DateTime value to convert. The destination span.
public static byte[] ToByteArray(System.DateTime[] dateTimes) Converts an array of values to a byte array. The DateTime values to convert. A byte array containing the S7 date time representations of .
public static void ToSpan(ReadOnlySpan<System.DateTime> dateTimes, Span<byte> destination) Converts multiple DateTime values to the specified span. The DateTime values. The destination span.
S7PlcRx.PlcTypes.DateTimeLong

Source: PlcTypes/DateTimeLong.cs:11

Contains the methods to convert between and S7 representation of DateTimeLong (DTL) values.

Member Summary
public const int TypeLengthInBytes = 12; The type length in bytes.
public static readonly System.DateTime SpecMinimumDateTime = new(1970, 1, 1); The minimum value supported by the specification.
public static readonly System.DateTime SpecMaximumDateTime = new(2262, 4, 11, 23, 47, 16, 854); The maximum value supported by the specification.
public static System.DateTime FromByteArray(byte[] bytes) => ... Parses a value from bytes. Input bytes read from PLC. A object representing the value read from PLC.
public static System.DateTime FromSpan(ReadOnlySpan<byte> bytes) Parses a value from a span. Input bytes span read from PLC. A object representing the value read from PLC.
public static System.DateTime[] ToArray(byte[] bytes) => ... Parses an array of values from bytes. Input bytes read from PLC. An array of objects representing the values read from PLC.
public static System.DateTime[] ToArray(ReadOnlySpan<byte> bytes) Parses an array of values from a span. Input bytes span read from PLC. An array of objects representing the values read from PLC.
public static byte[] ToByteArray(System.DateTime dateTime) Converts a value to a byte array. The DateTime value to convert. A byte array containing the S7 DateTimeLong representation of .
public static void ToSpan(System.DateTime dateTime, Span<byte> destination) Converts a value to a span. The DateTime value to convert. The destination span.
public static byte[] ToByteArray(System.DateTime[] dateTimes) Converts an array of values to a byte array. The DateTime values to convert. A byte array containing the S7 DateTimeLong representations of .
public static void ToSpan(ReadOnlySpan<System.DateTime> dateTimes, Span<byte> destination) Converts multiple DateTime values to the specified span. The DateTime values. The destination span.
S7PlcRx.PlcTypes.Int

Source: PlcTypes/Int.cs:16

Provides static methods for converting between S7 Int (16-bit signed integer) representations and .NET types, including byte arrays and spans. This class is intended for working with Siemens S7 PLC data formats, which use big-endian byte order for 16-bit signed integers. All methods assume S7 Int format unless otherwise specified. The class is internal and not intended for direct use outside of the containing assembly.

Member Summary
public static short CWord(int value) Converts a 32-bit signed integer to a 16-bit signed integer, applying a custom transformation for values greater than 32,767. If the input value is greater than 32,767, a specific transformation is applied before conversion. This method does not throw an exception for values outside the range of a 16-bit signed integer; instead, it applies the custom logic to produce a result within the range. The 32-bit signed integer to convert. A 16-bit signed integer representing the converted value.
public static short FromByteArray(byte[] bytes) => ... Converts a byte array to a 16-bit signed integer. The byte array containing the bytes to convert. Must contain at least two bytes starting at index zero. A 16-bit signed integer represented by the first two bytes of the array.
public static short FromByteArray(byte[] bytes, int start) => ... Converts a sequence of bytes from the specified array, starting at the given index, to a 16-bit signed integer. The byte array containing the data to convert. The zero-based index in the array at which to begin reading the bytes. A 16-bit signed integer represented by the two bytes starting at the specified index in the array.
public static short FromSpan(ReadOnlySpan<byte> bytes) Creates a 16-bit signed integer from the first two bytes of the specified read-only byte span, interpreting the bytes as big-endian. This method interprets the input bytes using big-endian byte order, regardless of the system's endianness. This is commonly used for protocols or file formats that specify big-endian encoding. A read-only span of bytes containing at least two bytes. The first two bytes are used to construct the 16-bit signed integer. A 16-bit signed integer represented by the first two bytes of the span, interpreted as big-endian. Thrown when the length of is less than 2.
public static short FromBytes(byte loVal, byte hiVal) => ... Creates a 16-bit signed integer from two bytes, using the specified low and high byte values. The bytes are combined in little-endian order, with loVal as the least significant byte and hiVal as the most significant byte. The low-order byte of the 16-bit value. The high-order byte of the 16-bit value. A 16-bit signed integer formed by combining the specified low and high bytes.
public static short[] ToArray(byte[] bytes) => ... Converts the specified byte array to an array of 16-bit signed integers. The conversion interprets each consecutive pair of bytes as a single 16-bit signed integer. The byte order used for conversion is platform-dependent. If the length of the input array is not a multiple of 2, an exception may be thrown. The byte array to convert. The length must be a multiple of 2. An array of 16-bit signed integers representing the converted values from the input byte array.
public static short[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of 16-bit signed integers. Each pair of bytes in the input span is interpreted as a single 16-bit signed integer. The conversion uses the byte order expected by the FromSpan method. If the length of the span is not a multiple of 2, any remaining bytes are ignored. The read-only span of bytes to convert. The length must be a multiple of 2. An array of 16-bit signed integers representing the converted values from the input span.
public static byte[] ToByteArray(short value) Converts the specified 16-bit signed integer to a byte array. The 16-bit signed integer to convert. A byte array containing the two bytes that represent the specified value.
public static void ToSpan(short value, Span<byte> destination) Writes the specified 16-bit signed integer value to the provided span in big-endian byte order. This method writes the value in big-endian format, regardless of the system's native endianness. The caller is responsible for ensuring that the destination span has sufficient space. The 16-bit signed integer value to write to the span. The span of bytes that receives the big-endian representation of the value. Must be at least 2 bytes in length. Thrown if the length of destination is less than 2 bytes.
public static void ToSpan(ReadOnlySpan<short> values, Span<byte> destination) Writes the contents of a span of 16-bit signed integers to a span of bytes in little-endian order. The source span containing the 16-bit signed integer values to write. The destination span where the bytes will be written. Must be at least twice the length of . Thrown if is not large enough to contain the converted bytes.
public static byte[] ToByteArray(short[] value) Converts an array of 16-bit signed integers to a byte array. An array of 16-bit signed integers to convert. Cannot be null. A byte array containing the binary representation of the input values.
S7PlcRx.PlcTypes.LReal

Source: PlcTypes/LReal.cs:17

Provides static methods for converting between S7 LReal (64-bit floating point) representations and .NET double values. The methods in this class handle conversion between S7 LReal format (used in Siemens S7 PLCs) and .NET double values, including proper handling of endianness. All methods are static and intended for internal use when working with S7 protocol data. This class is not thread-safe, but all members are stateless and safe for concurrent use.

Member Summary
public static double FromByteArray(byte[] bytes) => ... Converts a byte array to a double-precision floating-point number. The byte array containing the binary representation of a double-precision floating-point value. Must be at least 8 bytes in length. A double-precision floating-point number represented by the specified byte array.
public static double FromByteArray(byte[] bytes, int start) => ... Converts a sequence of bytes from the specified array, starting at the given index, to a double-precision floating-point number. The byte array containing the value to convert. The zero-based index in the array at which to begin reading the bytes. A double-precision floating-point number represented by the specified bytes.
public static double FromSpan(ReadOnlySpan<byte> bytes) Converts the first 8 bytes of a read-only byte span to a double-precision floating-point value, interpreting the bytes as big-endian format. This method interprets the input bytes as a big-endian IEEE 754 double-precision value, regardless of the system's endianness. If the span contains more than 8 bytes, only the first 8 bytes are used. A read-only span of bytes containing at least 8 bytes representing a double-precision floating-point value in big-endian order. A double-precision floating-point value represented by the first 8 bytes of the span. Thrown when the length of is less than 8.
public static double FromDWord(int value) => ... Converts a 32-bit signed integer in DWord format to its equivalent double-precision floating-point value. The 32-bit signed integer value in DWord format to convert. A double-precision floating-point value that represents the specified DWord.
public static double FromDWord(uint value) => ... Converts the specified 32-bit unsigned integer to its double-precision floating-point representation. The 32-bit unsigned integer value to convert. A double-precision floating-point number that represents the specified 32-bit unsigned integer.
public static double[] ToArray(byte[] bytes) => ... Converts a byte array to an array of double-precision floating-point values. The method interprets each consecutive group of 8 bytes in the input array as a double-precision floating-point value, using the system's endianness. If the length of the input array is not a multiple of 8, an exception may be thrown. The byte array to convert. The length must be a multiple of the size of a double (8 bytes). An array of double values created from the input byte array.
public static double[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of double-precision floating-point values. The method interprets each consecutive group of 8 bytes in the span as a double-precision floating-point value. The conversion uses the system's endianness. Any remaining bytes that do not form a complete double are ignored. A read-only span of bytes representing the binary data to convert. The length must be a multiple of 8, as each double value is represented by 8 bytes. An array of double values parsed from the specified byte span. The length of the array is equal to the number of complete double values in the input.
public static byte[] ToByteArray(double value) Converts the specified double-precision floating-point value to its equivalent 8-byte array representation. The double-precision floating-point number to convert. A byte array containing the 8-byte binary representation of the specified value.
public static void ToSpan(double value, Span<byte> destination) Writes the specified double-precision floating-point value to the provided span in big-endian byte order. This method writes the value in big-endian format, which is commonly used in certain binary protocols such as Siemens S7. If the current platform is little-endian, the bytes are reversed to ensure correct ordering. The double-precision floating-point value to write to the span. The span of bytes that will receive the 8-byte big-endian representation of the value. Must be at least 8 bytes in length. Thrown if the length of destination is less than 8 bytes.
public static void ToSpan(ReadOnlySpan<double> values, Span<byte> destination) Writes each double-precision floating-point value from the specified read-only span to the specified destination span as a sequence of bytes. The read-only span of double values to convert to their byte representations. The span of bytes that receives the byte representations of the values. Must be at least values.Length × 8 bytes in length. Thrown when the length of destination is less than values.Length × 8 bytes.
public static byte[] ToByteArray(double[] value) Converts an array of double-precision floating-point numbers to a byte array representation. The array of double values to convert. Cannot be null. A byte array containing the binary representation of the input double array. The array will be empty if the input array is empty.
S7PlcRx.PlcTypes.Real

Source: PlcTypes/Real.cs:16

Provides static methods for converting between Siemens S7 Real (4-byte IEEE 754 floating-point) representations and .NET float values. The methods in this class handle endianness according to the S7 protocol, which uses big-endian byte order. Use these methods to serialize and deserialize float values when communicating with Siemens S7 PLCs or working with S7 Real data formats. All methods are static and intended for internal use.

Member Summary
public static float FromByteArray(byte[] bytes) => ... Converts a byte array to a single-precision floating-point value. The byte array containing the bytes to convert. Must contain at least four bytes representing a 32-bit floating-point value in the expected format. A single-precision floating-point value represented by the specified byte array.
public static float FromSpan(ReadOnlySpan<byte> bytes) Converts a 4-byte big-endian span to a single-precision floating-point value. This method interprets the input bytes as a big-endian IEEE 754 single-precision floating-point value, regardless of the system's endianness. Use this method when reading floating-point values from protocols or file formats that use big-endian byte order, such as Siemens S7 PLCs. A read-only span of 4 bytes representing a single-precision floating-point value in big-endian byte order. A single-precision floating-point value represented by the specified big-endian byte span. Thrown when the length of is not 4.
public static byte[] ToByteArray(float value) Converts the specified single-precision floating-point value to its equivalent byte array representation. The byte order of the returned array is platform-dependent. To ensure consistent results across different systems, consider specifying endianness explicitly if required. The single-precision floating-point value to convert. A 4-byte array containing the binary representation of .
public static void ToSpan(float value, Span<byte> destination) Writes the 4-byte big-endian representation of the specified single-precision floating-point value into the provided span. The value is written in big-endian byte order, regardless of the system's endianness. This is commonly required for protocols or file formats that specify big-endian encoding. The single-precision floating-point value to write to the span. The span of bytes that receives the 4-byte big-endian representation of the value. Must be at least 4 bytes in length. Thrown if the length of destination is less than 4 bytes.
public static byte[] ToByteArray(float[] value) Converts an array of single-precision floating-point values to a byte array. The array of values to convert. Cannot be null. A byte array containing the binary representation of the input values.
public static void ToSpan(ReadOnlySpan<float> values, Span<byte> destination) Converts a span of single-precision floating-point values to their byte representations and writes them to the specified destination span. The span of single-precision floating-point values to convert. The destination span to which the byte representations of the values are written. Must be at least four times the length of . Thrown when is not large enough to contain the byte representations of all values.
public static float[] ToArray(byte[] bytes) => ... Converts a byte array to an array of single-precision floating-point values. The method interprets each group of four bytes in the input array as a single-precision floating-point value, using the default endianness of the system. If the length of is not a multiple of 4, an exception may be thrown. The byte array containing the binary representation of the floating-point values. The length must be a multiple of 4. An array of values converted from the specified byte array.
public static float[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of 32-bit floating-point values. The method interprets each consecutive group of 4 bytes in the input span as a single-precision floating-point value. The byte order and format must match the expected representation for floats on the current platform. The read-only span of bytes to convert. The length must be a multiple of 4, as each float consists of 4 bytes. An array of 32-bit floating-point values parsed from the input byte span.
S7PlcRx.PlcTypes.S7String

Source: PlcTypes/S7String.cs:15

Provides methods for encoding and decoding S7 string values to and from byte arrays using the S7 protocol format. This static class supports conversion between .NET strings and the S7 string format used in Siemens PLCs, which includes a 2-byte header indicating the reserved and actual string lengths. The encoding used for string conversion can be configured via the StringEncoding property. All methods are thread-safe.

Member Summary
public static Encoding StringEncoding Gets or sets the Encoding used when serializing and deserializing S7String (Encoding.ASCII by default). The string encoding. StringEncoding. StringEncoding must not be null.
public static string FromByteArray(byte[] bytes) => ... Converts S7 bytes to a string. The bytes. A string. Malformed S7 String / too short or Malformed S7 String / length larger than capacity or Failed to parse {VarType.S7String} from data. Following fields were read: size: '{size}', actual length: '{length}', total number of bytes (including header): '{bytes.Length}'.
public static string FromSpan(ReadOnlySpan<byte> bytes) Converts S7 bytes from span to a string. The bytes span. A string. Malformed S7 String / too short or Malformed S7 String / length larger than capacity or Failed to parse {VarType.S7String} from data. Following fields were read: size: '{size}', actual length: '{length}', total number of bytes (including header): '{bytes.Length}'.
public static byte[] ToByteArray(string? value, int reservedLength) Converts a to S7 string with 2-byte header. The string to convert to byte array. The length (in characters) allocated in PLC for the string. A containing the string header and string value with a maximum length of + 2.
public static int ToSpan(string? value, int reservedLength, Span<byte> destination) Converts a string to S7 string format in the specified span. The string to convert. The length allocated in PLC for the string. The destination span. The number of bytes written. value. The maximum string length supported is 254. or Destination span is too small.
public static bool TryToSpan(string? value, int reservedLength, Span<byte> destination, out int bytesWritten) Tries to convert a string to S7 string format in the specified span. The string to convert. The length allocated in PLC for the string. The destination span. The number of bytes written. True if successful, false if the destination is too small.
public static int GetByteLength(int reservedLength) => ... Gets the total byte length for an S7 string with the specified reserved length. The reserved length for the string. The total byte length including header.
S7PlcRx.PlcTypes.S7StringAttribute

Source: PlcTypes/S7StringAttribute.cs:16

Member Summary
public S7StringAttribute(S7StringType type, int reservedLength) Initializes a new instance of the class with the specified string type and reserved length. The type of S7 string to use. Must be a defined value of the S7StringType enumeration. The reserved length for the string. Specifies the maximum number of characters the string can hold. Thrown if the specified type is not a valid value of the S7StringType enumeration.
public S7StringType Type get; } Gets the type of the S7 string represented by this instance.
public int ReservedLength get; } Gets the number of characters reserved for the value.
public int ReservedLengthInBytes => ... Gets the total number of bytes reserved for the string, including any protocol-specific header or length fields. The reserved length in bytes depends on the string type. For S7String, the value includes 2 bytes for header information; for S7WString, it includes 4 bytes for header information and accounts for UTF-16 encoding. This value is typically used to allocate buffers or validate data boundaries when working with S7 string types.
S7PlcRx.PlcTypes.S7WString

Source: PlcTypes/S7WString.cs:15

Provides static methods for converting between S7 WString byte arrays and .NET strings. The S7WString class supports encoding and decoding of S7 WString values, which are commonly used in Siemens S7 PLCs. All methods are static and thread-safe. The S7 WString format includes a 4-byte header specifying the reserved and actual string lengths, followed by the UTF-16 encoded string data.

Member Summary
public static string FromByteArray(byte[] bytes) Converts a byte array containing an S7 WString value to its corresponding .NET string representation. The input array must follow the S7 WString format, where the first two bytes specify the maximum capacity, the next two bytes specify the actual string length, and the remaining bytes contain the UTF-16 encoded string data in big-endian order. The byte array containing the S7 WString data, including the 4-byte header. Must not be null and must have a length of at least 4 bytes. A string representing the decoded S7 WString value from the specified byte array. Thrown if the input array is null, too short, contains malformed S7 WString data, or if decoding fails.
public static byte[] ToByteArray(string? value, int reservedLength) Converts the specified string to a big-endian Unicode byte array with a reserved length prefix. The returned byte array begins with a 4-byte header: the first two bytes represent the reserved length, and the next two bytes represent the actual string length, both in big-endian order. The string is encoded using big-endian Unicode (UTF-16BE). The string to convert to a byte array. Cannot be null. The number of characters to reserve in the output buffer. Must be less than or equal to 16,382 and greater than or equal to the length of . A byte array containing a 4-byte header followed by the big-endian Unicode bytes of the string, padded to the reserved length if necessary. Thrown if is null. Thrown if is greater than 16,382, or if the length of exceeds .
S7PlcRx.PlcTypes.String

Source: PlcTypes/String.cs:14

Provides utility methods for converting between strings and byte arrays using ASCII encoding. All methods in this class use ASCII encoding for conversions. These methods are intended for scenarios where data is known to be ASCII-compatible. Non-ASCII characters will be replaced with '?' during encoding and decoding. The class is internal and intended for use within the assembly.

Member Summary
public static string FromByteArray(byte[] bytes) => ... Decodes a UTF-8 encoded byte array into a string. The byte array containing the UTF-8 encoded text to decode. Cannot be null. A string representation of the decoded UTF-8 text. Returns an empty string if the array is empty.
public static string FromSpan(ReadOnlySpan<byte> bytes) Converts the specified read-only span of ASCII-encoded bytes to its equivalent string representation. A read-only span containing the bytes to decode as an ASCII string. A string that represents the decoded ASCII characters. Returns an empty string if is empty.
public static string FromByteArray(byte[] bytes, int start, int length) Converts a specified range of bytes from a byte array to a string. The byte array containing the data to convert. The zero-based index in the array at which to begin conversion. The number of bytes to convert starting from . A string representation of the specified range of bytes, or an empty string if the range exceeds the bounds of the array.
public static byte[] ToByteArray(string? value) Converts the specified string to a byte array using ASCII encoding. Characters in the input string that are not representable in ASCII are replaced with a question mark ("?") in the resulting byte array. The string to convert to a byte array. If null or empty, an empty array is returned. A byte array containing the ASCII-encoded bytes of the input string, or an empty array if the input is null or empty.
public static int ToSpan(string? value, Span<byte> destination) Encodes the specified string as ASCII bytes and writes the result to the provided destination span. Characters in the input string that cannot be represented in ASCII are replaced with a question mark ('?'). The string to encode as ASCII. If null or empty, no bytes are written. The span to which the encoded ASCII bytes are written. Must be large enough to hold the encoded bytes. The number of bytes written to the destination span. Returns 0 if the input string is null or empty. Thrown if the destination span is not large enough to contain the encoded bytes.
public static bool TryToSpan(string? value, Span<byte> destination, out int bytesWritten) Attempts to encode the specified string as ASCII bytes and write the result to the provided destination buffer. If the input string is null or empty, no bytes are written and the method returns true. The method returns false if the destination buffer is not large enough to hold the encoded bytes. The string to encode as ASCII. Can be null or empty. The buffer that receives the ASCII-encoded bytes of the string. When this method returns, contains the number of bytes written to the destination buffer. Set to 0 if the input string is null or empty. true if the string was successfully encoded and written to the destination buffer; otherwise, false.
S7PlcRx.PlcTypes.Struct

Source: PlcTypes/Struct.cs:17

Provides utility methods for working with struct types, including calculating their size in bytes and converting between structs and byte arrays. The methods in this class are primarily intended for scenarios where struct data needs to be serialized to or deserialized from byte arrays, such as communication with PLCs or binary protocols. The struct types used with these methods should have public fields and, for string fields, must be decorated with the S7StringAttribute to specify their encoding and length. All methods are static and thread-safe.

Member Summary
public static int GetStructSize(Type structType) Calculates the total size, in bytes, required to store an instance of the specified struct type, based on its fields and their types. This method inspects the public fields of the provided struct type and calculates the size according to the field types, including handling of custom attributes such as S7StringAttribute for string fields. The calculation may not account for all platform-specific alignment or padding rules. The type of the struct for which to calculate the size. Must not be null. The total size, in bytes, needed to represent an instance of the specified struct type. Thrown if structType is null. Thrown if a string field in the struct does not have the required S7StringAttribute.
public static object? FromBytes(Type structType, byte[] bytes) Deserializes a byte array into an instance of the specified structure type. The method supports deserialization of structures containing fields of supported primitive types, strings with S7StringAttribute, and nested structures. All fields must be public. The structure's layout and field order must match the serialized byte format. The type of the structure to deserialize the byte array into. Must be a type with a parameterless constructor and supported field types. The byte array containing the serialized data for the structure. The length must match the expected size of the structure. An object representing the deserialized structure, or null if the byte array is null or does not match the expected size. Thrown if an instance of the specified type cannot be created, or if a string field is missing the required S7StringAttribute, or if an invalid string type is specified for the S7StringAttribute.
public static byte[] ToBytes(object structValue) Converts the specified structure object to its byte array representation. Supported field types include Boolean, Byte, Int16, UInt16, Int32, UInt32, Single, Double, String (with S7StringAttribute), and TimeSpan. All fields of the structure must be of these types for successful conversion. The structure object to convert to a byte array. Must not be null. The object's fields must be of supported types. A byte array containing the serialized representation of the structure. Returns an empty array if is null. Thrown if a field value cannot be converted to its corresponding type, or if a string field is missing the required S7StringAttribute, or if an invalid string type is specified in the S7StringAttribute.
S7PlcRx.PlcTypes.TimeSpan

Source: PlcTypes/TimeSpan.cs:16

Provides methods and constants for converting between S7 PLC time representations and .NET values. This class supports parsing and serializing values to and from the S7 PLC binary format, where time spans are represented as 4-byte signed integers in milliseconds. All methods assume the S7 time format and enforce the valid range defined by and . The class is static and cannot be instantiated.

Member Summary
public const int TypeLengthInBytes = 4; Represents the size, in bytes, of the type.
public static readonly System.TimeSpan SpecMinimumTimeSpan = System.TimeSpan.FromMilliseconds(int.MinValue); Represents the minimum allowable value for a specification time span, defined as the number of milliseconds equal to .
public static readonly System.TimeSpan SpecMaximumTimeSpan = System.TimeSpan.FromMilliseconds(int.MaxValue); Represents the maximum allowable time span for specification purposes, set to the largest value expressible in milliseconds as an integer. This value is useful when an upper bound for a time interval is required, such as in timeout or delay scenarios where the maximum supported duration is needed. The value is equivalent to TimeSpan.FromMilliseconds(int.MaxValue).
public static System.TimeSpan FromByteArray(byte[] bytes) => ... Creates a TimeSpan structure from its binary representation in a byte array. The byte array must contain a valid binary representation of a TimeSpan as produced by the corresponding serialization method. Supplying an array that is too short or incorrectly formatted may result in an exception. A byte array containing the binary representation of a TimeSpan. The array must be at least 8 bytes in length and encoded in the expected format. A TimeSpan value represented by the specified byte array.
public static System.TimeSpan FromSpan(ReadOnlySpan<byte> bytes) Creates a TimeSpan from a read-only span of bytes representing a 32-bit integer value in milliseconds. A read-only span of bytes containing the 32-bit integer value, in little-endian format, representing the number of milliseconds for the TimeSpan. Must be at least 4 bytes in length. A TimeSpan that represents the time interval specified by the 32-bit integer value, in milliseconds, contained in the input span. Thrown when the length of bytes is less than 4.
public static System.TimeSpan[] ToArray(byte[] bytes) => ... Converts a byte array to an array of values. The method interprets the input byte array as a sequence of values in their binary format. The caller is responsible for ensuring that the byte array was created using a compatible serialization method and that its length is valid. The byte array containing the binary representation of one or more values. The array length must be a multiple of the size of a structure. An array of values deserialized from the specified byte array.
public static System.TimeSpan[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes into an array of TimeSpan values, interpreting each group of bytes as a duration in milliseconds. Each consecutive group of 8 bytes in the input is interpreted as a 64-bit signed integer in the platform's endianness, representing a duration in milliseconds. The method does not perform validation on the range of the resulting TimeSpan values. A read-only span of bytes representing one or more 64-bit signed integer values, each corresponding to a duration in milliseconds. An array of TimeSpan values created from the input bytes. Each element represents a duration corresponding to one 64-bit integer value in the input. Thrown when the length of bytes is not a multiple of the size of a 64-bit signed integer.
public static byte[] ToByteArray(System.TimeSpan timeSpan) Converts the specified value to its binary representation as a byte array. The value to convert to a byte array. A byte array containing the binary representation of the specified value.
public static void ToSpan(System.TimeSpan timeSpan, Span<byte> destination) Encodes the specified value into its S7 time representation and writes the result to the provided byte span. The S7 time representation encodes a time interval as a 4-byte value in milliseconds. Only time spans within the supported S7 range can be encoded. The time interval to encode. Must be within the supported S7 time range. The span of bytes to which the encoded S7 time value will be written. Must be at least 4 bytes in length. Thrown if is less than 4 bytes in length. Thrown if is less than the minimum or greater than the maximum value supported by the S7 time representation.
public static byte[] ToByteArray(System.TimeSpan[] timeSpans) Converts an array of values to a byte array representation. An array of values to convert. Cannot be null. A byte array containing the serialized representation of the input values. The length of the array is proportional to the number of elements in . Thrown if is null.
public static void ToSpan(ReadOnlySpan<System.TimeSpan> timeSpans, Span<byte> destination) Converts a sequence of values to their binary representation and writes the result to the specified destination span. The read-only span containing the values to convert. The span of bytes that receives the binary representation of the values. Must be large enough to hold all converted values. Thrown when is not large enough to contain the binary representation of all values.
S7PlcRx.PlcTypes.Timer

Source: PlcTypes/Timer.cs:14

Provides static methods for converting between S7 Timer byte representations and .NET numeric types. This class is intended for working with Siemens S7 PLC timer values, enabling conversion to and from the S7-specific byte format and standard .NET types such as double and ushort. All members are static and the class cannot be instantiated.

Member Summary
public static double FromByteArray(byte[] bytes) => ... Converts a byte array to a double-precision floating-point number. The byte array containing the bytes to convert. Must represent a valid double value in the expected byte order. A double-precision floating-point number represented by the specified byte array.
public static double FromSpan(ReadOnlySpan<byte> bytes) => ... Converts a read-only span of bytes to a double-precision floating-point number. The conversion uses the platform's endianness. Ensure that the byte order in the span matches the expected endianness for correct results. A read-only span of bytes containing the binary representation of the double value. The span must contain at least 8 bytes, starting at the beginning of the span. A double-precision floating-point number represented by the first 8 bytes of the span.
public static double FromByteArray(byte[] bytes, int start) => ... Converts a sequence of bytes from the specified array, starting at the given index, to a double-precision floating-point number. The byte array containing the value to convert. The zero-based index in the array at which to begin reading the bytes. A double-precision floating-point number represented by the eight bytes starting at the specified index in the array.
public static double FromByteArray(ReadOnlySpan<byte> bytes, int start) Converts a sequence of bytes starting at the specified position to a double-precision floating-point value using a custom binary encoding. The method expects a custom binary format for the encoded value. The interpretation of the bytes and the resulting value may not correspond to standard IEEE 754 encoding. Ensure that the input data matches the expected format. A read-only span of bytes containing the encoded value. The zero-based index in the span at which to begin reading the 2-byte encoded value. A double-precision floating-point value decoded from the specified bytes. Thrown if the span does not contain at least 2 bytes starting from the specified position.
public static double[] ToArray(byte[] bytes) => ... Converts a byte array to an array of double-precision floating-point values. The method interprets each consecutive group of 8 bytes in the input array as a double-precision floating-point value, using the system's endianness. If the length of the input array is not a multiple of 8, an exception may be thrown. The byte array to convert. The length must be a multiple of the size of a double (8 bytes). An array of double values created from the input byte array.
public static double[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of double-precision floating-point values. The method interprets each consecutive pair of bytes in the input span as a double value. The length of the input span must be evenly divisible by 2; otherwise, any remaining bytes are ignored. The read-only span of bytes to convert. The length must be a multiple of 2, with each pair of bytes representing a double value. An array of double values parsed from the specified byte span.
public static byte[] ToByteArray(ushort value) Converts the specified 16-bit unsigned integer to a byte array. The 16-bit unsigned integer to convert to a byte array. A byte array containing the two bytes of the specified value in platform endianness.
public static void ToSpan(ushort value, Span<byte> destination) Writes the specified 16-bit unsigned integer value to the provided span as two bytes in big-endian order. The value is written in big-endian byte order, with the most significant byte first. The method does not allocate memory and writes directly to the provided span. The 16-bit unsigned integer value to write to the span. The span of bytes that will receive the two-byte representation of the value. Must be at least 2 bytes in length. Thrown if the length of destination is less than 2.
public static void ToSpan(ReadOnlySpan<ushort> values, Span<byte> destination) Converts a sequence of 16-bit unsigned integers to their byte representations and writes the result to the specified destination span. The read-only span of 16-bit unsigned integers to convert. The span of bytes that receives the converted values. Must be at least twice the length of . Thrown when is not large enough to contain the converted bytes.
public static byte[] ToByteArray(ushort[] value) Converts an array of 16-bit unsigned integers to a byte array. The array of 16-bit unsigned integers to convert. Cannot be null. A byte array containing the binary representation of the input values.
S7PlcRx.PlcTypes.Word

Source: PlcTypes/Word.cs:16

Provides utility methods for converting between 16-bit unsigned integers (words) and their byte array or span representations, using big-endian (high byte first) byte order. All methods in this class assume that words are represented in big-endian format, where the first byte is the high-order byte and the second byte is the low-order byte. These methods are intended for scenarios where explicit control over byte order is required, such as binary serialization, communication protocols, or file I/O. The class is static and cannot be instantiated.

Member Summary
public static ushort FromByteArray(byte[] bytes) => ... Creates a 16-bit unsigned integer from a byte array. The byte array containing the bytes to convert. Must contain at least two elements. A 16-bit unsigned integer represented by the first two bytes of the array.
public static ushort FromSpan(ReadOnlySpan<byte> bytes) => ... Creates a 16-bit unsigned integer from a span containing two bytes in little-endian order. This method interprets the first two bytes of the span as a little-endian encoded unsigned 16-bit integer. The caller must ensure that the span contains at least two bytes to avoid an exception. A read-only span of bytes that provides the two bytes to convert. The span must have a length of at least 2, with the least significant byte at index 0 and the most significant byte at index 1. A 16-bit unsigned integer represented by the two bytes in the specified span.
public static ushort FromByteArray(byte[] bytes, int start) => ... Creates a 16-bit unsigned integer from a byte array starting at the specified index. The byte array containing the data to convert. The zero-based index in the array at which to begin reading the value. A 16-bit unsigned integer formed from the specified bytes.
public static ushort FromBytes(byte loVal, byte hiVal) => ... Creates a 16-bit unsigned integer from two bytes, using the specified low and high byte values. The resulting value is calculated as (hiVal * 256) + loVal, with loVal as the least significant byte and hiVal as the most significant byte. This method assumes a little-endian byte order. The low-order byte of the resulting 16-bit unsigned integer. The high-order byte of the resulting 16-bit unsigned integer. A 16-bit unsigned integer composed from the specified low and high bytes.
public static ushort[] ToArray(byte[] bytes) => ... Converts a byte array to an array of 16-bit unsigned integers. The conversion interprets each pair of bytes in the input array as a single 16-bit unsigned integer. If the length of the input array is not a multiple of 2, an exception may be thrown. The byte array to convert. The length must be a multiple of 2. An array of 16-bit unsigned integers representing the converted values from the input byte array.
public static ushort[] ToArray(ReadOnlySpan<byte> bytes) Converts a read-only span of bytes to an array of 16-bit unsigned integers. Each pair of bytes in the input span is interpreted as a single 16-bit unsigned integer. The conversion uses the byte order expected by the FromSpan method. If the length of the input span is not a multiple of 2, any remaining bytes are ignored. The input span containing the bytes to convert. The length must be a multiple of 2. An array of 16-bit unsigned integers parsed from the input bytes. The length of the array is half the length of the input span.
public static byte[] ToByteArray(ushort value) Converts the specified 16-bit unsigned integer to a byte array. The 16-bit unsigned integer to convert. A byte array containing the bytes of the specified value in little-endian order.
public static void ToSpan(ushort value, Span<byte> destination) Writes the specified 16-bit unsigned integer to the provided span in big-endian byte order. The method writes the most significant byte of value to destination[0] and the least significant byte to destination[1]. The 16-bit unsigned integer value to write to the span. The span of bytes that receives the big-endian representation of the value. Must be at least 2 bytes in length. Thrown if destination is less than 2 bytes in length.
public static void ToByteArray(ushort value, Array destination, int start) Copies the byte representation of the specified 16-bit unsigned integer into the given array starting at the specified index. The 16-bit unsigned integer to convert to bytes. The array that will receive the bytes representing the value. Must have sufficient space to accommodate two bytes starting at the specified index. The zero-based index in the destination array at which to begin copying the bytes.
public static byte[] ToByteArray(ushort[] value) Converts an array of 16-bit unsigned integers to a byte array. The array of 16-bit unsigned integers to convert. Cannot be null. A byte array containing the binary representation of the input values.
public static void ToSpan(ReadOnlySpan<ushort> values, Span<byte> destination) Converts a sequence of 16-bit unsigned integers to their byte representation and writes the result to the specified destination span. The sequence of 16-bit unsigned integers to convert. The span of bytes that receives the converted values. Must be at least twice the length of . Thrown when is not large enough to contain the converted bytes.

Namespace S7PlcRx.Production

S7PlcRx.Production.CircuitBreaker

Source: Production/CircuitBreaker.cs:17

Provides a thread-safe implementation of the circuit breaker pattern to prevent repeated execution of failing operations and to allow recovery after a specified timeout. The circuit breaker monitors consecutive operation failures and transitions between Closed, Open, and HalfOpen states based on the provided configuration. When the failure threshold is reached, the circuit breaker enters the Open state and blocks further operations until the timeout elapses. After the timeout, it transitions to HalfOpen to test if operations can succeed before fully closing again. This class is thread-safe and intended for use in scenarios where repeated failures should be prevented from overwhelming a system or external dependency. The configuration settings that control circuit breaker thresholds, retry behavior, and timeouts.

Member Summary
public CircuitBreakerState State get; private set; } = CircuitBreakerState.Closed; Gets the current state of the circuit breaker. The state indicates whether the circuit breaker is allowing operations to proceed (Closed), temporarily blocking operations due to failures (Open), or testing if operations can resume (HalfOpen).
public long TotalOperations get; private set; } Gets the total number of operations that have been performed.
public long SuccessfulOperations get; private set; } Gets the total number of operations that have completed successfully.
public long FailedOperations get; private set; } Gets the total number of operations that have failed.
public double SuccessRate => ... Gets the percentage of operations that completed successfully.
public async Task<T> ExecuteAsync<T>(Func<Task<T>> operation) Executes the specified asynchronous operation within the circuit breaker, applying retry and failure handling policies as configured. If the circuit breaker is open due to previous failures, the operation will be blocked until the configured timeout has elapsed. Upon successful execution, the circuit breaker state is reset. This method is thread-safe. The type of the result returned by the asynchronous operation. A function that represents the asynchronous operation to execute. Cannot be null. A task that represents the asynchronous execution of the operation. The task result contains the value returned by the operation if it completes successfully. Thrown if the operation parameter is null. Thrown if the circuit breaker is open and the timeout period has not elapsed, preventing the operation from being executed.
S7PlcRx.Production.CircuitBreakerState

Source: Production/CircuitBreakerState.cs:12

Specifies the operational state of a circuit breaker used to control the flow of operations in response to failures. Use this enumeration to determine or set the current state of a circuit breaker implementation. The state controls whether operations are allowed, blocked, or tested for recovery. Typical usage involves transitioning between these states based on error rates or recovery attempts.

Enum values: Closed, Open, HalfOpen.

S7PlcRx.Production.ProductionDiagnostics

Source: Production/ProductionDiagnostics.cs:16

Represents diagnostic information collected from a production programmable logic controller (PLC) connection, including connection details, performance metrics, and recommendations. This class is typically used to capture and analyze the state of a PLC connection and its associated metrics at a specific point in time. It aggregates connection parameters, diagnostic results, and any errors or optimization suggestions identified during the diagnostic process. All properties are intended to be set and read by consumers managing or monitoring PLC diagnostics.

Member Summary
public CpuType PLCType get; set; } Gets or sets the PLC type.
public string IPAddress get; set; } = string.Empty; Gets or sets the IP address.
public short Rack get; set; } Gets or sets the rack number.
public short Slot get; set; } Gets or sets the slot number.
public bool IsConnected get; set; } Gets or sets a value indicating whether gets or sets the connection status.
public DateTime DiagnosticTime get; set; } Gets or sets when diagnostics were collected.
public double ConnectionLatencyMs get; set; } Gets or sets the connection latency in milliseconds.
public string[] CPUInformation get; set; } = []; Gets or sets the CPU information.
public ProductionTagMetrics TagMetrics get; set; } = new ProductionTagMetrics(); Gets or sets the tag metrics.
public List<string> Recommendations get; set; } = []; Gets or sets the optimization recommendations.
public List<string> Errors get; set; } = []; Gets or sets any errors encountered during diagnostics.
S7PlcRx.Production.ProductionErrorConfig

Source: Production/ProductionErrorConfig.cs:12

Represents the configuration settings for error handling and retry logic in a production environment. This class provides options to control retry attempts, delay strategies, and circuit breaker behavior for handling transient errors. It is typically used to configure error resilience policies in applications that interact with external systems or services.

Member Summary
public int MaxRetryAttempts get; set; } = 3; Gets or sets the maximum retry attempts.
public int BaseRetryDelayMs get; set; } = 1000; Gets or sets the base retry delay in milliseconds.
public bool UseExponentialBackoff get; set; } = true; Gets or sets a value indicating whether gets or sets whether to use exponential backoff.
public int CircuitBreakerThreshold get; set; } = 5; Gets or sets the circuit breaker failure threshold.
public TimeSpan CircuitBreakerTimeout get; set; } = TimeSpan.FromMinutes(1); Gets or sets the circuit breaker timeout.
S7PlcRx.Production.ProductionErrorHandler

Source: Production/ProductionErrorHandler.cs:16

Provides error handling for production environments by executing operations with circuit breaker protection and configurable error handling policies. This class is intended for use in production scenarios where robust error handling and resilience are required. It wraps operations in a circuit breaker to prevent repeated failures and applies the error handling strategies specified in the provided configuration. Instances of this class are thread-safe and can be reused across multiple operations. The configuration settings that define error handling behavior, including circuit breaker thresholds and retry policies. Cannot be null.

Member Summary
public async Task<T> ExecuteAsync<T>(Func<Task<T>> operation) => ... Executes an operation with comprehensive error handling. The return type. The operation to execute. The result of the operation.
S7PlcRx.Production.ProductionExtensions

Source: Production/ProductionExtensions.cs:18

Provides extension methods for enabling production-grade error handling, retry logic, and system validation on PLC instances using the circuit breaker pattern. These extension methods are intended to enhance the reliability and readiness of PLC-based systems in production environments. They offer mechanisms for robust error handling, configurable retry strategies, and comprehensive validation routines to assess system health and readiness for production deployment. All methods require a valid IRxS7 PLC instance and may utilize user-supplied or default configuration objects. Thread safety is ensured for shared resources such as circuit breakers.

Member Summary
public static ProductionErrorHandler EnableProductionErrorHandling( this IRxS7 plc, ProductionErrorConfig config) Enables production error handling for the specified PLC using the provided configuration. The PLC instance to enable production error handling for. Cannot be null. The configuration settings to use for production error handling. Cannot be null. A new instance of configured for the specified PLC. Thrown if or is null.
public static async Task<T> ExecuteWithErrorHandling<T>( this IRxS7 plc, Func<Task<T>> operation, ProductionErrorConfig? config = null) Executes the specified asynchronous PLC operation with error handling and circuit breaker protection. This method ensures that the provided operation is executed with error handling policies defined by the specified or default configuration. It uses a circuit breaker to prevent repeated execution of failing operations, which can help protect the PLC and improve system resilience. The type of the result returned by the operation. The PLC instance on which to perform the operation. Cannot be null. A function that represents the asynchronous operation to execute. Cannot be null. An optional configuration object that specifies error handling and circuit breaker behavior. If null, a default configuration is used. A task that represents the asynchronous operation. The task result contains the value returned by the operation. Thrown if or is null.
public static async Task<SystemValidationResult> ValidateProductionReadiness( this IRxS7 plc, ProductionValidationConfig? validationConfig = null) Performs a comprehensive validation of the specified PLC to determine its readiness for production deployment. The validation process includes checks for connectivity, performance, and reliability. The method aggregates results and determines production readiness based on the provided or default configuration. The returned result includes timestamps, scores, and any critical errors encountered during validation. The PLC instance to validate for production readiness. Cannot be null. An optional configuration object that specifies validation parameters and thresholds. If null, default validation settings are used. A task that represents the asynchronous operation. The task result contains a SystemValidationResult object with detailed validation outcomes, including overall readiness, scores, and any detected issues. Thrown if the plc parameter is null.
S7PlcRx.Production.ProductionMetrics

Source: Production/ProductionMetrics.cs:13

Represents a set of metrics related to the monitoring and connectivity status of a PLC (Programmable Logic Controller) over a specified period. This class is typically used to capture and report operational statistics for a PLC, such as connection times, uptime percentage, and tag counts. All properties are mutable, allowing for incremental updates as new data is collected.

Member Summary
public string PLCIdentifier get; set; } = string.Empty; Gets or sets the PLC identifier.
public DateTime StartTime get; set; } Gets or sets when monitoring started.
public DateTime LastUpdateTime get; set; } Gets or sets the last update time.
public bool IsConnected get; set; } Gets or sets a value indicating whether gets or sets whether the PLC is currently connected.
public TimeSpan ConnectedTime get; set; } Gets or sets the total connected time.
public TimeSpan DisconnectedTime get; set; } Gets or sets the total disconnected time.
public double UptimePercentage get; set; } Gets or sets the uptime percentage.
public int ActiveTagCount get; set; } Gets or sets the number of active tags.
public int TotalTagCount get; set; } Gets or sets the total number of tags.
S7PlcRx.Production.ProductionTagMetrics

Source: Production/ProductionTagMetrics.cs:12

Represents aggregated metrics related to production tags, including counts and distribution information. Use this class to track and analyze the status and distribution of tags within a production environment. The metrics provided can assist in monitoring tag activity and identifying trends or anomalies in tag usage.

Member Summary
public int TotalTags get; set; } Gets or sets the total number of tags.
public int ActiveTags get; set; } Gets or sets the number of active tags.
public int InactiveTags get; set; } Gets or sets the number of inactive tags.
public Dictionary<string, int> DataBlockDistribution get; set; } = []; Gets or sets the distribution of tags by data block.
S7PlcRx.Production.ProductionValidationConfig

Source: Production/ProductionValidationConfig.cs:12

Represents configuration settings for validating production system performance and reliability. Use this class to specify thresholds and criteria for production validation checks, such as acceptable response times, reliability rates, and minimum production scores. These settings can be adjusted to match the requirements of different production environments.

Member Summary
public TimeSpan MaxAcceptableResponseTime get; set; } = TimeSpan.FromMilliseconds(500); Gets or sets the maximum acceptable response time.
public double MinimumReliabilityRate get; set; } = 0.95; Gets or sets the minimum reliability rate (0.0 to 1.0).
public int ReliabilityTestCount get; set; } = 10; Gets or sets the number of operations to test for reliability.
public double MinimumProductionScore get; set; } = 80.0; Gets or sets the minimum production score (0 to 100).
S7PlcRx.Production.SystemValidationResult

Source: Production/SystemValidationResult.cs:13

Represents the result of a system validation process, including timing, test results, and production readiness status. Use this class to capture and inspect the outcome of a system validation run, such as for a PLC or similar automated system. It provides details about the validation period, individual test results, critical errors, and an overall score indicating system readiness for production.

Member Summary
public DateTime ValidationStartTime get; set; } Gets or sets the validation start time.
public DateTime ValidationEndTime get; set; } Gets or sets the validation end time.
public string PLCIdentifier get; set; } = string.Empty; Gets or sets the PLC identifier.
public bool IsProductionReady get; set; } Gets or sets a value indicating whether the system is production ready.
public double OverallScore get; set; } Gets or sets the overall validation score (0-100).
public List<ValidationTest> ValidationTests get; } = []; Gets the individual validation tests.
public List<string> CriticalErrors get; } = []; Gets critical errors that prevent production use.
public TimeSpan TotalValidationTime => ... Gets the total validation time.
S7PlcRx.Production.ValidationTest

Source: Production/ValidationTest.cs:9

Represents the result and metadata of a validation test, including timing, outcome, and related details.

Member Summary
public string TestName get; set; } = string.Empty; Gets or sets the test name.
public DateTime StartTime get; set; } Gets or sets the test start time.
public DateTime EndTime get; set; } Gets or sets the test end time.
public bool Success get; set; } Gets or sets a value indicating whether gets or sets whether the test was successful.
public string? ErrorMessage get; set; } Gets or sets any error message.
public List<string> Details get; } = []; Gets additional test details.
public TimeSpan Duration => ... Gets the test duration.

Namespace S7PlcRx.SourceGeneration

S7PlcRx.SourceGeneration.S7PlcBindingAttribute

Source: S7TagBindingSourceGenerator.cs:273

No public instance/static members declared directly on this type.

S7PlcRx.SourceGeneration.S7TagAttribute

Source: S7TagBindingSourceGenerator.cs:278

Member Summary
public S7TagAttribute(string address)
public string Address get; }
public int PollIntervalMs get; set; } = 100;
public S7TagDirection Direction get; set; }
public int ArrayLength get; set; } = 1;
S7PlcRx.SourceGeneration.S7TagDirection

Source: S7TagBindingSourceGenerator.cs:294

Enum values: ReadWrite, ReadOnly, WriteOnly.

Namespace S7PlcRx.SourceGenerators

S7PlcRx.SourceGenerators.S7TagBindingSourceGenerator

Source: S7TagBindingSourceGenerator.cs:17

Member Summary
public void Initialize(IncrementalGeneratorInitializationContext context)

Build and test

dotnet build src/S7PlcRx/S7PlcRx.csproj
dotnet test src/S7PlcRx.Tests/S7PlcRx.Tests.csproj --framework net8.0

From WSL when only Windows .NET is installed:

'/mnt/c/Program Files/dotnet/dotnet.exe' build src/S7PlcRx/S7PlcRx.csproj
'/mnt/c/Program Files/dotnet/dotnet.exe' test src/S7PlcRx.Tests/S7PlcRx.Tests.csproj --framework net8.0

License

MIT. See LICENSE.

Support

About

S7PlcRx is a comprehensive, production-ready reactive library for communicating with Siemens S7 PLCs. Built on Reactive Extensions (Rx.NET), it provides real-time data streaming, advanced performance optimizations, enterprise-grade reliability, and comprehensive industrial automation features.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors

Languages