Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
001b2ff686
4 files changed
+90
-24
No files matched your search
Generated
+18
@@ -465,6 +465,15 @@ namespace DyeingComputer.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Malfunction 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Malfunction {
|
||||
get {
|
||||
return ResourceManager.GetString("Malfunction", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Measure 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -834,6 +843,15 @@ namespace DyeingComputer.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Sensor 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Sensor {
|
||||
get {
|
||||
return ResourceManager.GetString("Sensor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 StartTime 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -429,4 +429,10 @@
|
||||
<data name="Heat insulating" xml:space="preserve">
|
||||
<value>Heat insulating</value>
|
||||
</data>
|
||||
<data name="Malfunction" xml:space="preserve">
|
||||
<value>Malfunction</value>
|
||||
</data>
|
||||
<data name="Sensor" xml:space="preserve">
|
||||
<value>Sensor</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -99,6 +99,8 @@ namespace DyeingComputer.View
|
||||
}
|
||||
|
||||
private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控
|
||||
{
|
||||
if (string.IsNullOrEmpty(MainWindowViewModel.Name_err.ToString()))//无错误信息
|
||||
{
|
||||
if ((MainWindowViewModel.WORK_RUN == 1) || (MainWindowViewModel.WORK_RUN == 0))//停止暂停时可以启用开始
|
||||
{
|
||||
@@ -110,6 +112,7 @@ namespace DyeingComputer.View
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace DyeingComputer.ViewModel
|
||||
disTimer.Start();//计时开始
|
||||
}//时间周期初始化
|
||||
|
||||
public static object Name_err;
|
||||
public static object Name_err = "";
|
||||
public static object WorkNumder;
|
||||
public static object Process_step;
|
||||
public static Int32 DIDETime; //空闲计时器
|
||||
@@ -163,23 +163,25 @@ namespace DyeingComputer.ViewModel
|
||||
Work_Numder = WorkNumder.ToString();
|
||||
|
||||
if (LINK_OK) Modbus_link();
|
||||
|
||||
DIDETime++;
|
||||
|
||||
STEP_RUN();
|
||||
IO_data();
|
||||
|
||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
||||
}
|
||||
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
||||
{
|
||||
if (!LINK_OK) Modbus_link();
|
||||
if (Name_err != null) Status_Str = Name_err.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 10) || (Selet_dtm("1010") > 160)))
|
||||
{ Status_Str = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
||||
}
|
||||
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int WORK_RUN = 0; //运行状态0停止1暂停2运行
|
||||
private static string STEP_ID = "0";
|
||||
private static double STEP_P1 = 0;
|
||||
@@ -195,8 +197,9 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
public static void STEP_START(string ID,double P1,double P2,double P3,double P4,double P5)
|
||||
{
|
||||
if (ID == "001")
|
||||
switch (STEP_ID)
|
||||
{
|
||||
case "001":
|
||||
STEP_ID = "001";
|
||||
STEP_P1 = Convert.ToDouble(P1);
|
||||
STEP_P2 = Convert.ToDouble(P2);
|
||||
@@ -211,19 +214,43 @@ namespace DyeingComputer.ViewModel
|
||||
STEP_TIME = Convert.ToInt16(STEP_P3) * 60;
|
||||
WORK_RUN = 2;
|
||||
SETP_runtime = true;
|
||||
break;
|
||||
case "007":
|
||||
|
||||
break;
|
||||
case "009":
|
||||
|
||||
break;
|
||||
case "013":
|
||||
|
||||
break;
|
||||
case "015":
|
||||
|
||||
break;
|
||||
case "017":
|
||||
|
||||
break;
|
||||
case "020":
|
||||
|
||||
break;
|
||||
case "022":
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TimeSpan ts=new TimeSpan(1);//1秒间隔
|
||||
void STEP_RUN()
|
||||
{
|
||||
|
||||
if (WORK_RUN == 2)
|
||||
{
|
||||
if (SETP_runtime)
|
||||
{
|
||||
if (STEP_ID == "001")
|
||||
switch (STEP_ID)
|
||||
{
|
||||
case "001": //功能模块001温度控制
|
||||
int TIME_H;
|
||||
int TIME_M;
|
||||
int TIME_S;
|
||||
@@ -239,7 +266,7 @@ 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;
|
||||
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);
|
||||
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);
|
||||
}
|
||||
else if (THL_mode == 1)//升温
|
||||
{
|
||||
@@ -253,9 +280,9 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
TIME_M = Convert.ToInt16( (STEP_P1 - T) / (STEP_P2/10));
|
||||
TIME_M = Convert.ToInt16((STEP_P1 - T) / (STEP_P2 / 10));
|
||||
}
|
||||
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C" + Resources.Expected+ string.Format(" {0:D2}", TIME_M) + Resources.Min;
|
||||
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C" + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
|
||||
}
|
||||
else if (THL_mode == 2)//降温
|
||||
{
|
||||
@@ -272,18 +299,39 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
TIME_M = Convert.ToInt16((T - STEP_P1) / (STEP_P2 / 10));
|
||||
}
|
||||
Status_Str = Resources.Cooling +":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) +"°C" + Resources.Expected + string.Format(" {0:D2}", TIME_M )+ Resources.Min;
|
||||
Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C" + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
|
||||
}
|
||||
|
||||
updata_dtm("1004", TO);
|
||||
updata_dtm("1005", TEMP_co);
|
||||
break;
|
||||
case "007":
|
||||
|
||||
break;
|
||||
case "009":
|
||||
|
||||
break;
|
||||
case "013":
|
||||
|
||||
break;
|
||||
case "015":
|
||||
|
||||
break;
|
||||
case "017":
|
||||
|
||||
break;
|
||||
case "020":
|
||||
|
||||
break;
|
||||
case "022":
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Name_err == null)
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()))
|
||||
{
|
||||
Status_Str = Resources.Await;
|
||||
}
|
||||
@@ -296,7 +344,7 @@ namespace DyeingComputer.ViewModel
|
||||
else
|
||||
if (WORK_RUN == 0)
|
||||
{
|
||||
if (Name_err == null)
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()))
|
||||
{
|
||||
int TIMEH = DIDETime / 3600;
|
||||
int TIMEM = (DIDETime - TIMEH * 3600) / 60;
|
||||
@@ -304,13 +352,8 @@ namespace DyeingComputer.ViewModel
|
||||
Status_Str = Resources.Dide + string.Format(" {0:D4}", TIMEH) + ":" + string.Format(" {0:D2}", TIMEM) + ":" + string.Format(" {0:D2}", TIMES);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static SerialPort port = new SerialPort();//创建串口
|
||||
static ModbusFactory factory = new ModbusFactory();
|
||||
// Create Modbus Master
|
||||
@@ -360,18 +403,14 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
master.WriteMultipleCoils(slaveId, 00000, DQ); //写入线圈
|
||||
master.WriteMultipleRegisters(slaveId,07000,DW); //写入寄存器
|
||||
|
||||
DO = master.ReadCoils(slaveId, 01000, DO_L); //读取线圈
|
||||
// DQ = master.ReadCoils(slaveId, 00000, DQ_L);
|
||||
RW = master.ReadHoldingRegisters(slaveId,06000, RW_L); //读取寄存器
|
||||
// RW = master.ReadHoldingRegisters(slaveId, 07000, RW_L);
|
||||
LINK_OK =true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LINK_OK=false;
|
||||
LINK_ERR++;
|
||||
// LogGing.LogGingDATA(ex.Message);
|
||||
Name_err = "PLC"+Properties.Resources.Connectionlost+"("+ ex.Message + ")";
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user