PLCcomForS7 14.1.12
dotnet add package PLCcomForS7 --version 14.1.12
NuGet\Install-Package PLCcomForS7 -Version 14.1.12
<PackageReference Include="PLCcomForS7" Version="14.1.12" />
paket add PLCcomForS7 --version 14.1.12
#r "nuget: PLCcomForS7, 14.1.12"
// Install PLCcomForS7 as a Cake Addin #addin nuget:?package=PLCcomForS7&version=14.1.12 // Install PLCcomForS7 as a Cake Tool #tool nuget:?package=PLCcomForS7&version=14.1.12
PLCcom for S7: A .NET SDK for Communication with S7 Plcs
The PLCcom library is a highly performant and optimized component especially designed for Java / .Net-Developer to access data provided by a Siemens PLC in the most comfortable way. With PLCcom you can read and write data from a PLC with ease.
What provides PLCCom for S7 SDK?
Depending on the package the library consist purely of Java or .Net files. The driver can be integrated directly as a reference so that no API calls are necessary. PLCcom is platform independent and works on 32 as well as 64bit.
Within the scope of supply are various code examples to illustrate the connection between your application and different controllers. These examples can also be used in your own projects.
In its current version, PLCcom is compatible with S7 controllers (200, 300, 400, 1200, 1500, SoftSPS WinAC RTX as well as Logo! 0BA7 / 0BA8 / 0BA0) as well as CPUs from other manufacturers (e.g. VIPA 100V/200V/300V/300S, etc.) Symbolic access is possible to S7 controllers of the 1200 and 1500 series. The driver will be delivered with Code-Examples, which shows you how easy it is to connect the PLC to your application.
Communication: Serial adapter MPI, Serial adapter PPI, MPI adapter USB, Ethernet TCP/IP, Green Cable (VIPA PLC only)
The following data types are supported for classic optimized read and write functions:
- Raw (Byte Array)
- Bit
- Byte
- Word
- DWord
- LWord
- INT
- DINT
- LINT
- Real
- LReal
- BCD8
- BCD16
- BCD32
- BCD64
- Date
- Time
- LTime
- Date_And_Time
- LDate_And_Time
- Time_OF_DAY
- LTime_OF_DAY
- DTL
- S5Time
- Char
- String
- S7_String
- S7_WString
The following data types are supported for symbolic optimized read and write functions:
- Array[n..m](read-write access to the complete array or its individual elements)
- Bool(read-write)
- Byte(read-write)
- Char(read-write)
- Counter(read-write)
- Date(read-write)
- Date_And_Time(read-write)
- DInt(read-write)
- DWord(read-write)
- Int(read-write)
- LDT(read-write)
- LInt(read-write)
- LReal(read-write)
- LTime(read-write)
- LTime_Of_Day(read-write)
- LWord(read-write)
- Real(read-write)
- S5Time(read-write)
- SInt(read-write)
- String(read-write)
- Time(read-write)
- Time_Of_Day(read-write)
- Timer(read-write)
- UDInt(read-write)
- UInt(read-write)
- ULInt(read-write)
- USInt(read-write)
- WChar(read-write)
- WString(read-write)
- Word(read-write)
- CREF(read-write access to the complete struct or its individual elements)
- NREF(read-write access to the complete struct or its individual elements)
- DTL(read-write access to the complete struct or its individual elements)
- ErrorStruct(read-write access to the complete struct or its individual elements)
- IEC_COUNTER(read-write access to the complete struct or its individual elements)
- IEC_DCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_LCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_LTIMER(read-write access to the complete struct or its individual elements)
- IEC_SCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_TIMER(read-write access to the complete struct or its individual elements)
- IEC_UCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_UDCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_ULCOUNTER(read-write access to the complete struct or its individual elements)
- IEC_USCOUNTER(read-write access to the complete struct or its individual elements)
- Struct(read-access to the complete struct or its individual elements, write access to its individual elements)
Access via put/get or symbolic addressing
Reading of data blocks, inputs, outputs, data blocks, flags, timers, counters
Several operations possible in one function call, each operation returns a detailed return value.
Simultaneous access to different CPUs possible
Implemented high-performance access, the required accesses to the PLC are reduced to the absolute minimum.
Internal help and conversion functions for simple reading and writing of certain PLC data types
Provision of the PLCcom data server for cyclical read accesses with event-controlled notification of value changes
Starting and stopping the CPU
Reading out the serial number and firmware version
Reading out the key switch position
Reading LED information
Reading and setting the PLC time
Reading the system status list
Reading the block list
Reading block lengths
Backup of blocks
Restoring blocks
Restoring blocks under a changed block number
Deleting blocks
Output of block details such as code, creation languages, author, etc.
Sending the connection password
Reading out the diagnostic data
AutoConnect
Asynchronous connection
and much more.
Note: The previous list is not complete, furthermore there are exclusions depending on the PLC type. A complete list of supported functions depending on PLC type and communication path can be found here: https://www.indi-an.com/help_s7/net/help/index.html
Included in the software package are extensive code examples and tutorials, which illustrate the easy connection between your application and a S7 Plc and can also be used in your projects. For development support, test server and client applications are included in the delivery package.
Prerequisites
To create applications with the toolkit, advanced programming skills in a .Net programming language are advantageously required with C # or Visual Basic. The following system components are also required for the operation of the PLCcom for S7 library: � Microsoft .net Framework 4.7.2 or higher � Microsoft .net 6.0 or higher � Microsoft .net 7.0 or higher � Microsoft .net 8.0 or higher � A development environment that is compatible with .net Standard 2.1 (e.g. Xamarin)
To execute the included examples you need to have � Visual Studio 2019 or higher � A code editor compatible with .net framework
Important notes for using PLCcom with S7-1200/1500 controllers
Prerequisites for the classic way
It is possible to access inputs, outputs, flags, and accessible DBs. The access to a S7-1200 or 1500 is disabled by default. You have to process the following steps:
Allow the general access. Activate in the property settings section protection the option 'Connection mechanism - Allow access PUT/GET communication from remote partner. Enable access to your DBs. Go to DB properties and deactivate 'optimized access'. Load to PLC, done! If the changes don't have any effect, use 'extended download to device' to load to PLC.
Certain requirements must be met for symbolic access:
At least HMI access must be enabled in the controller without a password as a protection level. The controller must have been created with at least TIA version 17. If a data block has been created with a previous version, it must have been recompiled once with TIA from V17. At least the following firmware versions are required: S7-1200 from V4.5 S7-1500 from V2.9
Getting started
To get started with the PLCcom for S7 library, follow these steps:
1.Install the NuGet package: Install the PLCcomForS7 NuGet package into your project. You can find it in the NuGet package manager or by searching for "PLCcomForS7" in the NuGet package search. 2.Import the necessary namespaces: In your C# code, import the required namespaces from the PLCcom.Opc.Ua.Sdk package. For example:
using PLCcom;
using PLCcom.Core;
- Enter your licence key
string LicenseUserName = "<Enter your UserName here>";
string LicenseSerial = "<Enter your Serial here>";
- Create a PLCcom device instance and pass hostname or ip addresse and plc password
Tls13Device tlsDevice = new Tls13Device("192.168.1.100","Password");
Usage
Reading data
// Which variables do you want to read?
ReadSymbolicRequest readRequest = new ReadSymbolicRequest();
readRequest.AddFullVariableName("DataBlock_1.ByteValue");
readRequest.AddFullVariableName("DataBlock_1.RealValue");
// Read from device
var readResult = tlsDevice.ReadData(readRequest);
Writing data
List<PlcCoreVariable> writeVariables = new List<PlcCoreVariable>();
//get a variable body for writing
var variableBody = GetEmptyVariableBody(tlsDevice,"DataBlock_1.ByteValue");
// Set the value and add the variable to the write list
if (variableBody != null)
{
variableBody.Value = 1;
writeVariables.Add(variableBody);
}
//get a variable body for writing
variableBody = GetEmptyVariableBody(tlsDevice,"DataBlock_1.RealValue");
// Set the value and add the variable to the write list
if (variableBody != null)
{
variableBody.Value = 123.456f;
writeVariables.Add(variableBody);
}
// create a write request
WriteSymbolicRequest writeRequest = new WriteSymbolicRequest(writeVariables);
// write to device
var writeResult = tlsDevice.WriteData(writeRequest);
Subscribing to data changes
//Create a new non activated subscription with a 300ms cyling period
CreateSubscriptionRequest createSubscriptionRequest = new("TestSubscription", 300);
// Which variables do you want to subcribe?
createSubscriptionRequest.AddFullVariableName("DataBlock_1.ByteValue");
createSubscriptionRequest.AddFullVariableName("DataBlock_1.RealValue");
//create the subscription
CreateSubscriptionResult createSubResult = tlsDevice.CreateSubscription(createSubscriptionRequest);
PlcSubscription subscription = createSubResult.GetSubscription();
//register variable change handler
subscription.VariableChange += Subscription_VariableChange;
//register the new subscription with Plc
RegisterSubscriptionResult registerSubscriptionResult = tlsDevice.RegisterSubscription(new RegisterSubscriptionRequest(subscription));
Console.WriteLine($"Subscription {subscription.SubscriptionName} registered!");
Additional documentation
To provide feedback or report issues, please use the ressorces of your download packet. The online class documentation can you find here: https://www.indi-an.com/help_s7/net/help/index.html
Feedback
To provide feedback or report issues, please write an email to support@indi-an.com:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- Portable.BouncyCastle (>= 1.9.0)
- System.IO.Ports (>= 7.0.0)
-
.NETFramework 4.8
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- Portable.BouncyCastle (>= 1.9.0)
- System.IO.Ports (>= 7.0.0)
-
.NETStandard 2.1
- BouncyCastle.NetCore (>= 2.2.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.IO.Ports (>= 7.0.0)
-
net5.0
- BouncyCastle.NetCore (>= 2.2.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.IO.Ports (>= 7.0.0)
-
net6.0
- BouncyCastle.NetCore (>= 2.2.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.IO.Ports (>= 7.0.0)
-
net7.0
- BouncyCastle.NetCore (>= 2.2.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.IO.Ports (>= 7.0.0)
-
net8.0
- BouncyCastle.NetCore (>= 2.2.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.IO.Ports (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.