|
|
@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
namespace DataBlockHelper.DBHelpers
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public class Db2119WriteHelper
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
private static readonly string DbName = "DB2119";
|
|
|
|
|
|
|
|
private static readonly int HaNo = 106;
|
|
|
|
|
|
|
|
public static readonly int HbNo = 114;
|
|
|
|
|
|
|
|
private static readonly int CaNo = 122;
|
|
|
|
|
|
|
|
private static readonly int CbNo = 130;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 添加方法Ha
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddValue(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddRemainValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddRemainValue(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddForceBin(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceBin(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddForceOn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceOn(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddStartIn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartIn(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHaAddStartOut(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartOut(value, HaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Hb 添加方法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddValue(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddRemainValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddRemainValue(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddForceBin(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceBin(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddForceOn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceOn(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddStartIn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartIn(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddHbAddStartOut(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartOut(value, HbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Ca 添加方法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddValue(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddRemainValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddRemainValue(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddForceBin(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceBin(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddForceOn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceOn(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddStartIn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartIn(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCaAddStartOut(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartOut(value, CaNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Cb 添加方法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddValue(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddRemainValue(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddRemainValue(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddForceBin(short value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceBin(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddForceOn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddForceOn(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddStartIn(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartIn(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void AddCbAddStartOut(bool value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AddStartOut(value, CbNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddValue(short value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//106
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{start}.0",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddRemainValue(short value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int nu = start + 2;
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{nu}.0",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddForceBin(short value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int nu = start + 4;
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{nu}.0",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddForceOn(bool value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int nu = start + 6;
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{nu}.0",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddStartIn(bool value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int nu = start + 6;
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{nu}.1",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AddStartOut(bool value, int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int nu = start + 6;
|
|
|
|
|
|
|
|
var siemensS7Net = PlcConnect.Instance;
|
|
|
|
|
|
|
|
siemensS7Net.Write($"{DbName}.{nu}.2",value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|