fix(ablegacy): #984 review — MicroLogix profile supports L files
MicroLogix 1100/1200/1400/1500 all have L (32-bit integer) files (only the ML 1000 lacks them, and the family flag cannot tell it apart — an ML 1000 refuses an L read itself, per tag). SupportsLongFile: false made the P-5 per-tag rule refuse every Long tag on the family the parser, coalescer and L-bit RMW already handle. The per-tag rejection tests now pin PLC-5, the one family without L files. Pending hardware confirmation: one L-tag read on an ML 1400 (Vitamine press fleet).
This commit is contained in:
@@ -27,16 +27,18 @@ fixture coverage map, see [AbLegacy-Test-Fixture.md](AbLegacy-Test-Fixture.md).
|
||||
Per family the `AbLegacyPlcFamilyProfile` supplies the libplctag `plc` attribute,
|
||||
default CIP path, max-payload bytes, and the `SupportsStringFile` /
|
||||
`SupportsLongFile` capability flags. MicroLogix uses direct EIP (empty default
|
||||
path); MicroLogix and PLC-5 don't ship L-files; PLC-5 predates them entirely.
|
||||
path); PLC-5 predates L-files and is the only family without them. MicroLogix 1100/1200/1400/1500 ship L files (#984
|
||||
review — only the ML 1000 lacks them, and the family flag cannot tell it apart, so an ML 1000 answers an L read with
|
||||
its own PCCC refusal, per tag).
|
||||
Tag types are validated against the device's profile — declaring a `Long` or
|
||||
`String` tag on a family that can't support it is **that tag's** configuration
|
||||
error (review 2026-12-02 P-5): init still succeeds, the tag reads and writes
|
||||
`BadConfigurationError` without touching the wire, one Warning is logged, and the tag
|
||||
appears in the skipped-tag report. The deploy gate (`AbLegacyTagDefinitionFactory.Inspect`
|
||||
with the device's `PlcFamily`, same `AbLegacyPlcFamilyProfile.UnsupportedDataTypeReason`
|
||||
authority) warns earlier. Note the MicroLogix profile says `SupportsLongFile: false`;
|
||||
MicroLogix 1100/1400 may in fact ship L files (product knowledge, unverified on
|
||||
hardware here) — flipping the flag is a one-line change once a real controller confirms.
|
||||
authority) warns earlier. The MicroLogix profile said `SupportsLongFile: false` until the #984 review, which refused
|
||||
every `Long` tag on the family; it is now `true` per Rockwell's MicroLogix 1100/1200/1400/1500 documentation. ⚠️ Not yet
|
||||
hardware-confirmed: a read of one authored `L` tag on an ML 1400 (Vitamine press fleet) is the pending gate.
|
||||
|
||||
## Capability Surface
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public enum AbLegacyDataType
|
||||
Bit,
|
||||
/// <summary>N-file integer (signed 16-bit).</summary>
|
||||
Int,
|
||||
/// <summary>L-file long integer — SLC 5/05+ only (signed 32-bit).</summary>
|
||||
/// <summary>L-file long integer (signed 32-bit) — SLC 5/05+, MicroLogix 1100/1200/1400/1500 (not ML 1000), Logix PCCC; not PLC-5.</summary>
|
||||
Long,
|
||||
/// <summary>F-file float (32-bit IEEE-754).</summary>
|
||||
Float,
|
||||
|
||||
@@ -72,7 +72,11 @@ public sealed record AbLegacyPlcFamilyProfile(
|
||||
DefaultCipPath: "", // MicroLogix 1100/1400 use direct EIP, no backplane path
|
||||
MaxTagBytes: 232,
|
||||
SupportsStringFile: true,
|
||||
SupportsLongFile: false, // ML 1100/1200/1400 don't ship L files
|
||||
// #984 review: MicroLogix 1100/1200/1400/1500 all have L (32-bit integer) files — only the ML 1000 lacks them,
|
||||
// and the family cannot tell the two apart, so the profile allows L and an ML 1000 answers the read itself
|
||||
// (a PCCC refusal, per tag). It used to say false, refusing L tags the parser, coalescer and L-bit RMW
|
||||
// already handle. Pending a hardware read of one L tag on an ML 1400 (Vitamine press fleet).
|
||||
SupportsLongFile: true,
|
||||
SupportsFunctionFiles: true); // ML 1100/1400 expose RTC/HSC/DLS/MMI/PTO/PWM/STI/EII/IOS/BHI
|
||||
|
||||
public static readonly AbLegacyPlcFamilyProfile Plc5 = new(
|
||||
|
||||
@@ -250,7 +250,7 @@ public sealed partial class AbLegacyDriver : IDriver, IReadable, IWritable, ITag
|
||||
};
|
||||
tags[entry.RawPath] = resolved;
|
||||
|
||||
// A data type the owning device's PLC family does not ship (an L-file Long on a MicroLogix, an ST-file
|
||||
// A data type the owning device's PLC family does not ship (an L-file Long on a PLC-5, an ST-file
|
||||
// String on a family without one) is THIS TAG's configuration error — it reads/writes
|
||||
// BadConfigurationError and is reported in the skipped-tag ledger — never a reason to fault every other
|
||||
// tag and device of the instance (review 2026-12-02 P-5). The deploy gate says the same thing earlier
|
||||
|
||||
@@ -89,7 +89,7 @@ public sealed class AbLegacyDriverTests
|
||||
AbLegacyPlcFamilyProfile.Slc500.DefaultCipPath.ShouldBe("1,0");
|
||||
|
||||
AbLegacyPlcFamilyProfile.MicroLogix.DefaultCipPath.ShouldBe("");
|
||||
AbLegacyPlcFamilyProfile.MicroLogix.SupportsLongFile.ShouldBeFalse();
|
||||
AbLegacyPlcFamilyProfile.MicroLogix.SupportsLongFile.ShouldBeTrue(); // ML 1100/1200/1400/1500 have L files (#984 review)
|
||||
|
||||
AbLegacyPlcFamilyProfile.Plc5.LibplctagPlcAttribute.ShouldBe("plc5");
|
||||
AbLegacyPlcFamilyProfile.Plc5.SupportsLongFile.ShouldBeFalse();
|
||||
@@ -165,25 +165,26 @@ public sealed class AbLegacyDriverTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Long tag on a MicroLogix is THAT TAG's configuration error and must not fault the whole instance (review
|
||||
/// 2026-12-02 P-5; this test used to pin the throw). Init succeeds, the tag reads BadConfigurationError, and the
|
||||
/// skipped-tag ledger names it.
|
||||
/// #984 review: a Long tag on a MicroLogix is ACCEPTED. MicroLogix 1100/1200/1400/1500 all have L (32-bit integer)
|
||||
/// files (only the ML 1000 lacks them); the profile used to say otherwise and refused every L tag on the family
|
||||
/// the driver's own parser, coalescer and L-bit RMW already handle. The per-tag rejection rule is pinned on PLC-5.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task Long_tag_on_MicroLogix_device_is_rejected_per_tag_not_at_init()
|
||||
public async Task Long_tag_on_MicroLogix_device_is_accepted()
|
||||
{
|
||||
var factory = new FakeAbLegacyTagFactory { Customise = p => new FakeAbLegacyTag(p) { Value = 70000 } };
|
||||
var drv = new AbLegacyDriver(new AbLegacyDriverOptions
|
||||
{
|
||||
Devices = [new AbLegacyDeviceOptions("ab://10.0.0.5/", AbLegacyPlcFamily.MicroLogix)],
|
||||
RawTags = AbLegacyRawTags.Entries([new AbLegacyTagDefinition("X", "ab://10.0.0.5/", "L9:0", AbLegacyDataType.Long)]),
|
||||
Probe = new AbLegacyProbeOptions { Enabled = false },
|
||||
}, "drv-1", new FakeAbLegacyTagFactory());
|
||||
}, "drv-1", factory);
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
drv.GetHealth().State.ShouldBe(DriverState.Healthy);
|
||||
(await drv.ReadAsync(["X"], CancellationToken.None)).Single().StatusCode.ShouldBe(AbLegacyStatusMapper.BadConfigurationError);
|
||||
drv.GetSkippedTags()!.Sample.ShouldContain(t => t.RawPath == "X");
|
||||
(await drv.ReadAsync(["X"], CancellationToken.None)).Single().StatusCode.ShouldBe(AbLegacyStatusMapper.Good);
|
||||
drv.GetSkippedTags()?.Sample.ShouldNotContain(t => t.RawPath == "X");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that long tag on SLC 500 device is accepted.</summary>
|
||||
|
||||
+14
-13
@@ -15,7 +15,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests;
|
||||
public sealed class AbLegacyReview20261202Tests
|
||||
{
|
||||
private const string Slc = "ab://10.0.0.5/1,0";
|
||||
private const string Ml = "ab://10.0.0.6/";
|
||||
private const string Plc5 = "ab://10.0.0.6/1,0";
|
||||
|
||||
private static AbLegacyDriver NewDriver(
|
||||
FakeAbLegacyTagFactory factory, IReadOnlyList<AbLegacyDeviceOptions> devices,
|
||||
@@ -31,16 +31,17 @@ public sealed class AbLegacyReview20261202Tests
|
||||
// ---- P-5 ----
|
||||
|
||||
[Fact]
|
||||
public async Task P5_one_Long_tag_on_a_MicroLogix_does_not_fault_the_other_devices_or_tags()
|
||||
public async Task P5_one_Long_tag_on_a_Plc5_does_not_fault_the_other_devices_or_tags()
|
||||
{
|
||||
var factory = new FakeAbLegacyTagFactory { Customise = p => new FakeAbLegacyTag(p) { Value = 7 } };
|
||||
var drv = NewDriver(factory,
|
||||
[new AbLegacyDeviceOptions(Slc), new AbLegacyDeviceOptions(Ml, AbLegacyPlcFamily.MicroLogix)],
|
||||
// PLC-5 has no L files (since the #984 review MicroLogix does — the rule is exercised on PLC-5).
|
||||
[new AbLegacyDeviceOptions(Slc), new AbLegacyDeviceOptions(Plc5, AbLegacyPlcFamily.Plc5)],
|
||||
null,
|
||||
new AbLegacyTagDefinition("Good", Slc, "N7:0", AbLegacyDataType.Int),
|
||||
new AbLegacyTagDefinition("LongOnSlc", Slc, "L9:0", AbLegacyDataType.Long), // positive control: SLC has L files
|
||||
new AbLegacyTagDefinition("GoodMl", Ml, "N7:1", AbLegacyDataType.Int),
|
||||
new AbLegacyTagDefinition("LongOnMl", Ml, "L9:0", AbLegacyDataType.Long));
|
||||
new AbLegacyTagDefinition("GoodMl", Plc5, "N7:1", AbLegacyDataType.Int),
|
||||
new AbLegacyTagDefinition("LongOnMl", Plc5, "L9:0", AbLegacyDataType.Long));
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None); // used to throw and fault every device
|
||||
|
||||
@@ -52,7 +53,7 @@ public sealed class AbLegacyReview20261202Tests
|
||||
r[3].StatusCode.ShouldBe(AbLegacyStatusMapper.BadConfigurationError);
|
||||
r[3].Value.ShouldBeNull();
|
||||
factory.Tags.ContainsKey("L9:0").ShouldBeTrue(); // the SLC's Long created its runtime ...
|
||||
drv.GetDeviceState(Ml)!.Runtimes.ContainsKey("LongOnMl").ShouldBeFalse(); // ... the rejected one never did
|
||||
drv.GetDeviceState(Plc5)!.Runtimes.ContainsKey("LongOnMl").ShouldBeFalse(); // ... the rejected one never did
|
||||
|
||||
var report = drv.GetSkippedTags()!;
|
||||
report.SkippedCount.ShouldBe(1);
|
||||
@@ -64,20 +65,20 @@ public sealed class AbLegacyReview20261202Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void P5_deploy_gate_flags_a_Long_on_a_MicroLogix_only_when_the_family_is_known()
|
||||
public void P5_deploy_gate_flags_a_Long_on_a_Plc5_only_when_the_family_is_known()
|
||||
{
|
||||
const string longCfg = """{"address":"L9:0","dataType":"Long"}""";
|
||||
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, AbLegacyPlcFamily.MicroLogix)
|
||||
.ShouldContain(w => w.Contains("Long") && w.Contains("MicroLogix") && w.Contains("BadConfigurationError"));
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, AbLegacyPlcFamily.Plc5).ShouldNotBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, AbLegacyPlcFamily.Plc5)
|
||||
.ShouldContain(w => w.Contains("Long") && w.Contains("Plc5") && w.Contains("BadConfigurationError"));
|
||||
|
||||
// Controls: a family that ships L files, an unknown family and the family-less overload stay clean; and an
|
||||
// Int on a MicroLogix is not touched.
|
||||
// Controls: families that ship L files (SLC 500, and MicroLogix since the #984 review), an unknown family and
|
||||
// the family-less overload stay clean; and an Int on a PLC-5 is not touched.
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, AbLegacyPlcFamily.Slc500).ShouldBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, AbLegacyPlcFamily.MicroLogix).ShouldBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg, family: null).ShouldBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect(longCfg).ShouldBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect("""{"address":"N7:0","dataType":"Int"}""", AbLegacyPlcFamily.MicroLogix).ShouldBeEmpty();
|
||||
AbLegacyTagDefinitionFactory.Inspect("""{"address":"N7:0","dataType":"Int"}""", AbLegacyPlcFamily.Plc5).ShouldBeEmpty();
|
||||
}
|
||||
|
||||
// ---- P-14 ----
|
||||
|
||||
Reference in New Issue
Block a user