예제 #1
0
 private void runPredict()
 {
     ServiceLog.WriteLog("predict", null);
     n_predict++;
     CallUserExe.call("phm_home", exePredictPath, null);
     hasDiaged    = false;
     hasPredicted = true;
 }
예제 #2
0
 private void runDiag()
 {
     ServiceLog.WriteLog("diag", null);
     n_diag++;
     // 定时器默认会新开一个线程,无需手动写
     CallUserExe.call("phm_home", exeDiagPath, null);
     hasDiaged    = true;
     hasPredicted = false;
 }
예제 #3
0
        // ------------------ 开始结束触发事件 --------------------- //
        protected override void OnStart(string[] args)
        {
            File.Delete(done_flag_path);
            string failed_dir = CallUserExe.getFullFilePath("phm_home", @"\Csharp代码\PHM运行失败日志");

            if (!Directory.Exists(failed_dir))
            {
                Directory.CreateDirectory(failed_dir);
            }

            ServiceLog.WriteLog("start", null);
        }
예제 #4
0
        private void runChecklog() // 检查PHM.log是否有异常
        {
            string info = ServiceLog.checkPHMlog(logpath);

            if (info == "success")
            {
                ServiceLog.WriteLog(info, null);
                if (hasDiaged) // 执行完诊断才写入alarm
                {
                    // 执行完毕后运行 diag_post.bat 将诊断结果写入报警表(2016.12.8改为在matlab中处理)
                    //CallUserExe.call("phm_home", exePostPath, " diag");
                    // 这里的参数需要加一个空格,猜测是采用system('exe arg1 arg2')这种形式
                    ServiceLog.WriteLog("alarm", null);
                }
                else
                {
                    // 执行完毕后运行 predict_post.bat 进行后处理(2016.12.8改为在matlab中处理)
                    //CallUserExe.call("phm_home", exePostPath, " predict");
                    ServiceLog.WriteLog("alarm", null);
                }
            }
            else // 出现异常
            {
                if (hasPredicted) // 记录异常出现次数
                {
                    n_failed_predict++;
                }
                if (hasDiaged)
                {
                    n_failed_diag++;
                }

                if (info == "PHM日志不存在!")
                {
                    ServiceLog.WriteLog("failed", null);
                }
                else
                {
                    string newlogpath = ServiceLog.backupPHMlog(logpath, hasDiaged); // 将出错的log文件备份
                    ServiceLog.WriteLog("failed", newlogpath);
                }
                //Interop.ShowMessageBox(info, "错误信息"); // 向桌面发送错误信息提示
            }
        }
예제 #5
0
 protected override void OnStop()
 {
     ServiceLog.WriteLog("stop", null);
 }