Auto: abcip-2.6 — AOI input/output handling
AOI-aware browse paths: AOI instances now fan out under directional sub-folders (Inputs/, Outputs/, InOut/) instead of a flat layout. The sub-folders only appear when at least one member carries a non-Local AoiQualifier, so plain UDT tags keep the pre-2.6 flat structure. - Add AoiQualifier enum (Local / Input / Output / InOut) + new property on AbCipStructureMember (defaults to Local). - L5K parser learns ADD_ON_INSTRUCTION_DEFINITION blocks; PARAMETER entries' Usage attribute flows through L5kMember.Usage. - L5X parser captures the Usage attribute on <Parameter> elements. - L5kIngest maps Usage strings (Input/Output/InOut) to AoiQualifier; null + unknown values map to Local. - AbCipDriver.DiscoverAsync groups directional members under Inputs / Outputs / InOut sub-folders when any member is non-Local. - Tests for L5K AOI block parsing, L5X Usage capture, ingest mapping (both formats), and AOI-vs-plain UDT discovery fan-out. Closes #234
This commit is contained in:
@@ -167,6 +167,83 @@ public sealed class AbCipUdtMemberTests
|
||||
builder.Variables.ShouldContain(v => v.BrowseName == "EmptyUdt");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AOI_typed_tag_groups_members_under_directional_subfolders()
|
||||
{
|
||||
// PR abcip-2.6 — when any member carries a non-Local AoiQualifier, the tag is treated
|
||||
// as an AOI instance: Input / Output / InOut members get grouped under sub-folders so
|
||||
// the browse tree mirrors Studio 5000's AOI parameter tabs. Plain UDT tags (every member
|
||||
// Local) keep the pre-2.6 flat layout.
|
||||
var builder = new RecordingBuilder();
|
||||
var drv = new AbCipDriver(new AbCipDriverOptions
|
||||
{
|
||||
Devices = [new AbCipDeviceOptions("ab://10.0.0.5/1,0")],
|
||||
Tags =
|
||||
[
|
||||
new AbCipTagDefinition(
|
||||
Name: "Valve_001",
|
||||
DeviceHostAddress: "ab://10.0.0.5/1,0",
|
||||
TagPath: "Valve_001",
|
||||
DataType: AbCipDataType.Structure,
|
||||
Members:
|
||||
[
|
||||
new AbCipStructureMember("Cmd", AbCipDataType.Bool, AoiQualifier: AoiQualifier.Input),
|
||||
new AbCipStructureMember("Status", AbCipDataType.DInt, Writable: false, AoiQualifier: AoiQualifier.Output),
|
||||
new AbCipStructureMember("Buffer", AbCipDataType.DInt, AoiQualifier: AoiQualifier.InOut),
|
||||
new AbCipStructureMember("LocalVar", AbCipDataType.DInt, AoiQualifier: AoiQualifier.Local),
|
||||
]),
|
||||
],
|
||||
}, "drv-1");
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
await drv.DiscoverAsync(builder, CancellationToken.None);
|
||||
|
||||
// Sub-folders for each directional bucket land in the recorder; the AOI parent folder
|
||||
// and the Local member's lack of a sub-folder confirm only directional members get
|
||||
// bucketed. Folder names are intentionally simple (Inputs / Outputs / InOut) — clients
|
||||
// that browse "Valve_001/Inputs/Cmd" see exactly that path.
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldContain("Valve_001");
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldContain("Inputs");
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldContain("Outputs");
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldContain("InOut");
|
||||
|
||||
// Variables emitted under the right full names — full reference still {Tag}.{Member}
|
||||
// so the read/write paths stay unchanged from the flat-UDT case.
|
||||
var variables = builder.Variables.Select(v => (v.BrowseName, v.Info.FullName)).ToList();
|
||||
variables.ShouldContain(("Cmd", "Valve_001.Cmd"));
|
||||
variables.ShouldContain(("Status", "Valve_001.Status"));
|
||||
variables.ShouldContain(("Buffer", "Valve_001.Buffer"));
|
||||
variables.ShouldContain(("LocalVar", "Valve_001.LocalVar"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Plain_UDT_keeps_flat_layout_when_every_member_is_Local()
|
||||
{
|
||||
// Plain UDTs (no Usage attributes anywhere) stay on the pre-2.6 flat layout — no
|
||||
// Inputs/Outputs/InOut sub-folders should appear since there are no directional members.
|
||||
var builder = new RecordingBuilder();
|
||||
var drv = new AbCipDriver(new AbCipDriverOptions
|
||||
{
|
||||
Devices = [new AbCipDeviceOptions("ab://10.0.0.5/1,0")],
|
||||
Tags =
|
||||
[
|
||||
new AbCipTagDefinition("Tank1", "ab://10.0.0.5/1,0", "Tank1", AbCipDataType.Structure,
|
||||
Members:
|
||||
[
|
||||
new AbCipStructureMember("Level", AbCipDataType.Real),
|
||||
new AbCipStructureMember("Pressure", AbCipDataType.Real),
|
||||
]),
|
||||
],
|
||||
}, "drv-1");
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
await drv.DiscoverAsync(builder, CancellationToken.None);
|
||||
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldNotContain("Inputs");
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldNotContain("Outputs");
|
||||
builder.Folders.Select(f => f.BrowseName).ShouldNotContain("InOut");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UDT_members_mixed_with_flat_tags_coexist()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user