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/DB2104Helper.cs

106 lines
3.6 KiB
C#

using DataBlockHelper.Entity.DB2107Entity;
using DataBlockHelper.Entity.DB2104Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace DataBlockHelper.DBHelpers
{
public class DB2104Helper : DBHelper
{
public DB2104Helper()
{
this.bytes = PlcConnect.Instance.Read("DB2104.0.0", 3802).Content;
}
public RecipeCommEntity RecipeComm => RecipeCom(bytes);
private RecipeCommEntity RecipeCom(byte[] bytes)
{
return new RecipeCommEntity(bytes);
}
public EnableStatusEntity EnableStatus => EnableS(bytes);
private EnableStatusEntity EnableS(byte[] bytes)
{
return new EnableStatusEntity(bytes);
}
//public DryerEntity Dryer_D1 => new DryerEntity(58, bytes);
//public DryerEntity Dryer_D2 => new DryerEntity(218, bytes);
//public DryerEntity Dryer_D3 => new DryerEntity(378, bytes);
//public DryerEntity Dryer_D4 => new DryerEntity(538, bytes);
//public GelatEntity Gelat_G1 => new GelatEntity(698, bytes);
//public GelatEntity Gelat_G2 => new GelatEntity(858, bytes);
//public GelatEntity Gelat_G3 => new GelatEntity(1018, bytes);
//public GelatEntity Gelat_G4 => new GelatEntity(1178, bytes);
//public GelatEntity Gelat_G5 => new GelatEntity(1338, bytes);
//public GelatEntity Gelat_G6 => new GelatEntity(1498, bytes);
//public GelatEntity Gelat_G7 => new GelatEntity(1658, bytes);
//public GelatEntity Gelat_G8 => new GelatEntity(1818, bytes);
//public WeterEntity Weter_M1 => new WeterEntity(1978, bytes);
//public WeterEntity Weter_M2 => new WeterEntity(2178, bytes);
//public WeterEntity Weter_M3 => new WeterEntity(2378, bytes);
//public WeterEntity Weter_M4 => new WeterEntity(2578, bytes);
//public WeterEntity Weter_M5 => new WeterEntity(2778, bytes);
//public WeterEntity Weter_M6 => new WeterEntity(2978, bytes);
//public WeterEntity Weter_M7 => new WeterEntity(3178, bytes);
//public WeterEntity Weter_M8 => new WeterEntity(3378, bytes);
1 year ago
/// <summary>
/// 热水秤A
/// </summary>
public WaterEntity GetAHotWater => GetWater(3738);
1 year ago
/// <summary>
/// 热水秤B
/// </summary>
public WaterEntity GetBHotWater => GetWater(3754);
1 year ago
/// <summary>
/// 冷水秤A
/// </summary>
public WaterEntity GetAColWater => GetWater(3770);
1 year ago
/// <summary>
/// 冷水秤B
/// </summary>
public WaterEntity GetBColWater => GetWater(3786);
1 year ago
private WaterEntity GetWater(int start)
{
var instanceByteTransform = PlcConnect.Instance.ByteTransform;
var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 16).Content;
11 months ago
if (ls != null)
1 year ago
{
11 months ago
WaterEntity entity = new WaterEntity
{
Bin = instanceByteTransform.TransInt16(ls, 0),
Set = instanceByteTransform.TransSingle(ls, 2),
Tolerance = instanceByteTransform.TransSingle(ls, 6),
differ = instanceByteTransform.TransSingle(ls, 10),
stand = instanceByteTransform.TransInt16(ls, 14),
};
return entity;
11 months ago
}
return new WaterEntity();
1 year ago
}
}
}