{"id":16318383,"url":"https://github.com/chrispulman/twincatrx","last_synced_at":"2025-03-22T21:31:47.449Z","repository":{"id":65165957,"uuid":"545596123","full_name":"ChrisPulman/TwinCATRx","owner":"ChrisPulman","description":"A Reactive implementation of TwinCAT ADS","archived":false,"fork":false,"pushed_at":"2024-10-11T20:49:07.000Z","size":615,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T22:23:14.007Z","etag":null,"topics":["ads","beckhoff","reactive","twincat"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChrisPulman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-04T16:44:27.000Z","updated_at":"2024-10-02T21:33:26.000Z","dependencies_parsed_at":"2023-01-13T15:45:48.052Z","dependency_job_id":"691b21bd-a8c9-4fd0-891d-3f31a8abcc12","html_url":"https://github.com/ChrisPulman/TwinCATRx","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.032258064516129004","last_synced_commit":"ed7b3e1a63471483d0543e5bc4ff57387717356a"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisPulman%2FTwinCATRx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisPulman%2FTwinCATRx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisPulman%2FTwinCATRx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisPulman%2FTwinCATRx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChrisPulman","download_url":"https://codeload.github.com/ChrisPulman/TwinCATRx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244246516,"owners_count":20422455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ads","beckhoff","reactive","twincat"],"created_at":"2024-10-10T22:23:21.357Z","updated_at":"2025-03-22T21:31:47.427Z","avatar_url":"https://github.com/ChrisPulman.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwinCATRx\n\n![License](https://img.shields.io/github/license/ChrisPulman/TwinCATRx.svg) [![Build](https://github.com/ChrisPulman/TwinCATRx/actions/workflows/BuildOnly.yml/badge.svg)](https://github.com/ChrisPulman/TwinCATRx/actions/workflows/BuildOnly.yml) ![Nuget](https://img.shields.io/nuget/dt/CP.TwinCATRx?color=pink\u0026style=plastic) [![NuGet](https://img.shields.io/nuget/v/CP.TwinCATRx.svg?style=plastic)](https://www.nuget.org/packages/CP.TwinCATRx)\n\nA Reactive implementation of TwinCAT ADS\n\nThis is a reactive implementation of TwinCAT ADS. It is based on the TwinCAT ADS library from Beckhoff. \nIt is a wrapper around the TwinCAT ADS library that allows you to use the TwinCAT ADS library in a reactive way. \nIt is based on the Reactive Extensions (Rx) library.\n\nCurrently it does not support the following features:\n- Arrays of string\n- Arrays of string in structures\n\n```c#\n    // Create Client\n    var client = new RxTcAdsClient();\n    var settings = new Settings { AdsAddress = \"5.35.59.10.1.1\", Port = 801, SettingsId = \"Default\" };\n\n    // Add notification variables\n    // Structures\n    settings.AddNotification(\".Tag1\");\n    settings.AddNotification(\".Tag2\");\n    settings.AddNotification(\".Tag3\");\n    settings.AddNotification(\".AString\", arraySize: 80);\n    settings.AddNotification(\".ABool\");\n    settings.AddNotification(\".AByte\");\n    settings.AddNotification(\".AInt\");\n    settings.AddNotification(\".ADInt\");\n    settings.AddNotification(\".AReal\");\n    settings.AddNotification(\".ALReal\");\n\n    // Add Write variables, these can be read too using client.Read(\"TagName\")\n    // NOT SUPPORTED: arrays of string\n    ////settings.AddWriteVariable(\".ArrString\", 11));\n    settings.AddWriteVariable(\".ArrBool\", 11);\n    settings.AddWriteVariable(\".ArrByte\", 11);\n    settings.AddWriteVariable(\".ArrInt\", 11);\n    settings.AddWriteVariable(\".ArrDInt\", 11);\n    settings.AddWriteVariable(\".ArrReal\", 11);\n    settings.AddWriteVariable(\".ArrLReal\", 11);\n    client.Connect(settings);\n\n    // Observe notification tags simple types\n    client.Observe\u003cstring\u003e(\".AString\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cbool\u003e(\".ABool\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cbyte\u003e(\".AByte\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cshort\u003e(\".AInt\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cint\u003e(\".ADInt\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cfloat\u003e(\".AReal\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cdouble\u003e(\".ALReal\").Subscribe(data =\u003e Console.WriteLine(data));\n\n    // Observe Write variables these will execute when tag is read.\n    client.Observe\u003cbool[]\u003e(\".ArrBool\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cbyte[]\u003e(\".ArrByte\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cshort[]\u003e(\".ArrInt\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cint[]\u003e(\".ArrDInt\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cfloat[]\u003e(\".ArrReal\").Subscribe(data =\u003e Console.WriteLine(data));\n    client.Observe\u003cdouble[]\u003e(\".ArrLReal\").Subscribe(data =\u003e Console.WriteLine(data));\n\n    // Ensure the client is initialized before reading or writing\n    client.InitializeComplete().Subscribe(() =\u003e\n    {\n        // Read tags of a simple type\n        client.Read(\".AString\");\n        client.Read(\".ABool\");\n        client.Read(\".AByte\");\n        client.Read(\".AInt\");\n        client.Read(\".ADInt\");\n        client.Read(\".AReal\");\n        client.Read(\".ALReal\");\n\n        // Write a value\n        client.Write(\".ABool\", true);\n    });\n\n    // Create structure to store data\n    var tag1 = client.CreateStruct(\".Tag1\", true);\n    tag1.StructureReady().Subscribe(data =\u003e\n    {\n        // read from structure as stream\n        data.Observe\u003cbool\u003e(\"ABool\").Subscribe(value =\u003e Console.WriteLine(value));\n        data.Observe\u003cshort\u003e(\"AInt\").Subscribe(value =\u003e Console.WriteLine(value));\n        data.Observe\u003cstring\u003e(\"AString\").Subscribe(value =\u003e Console.WriteLine(value));\n\n        // read from structure as one time read from the first level.\n        var tag = data.Value\u003cshort\u003e(\"AInt\");\n\n        data.WriteValues(ht =\u003e\n        {\n            // write values to structure\n            ht.Value(\"AInt\", (short)(tag + 10));\n            ht.Value(\"AString\", $\"Int Value {tag + 10}\");\n            \n            // Values are written from the structure to the PLC upon return.\n        });\n    });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispulman%2Ftwincatrx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrispulman%2Ftwincatrx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispulman%2Ftwincatrx/lists"}