45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests.S7;
|
|
|
|
/// <summary>
|
|
/// Tag map for the Siemens SIMATIC S7-1500 device class with the <c>MB_SERVER</c> library
|
|
/// block mapping HR[0..] to DB1.DBW0+. Mirrors <c>s7_1500.json</c> in <c>Pymodbus/</c>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Unlike DL205, S7 has no fixed Modbus memory map — every site wires MB_SERVER to a
|
|
/// different DB. The profile here models the *default* user layout documented in
|
|
/// <c>docs/v2/s7.md</c> §per-model-matrix: DB1.DBW0 = fingerprint marker, a scratch HR
|
|
/// range 200..209 for write-roundtrip tests, and ABCD-order Float32 / Int32 markers at
|
|
/// HR[100..101] and HR[300..301] to prove the driver's S7 profile default is correct.
|
|
/// </remarks>
|
|
public static class S7_1500Profile
|
|
{
|
|
/// <summary>
|
|
/// Scratch HR the smoke test writes + reads. Address 200 mirrors the DL205 /
|
|
/// standard scratch range so one smoke test pattern works across all device profiles.
|
|
/// </summary>
|
|
public const ushort SmokeHoldingRegister = 200;
|
|
|
|
/// <summary>Value the smoke test writes then reads back.</summary>
|
|
public const short SmokeHoldingValue = 4321;
|
|
|
|
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),
|
|
],
|
|
// Disable the background probe loop — integration tests drive reads explicitly and
|
|
// the probe would race with assertions.
|
|
Probe = new ModbusProbeOptions { Enabled = false },
|
|
};
|
|
}
|