- The update of the 6th watermeter data in ProcessTabPageCtrl fixed
- Valve/Pump delay evaluation modified: Delays of valves/pums that have not changed are not taken into account (faster when there is no valve/pump switching)
This commit is contained in:
@@ -27,16 +27,33 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
this.VClose = (vClose == null) ? new List<IValve>() : vClose;
|
||||
}
|
||||
|
||||
/// Max. delay in [s] of all valves to be opened or closed
|
||||
public int MaxDelay
|
||||
/// <summary>
|
||||
/// Max. delay of all valves that were opened or closed
|
||||
/// </summary>
|
||||
/// <param name="changed">'ulong' with bits of valves that were actually changed set ot '1'</param>
|
||||
/// <returns>Delay in [s]</returns>
|
||||
public int MaxDelay(ulong changed)
|
||||
{
|
||||
get
|
||||
int max = 0;
|
||||
foreach (var vlv in VOpen)
|
||||
{
|
||||
int max = 0;
|
||||
foreach (var vlv in VOpen) if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
foreach (var vlv in VClose) if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
return max;
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve && ((vlv as Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
}
|
||||
foreach (var vlv in VClose)
|
||||
{
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve && ((vlv as Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,9 +200,9 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
controlBoard.SetValves(switchPoints[0].MasksOpen, switchPoints[0].MasksClose);
|
||||
ulong changed = controlBoard.SetValves(switchPoints[0].MasksOpen, switchPoints[0].MasksClose);
|
||||
swStartTime = StateMachine.Time;
|
||||
maxDelayTime = switchPoints[0].MaxDelay;
|
||||
maxDelayTime = switchPoints[0].MaxDelay(changed);
|
||||
nextIx = 1;
|
||||
}
|
||||
|
||||
@@ -203,11 +220,14 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
|
||||
if (StateMachine.Time >= swStartTime + switchPoints[nextIx].TimeSec)
|
||||
{
|
||||
if (switchPoints[nextIx].TimeSec + switchPoints[nextIx].MaxDelay > maxDelayTime)
|
||||
ulong changed = controlBoard.SetValves(switchPoints[nextIx].MasksOpen, switchPoints[nextIx].MasksClose);
|
||||
|
||||
int nextDelay = switchPoints[nextIx].MaxDelay(changed);
|
||||
if (switchPoints[nextIx].TimeSec + nextDelay > maxDelayTime)
|
||||
{
|
||||
maxDelayTime = switchPoints[nextIx].TimeSec + switchPoints[nextIx].MaxDelay;
|
||||
maxDelayTime = switchPoints[nextIx].TimeSec + nextDelay;
|
||||
}
|
||||
controlBoard.SetValves(switchPoints[nextIx].MasksOpen, switchPoints[nextIx].MasksClose);
|
||||
|
||||
nextIx++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user