|
@ -52,23 +52,21 @@ namespace DyeingComputer.ViewModel |
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
|
|
private PID PID = null; |
|
|
private PID PID = null; |
|
|
private IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini"); |
|
|
private IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini"); |
|
|
|
|
|
PID pid = new PID(); |
|
|
|
|
|
|
|
|
public MainWindowViewModel() |
|
|
public MainWindowViewModel() |
|
|
{ |
|
|
{ |
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
double ST01 = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST01'", null)); //读取
|
|
|
pid.Kp = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST01'", null)); //读取
|
|
|
double ST02 = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST02'", null)); |
|
|
pid.Ki = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST02'", null)); |
|
|
double ST03 = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST03'", null)); |
|
|
pid.Kd = Convert.ToDouble( SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST03'", null)); |
|
|
double ST04 = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST04'", null)); |
|
|
pid.N = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST04'", null)); |
|
|
double ST05 = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST05'", null)); |
|
|
pid.OutputUpperLimit = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST05'", null)); |
|
|
double ST06 = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST06'", null)); |
|
|
pid.OutputLowerLimit = Convert.ToDouble(SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'ST06'", null)); |
|
|
SQLiteHelpers.Close(); |
|
|
SQLiteHelpers.Close(); |
|
|
|
|
|
|
|
|
WorkNumder = "----------"; |
|
|
WorkNumder = "----------"; |
|
|
PID pid=new PID(ST01,ST02,ST03,ST04,ST05,ST06); |
|
|
|
|
|
|
|
|
|
|
|
CountDown(); //启动循环任务
|
|
|
CountDown(); //启动循环任务
|
|
|
SQL_data(); //读数据库
|
|
|
SQL_data(); //读数据库
|
|
|
UPort(); //启动串口
|
|
|
UPort(); //启动串口
|
|
|