44 lines
1.8 KiB
C#
44 lines
1.8 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests.Mitsubishi;
|
|
|
|
/// <summary>
|
|
/// Tag map for the Mitsubishi MELSEC device class with a representative Modbus Device
|
|
/// Assignment block mapping D0..D1023 → HR[0..1023]. Mirrors the behaviors in
|
|
/// <c>mitsubishi.json</c> pymodbus profile and <c>docs/v2/mitsubishi.md</c>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// MELSEC Modbus sites all have *different* device-assignment parameter blocks; this profile
|
|
/// models the conventional default. Per-model differences (FX5U needs firmware ≥ 1.060 for
|
|
/// Modbus server; QJ71MT91 lacks FC22/FC23; FX/iQ-F use octal X/Y while Q/L/iQ-R use hex)
|
|
/// are handled in <see cref="MelsecAddress"/> (PR 59) and the per-model test files.
|
|
/// </remarks>
|
|
public static class MitsubishiProfile
|
|
{
|
|
/// <summary>
|
|
/// Scratch HR the smoke test writes + reads. Address 200 mirrors the
|
|
/// dl205/s7_1500/standard scratch range so one smoke test pattern works across every
|
|
/// device profile the simulator supports.
|
|
/// </summary>
|
|
public const ushort SmokeHoldingRegister = 200;
|
|
|
|
/// <summary>Value the smoke test writes then reads back.</summary>
|
|
public const short SmokeHoldingValue = 7890;
|
|
|
|
public static ModbusDriverOptions BuildOptions(string host, int port) => new()
|
|
{
|
|
Host = host,
|
|
Port = port,
|
|
UnitId = 1,
|
|
Timeout = TimeSpan.FromSeconds(2),
|
|
Tags =
|
|
[
|
|
new ModbusTagDefinition(
|
|
Name: "Smoke_HReg200",
|
|
Region: ModbusRegion.HoldingRegisters,
|
|
Address: SmokeHoldingRegister,
|
|
DataType: ModbusDataType.Int16,
|
|
Writable: true),
|
|
],
|
|
Probe = new ModbusProbeOptions { Enabled = false },
|
|
};
|
|
}
|