S7PlcRx 1.3.2
See the version list below for details.
dotnet add package S7PlcRx --version 1.3.2
NuGet\Install-Package S7PlcRx -Version 1.3.2
<PackageReference Include="S7PlcRx" Version="1.3.2" />
paket add S7PlcRx --version 1.3.2
#r "nuget: S7PlcRx, 1.3.2"
// Install S7PlcRx as a Cake Addin #addin nuget:?package=S7PlcRx&version=1.3.2 // Install S7PlcRx as a Cake Tool #tool nuget:?package=S7PlcRx&version=1.3.2
<p align="left"> <a href="https://github.com/ChrisPulman/S7PlcRx"> <img alt="S7PlcRx" src="./Images/S7PlcRx.png" width="200"/> </a> </p>
S7PlcRx
Reactive S7 PLC Communications Library
Introduction
S7PlcRx is a library that provides a simple interface to communicate with Siemens S7 PLCs.
Features
- Read and Write to PLC
- Read from PLC with Reactive Subscription
Getting Started
Installation
S7PlcRx is available on NuGet.
In the Siemens PLC program you need to enable PUT/GET communication in the PLC settings. You will also need to set any DBs you want to access to be non-optimized.
Package Manager
Install-Package S7PlcRx
.NET CLI
dotnet add package S7PlcRx
Usage
Setup Tags and Observe values in PLC
using S7PlcRx;
var plc = new RxS7(S7PlcRx.Enums.CpuType.S71500, "PLC_IP_ADDRESS", 0, 5);
// Add Tag without Polling
plc.AddUpdateTagItem<double>("Tag0", "DB500.DBD0").SetTagPollIng(false);
// Add Tag with Polling
plc.AddUpdateTagItem<double>("Tag1", "DB500.DBD8");
plc.IsConnected
.Where(x => x)
.Take(1)
.Subscribe(async _ =>
{
Console.WriteLine("Connected");
// Read Tag Value manually
var tag0 = await plc.Value<double>("Tag0");
});
// Subscribe to Tag Values
plc.Observe<double>("Tag0").Subscribe(x => Console.WriteLine($"Tag0: {x}"));
plc.Observe<double>("Tag1").Subscribe(x => Console.WriteLine($"Tag1: {x}"));
// Start Polling on previously disabled Tag
plc?.GetTag("Tag0")?.SetTagPollIng(true);
SetPolling
Polling is enabled by default when a Tag is added. You can disable and enable polling on a Tag at any time.
// Create a new Tag and with no Polling
plc.AddUpdateTagItem<double>("Tag0", "DB500.DBD0").SetTagPollIng(false);
// Set Polling on Tag
plc?.GetTag("Tag0")?.SetTagPollIng(true);
// Stop Polling on Tag
plc?.GetTag("Tag0")?.SetTagPollIng(false);
Write to PLC
plc.Value<double>("Tag0", 1.0);
Read PLC CPU Info
// Get CPU Info from PLC Async
var cpuInfo = await plc.CpuInfo();
// Get CPU Info from PLC Reactive
plc.GetCpuInfo().Subscribe(info =>
{
});
This returns a CpuInfo
string Array with the following values:
AS Name, Module Name, Copyright, Serial Number, Module Type Name, Order Code, Version.
Supported Data Types
- Bool - DB?.DBX?.?
- Byte - DB?.DBB?
- Byte[] - DB?.DBB? set length to number of bytes when creating array tags - example AddUpdateTagItem<byte[]>(PlcData, "DB100.DBB0", 64) - creates a tag with 64 bytes
- Int - DB?.DBW?
- Int[] - DB?.DBW?
- UInt - DB?.DBW?
- UInt[] - DB?.DBW?
- DInt - DB?.DBD?
- DInt[] - DB?.DBD?
- UDInt - DB?.DBD?
- UDInt[] - DB?.DBD?
- Real - DB?.DBD?
- Real[] - DB?.DBD?
- LReal - DB?.DBD?
- LReal[] - DB?.DBD?
- String - TODO - for the time being use a Byte Array
- Word - DB?.DBW?
- Word[] - DB?.DBW?
- DWord - DB?.DBD?
- DWord[] - DB?.DBD?
Further types will be added in the future.
Supported PLCs
- Logo-0BA8
- S7-200
- S7-300
- S7-400
- S7-1200
- S7-1500
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Reactive (>= 6.0.0)
-
net6.0
- System.Reactive (>= 6.0.0)
-
net7.0
- System.Reactive (>= 6.0.0)
-
net8.0
- System.Reactive (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on S7PlcRx:
Package | Downloads |
---|---|
MQTTnet.Rx.S7Plc
Reactive extensions for MQTTnet Broker |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.3.3 | 666 | 2/29/2024 |
1.3.2 | 148 | 1/18/2024 |
1.3.1 | 111 | 1/18/2024 |
1.3.0 | 127 | 1/16/2024 |
1.2.5 | 230 | 12/19/2023 |
1.2.4 | 212 | 10/30/2023 |
1.2.3 | 150 | 10/20/2023 |
1.2.2 | 126 | 10/19/2023 |
1.2.1 | 335 | 8/22/2023 |
1.2.0 | 131 | 8/21/2023 |
1.1.4 | 234 | 8/3/2023 |
1.1.3 | 165 | 8/2/2023 |
1.1.2 | 151 | 8/2/2023 |
1.1.1 | 217 | 7/27/2023 |
1.1.0 | 148 | 7/27/2023 |
1.0.3 | 239 | 5/19/2023 |
1.0.2 | 1,276 | 7/26/2022 |
1.0.1 | 389 | 7/25/2022 |
Compatability with Net 6 / 7 and netstandard2.0