You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/DataBlockHelper/DBHelpers/DB2104WriteHelper.cs

56 lines
1.6 KiB
C#

1 year ago
using System.Collections.Generic;
using DataBlockHelper.Entity.DB2104Entity;
namespace DataBlockHelper.DBHelpers
{
public class Db2104WriteHelper
{
private static readonly string DbName = "DB2104";
1 year ago
/// <summary>
/// A热水
1 year ago
/// </summary>
/// <param name="entity"></param>
public static void WriteAHostWater(WaterEntity entity)
{
Write(3738, entity);
1 year ago
}
/// <summary>
/// B热水
1 year ago
/// </summary>
/// <param name="entity"></param>
public static void WriteBHostWater(WaterEntity entity)
{
Write(3754, entity);
1 year ago
}
/// <summary>
/// 冷水A
1 year ago
/// </summary>
/// <param name="entity"></param>
public static void WriteAColWater(WaterEntity entity)
{
Write(3770, entity);
1 year ago
}
/// <summary>
/// 冷水B
1 year ago
/// </summary>
/// <param name="entity"></param>
public static void WriteBColWater(WaterEntity entity)
{
Write(3786, entity);
1 year ago
}
private static void Write(int start, WaterEntity entity)
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{start}.0", entity.Bin);
siemensS7Net.Write($"{DbName}.{start+2}.0", entity.Set);
siemensS7Net.Write($"{DbName}.{start+6}.0", entity.Tolerance);
siemensS7Net.Write($"{DbName}.{start + 10}.0", entity.differ);
siemensS7Net.Write($"{DbName}.{start + 14}.0", entity.stand);
1 year ago
}
}
}