2026-02-27 16:58:02 +08:00
|
|
|
|
namespace MembranePoreTester.Communication
|
|
|
|
|
|
{
|
|
|
|
|
|
public class PlcConfiguration
|
|
|
|
|
|
{
|
|
|
|
|
|
public string IpAddress { get; set; }
|
|
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
|
public byte SlaveId { get; set; } = 1; // 从站地址,默认1
|
|
|
|
|
|
public ushort PressureRegister { get; set; }
|
|
|
|
|
|
public ushort WetFlowRegister { get; set; }
|
|
|
|
|
|
public ushort DryFlowRegister { get; set; }
|
|
|
|
|
|
public double PressureFactor { get; set; } = 1.0;
|
|
|
|
|
|
public double WetFlowFactor { get; set; } = 1.0;
|
|
|
|
|
|
public double DryFlowFactor { get; set; } = 1.0;
|
2026-03-19 20:40:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ushort PressureRegisterStation1 { get; set; }
|
|
|
|
|
|
public ushort PressureRegisterStation2 { get; set; }
|
|
|
|
|
|
public ushort PressureRegisterStation3 { get; set; }
|
|
|
|
|
|
public ushort PressureModeRegister { get; set; }
|
|
|
|
|
|
public ushort PressCoil { get; set; }
|
|
|
|
|
|
public ushort StartCoil { get; set; }
|
|
|
|
|
|
public ushort EnableCoil { get; set; }
|
|
|
|
|
|
public ushort StopCoil { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-27 16:58:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface IPlcService
|
|
|
|
|
|
{
|
2026-03-19 20:40:54 +08:00
|
|
|
|
Task<float> ReadPressureAsync(int stationId); // 按工位读取压力
|
2026-02-27 16:58:02 +08:00
|
|
|
|
Task<float> ReadWetFlowAsync();
|
|
|
|
|
|
Task<float> ReadDryFlowAsync();
|
2026-03-19 20:40:54 +08:00
|
|
|
|
Task WriteCoilAsync(ushort coilAddress, bool value); // 写线圈
|
|
|
|
|
|
Task WriteRegisterAsync(ushort registerAddress, ushort value); // 写寄存器
|
|
|
|
|
|
|
|
|
|
|
|
Task<bool> ReadCoilAsync(ushort coilAddress); // 新增:读取线圈状态
|
2026-02-27 16:58:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|