diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 367e40c..ba5a4f8 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -170,6 +170,7 @@ namespace DyeingComputer
if (messageBoxResult == MessageBoxResult.OK)
{
MainWindowViewModel.WORK_RUN = 0;// 运行时停止键为
+ MainWindowViewModel.DIDETime = 0;
}
}
}
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 7e52ee0..1021a8b 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -330,6 +330,15 @@ namespace DyeingComputer.Properties {
}
}
+ ///
+ /// 查找类似 Expected 的本地化字符串。
+ ///
+ public static string Expected {
+ get {
+ return ResourceManager.GetString("Expected", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Finish 的本地化字符串。
///
@@ -366,6 +375,24 @@ namespace DyeingComputer.Properties {
}
}
+ ///
+ /// 查找类似 Heat insulating 的本地化字符串。
+ ///
+ public static string Heat_insulating {
+ get {
+ return ResourceManager.GetString("Heat insulating", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Heats 的本地化字符串。
+ ///
+ public static string Heats {
+ get {
+ return ResourceManager.GetString("Heats", resourceCulture);
+ }
+ }
+
///
/// 查找类似 History 的本地化字符串。
///
@@ -456,6 +483,15 @@ namespace DyeingComputer.Properties {
}
}
+ ///
+ /// 查找类似 Min 的本地化字符串。
+ ///
+ public static string Min {
+ get {
+ return ResourceManager.GetString("Min", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Mixing 的本地化字符串。
///
diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx
index 65061a6..d69d5f4 100644
--- a/Properties/Resources.en-US.resx
+++ b/Properties/Resources.en-US.resx
@@ -117,50 +117,26 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Work Order
-
-
- Process
-
Curve
+
+ Delete
+
+
+ End Time
+
Engineer
Simulation
-
- I/O
-
-
- Next
-
-
- back
-
-
- System
-
History
-
- Parameter
-
-
- Program Group
-
-
- System Data Lost
-
-
- Work Order Numder
-
-
- Temperature
+
+ I/O
Lock/Unlock
@@ -168,27 +144,51 @@
New
-
- Delete
+
+ Next
-
- Redye
+
+ Parameter
-
- End Time
+
+ back
Process name
+
+ Program Group
+
+
+ Redye
+
Remarks
Start Time
+
+ System Data Lost
+
+
+ System
+
+
+ Process
+
+
+ Temperature
+
Time
+
+ Work Order
+
+
+ Work Order Numder
+
Ready
@@ -210,14 +210,14 @@
Line Up
-
- State
+
+ Not Implementation
Confirm
-
- Step
+
+ State
Edit
@@ -225,60 +225,63 @@
Rename
-
- ID
-
-
- Directives
+
+ Step
Code
-
- Recover
+
+ Directives
+
+
+ ID
Insert
+
+ Recover
+
Save
Quit
-
- Temperature Control
-
Add water
+
+ Cooling
+
+
+ Drainage
+
Flowmeter
-
- Water Level
+
+ Temperature Control
Washing
-
- Cooling
-
-
- Drainage
+
+ Water Level
-
- Pump Drainage
+
+ Put in the cloth
Out The Cloth
+
+ Pump Drainage
+
Running Time
-
- Put in the cloth
-
Add The Medicine
@@ -327,80 +330,77 @@
Sampling
-
- Invalid features
-
Function
+
+ Invalid features
+
NO
YES
-
- Rate
+
+ Advance
-
- Target
+
+ Beginning
+
+
+ Container
+
+
+ Curve
Headwaters
+
+ Medicine
+
+
+ Mixing
+
Number
Pressure
-
- Container
-
-
- Medicine
+
+ Rate
Tank
-
- Beginning
+
+ Target
Type
-
- Advance
-
-
- Curve
-
-
- Mixing
-
Blower
-
- Pump
-
Nozzle
-
- Wiggle
-
Overflow
-
- The process does not exist
+
+ Pump
+
+
+ Wiggle
Implementation
-
- Not Implementation
+
+ The process does not exist
Connection lost
@@ -417,4 +417,17 @@
Paused
+
+ Heats
+
+
+ Min
+
+
+
+
+
+
+ Heat insulating
+
\ No newline at end of file
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 1a24c84..be71ab8 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -417,4 +417,16 @@
Paused
+
+ Heats
+
+
+ Min
+
+
+ Expected
+
+
+ Heat insulating
+
\ No newline at end of file
diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx
index a6cb02c..89ec866 100644
--- a/Properties/Resources.zh-CN.resx
+++ b/Properties/Resources.zh-CN.resx
@@ -417,4 +417,17 @@
暂停
+
+ 加热
+
+
+ 分钟
+
+
+
+
+
+
+ 保温
+
\ No newline at end of file
diff --git a/Properties/Resources.zh-TW.resx b/Properties/Resources.zh-TW.resx
index 2349a55..d95b035 100644
--- a/Properties/Resources.zh-TW.resx
+++ b/Properties/Resources.zh-TW.resx
@@ -417,4 +417,13 @@
已暫停
+
+ 加熱
+
+
+ 分鐘
+
+
+ 保溫
+
\ No newline at end of file
diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs
index c55edc1..7cb4c5f 100644
--- a/View/TechnologicalProcessView.xaml.cs
+++ b/View/TechnologicalProcessView.xaml.cs
@@ -104,8 +104,9 @@ namespace DyeingComputer.View
{
if (e.Key == Key.Y) //按键y
{
- // MainWindowViewModel strart = new MainWindowViewModel();//实例
- // strart.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5));//传入参数开始
+ MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5));
+ // MainWindowViewModel strart = new MainWindowViewModel();//实例
+ // strart.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5));//传入参数开始
}
}
}
diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs
index 9c93ee6..f276783 100644
--- a/ViewModel/MainWindowViewModel.cs
+++ b/ViewModel/MainWindowViewModel.cs
@@ -155,14 +155,12 @@ namespace DyeingComputer.ViewModel
public static object Name_err;
public static object WorkNumder;
public static object Process_step;
- public Int32 DIDETime;
+ public static Int32 DIDETime; //空闲计时器
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
-
Work_Temp = Selet_dtm("1010") + " ℃";
Work_Numder = WorkNumder.ToString();
- // Status_Str = "qweqeqwqqfwfqef";
if (LINK_OK) Modbus_link();
@@ -175,28 +173,27 @@ namespace DyeingComputer.ViewModel
{
if (!LINK_OK) Modbus_link();
if (Name_err != null) Status_Str = Name_err.ToString();
- // if(SETP_runtime) STEP_RUN();
}
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
{
- // if (LINK_OK) Modbus_link();
+
}
public static int WORK_RUN = 0; //运行状态0停止1暂停2运行
- private string STEP_ID = "0";
- private double STEP_P1 = 0;
- private double STEP_P2 = 0;
- private double STEP_P3 = 0;
- private double STEP_P4 = 0;
- private double STEP_P5 = 0;
- private int SETP_runtime; //步骤开始
- private bool STEP_finish = false; //步骤结束
- private int STEP_TIME = 0; //步骤计时S
- private int THL_mode = 0; //温控模式 0保温 1加热 2降
- private double TEMP_co = 0; //计算温度
-
- public void STEP_START(string ID,double P1,double P2,double P3,double P4,double P5)
+ private static string STEP_ID = "0";
+ private static double STEP_P1 = 0;
+ private static double STEP_P2 = 0;
+ private static double STEP_P3 = 0;
+ private static double STEP_P4 = 0;
+ private static double STEP_P5 = 0;
+ private static bool SETP_runtime = false; //步骤开始
+ private static bool STEP_finish = false; //步骤结束
+ private static int STEP_TIME = 0; //步骤计时S
+ private static int THL_mode = 0; //温控模式 0保温 1加热 2降
+ private static double TEMP_co = 0; //计算温度
+
+ public static void STEP_START(string ID,double P1,double P2,double P3,double P4,double P5)
{
if (ID == "001")
{
@@ -213,7 +210,7 @@ namespace DyeingComputer.ViewModel
updata_dtm("1003", STEP_P2 / 600);
STEP_TIME = Convert.ToInt16(STEP_P3) * 60;
WORK_RUN = 2;
- SETP_runtime = 1;
+ SETP_runtime = true;
}
}
@@ -221,13 +218,15 @@ namespace DyeingComputer.ViewModel
void STEP_RUN()
{
- /* if (WORK_RUN == 2)
+ if (WORK_RUN == 2)
{
- if (SETP_runtime == 1)
+ if (SETP_runtime)
{
if (STEP_ID == "001")
{
-
+ int TIME_H;
+ int TIME_M;
+ int TIME_S;
double TO = 0;
double T = Selet_dtm("1010"); //实际温度
if (THL_mode == 0) //保温
@@ -237,25 +236,43 @@ namespace DyeingComputer.ViewModel
TO = pid.PID_iterate(STEP_P1, T, ts);
if (TO < 0) TO = 0;
- int TIME_H = STEP_TIME / 3600;
- int TIME_M = (STEP_TIME - TIME_H * 3600) / 60;
- int TIME_S = STEP_TIME - TIME_H * 3600 - TIME_M * 60;
- Status_Str = Resources.Temperature + Resources.Time + string.Format(" {0:D2}", TIME_H) + ":" + string.Format(" {0:D2}", TIME_M) + ":" + string.Format(" {0:D2}", TIME_S);
+ 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);
}
else if (THL_mode == 1)//升温
{
- TEMP_co = TEMP_co + (STEP_P2 / 60);
+ TEMP_co = TEMP_co + (STEP_P2 / 600);
TO = pid.PID_iterate(TEMP_co, T, ts);
if (TO < 0) TO = 0;
- if (STEP_P1 < T) THL_mode = 0;
+ if (STEP_P1 < T)
+ {
+ THL_mode = 0;
+ TIME_M = 0;
+ }
+ else
+ {
+ 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;
}
else if (THL_mode == 2)//降温
{
- TEMP_co = TEMP_co - (STEP_P2 / 60);
+ TEMP_co = TEMP_co - (STEP_P2 / 600);
TO = pid.PID_iterate(TEMP_co, T, ts);
if (TO > 0) TO = 0;
TO = Math.Abs(TO);
- if (STEP_P1 > T) THL_mode = 0;
+ if (STEP_P1 > T)
+ {
+ THL_mode = 0;
+ TIME_M = 0;
+ }
+ else
+ {
+ 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;
}
updata_dtm("1004", TO);
@@ -276,7 +293,7 @@ namespace DyeingComputer.ViewModel
{
Status_Str = Resources.Paused;
}
- else */
+ else
if (WORK_RUN == 0)
{
if (Name_err == null)
@@ -360,9 +377,9 @@ namespace DyeingComputer.ViewModel
});
}
- public DataTable dt_d = new DataTable("DIO");
- public DataTable dt_a = new DataTable("AIO");
- public DataTable dt_m = new DataTable("M");
+ public static DataTable dt_d = new DataTable("DIO");
+ public static DataTable dt_a = new DataTable("AIO");
+ public static DataTable dt_m = new DataTable("M");
void SQL_data()//获得io表
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
@@ -396,7 +413,7 @@ namespace DyeingComputer.ViewModel
});
}
- public double Selet_dtm(string key)//M寄存器
+ public static double Selet_dtm(string key)//M寄存器
{
try
{
@@ -410,7 +427,7 @@ namespace DyeingComputer.ViewModel
return -1;
}
}
- public bool Selet_dtd(string key)//D寄存器
+ public static bool Selet_dtd(string key)//D寄存器
{
try {
DataRow[] arrRows = dt_d.Select("ID='" + key + "'");
@@ -423,7 +440,7 @@ namespace DyeingComputer.ViewModel
return false;
}
}
- public int Selet_dta(string key)//A寄存器
+ public static int Selet_dta(string key)//A寄存器
{
try {
DataRow[] arrRows = dt_a.Select("ID='" + key + "'");
@@ -436,7 +453,7 @@ namespace DyeingComputer.ViewModel
return -1;
}
}
- public void updata_dtm(string key,double Value)//更新M寄存器
+ public static void updata_dtm(string key,double Value)//更新M寄存器
{
try
{
@@ -459,7 +476,7 @@ namespace DyeingComputer.ViewModel
}
}
- public void updata_dtd(string key, bool Value)//更新D寄存器
+ public static void updata_dtd(string key, bool Value)//更新D寄存器
{
try
{
@@ -483,7 +500,7 @@ namespace DyeingComputer.ViewModel
LogGing.LogGingDATA(ex.ToString());
}
}
- public void updata_dta(string key, int Value)//更新A寄存器
+ public static void updata_dta(string key, int Value)//更新A寄存器
{
try
{