Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
577f67a4f1
1 file changed
+32
-22
@@ -64,10 +64,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
UPort(); //启动串口
|
UPort(); //启动串口
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double MT05;//主缸排水延时
|
private static int MT05;//主缸排水延时
|
||||||
private static double MT06;//主缸排水延时
|
private static int MT06;//主缸排水延时
|
||||||
|
private static double MT16;//流量计数系数
|
||||||
private static double MT33;//主缸温度偏差
|
private static double MT33;//主缸温度偏差
|
||||||
private static double MT90;//呼叫操作员
|
private static int MT90;//呼叫操作员
|
||||||
void SYS_SET()
|
void SYS_SET()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
@@ -82,10 +83,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
pid.OutputUpperLimit = Convert.ToDouble(Selet_sys("MT25"));
|
pid.OutputUpperLimit = Convert.ToDouble(Selet_sys("MT25"));
|
||||||
pid.OutputLowerLimit = Convert.ToDouble(Selet_sys("MT26"));
|
pid.OutputLowerLimit = Convert.ToDouble(Selet_sys("MT26"));
|
||||||
|
|
||||||
MT05 = Convert.ToDouble(Selet_sys("MT05"));//主缸排水延时
|
MT05 = Convert.ToInt16(Selet_sys("MT05"));//主缸排水延时
|
||||||
MT06 = Convert.ToDouble(Selet_sys("MT06"));//动力排水延时
|
MT06 = Convert.ToInt16(Selet_sys("MT06"));//动力排水延时
|
||||||
|
MT16 = Convert.ToDouble(Selet_sys("MT16"));//流量计数系数
|
||||||
MT33 = Convert.ToDouble(Selet_sys("MT33"));//温度偏差参数
|
MT33 = Convert.ToDouble(Selet_sys("MT33"));//温度偏差参数
|
||||||
MT90 = Convert.ToDouble(Selet_sys("MT90"));//呼叫操作员
|
MT90 = Convert.ToInt16(Selet_sys("MT90"));//呼叫操作员
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -148,9 +150,9 @@ namespace DyeingComputer.ViewModel
|
|||||||
//设置定时器
|
//设置定时器
|
||||||
DispatcherTimer disTimer = new DispatcherTimer
|
DispatcherTimer disTimer = new DispatcherTimer
|
||||||
{
|
{
|
||||||
Interval = TimeSpan.FromMilliseconds(100) //毫秒
|
Interval = TimeSpan.FromMilliseconds(500) //毫秒
|
||||||
};
|
};
|
||||||
disTimer.Tick += new EventHandler(DisTimer_100MS);//每一秒执行的方法
|
disTimer.Tick += new EventHandler(DisTimer_500MS);//每一秒执行的方法
|
||||||
disTimer.Start();//计时开始
|
disTimer.Start();//计时开始
|
||||||
}//时间周期初始化
|
}//时间周期初始化
|
||||||
|
|
||||||
@@ -165,11 +167,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
Work_Temp = Selet_dtm("1010") + " ℃";
|
Work_Temp = Selet_dtm("1010") + " ℃";
|
||||||
Work_Numder = WorkNumder.ToString();
|
Work_Numder = WorkNumder.ToString();
|
||||||
|
|
||||||
if (LINK_OK) Modbus_link();
|
// if (LINK_OK) Modbus_link();
|
||||||
if(!SETP_runtime) DIDETime++;
|
if(!SETP_runtime) DIDETime++;
|
||||||
|
|
||||||
STEP_RUN();
|
STEP_RUN();
|
||||||
IO_data();
|
IO_view();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
||||||
}
|
}
|
||||||
@@ -180,8 +182,10 @@ namespace DyeingComputer.ViewModel
|
|||||||
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 10) || (Selet_dtm("1010") > 160)))
|
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 10) || (Selet_dtm("1010") > 160)))
|
||||||
{ Status_Str = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
{ Status_Str = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
||||||
}
|
}
|
||||||
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
||||||
{
|
{
|
||||||
|
Modbus_link();
|
||||||
|
IO_data();
|
||||||
if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持
|
if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持
|
||||||
{
|
{
|
||||||
ERR_JOG = true;
|
ERR_JOG = true;
|
||||||
@@ -875,21 +879,25 @@ namespace DyeingComputer.ViewModel
|
|||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
async void IO_data()//刷新
|
private async void IO_data()//刷新
|
||||||
{
|
{
|
||||||
updata_dtm("1001", LINK_RUN);
|
updata_dtm("1001", LINK_RUN);
|
||||||
updata_dtm("1002", LINK_ERR);
|
updata_dtm("1002", LINK_ERR);
|
||||||
updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10);
|
updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10);
|
||||||
|
updata_dtm("1006", Selet_dta("4006"));
|
||||||
|
updata_dtm("1015", Selet_dta("4007"));
|
||||||
|
updata_dtm("1016", Selet_dta("4006") * MT16);
|
||||||
|
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
for (ushort i = 0; i < DO_L; i++) { updata_dtd((i + 2001).ToString(), DO[i]); }
|
for (ushort i = 0; i < DO_L; i++) { updata_dtd((i + 2001).ToString(), DO[i]); }
|
||||||
//for (ushort i = 0; i < DQ_L; i++) { updata_dtd((i + 3001).ToString(), DQ[i]); }
|
|
||||||
for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Selet_dtd((i + 3001).ToString()); }
|
for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Selet_dtd((i + 3001).ToString()); }
|
||||||
for (ushort i = 0; i < RW_L; i++) { updata_dta((i + 4001).ToString(), RW[i]); }
|
for (ushort i = 0; i < RW_L; i++) { updata_dta((i + 4001).ToString(), RW[i]); }
|
||||||
for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Selet_dta((i + 5001).ToString())); }
|
for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Selet_dta((i + 5001).ToString())); }
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
private async void IO_view()
|
||||||
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||||
@@ -914,10 +922,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
}
|
}
|
||||||
public static bool Selet_dtd(string key)//D寄存器
|
public static bool Selet_dtd(string key)//D寄存器
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
DataRow[] arrRows = dt_d.Select("ID='" + key + "'");
|
{
|
||||||
bool index = Convert.ToBoolean(arrRows[0]["DIO"].ToString());
|
DataRow[] arrRows = dt_d.Select("ID='" + key + "'");
|
||||||
return index;
|
bool index = Convert.ToBoolean(arrRows[0]["DIO"].ToString());
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -927,10 +936,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
}
|
}
|
||||||
public static int Selet_dta(string key)//A寄存器
|
public static int Selet_dta(string key)//A寄存器
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
DataRow[] arrRows = dt_a.Select("ID='" + key + "'");
|
{
|
||||||
int index = Convert.ToInt16(arrRows[0]["AIO"].ToString());
|
DataRow[] arrRows = dt_a.Select("ID='" + key + "'");
|
||||||
return index;
|
int index = Convert.ToInt16(arrRows[0]["AIO"].ToString());
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user