private static bool AnalysisInputData() { try { // Test_Led.CheckLed(); bool outLed1 = Double.Parse(State.VmTestResults.LED1Value) >= State.TestSpec.LedOnCount; bool outLed2 = Double.Parse(State.VmTestResults.LED2Value) >= State.TestSpec.LedOnCount; bool outLed3 = Double.Parse(State.VmTestResults.LED3Value) >= State.TestSpec.LedOnCount; ListTestSpec.FirstOrDefault(L => L.name == NAME.LED1).Output = outLed1; ListTestSpec.FirstOrDefault(L => L.name == NAME.LED2).Output = outLed2; ListTestSpec.FirstOrDefault(L => L.name == NAME.LED3).Output = outLed3; General.io.ReadInputData(EPX64S.PORT.P3); var p3Data = General.io.P3InputData; bool outPc1 = (p3Data & 0x02) == 0x00; bool outPc2 = (p3Data & 0x04) == 0x00; bool outPc3 = (p3Data & 0x20) == 0x00; bool outPc4 = (p3Data & 0x40) == 0x00; ListTestSpec.FirstOrDefault(L => L.name == NAME.PC1).Output = outPc1; ListTestSpec.FirstOrDefault(L => L.name == NAME.PC2).Output = outPc2; ListTestSpec.FirstOrDefault(L => L.name == NAME.PC3).Output = outPc3; ListTestSpec.FirstOrDefault(L => L.name == NAME.PC4).Output = outPc4; //ビューモデルの更新 State.VmTestResults.ColorLed1Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.LED1).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorLed2Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.LED2).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorLed3Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.LED3).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorPc1Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.PC1).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorPc2Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.PC2).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorPc3Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.PC3).Output ? OnBrush : Brushes.Transparent; State.VmTestResults.ColorPc4Out = ListTestSpec.FirstOrDefault(L => L.name == NAME.PC4).Output ? OnBrush : Brushes.Transparent; Thread.Sleep(300); return(ListTestSpec.All(L => L.Output == L.Exp)); } catch { return(false); } }
public static async Task <bool> CheckDout() { const bool on = true; const bool off = false; bool FlagTimeout = false; var tmTimeout = new System.Timers.Timer(); tmTimeout.Elapsed += (sender, e) => { FlagTimeout = true; }; return(await Task <bool> .Run(() => { try { General.ResetIo(); Thread.Sleep(1500); Flags.AddDecision = false; ResetViewModel(); InitList();//テストスペック初期化 //テストログの更新 State.VmTestStatus.TestLog += "\r\nテストモード + 電源投入"; General.SetRL1(false); General.SetRL2(false); General.SetRL3(false); General.SetRL4(false); General.SetRL5(true); General.SetRL6(true); Thread.Sleep(500); General.PowSupply(true);//RL1 SetInput(on, off, off, off, on, on, off); //SetExp(off, off, off, off, off, on, off);//マイコン特採対応 2017.11.9 ※限定です SetExp(off, off, off, off, on, off, off); Thread.Sleep(2000); State.VmTestStatus.TestLog += "\r\nソフトVerチェック"; ErrTitle = "ソフトVerチェック"; if (!AnalysisInputData()) { return false; } State.VmTestStatus.TestLog += "---PASS"; ////マイコン特採対応 2017.11.9 ※限定です //State.VmTestStatus.TestLog += "\r\nLED2(緑)カラーチェック"; //ErrTitle = "LED2(緑)カラーチェック"; //if (!Test_Led.CheckColor(Test_Led.NAME.LED2)) return false; //State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nLED1(黄)カラーチェック"; ErrTitle = "LED1(黄)カラーチェック"; if (!Test_Led.CheckColor(Test_Led.NAME.LED1)) { return false; } State.VmTestStatus.TestLog += "---PASS"; //ここで製品のRY1、RY2がOFFしているはずなので、VCC2(RelayOff状態)を計測する State.VmTestStatus.TestLog += "\r\n電源電圧チェック Vcc2(RY1,RY2 ON)"; ErrTitle = "電源電圧チェック Vcc2(RY1,RY2 ON)"; if (!電圧チェック.CheckVolt(電圧チェック.CH.VCC2_RELAY_OFF)) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nS1 OnOffチェック"; ErrTitle = "S1 OnOffチェック"; SetInput(on, off, off, off, on, on, on); SetExp(off, off, off, off, off, off, off); General.S1On(); Thread.Sleep(2000); if (!AnalysisInputData()) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nフロートスイッチ下限チェック"; ErrTitle = "フロートスイッチ下限チェック"; SetInput(on, on, off, off, on, on, off); SetExp(off, off, off, off, on, off, off); General.SetRL2(true); Thread.Sleep(2000); if (!AnalysisInputData()) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nフロートスイッチ上限チェック 1"; ErrTitle = "フロートスイッチ上限チェック 1"; SetInput(on, on, on, off, on, on, off); SetExp(off, off, off, on, off, on, off); FlagTimeout = false; tmTimeout.Interval = 2000; tmTimeout.Start(); General.SetRL3(true); while (true) { if (FlagTimeout) { return false; } if (AnalysisInputData()) { break; } } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nフロートスイッチ上限チェック 2"; ErrTitle = "フロートスイッチ上限チェック 2"; SetExp(off, on, off, on, off, on, off); FlagTimeout = false; tmTimeout.Interval = 4000; tmTimeout.Start(); while (true) { if (FlagTimeout) { return false; } if (AnalysisInputData()) { break; } } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nLED2(緑)カラーチェック"; ErrTitle = "LED2(緑)カラーチェック"; if (!Test_Led.CheckColor(Test_Led.NAME.LED2)) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nフロートスイッチ漏れチェック①"; ErrTitle = "フロートスイッチ漏れチェック①"; SetInput(on, on, on, on, on, on, off); SetExp(off, off, off, off, off, off, on); General.SetRL4(true); Thread.Sleep(2000); if (!AnalysisInputData()) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nLED3(赤)カラーチェック"; ErrTitle = "LED3(赤)カラーチェック"; if (!Test_Led.CheckColor(Test_Led.NAME.LED3)) { return false; } State.VmTestStatus.TestLog += "---PASS"; State.VmTestStatus.TestLog += "\r\nフロートスイッチ漏れチェック②"; ErrTitle = "フロートスイッチ漏れチェック②"; SetInput(on, on, on, on, off, on, off); SetExp(off, off, on, off, off, off, off); General.SetRL5(false); Thread.Sleep(2000); if (!AnalysisInputData()) { return false; } State.VmTestStatus.TestLog += "---PASS"; Thread.Sleep(2000); return true; } catch { return false; } })); }