Browse Source

PH控制

master
sc 1 year ago
parent
commit
7d5a0fc58d
  1. 102
      ViewModel/MainWindowViewModel.cs
  2. 2
      Windows/ViewStep.xaml.cs

102
ViewModel/MainWindowViewModel.cs

@ -503,7 +503,7 @@ namespace DyeingComputer.ViewModel
STEP_finish = false;
break;//PH温度控制
case "093":
STEP_P1 = Convert.ToDouble(P1);
STEP_TIME = Convert.ToInt16(P1);
WORK_RUN = 2;
SETP_runtime = true;
STEP_finish = false;
@ -522,6 +522,7 @@ namespace DyeingComputer.ViewModel
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
private int temp_time10s = 10;//开关周期时间
private bool PH_start = false;
private string TANK1, TANK2, TANK3;//料桶信息
public static string TANK1_DYELOT, TANK2_DYELOT, TANK3_DYELOT;//料单号
private int TANK1_REDYE,TANK1_STEP, TANK2_REDYE, TANK2_STEP, TANK3_REDYE, TANK3_STEP;
@ -1194,17 +1195,106 @@ namespace DyeingComputer.ViewModel
STEP_finish = true;
break;//呼叫输送准备
case "090":
if (((STEP_P1-1)<Selet_dtm("1010"))&&(Selet_dtm("1010") < (STEP_P1+1))) PH_start = true;//达到温度开始ph控制
if (PH_start)
{
if (STEP_P2 >= Selet_dtm("1009"))
{
PH_start= false;
STEP_finish = true;
}
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = "PH" + Resources.PHControl + "(" + Selet_dtm("1009") + "pH)";
}
else
{
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = "PH" + Resources.PHControl + "(" + Resources.Await + Resources.Temperature +")";
}
break;//快速加酸
case "091":
T = Selet_dtm("1010"); //实际温度
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 ((TEMP_co < T) || (T - TEMP_co > 3)) TO = 0;
if (STEP_P1 <= T)
{
TO = 0;
Updata_dtm("1004", TO);
Updata_dta("5001", Convert.ToInt16(TO));
Updata_dtd("3009", false);
}
else
{
Updata_dtm("1004", TO);
Updata_dtm("1005", TEMP_co);
if (MT12 == 1)//输出类型0开关1模拟
{
Updata_dta("5001", Convert.ToInt16(TO));
}
else
{
if (temp_time10s <= 0) { temp_time10s = 10; } else { temp_time10s--; }
if (THL_mode == 2)
{
if ((temp_time10s <= Convert.ToInt16(TO) / 100))
{ Updata_dtd("3010", true); }
else { Updata_dtd("3010", false); }//降温
}
else
{
if ((temp_time10s <= Convert.ToInt16(TO) / 100))
{ Updata_dtd("3009", true); }
else { Updata_dtd("3009", false); }//升温
}
}
}
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 = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C";
}
}
if (STEP_P2 >= Selet_dtm("1009"))
{
PH_start = false;
STEP_finish = true;
}
else
{
PH_start= true;
Status_Str = Status_Str + "(" + Selet_dtm("1009")+"pH)";
}
break;//PH温度控制
case "093":
if (STEP_TIME <= 0)
{
STEP_finish = true;
}
else
{
STEP_TIME--;
}
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = "PH" + Resources.PHDetection +"("+ STEP_TIME +")";
break;//PH检测
case "094":
break;//PH控制
if (STEP_TIME <= 0)//控制时间到达结束
{
PH_start = false;
STEP_finish = true;
}
else
{
PH_start = true;
STEP_TIME--;
}
if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = "PH" + Resources.PHControl + "(" + STEP_TIME + "S)";
break;//PH控制(时间)
default:
break;
}

2
Windows/ViewStep.xaml.cs

@ -480,7 +480,7 @@ namespace DyeingComputer.Windows
P5N.Visibility = Visibility.Collapsed;
break;
case 27:
P1N.Text = Properties.Resources.Beginning+ Properties.Resources.Temperature;
P1N.Text = Properties.Resources.Time;
P2N.Text = "PH";
P1.Visibility = Visibility.Visible;
P1N.Visibility = Visibility.Visible;

Loading…
Cancel
Save