Beckhoff.TwinCAT.Ads.Reactive 4.4.0

Extends the TwinCAT.Ads.TcAdsClient with Reactive Interfaces for ADS Notifications to support observable Streams of
   value changes.
   
   Prerequisites:
     - TwinCAT 2 or 3 (XAR or Full) installation

There is a newer version of this package available.
See the version list below for details.
Install-Package Beckhoff.TwinCAT.Ads.Reactive -Version 4.4.0
dotnet add package Beckhoff.TwinCAT.Ads.Reactive --version 4.4.0
<PackageReference Include="Beckhoff.TwinCAT.Ads.Reactive" Version="4.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Beckhoff.TwinCAT.Ads.Reactive --version 4.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Description

The package 'Beckhoff.TwinCAT.Ads.Reactive' implements reactive extensions for the TwinCAT.Ads.TcAdsClient class included in the
'Beckhoff.TwinCAT.Ads' package.

Reactive Extensions (Rx) is a .NET library for composing asynchronous and event-based programs using observable sequences
and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous
data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers.

Simply put, Rx = Observables + LINQ + Schedulers.

In ADS terms, not only the reading and writing data or symbol values can be put into reactive data streams, also ADS Notifications or polling of values are a perfect
fit for reactive code.
With the help of this package not only data binding to reactive frameworks (e.g. reactive UI) is simplified but also enhanced data manipulation via synchronous and asynchronous
observers.
Multithreaded and parallelized code paths that support multiple CPU cores can be written very easily without the burden of deadlock and synchronization issues.

Requirements

  • .NET Framework 4.61 or later
  • A TwinCAT Installation (ADS, XAR or Full)

First Steps

The following code instantiates an AdsClient object, connects to the local PLC System Port 851 and subscribes fir the first 20 change notifications
of the Task cycle count and writes the value to the Console.

sing System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using TwinCAT.Ads;
using TwinCAT.Ads.Reactive;
using TwinCAT.Ads.TypeSystem;
using TwinCAT.TypeSystem;

namespace ReactiveTest
{
    class Program
    {
        // To Test the Observer run a project on the local PLC System (Port 851)
        using (TcAdsClient client = new TcAdsClient())
        {
            // Connect to target
            client.Connect(new AmsAddress(AmsNetId.Local, 851));

            // Reactive Notification Handler
            var valueObserver = Observer.Create<ushort>(val =>
            {
                Console.WriteLine(string.Format("Value: {0}", val.ToString()));
            }
            );

            // Turning ADS Notifications into sequences of Value Objects (Taking 20 Values)
            // and subscribe to them.
            IDisposable subscription = client.WhenNotification<ushort>("TwinCAT_SystemInfoVarList._TaskInfo.CycleCount", NotificationSettings.Default).Take(20).Subscribe(valueObserver);

            Console.ReadKey(); // Wait for Key press
            subscription.Dispose(); // Dispose the Subscription
        }
    }
}

Hints

For more information and Samples please consult the Beckhoff InfoSystem:
Beckhoff.TwinCAT.Ads API Documentation

Description

The package 'Beckhoff.TwinCAT.Ads.Reactive' implements reactive extensions for the TwinCAT.Ads.TcAdsClient class included in the
'Beckhoff.TwinCAT.Ads' package.

Reactive Extensions (Rx) is a .NET library for composing asynchronous and event-based programs using observable sequences
and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous
data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers.

Simply put, Rx = Observables + LINQ + Schedulers.

In ADS terms, not only the reading and writing data or symbol values can be put into reactive data streams, also ADS Notifications or polling of values are a perfect
fit for reactive code.
With the help of this package not only data binding to reactive frameworks (e.g. reactive UI) is simplified but also enhanced data manipulation via synchronous and asynchronous
observers.
Multithreaded and parallelized code paths that support multiple CPU cores can be written very easily without the burden of deadlock and synchronization issues.

Requirements

  • .NET Framework 4.61 or later
  • A TwinCAT Installation (ADS, XAR or Full)

First Steps

The following code instantiates an AdsClient object, connects to the local PLC System Port 851 and subscribes fir the first 20 change notifications
of the Task cycle count and writes the value to the Console.

sing System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using TwinCAT.Ads;
using TwinCAT.Ads.Reactive;
using TwinCAT.Ads.TypeSystem;
using TwinCAT.TypeSystem;

namespace ReactiveTest
{
    class Program
    {
        // To Test the Observer run a project on the local PLC System (Port 851)
        using (TcAdsClient client = new TcAdsClient())
        {
            // Connect to target
            client.Connect(new AmsAddress(AmsNetId.Local, 851));

            // Reactive Notification Handler
            var valueObserver = Observer.Create<ushort>(val =>
            {
                Console.WriteLine(string.Format("Value: {0}", val.ToString()));
            }
            );

            // Turning ADS Notifications into sequences of Value Objects (Taking 20 Values)
            // and subscribe to them.
            IDisposable subscription = client.WhenNotification<ushort>("TwinCAT_SystemInfoVarList._TaskInfo.CycleCount", NotificationSettings.Default).Take(20).Subscribe(valueObserver);

            Console.ReadKey(); // Wait for Key press
            subscription.Dispose(); // Dispose the Subscription
        }
    }
}

Hints

For more information and Samples please consult the Beckhoff InfoSystem:
Beckhoff.TwinCAT.Ads API Documentation

Release Notes

Release Notes::
===============

4.4.0.0
=======
Enh: Referencing TwinCAT.Ads.dll AssemblyVersion 4.4.0.0 to prevent GAC usage in TwinCAT installations and restore Nuget Semantic Package Versioning.

4.3.10.0
========
Enh: Updated System.Reactive package from 4.1.0 to 4.1.6

4.3.7.0
=======
Enh: Some minor improvements.

4.3.1.0
=======
Enh: AdsClientExtensions.PollAdsState added

4.3.0.0
=======
First version of the 4.3.X.X series of the Beckhoff.TwinCAT.Ads.Reactive package

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
5.0.0-preview6 15 3/23/2020
5.0.0-preview5 61 3/6/2020
5.0.0-preview4 84 12/12/2019
4.4.2 77 3/18/2020
4.4.0 279 2/5/2020
4.3.11 150 12/17/2019
4.3.10 385 10/7/2019
4.3.7 387 6/27/2019
4.3.4 1,170 4/12/2019
Show less