StateMachine timing period is 2 seconds for iPerlST bench, 1 second for other all benches.

This commit is contained in:
Milan Hanajik
2015-08-19 13:00:00 +02:00
parent 22c652ad24
commit fa6b99b980
4 changed files with 11 additions and 7 deletions
@@ -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)";
@@ -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)";
@@ -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";
@@ -54,8 +54,12 @@ namespace TBF.BenchControl
public static IList<Elde.ValveEx.Valve> 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