问题标签 [twincat-ads-.net]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 如何从 TwinCat 读取包含结构数组的结构到 C#
使用 TwinCAT 3 ADS.Net 从 PLC 读取,我试图读取包含结构数组的结构,但 ReadAny 命令因“无法编组类型”异常而崩溃。
不过,直接读取结构数组可以正常工作。
ReadAny 方法的头部注释说:“如果要读取的对象的 Type 是数组类型,则必须在参数 args 中指定每个维度的元素数。”
但是对于包含结构数组的结构,args 应该是什么?(没有 'args' 它也会失败。)
我目前使用 .NET 4.7、VS 2013。
有选择吗?
c# - 使用 ADS.NET 从 TwinCAT PLC 读取字符串返回 ???? 数据后
我正在尝试使用 WinForm 和 ADS.NET 从 TwinCAT PLC 读取字符串数据。我的代码基于他们的示例代码。将字符串写入控制台显示我的数据为:“123456????????????????????????”。我可以使用文本框,它会显示并保存“123456”,但我想直接保存它而不使用文本框。
我究竟做错了什么?还是我的代码中缺少某些内容?
谢谢!
附加信息:
(我正在尝试将数据保存到数据库中):
代码:
twincat - 如何以编程方式在 Twincat 中添加 ADS 路由
如何以编程方式添加广告路由?
我只能通过 TcAmsRemoteMgr.exe 添加路由。我只能找到的代码是https://github.com/nikvoronin/AdsRemote。
但是,它似乎不起作用。
c# - 自动重新创建 PollValuesPLC 连接丢失或 PLC 程序上传后
我正在尝试编写 C# 应用程序,当应用程序与 PLC 失去连接或将下载新版本的 PLC 程序时,ADS 客户端将自动重新连接/更新读取/写入值和订阅。
我正在使用来自 NuGet 的TwinCAT.Ads.Reactive v4.4.0库。
我的程序流程是:
连接ADS服务器(连接成功)=>
- 使用ValueSymbolExtensions.WhenValueChanged创建反应式通知
创建反应循环写入值ValueSymbolExtensions.WriteValues
- 3[a] 创建响应式循环轮询值AnyTypeExtensions.PollValues.T
- 3[b] 我也尝试过 ValueSymbolExtensions.PollValues,这在 Beckhoff 网站上尚未记录
到目前为止,我发现即使我拔下以太网电缆或将新程序下载到 PLC,1. 和 2. 也能正常工作 -> WriteValues() 和 WhenValueChanged() 在内部自我更新
代码:
我每隔一秒读取一次PollValues()自定义数据结构。在正常运行期间,这工作正常,但是在我更改 PLC 程序并将更改下载到 PLC 或连接丢失(拔下以太网电缆)后,此订阅在内部失败,并且不会像上面的那样恢复。
ConnectionStateChanged
此外,仅当我在广告客户端上调用 Connect()/Disconnect() 时才会触发连接状态更改事件,而不是在连接问题时触发。知道如何找出连接问题吗?
c# - Read variables in Twincat 3 continously with the C# API
I want to read a lot of variables continuously (faster than 10 Hz) via the ADS client of C#. However, in the documentation the examples only read the variables one time.
I found the Twincat-OCX module that has this functionality, but it is used for Twincat 2.
What is the recommended way for Twincat3 while using c#?
c# - Reading properties from TwinCAT function blocks using c#
We are using a C# application to read variables from a Beckhoff PLC through TwinCAT ADS v.3. If we attempt to utilize the same code to read properties the code fails with an exception.
When trying to create a variable handle using the above code, we receive TwinCAT.Ads.AdsErrorException: 'Ads-Error 0x710 : Symbol could not be found.'
.
Since we knew that METHOD
must be marked with {attribute 'TcRpcEnable'}
so it can be called with this code:
We attempted to use that attribute {attribute 'TcRpcEnable'}
on the property as well. Using TcAdsClient.CreateSymbolLoader
and looping over all available symbols we discovered that the getter/setter of the property were then marked as rpc-methods.
But try as we might, we cannot invoke the rpc method:
Any suggestion on how we can read/write variables defined as properties on function blocks?
twincat-ads - 如何在没有 Twincat 系统应用程序的情况下在 WINdows 中创建 Twincat ADS 路由?
我有一个带有 Twincat ADS 库的 Windows 应用程序来监控 PLC。据我所知,该库仅在使用 Twincat 工具在 Windows 计算机中创建 ADS 路由后才能工作。您知道是否可以在没有 Twincat 系统工具应用程序的情况下创建路线?
ads - ADS 符号组和偏移量与 ADS 信息不匹配
我正在尝试使用变量的 IndexGroup 和 IndexOffset 通过 ADS 客户端访问来自 PLC 输入变量的数据。我使用 SymbolLoaderFactory 来访问符号。使用该符号,我可以使用 ADS 客户端读取它的数据。但是,我想通过它的 IndexGroup 和 IndexOffset 来读取它的数据。当我使用符号的 IndexGroup 和 IndexOffset 时,我无法获得预期的数据。IndexGroup 和 IndexOffset(和端口)与我在 TwinCAT 中看到的变量不匹配。为什么他们不匹配?如何获得正确的 IndexGroup 和 IndexOffset 以便正确读取数据?
附加细节:我创建了一个名为 MAIN.Input1 的 PLC 变量。TwinCAT 中定义的 ADS Info 是 Port: 350, IGrp: 0x8502000, IOffs: 0x8005DFEA, Len: 1
使用 SymbolLoaderFactory(客户端在端口 851 上),MAIN.Input1 符号表示它有一个 IndexGroup 和 IndexOffset 的 IGrp: 0x0000F020, IOffs: 0x0005DFEA
twincat-ads-.net - TwinCAT 数据类型的 C# 等效枚举
我需要为 TwinCAT 数据类型编写枚举吗?还是它们存在于某个地方而我只是找不到它们?
示例:有一个名为 的数据类型MC_HomingMode
,它定义了如何执行归位。我想通过 ADS 控制它,所以我需要一个枚举。没找到。
谢谢
remote-desktop - 具有 TwinCAT XAR 的简单 PC(Windows 10)能否用作具有 TwinCAT 3 XAE 的主机中的目标?
我想知道我是否可以使用安装了 TwinCAT XAR 的 Windows 10 操作系统的系统(运行时 pc)作为远程系统。换句话说,我可以选择它作为目标吗?我们是否需要任何额外的设置才能使其工作,或者它会像任何其他硬件控制器一样工作?