Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
5f542f5098
2 files changed
+49
-15
No files matched your search
+11
-11
@@ -8,16 +8,16 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
public class PID
|
public class PID
|
||||||
{
|
{
|
||||||
private static double Ts; // Sample period in seconds
|
private double Ts; // Sample period in seconds
|
||||||
private static double K; // Rollup parameter
|
private double K; // Rollup parameter
|
||||||
private static double b0, b1, b2; // Rollup parameters
|
private double b0, b1, b2; // Rollup parameters
|
||||||
private static double a0, a1, a2; // Rollup parameters
|
private double a0, a1, a2; // Rollup parameters
|
||||||
private static double y0 = 0; // Current output
|
private double y0 = 0; // Current output
|
||||||
private static double y1 = 0; // Output one iteration old
|
private double y1 = 0; // Output one iteration old
|
||||||
private static double y2 = 0; // Output two iterations old
|
private double y2 = 0; // Output two iterations old
|
||||||
private static double e0 = 0; // Current error
|
private double e0 = 0; // Current error
|
||||||
private static double e1 = 0; // Error one iteration old
|
private double e1 = 0; // Error one iteration old
|
||||||
private static double e2 = 0; // Error two iterations old
|
private double e2 = 0; // Error two iterations old
|
||||||
|
|
||||||
#region 构造函数
|
#region 构造函数
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -95,7 +95,7 @@ namespace DyeingComputer.UserClass
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置控制器历史记录,有效重置控制器。
|
/// 重置控制器历史记录,有效重置控制器。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ResetController()
|
public void ResetController()
|
||||||
{
|
{
|
||||||
e2 = 0;
|
e2 = 0;
|
||||||
e1 = 0;
|
e1 = 0;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using System.IO.Ports;
|
|||||||
using OpenTK.Graphics.ES11;
|
using OpenTK.Graphics.ES11;
|
||||||
using DyeingComputer.Properties;
|
using DyeingComputer.Properties;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using static DyeingComputer.Windows.ViewStep;
|
||||||
|
|
||||||
|
|
||||||
namespace DyeingComputer.ViewModel
|
namespace DyeingComputer.ViewModel
|
||||||
@@ -109,7 +110,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
|
|
||||||
DispatcherTimer timer5s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
DispatcherTimer timer5s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
||||||
{
|
{
|
||||||
Interval = TimeSpan.FromSeconds(3)//秒
|
Interval = TimeSpan.FromSeconds(5)//秒
|
||||||
};
|
};
|
||||||
timer5s.Tick += Tick_Event_5S;
|
timer5s.Tick += Tick_Event_5S;
|
||||||
timer5s.Start();
|
timer5s.Start();
|
||||||
@@ -125,7 +126,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
|
|
||||||
public static object Name_err;
|
public static object Name_err;
|
||||||
public static object WorkNumder;
|
public static object WorkNumder;
|
||||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
Work_Temp = Selet_dtm("1010") + " ℃";
|
Work_Temp = Selet_dtm("1010") + " ℃";
|
||||||
@@ -135,16 +136,49 @@ namespace DyeingComputer.ViewModel
|
|||||||
if (LINK_OK) Modbus_link();
|
if (LINK_OK) Modbus_link();
|
||||||
IO_data();
|
IO_data();
|
||||||
}
|
}
|
||||||
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件
|
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
||||||
{
|
{
|
||||||
if (!LINK_OK) Modbus_link();
|
if (!LINK_OK) Modbus_link();
|
||||||
if (Name_err != null) Status_Str = Name_err.ToString();
|
if (Name_err != null) Status_Str = Name_err.ToString();
|
||||||
|
STEP_RUN();
|
||||||
}
|
}
|
||||||
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件
|
void DisTimer_100MS(object sender, EventArgs e)//Tick_Event周期执行事件100MS
|
||||||
{
|
{
|
||||||
// if (LINK_OK) Modbus_link();
|
// if (LINK_OK) Modbus_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string STEP_ID = "0";
|
||||||
|
double STEP_P1 = 0;
|
||||||
|
double STEP_P2 = 0;
|
||||||
|
double STEP_P3 = 0;
|
||||||
|
double STEP_P4 = 0;
|
||||||
|
double STEP_P5 = 0;
|
||||||
|
|
||||||
|
void STEP_START(object sender, AddressUpdateEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (e.StepID == "001")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void STEP_RUN()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static SerialPort port = new SerialPort();//创建串口
|
public static SerialPort port = new SerialPort();//创建串口
|
||||||
static ModbusFactory factory = new ModbusFactory();
|
static ModbusFactory factory = new ModbusFactory();
|
||||||
// Create Modbus Master
|
// Create Modbus Master
|
||||||
|
|||||||
Reference in new issue
Block a user