399257377b
Closes #256
105 lines
5.1 KiB
C#
105 lines
5.1 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);
|
|
|
|
/// <remarks>
|
|
/// PR ablegacy-13 / #256 — PLC-5 is the only family that supports the 1756-DHRIO DH+
|
|
/// bridging form (CIP path <c>1,<slot>,2,<station-octal></c>). The DHRIO
|
|
/// module only speaks DH+ to PLC-5 / SLC-DH+ peers, and libplctag's PCCC stack only
|
|
/// exposes the PLC-5 side. SLC500 / MicroLogix / LogixPccc devices addressed through a
|
|
/// DHRIO path are rejected at <c>AbLegacyDriver.InitializeAsync</c> time. See
|
|
/// <c>docs/drivers/AbLegacy-DH-Bridging.md</c> for the full DH+ syntax + smoke procedure.
|
|
/// </remarks>
|
|
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,
|
|
}
|