Auto: ablegacy-5 — PD/MG/PLS/BT structure files

Adds PD (PID), MG (Message), PLS (Programmable Limit Switch) and BT
(Block Transfer) file types to the PCCC parser. New AbLegacyDataType
enum members (PidElement / MessageElement / PlsElement /
BlockTransferElement) plus per-type sub-element catalogue:

  - PD: SP/PV/CV/KP/KI/KD/MAXS/MINS/DB/OUT as Float32; EN/DN/MO/PE/
        AUTO/MAN/SP_VAL/SP_LL/SP_HL as Boolean (word-0 status bits).
  - MG: RBE/MS/SIZE/LEN as Int32; EN/EW/ER/DN/ST/CO/NR/TO as Boolean.
  - PLS: LEN as Int32 (bit table varies per PLC).
  - BT: RLEN/DLEN as Int32; EN/ST/DN/ER/CO/EW/TO/NR as Boolean.

Per-family flags on AbLegacyPlcFamilyProfile gate availability:

  - PD/MG: SLC500 + PLC-5 (operator + status bits both present).
  - PLS/BT: PLC-5 only (chassis-IO block transfer is PLC-5-specific).
  - MicroLogix + LogixPccc: rejected — no legacy file-letter form.

Status-bit indices match Rockwell DTAM / 1747-RM001 / 1785-6.5.12:
PD word 0 bits 0-8, MG/BT word 0 bits 8-15. PLC-set status bits
(PE/DN/SP_*; ST/DN/ER/CO/EW/NR/TO) are surfaced as ViewOnly via
IsPlcSetStatusBit, matching the Timer/Counter/Control pattern from
ablegacy-3.

LibplctagLegacyTagRuntime decodes PD non-bit members as Float32 and
MG/BT/PLS non-bit members as Int32; status bits route through GetBit
with the bit-position encoded by the driver via StatusBitIndex.

Tests: parser positive cases per family + negative cases per family,
catalogue + bit-index + read-only-bit assertions.

Closes #248
This commit is contained in:
Joseph Doherty
2026-04-25 19:08:51 -04:00
parent 5ca2ad83cd
commit 286ab3ba41
5 changed files with 365 additions and 6 deletions
@@ -11,7 +11,11 @@ public sealed record AbLegacyPlcFamilyProfile(
bool SupportsStringFile,
bool SupportsLongFile,
bool OctalIoAddressing,
bool SupportsFunctionFiles)
bool SupportsFunctionFiles,
bool SupportsPidFile,
bool SupportsMessageFile,
bool SupportsPlsFile,
bool SupportsBlockTransferFile)
{
public static AbLegacyPlcFamilyProfile ForFamily(AbLegacyPlcFamily family) => family switch
{
@@ -29,7 +33,11 @@ public sealed record AbLegacyPlcFamilyProfile(
SupportsStringFile: true, // ST file available SLC 5/04+
SupportsLongFile: true, // L file available SLC 5/05+
OctalIoAddressing: false, // SLC500 I:/O: indices are decimal in RSLogix 500
SupportsFunctionFiles: false); // SLC500 has no function files
SupportsFunctionFiles: false, // SLC500 has no function files
SupportsPidFile: true, // SLC 5/02+ supports PD via PID instruction
SupportsMessageFile: true, // SLC 5/02+ supports MG via MSG instruction
SupportsPlsFile: false, // SLC500 has no native PLS file (uses SQO/SQC instead)
SupportsBlockTransferFile: false); // SLC500 has no BT file (BT is PLC-5 ChassisIO only)
public static readonly AbLegacyPlcFamilyProfile MicroLogix = new(
LibplctagPlcAttribute: "micrologix",
@@ -38,7 +46,11 @@ public sealed record AbLegacyPlcFamilyProfile(
SupportsStringFile: true,
SupportsLongFile: false, // ML 1100/1200/1400 don't ship L files
OctalIoAddressing: false, // MicroLogix follows SLC-style decimal I/O addressing
SupportsFunctionFiles: true); // ML 1100/1400 expose RTC/HSC/DLS/MMI/PTO/PWM/STI/EII/IOS/BHI
SupportsFunctionFiles: true, // ML 1100/1400 expose RTC/HSC/DLS/MMI/PTO/PWM/STI/EII/IOS/BHI
SupportsPidFile: false, // MicroLogix 1100/1400 use PID-instruction-only addressing — no PD file type
SupportsMessageFile: false, // No MG file — MSG instruction control words live in standard files
SupportsPlsFile: false,
SupportsBlockTransferFile: false);
public static readonly AbLegacyPlcFamilyProfile Plc5 = new(
LibplctagPlcAttribute: "plc5",
@@ -47,7 +59,11 @@ public sealed record AbLegacyPlcFamilyProfile(
SupportsStringFile: true,
SupportsLongFile: false, // PLC-5 predates L files
OctalIoAddressing: true, // RSLogix 5 displays I:/O: word + bit indices as octal
SupportsFunctionFiles: false);
SupportsFunctionFiles: false,
SupportsPidFile: true, // PLC-5 PID instruction needs PD file
SupportsMessageFile: true, // PLC-5 MSG instruction needs MG file
SupportsPlsFile: true, // PLC-5 has PLS (programmable limit switch) file
SupportsBlockTransferFile: true); // PLC-5 chassis I/O block transfer (BTR/BTW) needs BT file
/// <summary>
/// Logix ControlLogix / CompactLogix accessed through the legacy PCCC compatibility layer.
@@ -61,7 +77,13 @@ public sealed record AbLegacyPlcFamilyProfile(
SupportsStringFile: true,
SupportsLongFile: true,
OctalIoAddressing: false, // Logix natively uses decimal arrays even via the PCCC bridge
SupportsFunctionFiles: false);
SupportsFunctionFiles: false,
// Logix native UDTs (PID_ENHANCED / MESSAGE) replace the legacy PD/MG file types — the
// PCCC bridge does not expose them as letter-prefixed files.
SupportsPidFile: false,
SupportsMessageFile: false,
SupportsPlsFile: false,
SupportsBlockTransferFile: false);
}
/// <summary>Which PCCC PLC family the device is.</summary>