Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/corsinvest/cv4ab-api-dotnet
API for accessing Allen-Bradley PLC data over Ethernet Windows/Linux .NET Core
https://github.com/corsinvest/cv4ab-api-dotnet
accessing-plcs allen-bradley c-sharp dotnet-core dotnetcore ethernet libplctag library libtagplc libtagplc-library linux nuget-package plc plc-access protocol rockwell tag windows
Last synced: 22 days ago
JSON representation
API for accessing Allen-Bradley PLC data over Ethernet Windows/Linux .NET Core
- Host: GitHub
- URL: https://github.com/corsinvest/cv4ab-api-dotnet
- Owner: Corsinvest
- License: gpl-3.0
- Created: 2018-09-17T08:07:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-19T06:36:27.000Z (about 3 years ago)
- Last Synced: 2024-10-14T03:03:32.119Z (22 days ago)
- Topics: accessing-plcs, allen-bradley, c-sharp, dotnet-core, dotnetcore, ethernet, libplctag, library, libtagplc, libtagplc-library, linux, nuget-package, plc, plc-access, protocol, rockwell, tag, windows
- Language: C#
- Homepage:
- Size: 697 KB
- Stars: 45
- Watchers: 7
- Forks: 23
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Corsinvest.AllenBradley.PLC.Api
[![License](https://img.shields.io/github/license/Corsinvest/cv4ab-api-dotnet.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) ![Nuget](https://img.shields.io/nuget/v/Corsinvest.AllenBradley.PLC.Api.svg) [![AppVeyor branch](https://img.shields.io/appveyor/ci/franklupo/cv4ab-api-dotnet/master.svg)](https://ci.appveyor.com/project/franklupo/cv4ab-api-dotnet) [![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=PPM9JHLQLRV2S&item_name=Open+Source+Project¤cy_code=EUR&source=url)
Comunication for Allen-Bradley Rockwell PLC in .NET Core
[LibPLCTag library C++ Api](https://github.com/kyle-github/libplctag)
[Based on libplctag-csharp](https://github.com/mesta1/libplctag-csharp)
[Nuget](https://www.nuget.org/packages/Corsinvest.AllenBradley.PLC.Api)
[Special thanks for testing Mavert](https://www.mavert.it)
Special thanks to Mario Averoldi for technical support .
[Corsinvest Srl](https://www.corsinvest.it)
```text
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/Client Api Allen-Bradley PLC (Made in Italy)
```## WARNING - DISCLAIMER
Note: *PLCs control many kinds of equipment and loss of property, production
or even life can happen if mistakes in programming or access are
made. Always use caution when accessing or programming PLCs!*We make no claims or warrants about the suitability of this code for
any purpose.Be careful!
## General
The client is wrapper of [LibPLCTag](https://github.com/kyle-github/libplctag) library.
## Main features
- Open source
- Controller implementation
- Native Tag type INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT32, FLOAT64, STRING
- Custom class definition structure
- Manipulation local value variable
- Read and Write with advanced result
- Time execution
- Status code
- Timestamp
- Tag
- Value property decode value natively
- Lock/Unlock for thread operation
- Decode Error **StatusCodeOperation.DecodeError()**
- Group interval read/write
- Event result Tag and TagGroup with result changed value
- Enable "Fail Operation Raise Exception" (default: false)
- Value Manager directly modify
- Bit manipulation
- Debug level
- Auto Read/Write when using value (default: false)
- Native support 32/64 bit for Windows/Linux## Usage
```CSharp
[Serializable]
public class Test12
{
public int AA1 { get; set; }
public int AA2 { get; set; }
public int AA3 { get; set; }
public int AA4 { get; set; }
public int AA5 { get; set; }
public int AA6 { get; set; }
public int AA7 { get; set; }
public int AA8 { get; set; }
}public static void Main(string[] args)
{
//initialize controller
using (var controller = new Controller("10.155.128.192", "1, 0", CPUType.LGX))
{
//ping controller
Console.Out.WriteLine("Ping " + controller.Ping(true));//create group tag
var grp = controller.CreateGroup();//add tag
var tag = grp.CreateTagType("Track", TagSize.STRING, 300);
tag.Changed += TagChanged;
var value = tag.Read();//add tag from Class
var tag1 = grp.CreateTagType("Test");
tag.Changed += TagChanged;var tag2 = grp.CreateTagFloat32("Fl32");
grp.Changed += GroupChanged;
grp.Read();}
}private static void PrintChange(string @event, ResultOperation result)
{
Console.Out.WriteLine($"{@event} {result.Timestamp} Changed: {result.Tag.Name}");
}static void TagChanged(ResultOperation result)
{
PrintChange("TagChanged", result);
}static void GroupChanged(IEnumerable results)
{
foreach (var result in results) PrintChange("GroupTagChanged", result);
}
```## Create Tag
It is possible to create a tag of any type:
- CreateTagInt64
- CreateTagUInt64
- CreateTagInt32
- CreateTagUInt32
- CreateTagInt16
- CreateTagUInt16
- CreateTagInt8
- CreateTagUInt8
- CreateTagString
- CreateTagFloat32
- CreateTagFloat64
- CreateTagType specify type and name only, and automatically calculated size from property or array
- CreateTagType specify name,size,length for array
- CreateTagArraySizes are specified in [TagSize](https://github.com/Corsinvest/cv4ab-api-dotnet/blob/master/src/Corsinvest.AllenBradley.PLC.Api/TagSize.cs).
For arrays specify the size in the definition.
Example:
```CSharp
public class TestArray
{
public int InTest { get; set; }
public int[] InTestArray { get; set; } = new int[5];
public string[] StringTestArray { get; set; } = new string[300];
}
```Custom types are classes. The properties are read sequentially.
[![paypal](https://www.paypalobjects.com/en_US/IT/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=PPM9JHLQLRV2S&item_name=Open+Source+Project¤cy_code=EUR&source=url)