|
|
@ -375,7 +375,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
pid.Kd = Convert.ToDouble(Selet_con("MT23")); |
|
|
|
pid.N = Convert.ToDouble(Selet_con("MT24")); |
|
|
|
pid.OutputUpperLimit = Convert.ToDouble(Selet_con("MT25")); |
|
|
|
pid.OutputLowerLimit = Convert.ToDouble(Selet_con("MT26")); |
|
|
|
pid.OutputLowerLimit = - Convert.ToDouble(Selet_con("MT26")); |
|
|
|
|
|
|
|
MT05 = Convert.ToInt16(Selet_con("MT05"));//主缸排水延时
|
|
|
|
MT06 = Convert.ToInt16(Selet_con("MT06"));//动力排水延时
|
|
|
@ -531,7 +531,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
if (set_) { set_ = false; SYS_SET(); }//设置更新
|
|
|
|
if (!SETP_runtime) DIDETime++; |
|
|
|
|
|
|
|
STEP_RUN_master(); |
|
|
|
STEP_RUN_master(); if (S04 == "1") { Simulate(); } |
|
|
|
STEP_RUN_slave(); |
|
|
|
LOG_view(); |
|
|
|
IO_view(); |
|
|
@ -557,23 +557,32 @@ namespace DyeingComputer.ViewModel |
|
|
|
else { AUTO_bool = _AUTO_bool; }//手自动图标
|
|
|
|
|
|
|
|
if ((Selet_dtm("1010") < 1) || (Selet_dtm("1010") > 160)) |
|
|
|
{ ERRinf.ERRinf_w(errTabler, Resources.Temperature + Resources.Sensor + Resources.Malfunction, "ERR101"); } //温度故障提示
|
|
|
|
{ ERRinf.ERRinf_w(errTabler, Resources.Temperature + Resources.Sensor + |
|
|
|
Resources.Malfunction, "ERR101"); } //温度故障提示
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR101"); } |
|
|
|
if (Selet_dtd("2001")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.EmergencyStop, "ERR100"); } //急停
|
|
|
|
if (Selet_dtd("2001")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.EmergencyStop, "ERR100"); } //急停
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR100"); } |
|
|
|
if (Selet_dtd("2008")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Blower, "ERR102"); } //风机
|
|
|
|
if (Selet_dtd("2008")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Blower, "ERR102"); } //风机
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR102"); } |
|
|
|
if (Selet_dtd("2009")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Pump + "-0", "ERR103"); } //主泵
|
|
|
|
if (Selet_dtd("2009")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Pump + "-0", "ERR103"); } //主泵
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR103"); } |
|
|
|
if (Selet_dtd("2012")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Wiggle, "ERR109"); } //摆布故障
|
|
|
|
if (Selet_dtd("2012")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Wiggle, "ERR109"); } //摆布故障
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR109"); } |
|
|
|
if (Selet_dtd("2013")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.OtherCircuits, "ERR108"); } //其它电器故障
|
|
|
|
if (Selet_dtd("2013")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.OtherCircuits, "ERR108"); } //其它电器故障
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR108"); } |
|
|
|
if (Selet_dtd("2014")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Pump + "-1", "ERR104-1"); } //加料泵
|
|
|
|
if (Selet_dtd("2014")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Pump + "-1", "ERR104-1"); } //加料泵
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR104-1"); } |
|
|
|
if (Selet_dtd("2015")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Pump + "-2", "ERR104-2"); } //加料泵
|
|
|
|
if (Selet_dtd("2015")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Pump + "-2", "ERR104-2"); } //加料泵
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR104-2"); } |
|
|
|
if (Selet_dtd("2016")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + Resources.Pump + "-3", "ERR104-3"); } //加料泵
|
|
|
|
if (Selet_dtd("2016")) { ERRinf.ERRinf_w(errTabler, Resources.Fault + ":" + |
|
|
|
Resources.Pump + "-3", "ERR104-3"); } //加料泵
|
|
|
|
else { ERRinf.ERRinf_d(errTabler, "ERR104-3"); } |
|
|
|
} |
|
|
|
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
|
|
@ -1050,13 +1059,15 @@ namespace DyeingComputer.ViewModel |
|
|
|
TIME_H = STEP_TIME / 3600; |
|
|
|
TIME_M = (STEP_TIME - TIME_H * 3600) / 60; |
|
|
|
TIME_S = STEP_TIME - TIME_H * 3600 - TIME_M * 60; |
|
|
|
if (errTabler.Rows.Count==0) Status_Str = Resources.Heat_insulating + ":" + Resources.Time + string.Format(" {0:D2}", TIME_H) + ":" + string.Format(" {0:D2}", TIME_M) + ":" + string.Format(" {0:D2}", TIME_S); |
|
|
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Heat_insulating + ":" + Resources.Time + string.Format(" {0:D2}", TIME_H) + ":" + string.Format(" {0:D2}", TIME_M) + ":" + string.Format(" {0:D2}", TIME_S); |
|
|
|
if (STEP_TIME <= 0) |
|
|
|
{ |
|
|
|
STEP_finish = true; |
|
|
|
Updata_dtm("1004", 0); |
|
|
|
Updata_dtd("3009", false); |
|
|
|
Updata_dtd("3010", false); |
|
|
|
Updata_dta("5001", 0); |
|
|
|
Updata_dta("5002", 0); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -1076,20 +1087,20 @@ namespace DyeingComputer.ViewModel |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
TIME_M = Convert.ToInt16((STEP_P1 - T) / STEP_P2 ); |
|
|
|
TIME_M = Convert.ToInt16((STEP_P1 - T) / STEP_P2); |
|
|
|
} |
|
|
|
if (errTabler.Rows.Count == 0) |
|
|
|
{ |
|
|
|
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; |
|
|
|
if ((TEMP_co - T) > 5) |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]", "201-1");//写入
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_d(errTabler, "201-1");//
|
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
if ((TEMP_co - T) > 5) |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]", "201-1");//写入
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_d(errTabler, "201-1");//
|
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (THL_mode == 2)//降温
|
|
|
@ -1105,35 +1116,29 @@ namespace DyeingComputer.ViewModel |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
TIME_M = Convert.ToInt16((T - STEP_P1) / STEP_P2 ); |
|
|
|
TIME_M = Convert.ToInt16((T - STEP_P1) / STEP_P2); |
|
|
|
} |
|
|
|
if (errTabler.Rows.Count == 0) |
|
|
|
{ |
|
|
|
Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; |
|
|
|
if ((T - TEMP_co) > 5) |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]", "201-2");//写入
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ERRinf.ERRinf_d(errTabler, "201-2");//
|
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Updata_dtm("1004", TO); |
|
|
|
Updata_dtm("1005", TEMP_co); |
|
|
|
if (MT12 == 1)//输出类型0开关1模拟
|
|
|
|
{ |
|
|
|
if (THL_mode == 2) |
|
|
|
if ((T - TEMP_co) > 5) |
|
|
|
{ |
|
|
|
Updata_dta("5002", Convert.ToInt16(TO)); |
|
|
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]", "201-2");//写入
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Updata_dta("5001", Convert.ToInt16(TO)); |
|
|
|
ERRinf.ERRinf_d(errTabler, "201-2");//
|
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
Updata_dtm("1004", TO); |
|
|
|
Updata_dtm("1005", TEMP_co); |
|
|
|
if (MT12 == 1)//输出类型0开关1模拟
|
|
|
|
{ |
|
|
|
if (THL_mode == 2) Updata_dta("5002", Convert.ToInt16(TO)); |
|
|
|
if (THL_mode == 1) Updata_dta("5001", Convert.ToInt16(TO)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (temp_time10s <= 0) { temp_time10s = 10; } else { temp_time10s--; } |
|
|
@ -3219,6 +3224,20 @@ namespace DyeingComputer.ViewModel |
|
|
|
Sys_log = SYSlog; |
|
|
|
} |
|
|
|
|
|
|
|
private Random _random=new Random(); |
|
|
|
private void Simulate()//模拟
|
|
|
|
{ |
|
|
|
double _rd = (double)_random.Next(1, 5) / 10; |
|
|
|
if (THL_mode == 1 || THL_mode == 0) { |
|
|
|
if (Selet_dta("4001") > 16) |
|
|
|
{ |
|
|
|
Updata_dta("4001", (int)(Selet_dta("4001") + Selet_dta("5001") / 100 * _rd)); |
|
|
|
Updata_dta("4001", (int)(Selet_dta("4001") - _rd)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (THL_mode == 2) { Updata_dta("4001", (int)(Selet_dta("4001") - Selet_dta("5002") / 100*_rd)); } |
|
|
|
} |
|
|
|
|
|
|
|
public static DataTable dt_d = new DataTable("DIO"); |
|
|
|
public static DataTable dt_a = new DataTable("AIO"); |
|
|
|
public static DataTable dt_m = new DataTable("M"); |
|
|
|