diff --git a/TBF/BenchControl/Dummy/Diverter/Component.cs b/TBF/BenchControl/Dummy/Diverter/Component.cs index 4622a4ae4..3598a2fdd 100644 --- a/TBF/BenchControl/Dummy/Diverter/Component.cs +++ b/TBF/BenchControl/Dummy/Diverter/Component.cs @@ -27,7 +27,9 @@ namespace TBF.BenchControl.Dummy.Diverter log.Debug(this.ToString()); } - bool state; - public bool State { get { return state; } } - } + public bool State { get { return false; } } + public int ThresholdGate { get { return 50; } } + public int ThresholdLo { get { return 10; } } + public int ThresholdHi { get { return 90; } } + } } diff --git a/TBF/BenchControl/Elde/ControlBoardDev.cs b/TBF/BenchControl/Elde/ControlBoardDev.cs index cf09c5d8d..0a069e20e 100644 --- a/TBF/BenchControl/Elde/ControlBoardDev.cs +++ b/TBF/BenchControl/Elde/ControlBoardDev.cs @@ -317,9 +317,10 @@ namespace TBF.BenchControl.Elde DiverterEdge = new uint[divertersCount * 2]; for (int i = 0; i < divertersCount; i++) { - DiverterEdge[2 * i] = (uint)BenchControl.Elde.Diverter.Diverter.DivStartingLevelPct[i]; - DiverterEdge[2 * i + 1] = (uint)BenchControl.Elde.Diverter.Diverter.DivStoppingLevelPct[i]; - controlCom.SetDivLimit(i, 10, 90); + DiverterEdge[2 * i] = (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdGate; + DiverterEdge[2 * i + 1] = (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdGate; + controlCom.SetDivLimit(i, (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdLo, + (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdHi); } controlCom.SendCalibData(RegValveCalib, @@ -598,14 +599,20 @@ namespace TBF.BenchControl.Elde } /// - /// Starts the measurement. - /// Events: MeasurementStarted + /// Read diverter samples from the control board and calculated the transition time. + /// Events: Event.None /// - /// Flow meter - /// An array of register readers - /// Number of reference pulses to complete the test + /// Diverter + /// State machine ticks from test start/end when diverter read command is issued (obsolete) + /// State machine ticks from test start/end when diverter samples are read + /// FloatBox for the resulting transition time in s + /// Statistics for plotting diverter transitions + /// Batch number + /// Test name (without repetitions) + /// Repetition number /// Created operation - public IOperation ReadDiverterTransitionOp(int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, TBF.Boxes.FloatBox tStart, TBF.Boxes.FloatBox tEnd) + public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, TBF.Boxes.FloatBox transitionTimeSec, + Sequences.Statistics plotter, int batchNr, string testName, int repetition) { if (controlBoardCfg.DebugLevel == DebugMode.Simulate) { @@ -613,7 +620,7 @@ namespace TBF.BenchControl.Elde } else { - return new ReadDiverterTransitionOp(this, runsCountWhenSendingCmd, runsCountWhenReadingDiv, tStart, tEnd); + return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, transitionTimeSec, plotter, batchNr, testName, repetition); } } diff --git a/TBF/BenchControl/Elde/Diverter/Diverter.cs b/TBF/BenchControl/Elde/Diverter/Diverter.cs index a1f4a2457..74d57c6b9 100644 --- a/TBF/BenchControl/Elde/Diverter/Diverter.cs +++ b/TBF/BenchControl/Elde/Diverter/Diverter.cs @@ -26,8 +26,6 @@ namespace TBF.BenchControl.Elde.Diverter } public static int DivertersCount { get { return nextIdx; } } public static GenericDevices.IDiverter[] Diverters; - public static int[] DivStartingLevelPct; - public static int[] DivStoppingLevelPct; readonly int diverterNr0; /// 0-based diverter number public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number @@ -42,10 +40,11 @@ namespace TBF.BenchControl.Elde.Diverter readonly IOperation diverterToSinkOp; - public bool State - { - get { return (controlBoard.Route & mask) != 0; } - } + public bool State { get { return (controlBoard.Route & mask) != 0; } } + public int ThresholdGate { get { return diverterCfg.StartingLevel; } } + public int ThresholdLo { get { return diverterCfg.ThresholdLo; } } + public int ThresholdHi { get { return diverterCfg.ThresholdHi; } } + public Diverter() { @@ -69,26 +68,15 @@ namespace TBF.BenchControl.Elde.Diverter if (Diverters == null || Diverters.Length < nextIdx) { GenericDevices.IDiverter[] divertersSoFar = Diverters; - int[] startingLevelsSoFar = DivStartingLevelPct; - int[] stoppingLevelsSoFar = DivStoppingLevelPct; Diverters = new GenericDevices.IDiverter[nextIdx]; - DivStartingLevelPct = new int[nextIdx]; - DivStoppingLevelPct = new int[nextIdx]; if (divertersSoFar != null) { - for (int i = 0; i < divertersSoFar.Length; i++) - { - Diverters[i] = divertersSoFar[i]; - DivStartingLevelPct[i] = startingLevelsSoFar[i]; - DivStoppingLevelPct[i] = stoppingLevelsSoFar[i]; - } + for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i]; } Diverters[nextIdx - 1] = this; - DivStartingLevelPct[nextIdx - 1] = diverterCfg.StartingLevel; - DivStoppingLevelPct[nextIdx - 1] = diverterCfg.StoppingLevel; } /// Prepare arguments of SendCalibData() diff --git a/TBF/BenchControl/Elde/Diverter/DiverterCfg.cs b/TBF/BenchControl/Elde/Diverter/DiverterCfg.cs index 83febd940..ecef1b184 100644 --- a/TBF/BenchControl/Elde/Diverter/DiverterCfg.cs +++ b/TBF/BenchControl/Elde/Diverter/DiverterCfg.cs @@ -23,7 +23,8 @@ namespace TBF.BenchControl.Elde.Diverter public int AdcValueToSink; /// 0..1023 public int AdcValueToTank; /// 0..1023 public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test - public int StoppingLevel; /// 0..100 in %, threshold for the ADC value to start the test + public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured + public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured /// Private parameterless constructor invoked by all other (public) constructors DiverterCfg() @@ -35,8 +36,9 @@ namespace TBF.BenchControl.Elde.Diverter AdcValueToSink = 100; AdcValueToTank = 500; StartingLevel = 50; - StoppingLevel = 50; - } + ThresholdLo = 10; + ThresholdHi = 90; + } public DiverterCfg(IComponentFactory factory) : this() @@ -46,7 +48,7 @@ namespace TBF.BenchControl.Elde.Diverter public string ToString(int i) { - return string.Format("Name={0}, Parent={1}, Bit={2}, ADC#={3}, ADC2Sink={4}, ADC2Tank={5}, StartingLevel={6}%, StoppingLevel={7}%", + return string.Format("Name={0}, Parent={1}, Bit={2}, ADC#={3}, ADC2Sink={4}, ADC2Tank={5}, Gate={6}%, Lo={7}%, Lo={8}%", Name, (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), BitPosition, @@ -54,7 +56,8 @@ namespace TBF.BenchControl.Elde.Diverter AdcValueToSink, AdcValueToTank, StartingLevel, - StoppingLevel); + ThresholdLo, + ThresholdHi); } } } diff --git a/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.Designer.cs b/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.Designer.cs index df84a5762..daa6bd76a 100644 --- a/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.Designer.cs +++ b/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.Designer.cs @@ -40,8 +40,8 @@ namespace TBF.BenchControl.Elde.Diverter this.parentNameComboBox = new System.Windows.Forms.ComboBox(); this.startingEdgeTextBox = new System.Windows.Forms.TextBox(); this.startingEdgeLabel = new System.Windows.Forms.Label(); - this.stoppingEdgeTextBox = new System.Windows.Forms.TextBox(); - this.stoppingEdgeLabel = new System.Windows.Forms.Label(); + this.thresholdLoTextBox = new System.Windows.Forms.TextBox(); + this.thresholdLoLabel = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.startButton = new System.Windows.Forms.Button(); @@ -70,6 +70,9 @@ namespace TBF.BenchControl.Elde.Diverter this.adcTextBox1 = new System.Windows.Forms.TextBox(); this.adcNrTextBox = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.thresholdHiTextBox = new System.Windows.Forms.TextBox(); + this.thresholdHiLabel = new System.Windows.Forms.Label(); this.groupBox4.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -153,22 +156,22 @@ namespace TBF.BenchControl.Elde.Diverter this.startingEdgeLabel.TabIndex = 13; this.startingEdgeLabel.Text = "Starting level"; // - // stoppingEdgeTextBox + // thresholdLoTextBox // - this.stoppingEdgeTextBox.Enabled = false; - this.stoppingEdgeTextBox.Location = new System.Drawing.Point(137, 203); - this.stoppingEdgeTextBox.Name = "stoppingEdgeTextBox"; - this.stoppingEdgeTextBox.Size = new System.Drawing.Size(46, 20); - this.stoppingEdgeTextBox.TabIndex = 17; + this.thresholdLoTextBox.Enabled = false; + this.thresholdLoTextBox.Location = new System.Drawing.Point(137, 203); + this.thresholdLoTextBox.Name = "thresholdLoTextBox"; + this.thresholdLoTextBox.Size = new System.Drawing.Size(46, 20); + this.thresholdLoTextBox.TabIndex = 17; // - // stoppingEdgeLabel + // thresholdLoLabel // - this.stoppingEdgeLabel.AutoSize = true; - this.stoppingEdgeLabel.Location = new System.Drawing.Point(27, 206); - this.stoppingEdgeLabel.Name = "stoppingEdgeLabel"; - this.stoppingEdgeLabel.Size = new System.Drawing.Size(74, 13); - this.stoppingEdgeLabel.TabIndex = 16; - this.stoppingEdgeLabel.Text = "Stopping level"; + this.thresholdLoLabel.AutoSize = true; + this.thresholdLoLabel.Location = new System.Drawing.Point(27, 206); + this.thresholdLoLabel.Name = "thresholdLoLabel"; + this.thresholdLoLabel.Size = new System.Drawing.Size(69, 13); + this.thresholdLoLabel.TabIndex = 16; + this.thresholdLoLabel.Text = "Threshold Lo"; // // label2 // @@ -430,10 +433,39 @@ namespace TBF.BenchControl.Elde.Diverter this.label7.TabIndex = 7; this.label7.Text = "Analog input #"; // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(190, 228); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(15, 13); + this.label8.TabIndex = 29; + this.label8.Text = "%"; + // + // thresholdHiTextBox + // + this.thresholdHiTextBox.Enabled = false; + this.thresholdHiTextBox.Location = new System.Drawing.Point(137, 226); + this.thresholdHiTextBox.Name = "thresholdHiTextBox"; + this.thresholdHiTextBox.Size = new System.Drawing.Size(46, 20); + this.thresholdHiTextBox.TabIndex = 28; + // + // thresholdHiLabel + // + this.thresholdHiLabel.AutoSize = true; + this.thresholdHiLabel.Location = new System.Drawing.Point(27, 229); + this.thresholdHiLabel.Name = "thresholdHiLabel"; + this.thresholdHiLabel.Size = new System.Drawing.Size(67, 13); + this.thresholdHiLabel.TabIndex = 27; + this.thresholdHiLabel.Text = "Threshold Hi"; + // // DiverterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label8); + this.Controls.Add(this.thresholdHiTextBox); + this.Controls.Add(this.thresholdHiLabel); this.Controls.Add(this.adcNrTextBox); this.Controls.Add(this.label7); this.Controls.Add(this.groupBox4); @@ -448,8 +480,8 @@ namespace TBF.BenchControl.Elde.Diverter this.Controls.Add(this.startButton); this.Controls.Add(this.label1); this.Controls.Add(this.label2); - this.Controls.Add(this.stoppingEdgeTextBox); - this.Controls.Add(this.stoppingEdgeLabel); + this.Controls.Add(this.thresholdLoTextBox); + this.Controls.Add(this.thresholdLoLabel); this.Controls.Add(this.startingEdgeTextBox); this.Controls.Add(this.startingEdgeLabel); this.Controls.Add(this.parentNameComboBox); @@ -484,8 +516,8 @@ namespace TBF.BenchControl.Elde.Diverter private System.Windows.Forms.ComboBox parentNameComboBox; private System.Windows.Forms.TextBox startingEdgeTextBox; private System.Windows.Forms.Label startingEdgeLabel; - private System.Windows.Forms.TextBox stoppingEdgeTextBox; - private System.Windows.Forms.Label stoppingEdgeLabel; + private System.Windows.Forms.TextBox thresholdLoTextBox; + private System.Windows.Forms.Label thresholdLoLabel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button startButton; @@ -514,5 +546,8 @@ namespace TBF.BenchControl.Elde.Diverter private System.Windows.Forms.TextBox adcTextBox1; private System.Windows.Forms.TextBox adcNrTextBox; private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox thresholdHiTextBox; + private System.Windows.Forms.Label thresholdHiLabel; } } diff --git a/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs b/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs index f8e95cfea..7e2996bcd 100644 --- a/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs +++ b/TBF/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs @@ -77,7 +77,8 @@ namespace TBF.BenchControl.Elde.Diverter adcToSinkTextBox.Text = config.AdcValueToSink.ToString(); adcToTankTextBox.Text = config.AdcValueToTank.ToString(); startingEdgeTextBox.Text = config.StartingLevel.ToString(); - stoppingEdgeTextBox.Text = config.StoppingLevel.ToString(); + thresholdLoTextBox.Text = config.ThresholdLo.ToString(); + thresholdHiTextBox.Text = config.ThresholdHi.ToString(); adcTextBox1.Text = adc1.ToString(); adcTextBox2.Text = adc2.ToString(); @@ -94,8 +95,9 @@ namespace TBF.BenchControl.Elde.Diverter adcToSinkTextBox.Enabled = true; adcToTankTextBox.Enabled = true; startingEdgeTextBox.Enabled = true; - stoppingEdgeTextBox.Enabled = true; - } + thresholdLoTextBox.Enabled = true; + thresholdHiTextBox.Enabled = true; + } public CfgUpdateFlags VerifyCfg(ref string message) { @@ -137,12 +139,17 @@ namespace TBF.BenchControl.Elde.Diverter flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "'Starting Edge' should be between 0 and 100%"; } - if (!int.TryParse(stoppingEdgeTextBox.Text, out dummy) || dummy < 0 || dummy > 100) + if (!int.TryParse(thresholdLoTextBox.Text, out dummy) || dummy < 0 || dummy > 100) { flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Stopping Edge' should be between 0 and 100%"; + message += Environment.NewLine + "'Threshold LO' should be between 0 and 100%"; } - return flags; + if (!int.TryParse(thresholdHiTextBox.Text, out dummy) || dummy < 0 || dummy > 100) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "'Threshold HI' should be between 0 and 100%"; + } + return flags; } public CfgUpdateFlags UpdateCfg() @@ -200,13 +207,20 @@ namespace TBF.BenchControl.Elde.Diverter flags |= CfgUpdateFlags.RestartRqrd; } - tmp = int.Parse(stoppingEdgeTextBox.Text); - if (config.StoppingLevel != tmp) + tmp = int.Parse(thresholdLoTextBox.Text); + if (config.ThresholdLo != tmp) { - config.StoppingLevel = tmp; + config.ThresholdLo = tmp; flags |= CfgUpdateFlags.RestartRqrd; } + tmp = int.Parse(thresholdHiTextBox.Text); + if (config.ThresholdHi != tmp) + { + config.ThresholdHi = tmp; + flags |= CfgUpdateFlags.RestartRqrd; + } + return flags; } diff --git a/TBF/BenchControl/Elde/ReadDiverterTransitionOp.cs b/TBF/BenchControl/Elde/ReadDiverterTransitionOp.cs index e8d99011a..ab3726d20 100644 --- a/TBF/BenchControl/Elde/ReadDiverterTransitionOp.cs +++ b/TBF/BenchControl/Elde/ReadDiverterTransitionOp.cs @@ -12,12 +12,19 @@ namespace TBF.BenchControl.Elde private static readonly ILog log = LogManager.GetLogger(typeof(ReadDiverterTransitionOp)); public override string ToString() { return string.Format("ReadDiverterTransitionOp()"); } + const int SamplesCount = 240; /// Should be less then or equal to 256 + float[] samples; + /// Set by the constructor readonly ControlBoardDev controlBoard; + readonly GenericDevices.IDiverter div; readonly int runsCountWhenSendingCmd; readonly int runsCountWhenReadingDiv; - readonly FloatBox tStart; - readonly FloatBox tEnd; + readonly FloatBox transitionTimeSec; + readonly Sequences.Statistics plotter; + readonly int batchNr; + readonly string testName; + readonly int repetition; int counter; bool cmdSent = false; @@ -33,19 +40,25 @@ namespace TBF.BenchControl.Elde /// Test method /// Test duration in number of reference flowmeter pulses /// Specifies filter for watermeter pulses - public ReadDiverterTransitionOp(ControlBoardDev controlBoard, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, FloatBox tStart, FloatBox tEnd) + public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, + FloatBox transitionTimeSec, Sequences.Statistics plotter, int batchNr, string testName, int repetition) { if (controlBoard == null) throw new ArgumentNullException("controlBoardDev"); if (runsCountWhenSendingCmd < 0) throw new ArgumentNullException("runsCountWhenSendingCmd"); if (runsCountWhenReadingDiv <= runsCountWhenSendingCmd) throw new ArgumentNullException("runsCountWhenReadingDiv"); - if (tStart == null) throw new ArgumentNullException("tStart"); - if (tEnd == null) throw new ArgumentNullException("tEnd"); + if (transitionTimeSec == null) throw new ArgumentNullException("transitionTimeSec"); this.controlBoard = controlBoard; + this.div = div; this.runsCountWhenSendingCmd = runsCountWhenSendingCmd; this.runsCountWhenReadingDiv = runsCountWhenReadingDiv; - this.tStart = tStart; - this.tEnd = tEnd; + this.transitionTimeSec = transitionTimeSec; + this.plotter = plotter; + this.batchNr = batchNr; + this.testName = testName; + this.repetition = repetition; + + samples = new float[SamplesCount]; log.Debug(this.ToString()); } @@ -54,9 +67,17 @@ namespace TBF.BenchControl.Elde public void Start() { counter = 0; - if (runsCountWhenSendingCmd == 0) + + if (plotter == null) { - SendCommand(); + if (div is TBF.BenchControl.Elde.Diverter.Diverter && runsCountWhenSendingCmd == 0) + { + SendCommand(); + } + } + else + { + plotter.Start(batchNr, testName, repetition); } } @@ -68,13 +89,30 @@ namespace TBF.BenchControl.Elde { counter++; - if (counter == runsCountWhenSendingCmd) + if (div is TBF.BenchControl.Elde.Diverter.Diverter) { - SendCommand(); - } - else if (counter == runsCountWhenReadingDiv) - { - ReadDiverter(); + if (counter == runsCountWhenSendingCmd) + { + if (plotter == null) SendCommand(); + } + else if (counter == runsCountWhenReadingDiv) + { + if (plotter == null) + { + ReadDiverterTransitionTimes(); + } + else + { + for (int i = 0; i < SamplesCount; i++) + { + float oneSample = controlBoard.DivSamples(i); + samples[i] = oneSample; + plotter.Update(oneSample); + } + + CalculateDiverterTransitionTimes(); + } + } } return Event.None; @@ -83,7 +121,8 @@ namespace TBF.BenchControl.Elde /// Stop this operation public void Stop() { - } + if (plotter != null) plotter.Stop(); + } void SendCommand() { @@ -92,11 +131,68 @@ namespace TBF.BenchControl.Elde cmdSent = true; } - void ReadDiverter() + /// + /// Diverter transition time is read from the control board + /// + /// true (always) + bool ReadDiverterTransitionTimes() { - tStart.Val = 0.001f * (float)controlBoard.DivTime(1); - tEnd.Val = 0.001F * (float)controlBoard.DivTime(2); - divRead = true; + transitionTimeSec.Val = (float)controlBoard.DivTime(2) - (float)controlBoard.DivTime(1); + return true; } - } + + /// + /// Diverter transition time is calculated from ADC samples and threshold levels + /// + /// true when transition time calculated OK + bool CalculateDiverterTransitionTimes() + { + bool startedRising = false; + bool startedFalling = false; + bool stopped = false; + + int transitionStartIdx = 0; + int transitionEndIdx = 0; + + float level = samples[0]; + for (int i = 1; i < SamplesCount; i++) + { + if (!startedRising && !startedFalling) + { + if (level <= div.ThresholdLo && samples[i] > div.ThresholdLo) + { + transitionStartIdx = i; + startedRising = true; + } + else if (level >= div.ThresholdHi && samples[i] < div.ThresholdHi) + { + transitionStartIdx = i; + startedFalling = true; + } + } + else if (startedRising && !stopped && level < div.ThresholdHi && samples[i] >= div.ThresholdHi) + { + transitionEndIdx = i; + stopped = true; + break; + } + else if (startedFalling && !stopped && level > div.ThresholdLo && samples[i] <= div.ThresholdLo) + { + transitionEndIdx = i; + stopped = true; + break; + } + } + + if ((startedRising || startedFalling) && stopped) + { + transitionTimeSec.Val = 0.002f * (float)(transitionEndIdx - transitionStartIdx); /// 2 ms per sample + return true; + } + else + { + return false; + } + } + } } diff --git a/TBF/BenchControl/GenericDevices/IDiverter.cs b/TBF/BenchControl/GenericDevices/IDiverter.cs index 5768c5a1b..7c1e6ff72 100644 --- a/TBF/BenchControl/GenericDevices/IDiverter.cs +++ b/TBF/BenchControl/GenericDevices/IDiverter.cs @@ -11,5 +11,20 @@ namespace TBF.BenchControl.GenericDevices /// Diverter state: true = to tank, false = bypass tank /// bool State { get; } + + /// + /// Threshold for the ADC value to start the test in %, 0..100 + /// + int ThresholdGate { get; } + + /// + /// Threshold for low level when diverter transition time is measured in %, 0..100 + /// + int ThresholdLo { get; } + + /// + /// Threshold for high level when diverter transition time is measured in %, 0..100 + /// + int ThresholdHi { get; } } } diff --git a/TBF/BenchControl/Sequences/ProcessData.cs b/TBF/BenchControl/Sequences/ProcessData.cs index 4577a558f..aefb6ee00 100644 --- a/TBF/BenchControl/Sequences/ProcessData.cs +++ b/TBF/BenchControl/Sequences/ProcessData.cs @@ -96,12 +96,16 @@ namespace TBF.BenchControl.Sequences public static Statistics VolumeForEnergy = new Statistics(); public static int lastEnergyUpdateTime; + public static Statistics DiverterStart = new Statistics(new Plotter("Div start")); + public static Statistics DiverterEnd = new Statistics(new Plotter("Div end")); + public static int machineTimeStart; public static int lastMachineTime; protected static void StartNewStatistics(int machineTime, int batchNr, string testName, int repetition) { - lastMachineTime = machineTimeStart = machineTime; + machineTimeStart = machineTime; + lastMachineTime = machineTime; AmbTempStat.Start(batchNr, testName, repetition); AmbPressStat.Start(batchNr, testName, repetition); @@ -121,7 +125,7 @@ namespace TBF.BenchControl.Sequences Energy.Start(batchNr, testName, repetition); VolumeForEnergy.Start(batchNr, testName, repetition); lastEnergyUpdateTime = 0; - } + } protected static void UpdateAllStatistics(int machineTime) { @@ -168,6 +172,6 @@ namespace TBF.BenchControl.Sequences TempRefLoStat.Stop(); Energy.Stop(); VolumeForEnergy.Stop(); - } + } } } diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs index cdbae26b8..de186e731 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs @@ -39,12 +39,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume : ((compoundTestParams != null) ? compoundTestParams.NextTestVolume : heatMetersTestParams.NextTestVolume); - float switchTimeStart = 0.001f; /// in seconds, initial value is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, initial value is 1 ms - FloatBox switchTimeStartLo = new FloatBox(0.001f); - FloatBox switchTimeStartHi = new FloatBox(0.002f); - FloatBox switchTimeEndLo = new FloatBox(0.001f); - FloatBox switchTimeEndHi = new FloatBox(0.002f); + FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms + FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms if (debugLevel == Config.Entities.DebugMode.Simulate) { @@ -587,13 +583,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl int estimtdEndTime = StateMachine.Time + (int)((repetitionNr == 1) ? test.TstTime : (test.TstTime * nextTestVolume / test.Volume)); StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr); - if (repetitionNr == 1) - { - /// Read the diverter switch time - switchTimeStart = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test start = {0} ms", cBrd.DivTime(0)); - } - /// Measurement loop - begin State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) .AddOperation(checkUiOp) @@ -611,7 +600,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation((repetitionNr == 1) ? outPath.Scale.ReadMassOp(ref Mass) : null) .AddOperation((repetitionNr == 1) ? StateMachine.ControlBoard.UpdateTankWeightOp() : null) - .AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(2, 4, switchTimeStartLo, switchTimeStartHi) : null) + .AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null) .AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) @@ -718,7 +707,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) .AddOperation(outPath.Scale.ReadMassOp(ref Mass)) .AddOperation(cBrd.UpdateTankWeightOp()) - .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeEndLo, switchTimeEndHi)) + .AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null) .AddOperation(processDataLoggingOp) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .EnterState(); @@ -734,10 +723,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); - /// Read the diverter switch time - switchTimeEnd = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test end = {0} ms", cBrd.DivTime(0)); - State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) @@ -812,17 +797,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); - tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); - tstRslt.DivStart10 = switchTimeStartLo.Val; - tstRslt.DivStart50 = switchTimeStart; - tstRslt.DivStart90 = switchTimeStartHi.Val; - tstRslt.DiverterEnd = switchTimeEnd; /// Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); - tstRslt.DivEnd90 = switchTimeEndHi.Val; - tstRslt.DivEnd50 = switchTimeEnd; - tstRslt.DivEnd10 = switchTimeEndLo.Val; - log.DebugFormat("Diverter switch time [s]: Start: {0}({1} {2} {3}) End: {4}({5} {6} {7})", - tstRslt.DiverterStart, tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, - tstRslt.DiverterEnd, tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); + tstRslt.DiverterStart = switchTimeStart.Val; + tstRslt.DivStart10 = 0; + tstRslt.DivStart50 = 0; + tstRslt.DivStart90 = 0; + tstRslt.DiverterEnd = switchTimeEnd.Val; + tstRslt.DivEnd90 = 0; + tstRslt.DivEnd50 = 0; + tstRslt.DivEnd10 = 0; + log.DebugFormat("Diverter switch time [s]: Start: {0}ms ({1} {2} {3}) End: {4}ms ({5} {6} {7})", + (tstRslt.DiverterStart * 1000).ToString("F0"), tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, + (tstRslt.DiverterEnd * 1000).ToString("F0"), tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, tstRslt.DiverterStart, tstRslt.DiverterEnd) : 0; diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs index acaf1aa75..644a8a5a7 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs @@ -40,12 +40,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged float volumeToTank = (singleTestParams != null) ? singleTestParams.VolumeToTank : ((compoundTestParams != null) ? compoundTestParams.VolumeToTank : heatMetersTestParams.VolumeToTank); - float switchTimeStart = 0.001f; /// in seconds, initial value is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, initial value is 1 ms - FloatBox switchTimeStartLo = new FloatBox(0.001f); - FloatBox switchTimeStartHi = new FloatBox(0.002f); - FloatBox switchTimeEndLo = new FloatBox(0.001f); - FloatBox switchTimeEndHi = new FloatBox(0.002f); + FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms + FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms if (debugLevel == Config.Entities.DebugMode.Simulate) { @@ -591,10 +587,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged int estimtdEndTime = StateMachine.Time + (int)test.TstTime; StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr); - /// Read the diverter switch time - switchTimeStart = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test start = {0} ms", cBrd.DivTime(0)); - /// Measurement loop - begin State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) .AddOperation(checkUiOp) @@ -615,7 +607,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged .AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) - .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeStartLo, switchTimeStartHi)) + .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr)) .AddOperation(cBrd.QueryMeasurementEndOp()) .AddOperation(processDataLoggingOp) .EnterState(); @@ -717,7 +709,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) .AddOperation(outPath.Scale.ReadMassOp(ref Mass)) .AddOperation(cBrd.UpdateTankWeightOp()) - .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeEndLo, switchTimeEndHi)) + .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr)) .AddOperation(processDataLoggingOp) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .EnterState(); @@ -733,10 +725,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); - /// Read the diverter switch time - switchTimeEnd = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test end = {0} ms", cBrd.DivTime(0)); - State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) @@ -816,17 +804,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); - tstRslt.DivStart10 = switchTimeStartLo.Val; - tstRslt.DivStart50 = switchTimeStart; - tstRslt.DivStart90 = switchTimeStartHi.Val; - tstRslt.DiverterEnd = switchTimeEnd; /// Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); - tstRslt.DivEnd90 = switchTimeEndHi.Val; - tstRslt.DivEnd50 = switchTimeEnd; - tstRslt.DivEnd10 = switchTimeEndLo.Val; - log.DebugFormat("Diverter switch time [s]: Start: {0}({1} {2} {3}) End: {4}({5} {6} {7})", - tstRslt.DiverterStart, tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, - tstRslt.DiverterEnd, tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); + tstRslt.DiverterStart = switchTimeStart.Val; + tstRslt.DivStart10 = 0; + tstRslt.DivStart50 = 0; + tstRslt.DivStart90 = 0; + tstRslt.DiverterEnd = switchTimeEnd.Val; + tstRslt.DivEnd90 = 0; + tstRslt.DivEnd50 = 0; + tstRslt.DivEnd10 = 0; + log.DebugFormat("Diverter switch time [s]: Start: {0}ms ({1} {2} {3}) End: {4}ms ({5} {6} {7})", + (tstRslt.DiverterStart * 1000).ToString("F0"), tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, + (tstRslt.DiverterEnd * 1000).ToString("F0"), tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, tstRslt.DiverterStart, tstRslt.DiverterEnd) : 0; diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 04db55062..bd7864fff 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -35,12 +35,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection Event retVal = Event.Done; checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state - float switchTimeStart = 0.001f; /// in seconds, initial value is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, initial value is 1 ms - FloatBox switchTimeStartLo = new FloatBox(0.001f); - FloatBox switchTimeStartHi = new FloatBox(0.002f); - FloatBox switchTimeEndLo = new FloatBox(0.001f); - FloatBox switchTimeEndHi = new FloatBox(0.002f); + FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms + FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms if (debugLevel == Config.Entities.DebugMode.Simulate) { @@ -641,10 +637,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection int estimtdEndTime = StateMachine.Time + (int)test.TstTime; StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr); - /// Read the diverter switch time - switchTimeStart = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test start = {0} ms", cBrd.DivTime(0)); - /// Measurement loop - begin State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) .AddOperation(checkUiOp) @@ -665,7 +657,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection .AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) - .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeStartLo, switchTimeStartHi)) + .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr)) .AddOperation(cBrd.QueryMeasurementEndOp()) .AddOperation(processDataLoggingOp) .EnterState(); @@ -767,7 +759,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) .AddOperation(outPath.Scale.ReadMassOp(ref Mass)) .AddOperation(cBrd.UpdateTankWeightOp()) - .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeEndLo, switchTimeEndHi)) + .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr)) .AddOperation(processDataLoggingOp) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .EnterState(); @@ -783,10 +775,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); - /// Read the diverter switch time - switchTimeEnd = 0.001f * (float)cBrd.DivTime(0); - log.WarnFormat("Diverter switch time on test end = {0} ms", cBrd.DivTime(0)); - State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) @@ -862,17 +850,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); - tstRslt.DivStart10 = switchTimeStartLo.Val; - tstRslt.DivStart50 = switchTimeStart; - tstRslt.DivStart90 = switchTimeStartHi.Val; - tstRslt.DiverterEnd = switchTimeEnd; /// Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); - tstRslt.DivEnd90 = switchTimeEndHi.Val; - tstRslt.DivEnd50 = switchTimeEnd; - tstRslt.DivEnd10 = switchTimeEndLo.Val; - log.DebugFormat("Diverter switch time [s]: Start: {0}({1} {2} {3}) End: {4}({5} {6} {7})", - tstRslt.DiverterStart, tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, - tstRslt.DiverterEnd, tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); + tstRslt.DiverterStart = switchTimeStart.Val; + tstRslt.DivStart10 = 0; + tstRslt.DivStart50 = 0; + tstRslt.DivStart90 = 0; + tstRslt.DiverterEnd = switchTimeEnd.Val; + tstRslt.DivEnd90 = 0; + tstRslt.DivEnd50 = 0; + tstRslt.DivEnd10 = 0; + log.DebugFormat("Diverter switch time [s]: Start: {0}ms ({1} {2} {3}) End: {4}ms ({5} {6} {7})", + (tstRslt.DiverterStart * 1000).ToString("F0"), tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90, + (tstRslt.DiverterEnd * 1000).ToString("F0"), tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10); tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, tstRslt.DiverterStart, tstRslt.DiverterEnd) : 0; diff --git a/TBF/LocalSettings.cs b/TBF/LocalSettings.cs index f2fcb8616..97336f746 100644 --- a/TBF/LocalSettings.cs +++ b/TBF/LocalSettings.cs @@ -222,7 +222,9 @@ namespace TBF public bool Graph4_On; public bool Graph5_On; public bool Graph6_On; - public GraphLib.PlotterGraphPaneEx.LayoutMode GraphsLayoutMode; + public bool Graph7_On; + public bool Graph8_On; + public GraphLib.PlotterGraphPaneEx.LayoutMode GraphsLayoutMode; [XmlArrayAttribute("RsltsClmnWidths")] public int[] RsltsClmnWidths; diff --git a/TBF/MainWnd.cs b/TBF/MainWnd.cs index 27928bebe..66df07287 100644 --- a/TBF/MainWnd.cs +++ b/TBF/MainWnd.cs @@ -98,7 +98,7 @@ namespace TBF mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.cameraTSMItem}); #endif -#if MUNICH +#if NO_GRAPHS graphsToolStripMenuItem.Visible = false; #else graphsToolStripMenuItem.Text = Strings.Graphs; diff --git a/TBF/Screens/GraphsTabPageCtrl.cs b/TBF/Screens/GraphsTabPageCtrl.cs index 1d3151cbe..5ebaed374 100644 --- a/TBF/Screens/GraphsTabPageCtrl.cs +++ b/TBF/Screens/GraphsTabPageCtrl.cs @@ -18,12 +18,14 @@ namespace TBF.Screens static readonly GraphInfo[] SupportedGraphs = new GraphInfo[] { - new GraphInfo { FileName = "Flow", Caption = string.Format("Q [m3/h]", Strings.Flow) }, - new GraphInfo { FileName = "Pressure up", Caption = string.Format("Pr up [bar]", Strings.Pressure) }, - new GraphInfo { FileName = "Pressure down", Caption = string.Format("Pr dw [bar]", Strings.Pressure) }, - new GraphInfo { FileName = "Temperature up", Caption = string.Format("T up [°C]", Strings.Temperature) }, - new GraphInfo { FileName = "Temperature down", Caption = string.Format("T dw [°C]", Strings.Temperature) }, - new GraphInfo { FileName = "Temperature div", Caption = string.Format("T di [°C]", Strings.Temperature) }, + new GraphInfo { FileName = "Flow", Caption = string.Format("Q [m3/h]") }, + new GraphInfo { FileName = "Pressure up", Caption = string.Format("Pr up [bar]") }, + new GraphInfo { FileName = "Pressure down", Caption = string.Format("Pr dw [bar]") }, + new GraphInfo { FileName = "Temperature up", Caption = string.Format("T up [°C]") }, + new GraphInfo { FileName = "Temperature down", Caption = string.Format("T dw [°C]") }, + new GraphInfo { FileName = "Temperature div", Caption = string.Format("T di [°C]") }, + new GraphInfo { FileName = "Div start", Caption = string.Format("Div start") }, + new GraphInfo { FileName = "Div end", Caption = string.Format("Div end") }, }; @@ -38,7 +40,7 @@ namespace TBF.Screens InitializeComponent(); /// checkBoxes array must be initialized before other actions - checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6 }; + checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7, checkBox8 }; Localize(); @@ -49,6 +51,8 @@ namespace TBF.Screens checkBox4.Checked = Program.LocalSettings.Graph4_On; checkBox5.Checked = Program.LocalSettings.Graph5_On; checkBox6.Checked = Program.LocalSettings.Graph6_On; + checkBox7.Checked = Program.LocalSettings.Graph7_On; + checkBox8.Checked = Program.LocalSettings.Graph8_On; layoutMode = Program.LocalSettings.GraphsLayoutMode; layoutModeComboBox.Text = layoutMode.ToString(); @@ -186,7 +190,8 @@ namespace TBF.Screens Color.DarkGreen, Color.DarkBlue , Color.DarkMagenta, - Color.DeepPink }; + Color.DeepPink, + Color.DarkGreen }; float[] gridY = { 0.0002f, 0.0005f, 0.001f, 0.002f, 0.005f, 0.01f, 0.02f, 0.05f, 0.1f, 0.2f, 0.5f, 1, 2, 5, 10, 20, 50, 100, 200, 500 }; @@ -313,6 +318,8 @@ namespace TBF.Screens private void checkBox4_CheckedChanged(object sender, EventArgs e) { Program.LocalSettings.Graph4_On = checkBox4.Checked; AnyCBChanged(); } private void checkBox5_CheckedChanged(object sender, EventArgs e) { Program.LocalSettings.Graph5_On = checkBox5.Checked; AnyCBChanged(); } private void checkBox6_CheckedChanged(object sender, EventArgs e) { Program.LocalSettings.Graph6_On = checkBox6.Checked; AnyCBChanged(); } + private void checkBox7_CheckedChanged(object sender, EventArgs e) { Program.LocalSettings.Graph7_On = checkBox7.Checked; AnyCBChanged(); } + private void checkBox8_CheckedChanged(object sender, EventArgs e) { Program.LocalSettings.Graph8_On = checkBox8.Checked; AnyCBChanged(); } void AnyCBChanged() { diff --git a/TBF/Screens/GraphsTabPageCtrl.designer.cs b/TBF/Screens/GraphsTabPageCtrl.designer.cs index 3137df8ac..6e07d5cee 100644 --- a/TBF/Screens/GraphsTabPageCtrl.designer.cs +++ b/TBF/Screens/GraphsTabPageCtrl.designer.cs @@ -31,156 +31,174 @@ namespace TBF.Screens /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GraphsTabPageCtrl)); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.testsHistoryTreeView = new System.Windows.Forms.TreeView(); - this.plotterDisplayEx = new GraphLib.PlotterDisplayEx(); - this.refreshButton = new System.Windows.Forms.Button(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.checkBox6 = new System.Windows.Forms.CheckBox(); - this.checkBox5 = new System.Windows.Forms.CheckBox(); - this.checkBox4 = new System.Windows.Forms.CheckBox(); - this.checkBox3 = new System.Windows.Forms.CheckBox(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.layoutModeComboBox = new System.Windows.Forms.ComboBox(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer - // - resources.ApplyResources(this.splitContainer, "splitContainer"); - this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer.Name = "splitContainer"; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control; - this.splitContainer.Panel1.Controls.Add(this.testsHistoryTreeView); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this.plotterDisplayEx); - // - // testsHistoryTreeView - // - resources.ApplyResources(this.testsHistoryTreeView, "testsHistoryTreeView"); - this.testsHistoryTreeView.Name = "testsHistoryTreeView"; - this.testsHistoryTreeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.testsHistoryTreeView_NodeMouseClick); - // - // plotterDisplayEx - // - this.plotterDisplayEx.BackColor = System.Drawing.Color.Transparent; - this.plotterDisplayEx.BackgroundColorBot = System.Drawing.Color.White; - this.plotterDisplayEx.BackgroundColorTop = System.Drawing.Color.White; - this.plotterDisplayEx.DashedGridColor = System.Drawing.Color.DarkGray; - resources.ApplyResources(this.plotterDisplayEx, "plotterDisplayEx"); - this.plotterDisplayEx.DoubleBuffering = false; - this.plotterDisplayEx.Name = "plotterDisplayEx"; - this.plotterDisplayEx.SolidGridColor = System.Drawing.Color.DarkGray; - // - // refreshButton - // - resources.ApplyResources(this.refreshButton, "refreshButton"); - this.refreshButton.Name = "refreshButton"; - this.refreshButton.UseVisualStyleBackColor = true; - this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); - // - // splitContainer1 - // - resources.ApplyResources(this.splitContainer1, "splitContainer1"); - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.layoutModeComboBox); - this.splitContainer1.Panel1.Controls.Add(this.checkBox6); - this.splitContainer1.Panel1.Controls.Add(this.checkBox5); - this.splitContainer1.Panel1.Controls.Add(this.checkBox4); - this.splitContainer1.Panel1.Controls.Add(this.checkBox3); - this.splitContainer1.Panel1.Controls.Add(this.checkBox2); - this.splitContainer1.Panel1.Controls.Add(this.checkBox1); - this.splitContainer1.Panel1.Controls.Add(this.refreshButton); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.splitContainer); - // - // checkBox6 - // - resources.ApplyResources(this.checkBox6, "checkBox6"); - this.checkBox6.Name = "checkBox6"; - this.checkBox6.UseVisualStyleBackColor = true; - this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged); - // - // checkBox5 - // - resources.ApplyResources(this.checkBox5, "checkBox5"); - this.checkBox5.Name = "checkBox5"; - this.checkBox5.UseVisualStyleBackColor = true; - this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged); - // - // checkBox4 - // - resources.ApplyResources(this.checkBox4, "checkBox4"); - this.checkBox4.Name = "checkBox4"; - this.checkBox4.UseVisualStyleBackColor = true; - this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged); - // - // checkBox3 - // - resources.ApplyResources(this.checkBox3, "checkBox3"); - this.checkBox3.Name = "checkBox3"; - this.checkBox3.UseVisualStyleBackColor = true; - this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged); - // - // checkBox2 - // - resources.ApplyResources(this.checkBox2, "checkBox2"); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.UseVisualStyleBackColor = true; - this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); - // - // checkBox1 - // - resources.ApplyResources(this.checkBox1, "checkBox1"); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.UseVisualStyleBackColor = true; - this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); - // - // layoutModeComboBox - // - this.layoutModeComboBox.FormattingEnabled = true; - resources.ApplyResources(this.layoutModeComboBox, "layoutModeComboBox"); - this.layoutModeComboBox.Name = "layoutModeComboBox"; - this.layoutModeComboBox.SelectedIndexChanged += new System.EventHandler(this.layoutModeComboBox_SelectedIndexChanged); - // - // GraphsTabPageCtrl - // - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Silver; - this.Controls.Add(this.splitContainer1); - this.Name = "GraphsTabPageCtrl"; - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); - this.splitContainer.ResumeLayout(false); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.ResumeLayout(false); + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GraphsTabPageCtrl)); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.testsHistoryTreeView = new System.Windows.Forms.TreeView(); + this.plotterDisplayEx = new GraphLib.PlotterDisplayEx(); + this.refreshButton = new System.Windows.Forms.Button(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.checkBox8 = new System.Windows.Forms.CheckBox(); + this.checkBox7 = new System.Windows.Forms.CheckBox(); + this.layoutModeComboBox = new System.Windows.Forms.ComboBox(); + this.checkBox6 = new System.Windows.Forms.CheckBox(); + this.checkBox5 = new System.Windows.Forms.CheckBox(); + this.checkBox4 = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer + // + resources.ApplyResources(this.splitContainer, "splitContainer"); + this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control; + this.splitContainer.Panel1.Controls.Add(this.testsHistoryTreeView); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.plotterDisplayEx); + // + // testsHistoryTreeView + // + resources.ApplyResources(this.testsHistoryTreeView, "testsHistoryTreeView"); + this.testsHistoryTreeView.Name = "testsHistoryTreeView"; + this.testsHistoryTreeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.testsHistoryTreeView_NodeMouseClick); + // + // plotterDisplayEx + // + this.plotterDisplayEx.BackColor = System.Drawing.Color.Transparent; + this.plotterDisplayEx.BackgroundColorBot = System.Drawing.Color.White; + this.plotterDisplayEx.BackgroundColorTop = System.Drawing.Color.White; + this.plotterDisplayEx.DashedGridColor = System.Drawing.Color.DarkGray; + resources.ApplyResources(this.plotterDisplayEx, "plotterDisplayEx"); + this.plotterDisplayEx.DoubleBuffering = false; + this.plotterDisplayEx.Name = "plotterDisplayEx"; + this.plotterDisplayEx.SolidGridColor = System.Drawing.Color.DarkGray; + // + // refreshButton + // + resources.ApplyResources(this.refreshButton, "refreshButton"); + this.refreshButton.Name = "refreshButton"; + this.refreshButton.UseVisualStyleBackColor = true; + this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); + // + // splitContainer1 + // + resources.ApplyResources(this.splitContainer1, "splitContainer1"); + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.checkBox8); + this.splitContainer1.Panel1.Controls.Add(this.checkBox7); + this.splitContainer1.Panel1.Controls.Add(this.layoutModeComboBox); + this.splitContainer1.Panel1.Controls.Add(this.checkBox6); + this.splitContainer1.Panel1.Controls.Add(this.checkBox5); + this.splitContainer1.Panel1.Controls.Add(this.checkBox4); + this.splitContainer1.Panel1.Controls.Add(this.checkBox3); + this.splitContainer1.Panel1.Controls.Add(this.checkBox2); + this.splitContainer1.Panel1.Controls.Add(this.checkBox1); + this.splitContainer1.Panel1.Controls.Add(this.refreshButton); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer); + // + // checkBox8 + // + resources.ApplyResources(this.checkBox8, "checkBox8"); + this.checkBox8.Name = "checkBox8"; + this.checkBox8.UseVisualStyleBackColor = true; + this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged); + // + // checkBox7 + // + resources.ApplyResources(this.checkBox7, "checkBox7"); + this.checkBox7.Name = "checkBox7"; + this.checkBox7.UseVisualStyleBackColor = true; + this.checkBox7.CheckedChanged += new System.EventHandler(this.checkBox7_CheckedChanged); + // + // layoutModeComboBox + // + this.layoutModeComboBox.FormattingEnabled = true; + resources.ApplyResources(this.layoutModeComboBox, "layoutModeComboBox"); + this.layoutModeComboBox.Name = "layoutModeComboBox"; + this.layoutModeComboBox.SelectedIndexChanged += new System.EventHandler(this.layoutModeComboBox_SelectedIndexChanged); + // + // checkBox6 + // + resources.ApplyResources(this.checkBox6, "checkBox6"); + this.checkBox6.Name = "checkBox6"; + this.checkBox6.UseVisualStyleBackColor = true; + this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged); + // + // checkBox5 + // + resources.ApplyResources(this.checkBox5, "checkBox5"); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.UseVisualStyleBackColor = true; + this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged); + // + // checkBox4 + // + resources.ApplyResources(this.checkBox4, "checkBox4"); + this.checkBox4.Name = "checkBox4"; + this.checkBox4.UseVisualStyleBackColor = true; + this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged); + // + // checkBox3 + // + resources.ApplyResources(this.checkBox3, "checkBox3"); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.UseVisualStyleBackColor = true; + this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged); + // + // checkBox2 + // + resources.ApplyResources(this.checkBox2, "checkBox2"); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.UseVisualStyleBackColor = true; + this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); + // + // checkBox1 + // + resources.ApplyResources(this.checkBox1, "checkBox1"); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.UseVisualStyleBackColor = true; + this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); + // + // GraphsTabPageCtrl + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Silver; + this.Controls.Add(this.splitContainer1); + this.Name = "GraphsTabPageCtrl"; + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); } @@ -198,5 +216,7 @@ namespace TBF.Screens private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.ComboBox layoutModeComboBox; + private System.Windows.Forms.CheckBox checkBox8; + private System.Windows.Forms.CheckBox checkBox7; } } diff --git a/TBF/Screens/GraphsTabPageCtrl.resx b/TBF/Screens/GraphsTabPageCtrl.resx index 2701fede8..2260ec5de 100644 --- a/TBF/Screens/GraphsTabPageCtrl.resx +++ b/TBF/Screens/GraphsTabPageCtrl.resx @@ -244,7 +244,7 @@ splitContainer1.Panel1 - 7 + 9 Fill @@ -258,6 +258,66 @@ Horizontal + + True + + + NoControl + + + 952, 10 + + + 80, 17 + + + 9 + + + checkBox8 + + + checkBox8 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1.Panel1 + + + 0 + + + True + + + NoControl + + + 856, 10 + + + 80, 17 + + + 8 + + + checkBox7 + + + checkBox7 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer1.Panel1 + + + 1 + 129, 6 @@ -277,13 +337,13 @@ splitContainer1.Panel1 - 0 + 2 True - 880, 10 + 760, 10 80, 17 @@ -304,13 +364,13 @@ splitContainer1.Panel1 - 1 + 3 True - 760, 10 + 664, 10 80, 17 @@ -331,13 +391,13 @@ splitContainer1.Panel1 - 2 + 4 True - 640, 10 + 568, 10 80, 17 @@ -358,13 +418,13 @@ splitContainer1.Panel1 - 3 + 5 True - 520, 10 + 472, 10 80, 17 @@ -385,13 +445,13 @@ splitContainer1.Panel1 - 4 + 6 True - 400, 10 + 376, 10 80, 17 @@ -412,7 +472,7 @@ splitContainer1.Panel1 - 5 + 7 True @@ -439,7 +499,7 @@ splitContainer1.Panel1 - 6 + 8 splitContainer1.Panel1