42 lines
1.6 KiB
C#
42 lines
1.6 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT;
|
|
|
|
/// <summary>
|
|
/// TwinCAT ADS driver configuration. One instance supports N targets (each identified by
|
|
/// an AMS Net ID + port). Compiles + runs without a local AMS router but every wire call
|
|
/// fails with <c>BadCommunicationError</c> until a router is reachable.
|
|
/// </summary>
|
|
public sealed class TwinCATDriverOptions
|
|
{
|
|
public IReadOnlyList<TwinCATDeviceOptions> Devices { get; init; } = [];
|
|
public IReadOnlyList<TwinCATTagDefinition> Tags { get; init; } = [];
|
|
public TwinCATProbeOptions Probe { get; init; } = new();
|
|
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
|
|
}
|
|
|
|
/// <summary>
|
|
/// One TwinCAT target. <paramref name="HostAddress"/> must parse via
|
|
/// <see cref="TwinCATAmsAddress.TryParse"/>; misconfigured devices fail driver initialisation.
|
|
/// </summary>
|
|
public sealed record TwinCATDeviceOptions(
|
|
string HostAddress,
|
|
string? DeviceName = null);
|
|
|
|
/// <summary>
|
|
/// One TwinCAT-backed OPC UA variable. <paramref name="SymbolPath"/> is the full TwinCAT
|
|
/// symbolic name (e.g. <c>MAIN.bStart</c>, <c>GVL.Counter</c>, <c>Motor1.Status.Running</c>).
|
|
/// </summary>
|
|
public sealed record TwinCATTagDefinition(
|
|
string Name,
|
|
string DeviceHostAddress,
|
|
string SymbolPath,
|
|
TwinCATDataType DataType,
|
|
bool Writable = true,
|
|
bool WriteIdempotent = false);
|
|
|
|
public sealed class TwinCATProbeOptions
|
|
{
|
|
public bool Enabled { get; init; } = true;
|
|
public TimeSpan Interval { get; init; } = TimeSpan.FromSeconds(5);
|
|
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
|
|
}
|