Coder Social home page Coder Social logo

cclee627 / cv4ab-api-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from corsinvest/cv4ab-api-dotnet

0.0 1.0 0.0 711 KB

API for accessing Allen-Bradley PLC data over Ethernet Windows/Linux .NET Core

License: GNU General Public License v3.0

C# 100.00%

cv4ab-api-dotnet's Introduction

Corsinvest.AllenBradley.PLC.Api

License Nuget AppVeyor branch Donate to this project using Paypal

Comunication for Allen-Bradley Rockwell PLC in .NET Core

LibTagPLC library C++ Api

Based on libplctag-csharp

Nuget

Special tanks for testing Mavert

Special thanks to Mario Averoldi for technical support [email protected].

Corsinvest Srl

   ______                _                      __
  / ____/___  __________(_)___ _   _____  _____/ /_
 / /   / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_
\____/\____/_/  /____/_/_/ /_/|___/\___/____/\__/

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 LibTagPLC 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

[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<string[]>("Track", TagSize.STRING, 300);
        tag.Changed += TagChanged;
        var value = tag.Read();

        //add tag from Class
        var tag1 = grp.CreateTagType<Test12>("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<ResultOperation> results)
{
  foreach (var result in results) PrintChange("GroupTagChanged", result);
}

Create Tag

Are possible to create any tag:

  • 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
  • CreateTagArray

Size are specified in TagSize.

For array specify size in definition.

Example:

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 type are class. The properties are read sequentially.

paypal

cv4ab-api-dotnet's People

Contributors

franklupo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.