From fa6b99b980b62746c81e59136e8b43630ee05150 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 19 Aug 2015 13:00:00 +0200 Subject: [PATCH] StateMachine timing period is 2 seconds for iPerlST bench, 1 second for other all benches. --- TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs | 2 +- .../BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs | 2 +- .../BenchControl/Elde/Valve/ValveCfgCtrl.cs | 6 +++--- TestBenchFramework/BenchControl/StateMachine.cs | 8 ++++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs index d0e5a6d1a..464dc1fa8 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs @@ -103,7 +103,7 @@ namespace TBF.BenchControl.Elde.Pump flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Bit Position' should be between 0 and 63"; } - if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300) + if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300 || (dummy % StateMachine.Period) != 0) { flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)"; diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs index f162cd0b3..f4bce4358 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs @@ -111,7 +111,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'FM Index' should be between 0 and FMPumpsCount - 1"; } - if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300) + if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300 || (dummy % StateMachine.Period) != 0) { flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)"; diff --git a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs index f55c98486..fae2e7300 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs @@ -149,17 +149,17 @@ namespace TBF.BenchControl.Elde.Valve flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Bit Position' should be between 0 and 63"; } - if (!int.TryParse(openCloseTimeTextBox.Text, out dummy) || dummy < 0 || dummy > 300) + if (!int.TryParse(openCloseTimeTextBox.Text, out dummy) || dummy < 0 || dummy > 300 || (dummy % StateMachine.Period) != 0) { flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Open/close time' should be between 0 and 300 s"; } - if (!int.TryParse(lagOpeningTextBox.Text, out dummy)) + if (!int.TryParse(lagOpeningTextBox.Text, out dummy) || (dummy % StateMachine.Period) != 0) { flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Delay when opening' error"; } - if (!int.TryParse(lagClosingTextBox.Text, out dummy)) + if (!int.TryParse(lagClosingTextBox.Text, out dummy) || (dummy % StateMachine.Period) != 0) { flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Delay when closing' error"; diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 88f3c6677..82a591774 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -54,8 +54,12 @@ namespace TBF.BenchControl public static IList ExtendedValves; /// list of extended valves - /// Time and synchronization - public const int Period = 1; /// State machine period in sec. + /// Time and synchronization +#if IPERLST + public const int Period = 2; /// State machine period in sec. +#else + public const int Period = 1; /// State machine period in sec. +#endif static DateTime startDateTime; /// DateTime of time instance when the state machine worker thread starts static int currentTimeSec; /// Time from the start of the state machine in seconds static bool quitStateMachine; /// flag to stop the worker thread