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/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPressure/PressurePLC.cs

996 lines
31 KiB
C#

1 year ago
using System;
using System.Collections.Generic;
using System.Linq;
5 months ago
using DataBlockHelper;
1 year ago
using DataBlockHelper.DBHelpers;
using DataBlockHelper.DbWrite;
using DataBlockHelper.Entity.DB2107Entity;
1 year ago
using DevExpress.XtraGauges.Core.Model;
using DevExpress.XtraRichEdit.API.Layout;
namespace Mesnac.Action.ChemicalWeighing.LjPressure
1 year ago
{
public class PressurePLC
{
1 year ago
#region 压送秤A气源压力 DBW12 数组Id=1
private void DownDbw12(PressureSettingView view)
1 year ago
{
1 year ago
1 year ago
if (view != null)
{
DownDbPressureSettingView(16,view);
1 year ago
1 year ago
}
}
PlcWriteUtil plcWriter = new PlcWriteUtil();
private void DownDbPressureSettingView(int start, PressureSettingView view)
{
int begin = start;
int end = begin + 4;
plcWriter.Write(PlcDbEnum.Db2107, $"{begin}.0", PlcDbType.PlcFloat, view.LowLimit);
plcWriter.Write(PlcDbEnum.Db2107, $"{end}.0", PlcDbType.PlcFloat, view.HighLimit);
}
1 year ago
DB2107Helper _db2107Helper = new DB2107Helper();
1 year ago
private PressureSettingView UpDbw12()
1 year ago
{
1 year ago
1 year ago
PressureSettingView view = new PressureSettingView();
1 year ago
var v1 = _db2107Helper.Pressure.MainPress_V1;
1 year ago
view.Id = 1;
1 year ago
view.LowLimit = v1.LowLimit;
view.HighLimit = v1.HighLimit;
1 year ago
return view;
}
1 year ago
1 year ago
#endregion
private void DownDbw26(PressureSettingView view)
1 year ago
{
1 year ago
// PlcWriter plcWriter=new PlcWriter();
1 year ago
if (view != null)
{
DownDbPressureSettingView(30, view);
//var basePlcHelper = GetPlcHelper;
//basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.topPressure_V1_LowLimit, view.LowLimit);
//basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.topPressure_V1_HighLimit, view.HighLimit);
1 year ago
1 year ago
}
}
private PressureSettingView UpDbw26()
1 year ago
{
var v1 = _db2107Helper.Pressure.TopPressure_V1;
return GetSettingView(2, v1);
}
public PressureSettingView GetSettingView(int id, Pressure_HMI v1)
{
1 year ago
PressureSettingView view = new PressureSettingView();
view.Id = id;
view.LowLimit = v1.LowLimit;
view.HighLimit = v1.HighLimit;
1 year ago
return view;
}
1 year ago
private void DownDbw40(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(44, view);
1 year ago
}
}
private PressureSettingView UpDbw40()
1 year ago
{
PressureSettingView view = GetSettingView(3, _db2107Helper.Pressure.LinePressure_V1);
//view.Id = 3;
//view.LowLimit = basePlcHelper.linePressure_V1_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.linePressure_V1_HighLimit.NowValue.ToFloat();
1 year ago
return view;
}
private void DownDbw54(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(58, view);
1 year ago
}
}
private PressureSettingView UpDbw54()
1 year ago
{
PressureSettingView view = GetSettingView(4, _db2107Helper.Pressure.MainPress_V2);
//view.Id = 4;
//view.LowLimit = basePlcHelper.mainPress_V2_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.mainPress_V2_HighLimit.NowValue.ToFloat();
//view.Alarm = basePlcHelper.mainPress_V2_Alarm.NowValue.ToInt();
1 year ago
return view;
}
private void DownDbw68(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(72, view);
1 year ago
}
}
private PressureSettingView UpDbw68()
1 year ago
{
PressureSettingView view = GetSettingView(5, _db2107Helper.Pressure.TopPressure_V2);
//view.Id = 5;
//view.LowLimit = basePlcHelper.topPressure_V2_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.topPressure_V2_HighLimit.NowValue.ToFloat();
//view.Alarm = basePlcHelper.topPressure_V2_Alarm.NowValue.ToInt();
1 year ago
return view;
}
private void DownDbw82(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(86, view);
1 year ago
}
}
private PressureSettingView UpDbw82()
1 year ago
{
PressureSettingView view = GetSettingView(6, _db2107Helper.Pressure.LinePressure_V2);
//view.Id = 6;
//view.LowLimit = basePlcHelper.linePressure_V2_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.linePressure_V2_HighLimit.NowValue.ToFloat();
//view.Alarm = basePlcHelper.linePressure_V2_Alarm.NowValue.ToInt();
1 year ago
return view;
}
private void DownDbw96(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(100, view);
1 year ago
}
}
private PressureSettingView UpDbw96()
1 year ago
{
PressureSettingView view = GetSettingView(7, _db2107Helper.Pressure.MainPress_V3);
//view.Id = 7;
//view.LowLimit = basePlcHelper.mainPress_V3_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.mainPress_V3_HighLimit.NowValue.ToFloat();
//view.Alarm = basePlcHelper.mainPress_V3_Alarm.NowValue.ToInt();
1 year ago
return view;
}
private void DownDbw110(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(114, view);
1 year ago
}
}
private PressureSettingView UpDbw110()
1 year ago
{
PressureSettingView view = GetSettingView(8, _db2107Helper.Pressure.TopPressure_V3);
//view.Id = 8;
//view.LowLimit = basePlcHelper.topPressure_V3_LowLimit.NowValue.ToFloat();
//view.HighLimit = basePlcHelper.topPressure_V3_HighLimit.NowValue.ToFloat();
//view.Alarm = basePlcHelper.topPressure_V3_Alarm.NowValue.ToInt();
1 year ago
return view;
}
private void DownDbw124(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(128, view);
1 year ago
}
}
private PressureSettingView UpDbw124()
1 year ago
{
PressureSettingView view = GetSettingView(9, _db2107Helper.Pressure.LinePressure_V3);
//{
// Id = 9,
// LowLimit = basePlcHelper.linePressure_V3_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.linePressure_V3_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.linePressure_V3_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw138(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(142, view);
1 year ago
}
}
private PressureSettingView UpDbw138()
1 year ago
{
PressureSettingView view = GetSettingView(10, _db2107Helper.Pressure.MainPress_V4);
//{
// Id = 10,
// LowLimit = basePlcHelper.mainPress_V4_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.mainPress_V4_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.mainPress_V4_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw152(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(156, view);
1 year ago
}
}
private PressureSettingView UpDbw152()
1 year ago
{
PressureSettingView view = GetSettingView(11, _db2107Helper.Pressure.TopPressure_V4);
//{
// Id = 11,
// LowLimit = basePlcHelper.topPressure_V4_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.topPressure_V4_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.topPressure_V4_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw166(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(170, view);
1 year ago
}
}
private PressureSettingView UpDbw166()
1 year ago
{
PressureSettingView view = GetSettingView(12, _db2107Helper.Pressure.LinePressure_V4);
//{
// Id = 12,
// LowLimit = basePlcHelper.linePressure_V4_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.linePressure_V4_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.linePressure_V4_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw180(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(184, view);
1 year ago
}
}
private PressureSettingView UpDbw180()
1 year ago
{
PressureSettingView view = GetSettingView(13, _db2107Helper.Pressure.MainPress_V5);
//{
// Id = 13,
// LowLimit = basePlcHelper.mainPress_V5_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.mainPress_V5_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.mainPress_V5_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw194(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(198, view);
1 year ago
}
}
private PressureSettingView UpDbw194()
1 year ago
{
PressureSettingView view = GetSettingView(14, _db2107Helper.Pressure.TopPressure_V5);
//{
// Id = 14,
// LowLimit = basePlcHelper.topPressure_V5_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.topPressure_V5_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.topPressure_V5_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDbw208(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(212, view);
1 year ago
}
}
private PressureSettingView UpDbw208()
1 year ago
{
PressureSettingView view = GetSettingView(15, _db2107Helper.Pressure.LinePressure_V5);
//{
// Id = 15,
// LowLimit = basePlcHelper.linePressure_V5_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.linePressure_V5_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.linePressure_V5_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW222(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(226, view);
1 year ago
}
}
private PressureSettingView UpDbw222()
1 year ago
{
PressureSettingView view = GetSettingView(16, _db2107Helper.Pressure.PressDaybin_B1);
//{
// Id = 16,
// LowLimit = basePlcHelper.presDaybin_B1_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B1_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B1_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW236(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(240, view);
1 year ago
}
}
private PressureSettingView UpDbw236()
1 year ago
{
PressureSettingView view = GetSettingView(17, _db2107Helper.Pressure.PressDaybin_B2);
//{
// Id = 17,
// LowLimit = basePlcHelper.presDaybin_B2_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B2_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B2_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW250(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(254, view);
1 year ago
}
}
private PressureSettingView UpDbw250()
1 year ago
{
PressureSettingView view = GetSettingView(18, _db2107Helper.Pressure.PressDaybin_B3);
//{
// Id = 18,
// LowLimit = basePlcHelper.presDaybin_B3_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B3_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B3_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW264(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(268, view);
1 year ago
}
}
private PressureSettingView UpDbw264()
1 year ago
{
PressureSettingView view = GetSettingView(19, _db2107Helper.Pressure.PressDaybin_B4);
//{
// Id = 19,
// LowLimit = basePlcHelper.presDaybin_B4_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B4_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B4_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW278(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(282, view);
1 year ago
}
}
private PressureSettingView UpDbw278()
1 year ago
{
PressureSettingView view = GetSettingView(20, _db2107Helper.Pressure.PressDaybin_B5);
//{
// Id = 20,
// LowLimit = basePlcHelper.presDaybin_B5_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B5_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B5_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW292(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(296, view);
1 year ago
}
}
private PressureSettingView UpDbw292()
1 year ago
{
PressureSettingView view = GetSettingView(21, _db2107Helper.Pressure.PressDaybin_B6);
//{
// Id = 21,
// LowLimit = basePlcHelper.presDaybin_B6_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B6_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B6_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW306(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(310, view);
1 year ago
}
}
private PressureSettingView UpDbw306()
1 year ago
{
PressureSettingView view = GetSettingView(22, _db2107Helper.Pressure.PressDaybin_B7);
//{
// Id = 22,
// LowLimit = basePlcHelper.presDaybin_B7_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B7_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B7_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW320(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(324, view);
1 year ago
}
}
private PressureSettingView UpDbw320()
1 year ago
{
PressureSettingView view = GetSettingView(23, _db2107Helper.Pressure.PressDaybin_B8);
//{
// Id = 23,
// LowLimit = basePlcHelper.presDaybin_B8_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B8_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B8_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW334(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(338, view);
1 year ago
}
}
private PressureSettingView UpDbw334()
1 year ago
{
PressureSettingView view = GetSettingView(24, _db2107Helper.Pressure.PressDaybin_B9);
//{
// Id = 24,
// LowLimit = basePlcHelper.presDaybin_B9_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B9_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B9_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW348(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(352, view);
1 year ago
}
}
private PressureSettingView UpDbw348()
1 year ago
{
PressureSettingView view = GetSettingView(25, _db2107Helper.Pressure.PressDaybin_B10);
//{
// Id = 25,
// LowLimit = basePlcHelper.presDaybin_B10_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B10_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B10_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW362(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(366, view);
1 year ago
}
}
private PressureSettingView UpDbw362()
1 year ago
{
PressureSettingView view = GetSettingView(26, _db2107Helper.Pressure.PressDaybin_B11);
//{
// Id = 26,
// LowLimit = basePlcHelper.presDaybin_B11_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B11_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B11_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW376(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(380, view);
1 year ago
}
}
private PressureSettingView UpDbw376()
1 year ago
{
PressureSettingView view = GetSettingView(27, _db2107Helper.Pressure.PressDaybin_B12);
//{
// Id = 27,
// LowLimit = basePlcHelper.presDaybin_B12_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.presDaybin_B12_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.presDaybin_B12_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW390(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(394, view);
1 year ago
}
}
private PressureSettingView UpDbw390()
1 year ago
{
PressureSettingView view = GetSettingView(28, _db2107Helper.Pressure.PR2PCP01);
//{
// Id = 28,
// LowLimit = basePlcHelper.PR2PCP01_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.PR2PCP01_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.PR2PCP01_B12_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW404(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(408, view);
1 year ago
}
}
private PressureSettingView UpDbw404()
1 year ago
{
PressureSettingView view = GetSettingView(29, _db2107Helper.Pressure.PR2PCP02);
//{
// Id = 29,
// LowLimit = basePlcHelper.PR2PCP02_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.PR2PCP02_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.PR2PCP02_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
private void DownDBW418(PressureSettingView view)
1 year ago
{
if (view != null)
{
DownDbPressureSettingView(422, view);
1 year ago
}
}
private PressureSettingView UpDbw418()
1 year ago
{
PressureSettingView view = GetSettingView(30, _db2107Helper.Pressure.PR2PCP03);
//{
// Id = 30,
// LowLimit = basePlcHelper.PR2PCP03_LowLimit.NowValue.ToFloat(),
// HighLimit = basePlcHelper.PR2PCP03_HighLimit.NowValue.ToFloat(),
// Alarm = basePlcHelper.PR2PCP03_Alarm.NowValue.ToInt()
//};
1 year ago
return view;
}
/// <summary>
/// 下发到plc
/// </summary>
/// <param name="ls"></param>
public void DownToPlc(List<PressureSettingView> ls)
1 year ago
{
foreach (var pressureSettingView in ls)
{
int id = pressureSettingView.Id;
switch (id)
{
case 1:
DownDbw12(pressureSettingView);
break;
case 2:
DownDbw26(pressureSettingView);
break;
case 3:
DownDbw40(pressureSettingView);
break;
case 4:
DownDbw54(pressureSettingView);
break;
case 5:
DownDbw68(pressureSettingView);
break;
case 6:
DownDbw82(pressureSettingView);
break;
case 7:
DownDbw96(pressureSettingView);
break;
case 8:
DownDbw110(pressureSettingView);
break;
case 9:
DownDbw124(pressureSettingView);
break;
case 10:
DownDbw138(pressureSettingView);
break;
case 11:
DownDbw152(pressureSettingView);
break;
case 12:
DownDbw166(pressureSettingView);
break;
case 13:
DownDbw180(pressureSettingView);
break;
case 14:
DownDbw194(pressureSettingView);
break;
case 15:
DownDbw208(pressureSettingView);
break;
case 16:
DownDBW222(pressureSettingView);
break;
case 17:
DownDBW236(pressureSettingView);
break;
case 18:
DownDBW250(pressureSettingView);
break;
case 19:
DownDBW264(pressureSettingView);
break;
case 20:
DownDBW278(pressureSettingView);
break;
case 21:
DownDBW292(pressureSettingView);
break;
case 22:
DownDBW306(pressureSettingView);
break;
case 23:
DownDBW320(pressureSettingView);
break;
case 24:
DownDBW334(pressureSettingView);
break;
case 25:
DownDBW348(pressureSettingView);
break;
case 26:
DownDBW362(pressureSettingView);
break;
case 27:
DownDBW376(pressureSettingView);
break;
case 28:
DownDBW390(pressureSettingView);
break;
case 29:
DownDBW404(pressureSettingView);
break;
case 30:
DownDBW418(pressureSettingView);
break;
5 months ago
case 31:
DownDBW500(pressureSettingView);
break;
1 year ago
}
}
}
/// <summary>
/// 下发到plc
/// </summary>
/// <param name="ls"></param>
public List<PressureSettingView> UpdateFromPlc()
1 year ago
{
List<PressureSettingView> ls = new List<PressureSettingView>
{
UpDbw12(),
UpDbw26(),
UpDbw40(),
UpDbw54(),
UpDbw68(),
UpDbw82(),
UpDbw96(),
UpDbw110(),
UpDbw124(),
UpDbw138(),
UpDbw152(),
UpDbw166(),
UpDbw180(),
UpDbw194(),
UpDbw208(),
UpDbw222(),
UpDbw236(),
UpDbw250(),
UpDbw264(),
UpDbw278(),
UpDbw292(),
UpDbw306(),
UpDbw320(),
UpDbw334(),
UpDbw348(),
UpDbw362(),
UpDbw376(),
UpDbw390(),
UpDbw404(),
5 months ago
UpDbw418(),
UpDbw500()
1 year ago
};
1 year ago
1 year ago
return ls;
}
1 year ago
public PressureSettingView UpdateFromPlc(int id)
1 year ago
{
PressureSettingView view = new PressureSettingView();
switch (id)
{
case 1:
view= UpDbw12();
break;
case 2:
view= UpDbw26();
break;
case 3:
view= UpDbw40();
break;
case 4:
view= UpDbw54();
break;
case 5:
view= UpDbw68();
break;
case 6:
view= UpDbw82();
break;
case 7:
view= UpDbw96();
break;
case 8:
view= UpDbw110();
break;
case 9:
view= UpDbw124();
break;
case 10:
view= UpDbw138();
break;
case 11:
view= UpDbw152();
break;
case 12:
view= UpDbw166();
break;
case 13:
view= UpDbw180();
break;
case 14:
view= UpDbw194();
break;
case 15:
view= UpDbw208();
break;
case 16:
view= UpDbw222();
break;
case 17:
view= UpDbw236();
break;
case 18:
view= UpDbw250();
break;
case 19:
view= UpDbw264();
break;
case 20:
view= UpDbw278();
break;
case 21:
view= UpDbw292();
break;
case 22:
view= UpDbw306();
break;
case 23:
view= UpDbw320();
break;
case 24:
view= UpDbw334();
break;
case 25:
view= UpDbw348();
break;
case 26:
view= UpDbw362();
break;
case 27:
view= UpDbw376();
break;
case 28:
view= UpDbw390();
break;
case 29:
view= UpDbw404();
break;
case 30:
view= UpDbw418();
break;
5 months ago
case 31:
view = UpDbw500();
break;
1 year ago
}
return view;
}
5 months ago
private static void DownDBW500(PressureSettingView view)
{
if (view != null)
{
var plc = PlcConnect.Instance;
plc.Write("DB2108.54.0", view.LowLimit);
plc.Write("DB2108.58.0", view.HighLimit);
}
}
private static PressureSettingView UpDbw500()
{
PressureSettingView view = new PressureSettingView();
view.Id = 32;
var plc = PlcConnect.Instance;
view.ActualValue = plc.ReadFloat("DB2108.50.0").Content;
view.LowLimit = plc.ReadFloat("DB2108.54.0").Content;
view.HighLimit = plc.ReadFloat("DB2108.58.0").Content;
view.Alarm = plc.ReadBool("DB2108.62.0").Content ? 1 : 0;
return view;
}
1 year ago
}
}