286ab3ba41
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
97 lines
4.5 KiB
C#
97 lines
4.5 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.PlcFamilies;
|
|
|
|
/// <summary>
|
|
/// Per-family libplctag defaults for PCCC PLCs. SLC 500 / MicroLogix / PLC-5 / LogixPccc
|
|
/// (Logix controller accessed via the PLC-5 compatibility layer — rare but real).
|
|
/// </summary>
|
|
public sealed record AbLegacyPlcFamilyProfile(
|
|
string LibplctagPlcAttribute,
|
|
string DefaultCipPath,
|
|
int MaxTagBytes,
|
|
bool SupportsStringFile,
|
|
bool SupportsLongFile,
|
|
bool OctalIoAddressing,
|
|
bool SupportsFunctionFiles,
|
|
bool SupportsPidFile,
|
|
bool SupportsMessageFile,
|
|
bool SupportsPlsFile,
|
|
bool SupportsBlockTransferFile)
|
|
{
|
|
public static AbLegacyPlcFamilyProfile ForFamily(AbLegacyPlcFamily family) => family switch
|
|
{
|
|
AbLegacyPlcFamily.Slc500 => Slc500,
|
|
AbLegacyPlcFamily.MicroLogix => MicroLogix,
|
|
AbLegacyPlcFamily.Plc5 => Plc5,
|
|
AbLegacyPlcFamily.LogixPccc => LogixPccc,
|
|
_ => Slc500,
|
|
};
|
|
|
|
public static readonly AbLegacyPlcFamilyProfile Slc500 = new(
|
|
LibplctagPlcAttribute: "slc500",
|
|
DefaultCipPath: "1,0",
|
|
MaxTagBytes: 240, // SLC 5/05 PCCC max packet data
|
|
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
|
|
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",
|
|
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
|
|
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
|
|
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",
|
|
DefaultCipPath: "1,0",
|
|
MaxTagBytes: 240, // DF1 full-duplex packet limit at 264 bytes, PCCC-over-EIP caps lower
|
|
SupportsStringFile: true,
|
|
SupportsLongFile: false, // PLC-5 predates L files
|
|
OctalIoAddressing: true, // RSLogix 5 displays I:/O: word + bit indices as octal
|
|
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.
|
|
/// Rare but real — some legacy HMI integrations address Logix controllers as if they were
|
|
/// PLC-5 via the PCCC-passthrough mechanism.
|
|
/// </summary>
|
|
public static readonly AbLegacyPlcFamilyProfile LogixPccc = new(
|
|
LibplctagPlcAttribute: "logixpccc",
|
|
DefaultCipPath: "1,0",
|
|
MaxTagBytes: 240,
|
|
SupportsStringFile: true,
|
|
SupportsLongFile: true,
|
|
OctalIoAddressing: false, // Logix natively uses decimal arrays even via the PCCC bridge
|
|
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>
|
|
public enum AbLegacyPlcFamily
|
|
{
|
|
Slc500,
|
|
MicroLogix,
|
|
Plc5,
|
|
LogixPccc,
|
|
}
|