|
|
@ -238,8 +238,8 @@ namespace DyeingComputer.ViewModel |
|
|
|
} |
|
|
|
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
|
|
|
{ |
|
|
|
Modbus_link(); |
|
|
|
IO_data(); |
|
|
|
if (LINK_OK) Modbus_link(); |
|
|
|
if (LINK_OK) IO_data(); |
|
|
|
if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持
|
|
|
|
{ |
|
|
|
ERR_JOG = true; |
|
|
@ -449,7 +449,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
} |
|
|
|
else if (THL_mode == 1)//升温
|
|
|
|
{ |
|
|
|
TEMP_co = TEMP_co + (STEP_P2 / 600); |
|
|
|
if (STEP_P1 > TEMP_co) TEMP_co = TEMP_co + (STEP_P2 / 600); |
|
|
|
TO = pid.PID_iterate(TEMP_co, T, ts); |
|
|
|
if (TO < 0) TO = 0; |
|
|
|
if (STEP_P1 < T) |
|
|
@ -461,11 +461,22 @@ namespace DyeingComputer.ViewModel |
|
|
|
{ |
|
|
|
TIME_M = Convert.ToInt16((STEP_P1 - T) / (STEP_P2 / 10)); |
|
|
|
} |
|
|
|
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C" + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
if (string.IsNullOrEmpty(Name_err.ToString())) |
|
|
|
{ |
|
|
|
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; |
|
|
|
if ((TEMP_co - T) > 5) |
|
|
|
{ |
|
|
|
Status_Str = Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (THL_mode == 2)//降温
|
|
|
|
{ |
|
|
|
TEMP_co = TEMP_co - (STEP_P2 / 600); |
|
|
|
if (STEP_P1 < TEMP_co) TEMP_co = TEMP_co - (STEP_P2 / 600); |
|
|
|
TO = pid.PID_iterate(TEMP_co, T, ts); |
|
|
|
if (TO > 0) TO = 0; |
|
|
|
TO = Math.Abs(TO); |
|
|
@ -478,7 +489,18 @@ namespace DyeingComputer.ViewModel |
|
|
|
{ |
|
|
|
TIME_M = Convert.ToInt16((T - STEP_P1) / (STEP_P2 / 10)); |
|
|
|
} |
|
|
|
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C" + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
if (string.IsNullOrEmpty(Name_err.ToString())) |
|
|
|
{ |
|
|
|
Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; |
|
|
|
if ((T - TEMP_co) > 5) |
|
|
|
{ |
|
|
|
Status_Str = Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
updata_dtm("1004", TO); |
|
|
|
updata_dtm("1005", TEMP_co); |
|
|
@ -903,16 +925,16 @@ namespace DyeingComputer.ViewModel |
|
|
|
private bool LINK_OK = false; |
|
|
|
private int LINK_RUN = 0; |
|
|
|
private int LINK_ERR = 0; |
|
|
|
bool[] DQ = new bool[128]; |
|
|
|
ushort DQ_L = 128; |
|
|
|
bool[] DO = new bool[128]; |
|
|
|
ushort DO_L = 128; |
|
|
|
bool[] DQ = new bool[63]; |
|
|
|
ushort DQ_L = 63; |
|
|
|
bool[] DO = new bool[63]; |
|
|
|
ushort DO_L = 63; |
|
|
|
//int[] MW = new int[128];
|
|
|
|
// ushort MW_L = 128;
|
|
|
|
ushort[] DW = new ushort[100]; |
|
|
|
ushort DW_L = 100; |
|
|
|
ushort[] RW = new ushort[100]; |
|
|
|
ushort RW_L = 100; |
|
|
|
ushort[] DW = new ushort[63]; |
|
|
|
ushort DW_L = 63; |
|
|
|
ushort[] RW = new ushort[63]; |
|
|
|
ushort RW_L = 63; |
|
|
|
readonly byte slaveId = 1; |
|
|
|
private async void Modbus_link() |
|
|
|
{ |
|
|
@ -942,7 +964,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
Sys_log = Resources.Target + Resources.Temperature + " : " + string.Format(" {0:###.#}", TEMP_tar) + "°C";//显示目标温度
|
|
|
|
Sys_log = Sys_log + " | " + Resources.MasterCylinder + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1010"))) + "°C";//显示实际温度
|
|
|
|
Sys_log = Sys_log + "\n" + Resources.Compute + Resources.Temperature + " : " + string.Format(" {0:###.#}", Convert.ToDouble(Selet_dtm("1005"))) + "°C";//显示计算温度
|
|
|
|
Sys_log = Sys_log + " | " + Resources.ProportionalValves + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1004"))) + "%";//显示比例
|
|
|
|
Sys_log = Sys_log + " | " + Resources.ProportionalValves + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1004"))/10) + "%";//显示比例
|
|
|
|
int IO1015 = Convert.ToInt16(Selet_dtm("1015")); |
|
|
|
if (IO1015 < MT39) |
|
|
|
{ |
|
|
|