diff --git a/TestBenchFramework/BenchControl/Elde/Pump/Pump.cs b/TestBenchFramework/BenchControl/Elde/Pump/Pump.cs index a8bfe20c0..094e99f71 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/Pump.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/Pump.cs @@ -23,10 +23,12 @@ namespace TBF.BenchControl.Elde.Pump public string Name { get { return pumpCfg.Name; } } + public int Delay { get { return pumpCfg.Delay; } } + public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding public GenericDevices.IValve CoupledTo { get { return null; } } - public bool Invert { get { return false; } } + public bool InvertCouple { get { return false; } } public int LagOpening { get { return 0; } } public int LagClosing { get { return 0; } } diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs index 6e3d95714..2097528f3 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs @@ -7,27 +7,30 @@ namespace TBF.BenchControl.Elde.Pump public class PumpCfg : ComponentCfgBase, IChildComponentCfg { public int BitPosition; + public int Delay; /// Parameterless constructor public PumpCfg() { + Delay = 1; } /// Constructor - public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition) + public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition, int delay) : base(factory, name, parentName) { this.BitPosition = bitPosition; + this.Delay = delay; } public IComponentCfg Clone() { - return new PumpCfg(Factory, Name, ParentName, BitPosition); + return new PumpCfg(Factory, Name, ParentName, BitPosition, Delay); } public string ToString(int i) { - return string.Format("bit={0}", BitPosition); + return string.Format("bit={0}, delay={1}s", BitPosition, Delay); } public TBF.Entities.Component CreateDbEntity() diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.Designer.cs index 1a21a54de..4880bdd5c 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.Designer.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.Designer.cs @@ -35,6 +35,8 @@ this.nameLabel = new System.Windows.Forms.Label(); this.classNameLabel = new System.Windows.Forms.Label(); this.parentNameComboBox = new System.Windows.Forms.ComboBox(); + this.delayTextBox = new System.Windows.Forms.TextBox(); + this.delayLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // bitPositionTextBox @@ -98,10 +100,29 @@ this.parentNameComboBox.Size = new System.Drawing.Size(130, 21); this.parentNameComboBox.TabIndex = 4; // + // delayTextBox + // + this.delayTextBox.Enabled = false; + this.delayTextBox.Location = new System.Drawing.Point(122, 124); + this.delayTextBox.Name = "delayTextBox"; + this.delayTextBox.Size = new System.Drawing.Size(46, 20); + this.delayTextBox.TabIndex = 8; + // + // delayLabel + // + this.delayLabel.AutoSize = true; + this.delayLabel.Location = new System.Drawing.Point(36, 127); + this.delayLabel.Name = "delayLabel"; + this.delayLabel.Size = new System.Drawing.Size(48, 13); + this.delayLabel.TabIndex = 7; + this.delayLabel.Text = "Delay [s]"; + // // PumpCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.delayTextBox); + this.Controls.Add(this.delayLabel); this.Controls.Add(this.parentNameComboBox); this.Controls.Add(this.bitPositionTextBox); this.Controls.Add(this.bitPositionLabel); @@ -126,5 +147,7 @@ private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label classNameLabel; private System.Windows.Forms.ComboBox parentNameComboBox; + private System.Windows.Forms.TextBox delayTextBox; + private System.Windows.Forms.Label delayLabel; } } diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs index b5b868e93..f32913b62 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs @@ -53,6 +53,7 @@ namespace TBF.BenchControl.Elde.Pump nameTextBox.Text = config.Name; parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; bitPositionTextBox.Text = config.BitPosition.ToString(); + delayTextBox.Text = config.Delay.ToString(); } public void Unlock() @@ -60,6 +61,7 @@ namespace TBF.BenchControl.Elde.Pump nameTextBox.Enabled = true; parentNameComboBox.Enabled = true; bitPositionTextBox.Enabled = true; + delayTextBox.Enabled = true; } public void UpdateCfg() @@ -69,7 +71,8 @@ namespace TBF.BenchControl.Elde.Pump config.Name = nameTextBox.Text; config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text; config.BitPosition = int.Parse(bitPositionTextBox.Text); - } + config.Delay = int.Parse(delayTextBox.Text); + } public CfgVerifyFlags VerifyCfg(ref string message) { @@ -86,7 +89,12 @@ namespace TBF.BenchControl.Elde.Pump flags |= CfgVerifyFlags.Error; message += Environment.NewLine + "'Bit Position' should be between 0 and 63"; } - return flags; + if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300) + { + flags |= CfgVerifyFlags.Error; + message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)"; + } + return flags; } } } diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs index e5e92bd55..9c2b787dd 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs @@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.Pump public IComponentCfg DefaultConfig(IList components) { - return new PumpCfg(this, "Pump", "CB", 0); + return new PumpCfg(this, "Pump", "CB", 0, 1); } public IComponentCfgCtrl CreateCfgCtrl() diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/Pump.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/Pump.cs index a0cd06fe5..49d42a9b0 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/Pump.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/Pump.cs @@ -23,10 +23,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM public string Name { get { return pumpCfg.Name; } } + public int Delay { get { return pumpCfg.Delay; } } + public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding public GenericDevices.IValve CoupledTo { get { return null; } } - public bool Invert { get { return false; } } + public bool InvertCouple { get { return false; } } public int LagOpening { get { return 0; } } public int LagClosing { get { return 0; } } diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs index 4c52a8f63..f1962eda7 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs @@ -8,27 +8,30 @@ namespace TBF.BenchControl.Elde.PumpWithFM { public int BitPosition; public int FMIndex; + public int Delay; /// Parameterless constructor public PumpCfg() { + Delay = 1; } /// Constructor - public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition, int fmIndex) + public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition, int fmIndex, int delay) : base(factory, name, parentName) { this.BitPosition = bitPosition; this.FMIndex = fmIndex; + this.Delay = delay; } public IComponentCfg Clone() { - return new PumpCfg(Factory, Name, ParentName, BitPosition, FMIndex); + return new PumpCfg(Factory, Name, ParentName, BitPosition, FMIndex, Delay); } public string ToString(int i) { - return string.Format("bit={0}, fmIdx={1}", BitPosition, FMIndex); + return string.Format("bit={0}, fmIdx={1}, delay={2}s", BitPosition, FMIndex, Delay); } public TBF.Entities.Component CreateDbEntity() diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.Designer.cs index a8b21c99a..dd491697d 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.Designer.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.Designer.cs @@ -37,6 +37,8 @@ this.parentNameComboBox = new System.Windows.Forms.ComboBox(); this.fmIndexTextBox = new System.Windows.Forms.TextBox(); this.fmIndexLabel = new System.Windows.Forms.Label(); + this.delayTextBox = new System.Windows.Forms.TextBox(); + this.delayLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // bitPositionTextBox @@ -117,10 +119,29 @@ this.fmIndexLabel.TabIndex = 7; this.fmIndexLabel.Text = "FM Index"; // + // delayTextBox + // + this.delayTextBox.Enabled = false; + this.delayTextBox.Location = new System.Drawing.Point(122, 149); + this.delayTextBox.Name = "delayTextBox"; + this.delayTextBox.Size = new System.Drawing.Size(46, 20); + this.delayTextBox.TabIndex = 10; + // + // delayLabel + // + this.delayLabel.AutoSize = true; + this.delayLabel.Location = new System.Drawing.Point(36, 152); + this.delayLabel.Name = "delayLabel"; + this.delayLabel.Size = new System.Drawing.Size(48, 13); + this.delayLabel.TabIndex = 9; + this.delayLabel.Text = "Delay [s]"; + // // PumpCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.delayTextBox); + this.Controls.Add(this.delayLabel); this.Controls.Add(this.fmIndexTextBox); this.Controls.Add(this.fmIndexLabel); this.Controls.Add(this.parentNameComboBox); @@ -149,5 +170,7 @@ private System.Windows.Forms.ComboBox parentNameComboBox; private System.Windows.Forms.TextBox fmIndexTextBox; private System.Windows.Forms.Label fmIndexLabel; + private System.Windows.Forms.TextBox delayTextBox; + private System.Windows.Forms.Label delayLabel; } } diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs index 41141e3fd..5afdd75a8 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs @@ -54,6 +54,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; bitPositionTextBox.Text = config.BitPosition.ToString(); fmIndexTextBox.Text = config.FMIndex.ToString(); + delayTextBox.Text = config.Delay.ToString(); } public void Unlock() @@ -62,6 +63,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM parentNameComboBox.Enabled = true; bitPositionTextBox.Enabled = true; fmIndexTextBox.Enabled = true; + delayTextBox.Enabled = true; } public void UpdateCfg() @@ -72,6 +74,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text; config.BitPosition = int.Parse(bitPositionTextBox.Text); config.FMIndex = int.Parse(fmIndexTextBox.Text); + config.Delay = int.Parse(delayTextBox.Text); } public CfgVerifyFlags VerifyCfg(ref string message) @@ -94,6 +97,11 @@ namespace TBF.BenchControl.Elde.PumpWithFM flags |= CfgVerifyFlags.Error; message += Environment.NewLine + "'FM Index' should be between 0 and FMPumpsCount - 1"; } + if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300) + { + flags |= CfgVerifyFlags.Error; + message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)"; + } return flags; } } diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs index f9d60cd82..51e0b335e 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs @@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM public IComponentCfg DefaultConfig(IList components) { - return new PumpCfg(this, "Pump", "CB", 0, 0); + return new PumpCfg(this, "Pump", "CB", 0, 0, 1); } public IComponentCfgCtrl CreateCfgCtrl() diff --git a/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs b/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs index 0fb35e8fd..2978c2f85 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs @@ -14,11 +14,12 @@ namespace TBF.BenchControl.Elde.Valve class SwitchPoint { - public int TimeSec; - public IList VOpen; - public IList VClose; - public ulong MasksOpen; - public ulong MasksClose; + public int TimeSec; /// Time [s] + public IList VOpen; /// List of valves to open in this point of time + public IList VClose; /// List of valves to close in this point of time + public ulong MasksOpen; /// OR-ed bitmasks of valves to open in this point of time + public ulong MasksClose; /// OR-ed bitmasks of valves to close in this point of time + public int MaxDelay; /// Max. delay in [s] of all valves to be opened or closed } IList switchPointsRaw; @@ -39,8 +40,8 @@ namespace TBF.BenchControl.Elde.Valve foreach (var valve in StateMachine.CoupledValves) { - if ((!valve.Invert && valvesOpen.Contains(valve.CoupledTo)) || - (valve.Invert && valvesClose.Contains(valve.CoupledTo))) + if ((!valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)) || + (valve.InvertCouple && valvesClose.Contains(valve.CoupledTo))) { /// The coupled valve 'valve' is opening int time = valve.LagOpening; @@ -55,8 +56,8 @@ namespace TBF.BenchControl.Elde.Valve VClose = new List() }); } } - else if ((!valve.Invert && valvesClose.Contains(valve.CoupledTo)) || - (valve.Invert && valvesOpen.Contains(valve.CoupledTo))) + else if ((!valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)) || + (valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo))) { /// The coupled valve 'valve' is closing int time = valve.LagClosing; diff --git a/TestBenchFramework/BenchControl/Elde/Valve/Valve.cs b/TestBenchFramework/BenchControl/Elde/Valve/Valve.cs index 8c12fb290..8a9435359 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/Valve.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/Valve.cs @@ -28,8 +28,9 @@ namespace TBF.BenchControl.Elde.Valve public string Name { get { return valveCfg.Name; } } public ValveCategory Category { get { return valveCfg.Category; } } + public int Delay { get { return valveCfg.OpenCloseTime; } } public IValve CoupledTo { get { return coupledTo; } } - public bool Invert { get { return valveCfg.InvertCouple; } } + public bool InvertCouple { get { return valveCfg.InvertCouple; } } public int LagOpening { get { return valveCfg.LagOpening; } } public int LagClosing { get { return valveCfg.LagClosing; } } diff --git a/TestBenchFramework/BenchControl/GenericDevices/IValve.cs b/TestBenchFramework/BenchControl/GenericDevices/IValve.cs index 9fff09123..da28c1a1e 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IValve.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IValve.cs @@ -14,6 +14,11 @@ namespace TBF.BenchControl.GenericDevices /// ValveCategory Category { get; } + /// + /// Delay of the valve in [s] (open or close time, whichever is larger) + /// + int Delay { get; } + /// /// Coupled valve or null. /// This valve is a slave and follows the coupled valve, which is a master. @@ -25,7 +30,7 @@ namespace TBF.BenchControl.GenericDevices /// The coupled valve is inverted referred to the master valve. /// This property is used only in case 'CoupledTo' is non-null. /// - bool Invert { get; } + bool InvertCouple { get; } /// /// Delay (referred to the master valve) when opening this (coupled, slave) valve in [s]