ProcessDataEventArgs added.
This commit is contained in:
parent
6e2bf48b43
commit
f31843f665
@ -647,71 +647,8 @@ namespace TBF.BenchControl.Sequences
|
||||
return Event.Done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepares 'TestProgressEventArgs' object that update screens during the test
|
||||
/// </summary>
|
||||
/// <param name="test">Current 'Test' entity</param>
|
||||
/// <param name="tstRslt">Current 'TestResult' entity</param>
|
||||
/// <param name="cBrd">Control board component reference</param>
|
||||
/// <param name="time">Current test time in [s]</param>
|
||||
/// <param name="progress">Current progress 0 .. 1.0f</param>
|
||||
/// <returns>Data for the UI</returns>
|
||||
protected TestProgressEventArgs CreateProgressData(Test test, int repetitionNr, Config.Entities.Progress phase, Elde.ControlBoardDev cBrd, float time, int progress)
|
||||
{
|
||||
TestProgressEventArgs data = new TestProgressEventArgs(test, repetitionNr, phase);
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
data.FlowMtrFreq = RefFreq;
|
||||
|
||||
data.Flow = RefFlow;
|
||||
data.Time = time;
|
||||
data.StartMass = startMass;
|
||||
data.Mass = Mass;
|
||||
|
||||
data.Progress = progress;
|
||||
float estCurrentTime = TimeEstimateBeginRpts + ((float)(repetitionNr - 1) + progress) * TimeEstimateOneTest;
|
||||
data.OveralProgress = estCurrentTime / TimeEstimateTotal;
|
||||
|
||||
data.Tin = TempIn;
|
||||
data.Tout = TempOut;
|
||||
data.Tdiv = TempDiv;
|
||||
data.Pin = PressureUp;
|
||||
data.Pout = PressureDown;
|
||||
|
||||
data.AmbientTemp = AmbientTemp;
|
||||
data.AmbientPressure = AmbientPressure;
|
||||
data.AmbientHumidity = AmbientHumidity;
|
||||
|
||||
if (phase == Config.Entities.Progress.Test)
|
||||
{
|
||||
/// Only when test is running
|
||||
data.RefPulses = cBrd.EtPulses(0);
|
||||
float refPulsesPerLtr = 1.0f / outPath.FlowMeter.LtrPerPulseCorrected(RefFlow.Val); /// [pulse/ltr]
|
||||
data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = (float)Formulas.VolumeFromPulses(data.RefPulses, refPulsesPerLtr) };
|
||||
|
||||
/// TODO: Reimplement
|
||||
//int count = Math.Min(Config.Data.WMsCount, data.TestResult.Meters.Count);
|
||||
//for (int i = 0; i < count; i++)
|
||||
//{
|
||||
// if (sensPath.RegisterReaders[i] != null)
|
||||
// {
|
||||
// data.TestResult.Meters[i].PulsesMeter = WMPulses[i];
|
||||
// data.TestResult.Meters[i].PulsesMaster = WMRefPulses[i];
|
||||
// data.TestResult.Meters[i].VolumeMeter = Formulas.VolumeFromPulses(WMPulses[i], sensPath.RegisterReaders[i].PulsesPerLtr);
|
||||
// data.TestResult.Meters[i].VolumeRef = Formulas.VolumeFromPulses(WMRefPulses[i], refPulsesPerLtr);
|
||||
// data.TestResult.Meters[i].VolumeErrorPct = Formulas.ErrorFromVolumes(data.TestResult.Meters[i].VolumeMeter, data.TestResult.Meters[i].VolumeRef);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = 0 };
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
protected string TestResult2CsvLine(string testName, int part)
|
||||
|
||||
protected string TestResult2CsvLine(string testName, int part)
|
||||
{
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, part);
|
||||
|
||||
|
||||
@ -159,19 +159,19 @@ namespace TBF.Screens
|
||||
// measurementTbl1Col3.SetData(i, data.TestResult.Meters[i].VolumeErrorPct.ToString("F1"));
|
||||
// }
|
||||
//}
|
||||
measurementTbl2Col2.SetData(0, data.RefPulses);
|
||||
measurementTbl2Col2.SetData(1, data.Time.ToString("F1"));
|
||||
//measurementTbl2Col2.SetData(0, data.RefPulses);
|
||||
//measurementTbl2Col2.SetData(1, data.Time.ToString("F1"));
|
||||
|
||||
measurementTbl2Col2.SetData(3, data.Tin.ToString());
|
||||
measurementTbl2Col2.SetData(4, data.Tout.ToString());
|
||||
measurementTbl2Col2.SetData(5, data.Tdiv.ToString());
|
||||
measurementTbl2Col2.SetData(6, data.Pin.ToString());
|
||||
measurementTbl2Col2.SetData(7, data.Pout.ToString());
|
||||
measurementTbl2Col2.SetData(8, data.Flow.ToString());
|
||||
//measurementTbl2Col2.SetData(3, data.Tin.ToString());
|
||||
//measurementTbl2Col2.SetData(4, data.Tout.ToString());
|
||||
//measurementTbl2Col2.SetData(5, data.Tdiv.ToString());
|
||||
//measurementTbl2Col2.SetData(6, data.Pin.ToString());
|
||||
//measurementTbl2Col2.SetData(7, data.Pout.ToString());
|
||||
//measurementTbl2Col2.SetData(8, data.Flow.ToString());
|
||||
|
||||
measurementTbl3Row2.SetData(0, data.AmbientTemp.ToString());
|
||||
measurementTbl3Row2.SetData(1, data.AmbientPressure.ToString());
|
||||
measurementTbl3Row2.SetData(2, data.AmbientHumidity.ToString());
|
||||
//measurementTbl3Row2.SetData(0, data.AmbientTemp.ToString());
|
||||
//measurementTbl3Row2.SetData(1, data.AmbientPressure.ToString());
|
||||
//measurementTbl3Row2.SetData(2, data.AmbientHumidity.ToString());
|
||||
|
||||
//measurementBar1.FValue = data.Progress;
|
||||
}
|
||||
|
||||
@ -384,17 +384,17 @@ namespace TBF.Screens
|
||||
void OnTestProgress(object sender, TestProgressEventArgs args)
|
||||
{
|
||||
/// Top part
|
||||
airTempLabel.Text = args.AmbientTemp.ToString();
|
||||
airPressLabel.Text = args.AmbientPressure.ToString();
|
||||
airHumiLabel.Text = args.AmbientHumidity.ToString();
|
||||
//airTempLabel.Text = args.AmbientTemp.ToString();
|
||||
//airPressLabel.Text = args.AmbientPressure.ToString();
|
||||
//airHumiLabel.Text = args.AmbientHumidity.ToString();
|
||||
|
||||
refPulsesLabel.Text = args.RefPulses.ToString();
|
||||
refFreqLabel.Text = args.FlowMtrFreq.ToString();
|
||||
refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4);
|
||||
refVolumeLabel.Text = args.Volume.ToString();
|
||||
//refPulsesLabel.Text = args.RefPulses.ToString();
|
||||
//refFreqLabel.Text = args.FlowMtrFreq.ToString();
|
||||
//refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4);
|
||||
//refVolumeLabel.Text = args.Volume.ToString();
|
||||
|
||||
//regValvePosLabel.Text = args.RegValvePos.ToString();
|
||||
tDivLabel.Text = args.Tdiv.ToString();
|
||||
//tDivLabel.Text = args.Tdiv.ToString();
|
||||
|
||||
/// Bottom part
|
||||
if (currentMetersKind == MetersKind.Single)
|
||||
@ -423,29 +423,29 @@ namespace TBF.Screens
|
||||
//error1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeErrorPct.ToString("F2");
|
||||
}
|
||||
|
||||
tInLabel.Text = args.Tin.ToString();
|
||||
tOutLabel.Text = args.Tout.ToString();
|
||||
prInLabel.Text = args.Pin.ToString();
|
||||
prOutLabel.Text = args.Pout.ToString();
|
||||
//tInLabel.Text = args.Tin.ToString();
|
||||
//tOutLabel.Text = args.Tout.ToString();
|
||||
//prInLabel.Text = args.Pin.ToString();
|
||||
//prOutLabel.Text = args.Pout.ToString();
|
||||
|
||||
massLabel.Text = args.Mass.ToString();
|
||||
//massLabel.Text = args.Mass.ToString();
|
||||
|
||||
if (args.Mass.Valid && args.StartMass.Valid)
|
||||
{
|
||||
massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
|
||||
}
|
||||
//if (args.Mass.Valid && args.StartMass.Valid)
|
||||
//{
|
||||
// massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
|
||||
//}
|
||||
|
||||
if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
|
||||
{
|
||||
//if (pumpOn != args.PumpOn)
|
||||
//{
|
||||
// if (pumpOn) pumpPictureBox.Image = System.Resources.
|
||||
// else pumpPictureBox.Image = System.Resources.
|
||||
//}
|
||||
pumpOn = args.PumpOn;
|
||||
diverterToTank = args.DivToTank;
|
||||
Invalidate();
|
||||
}
|
||||
//if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
|
||||
//{
|
||||
// //if (pumpOn != args.PumpOn)
|
||||
// //{
|
||||
// // if (pumpOn) pumpPictureBox.Image = System.Resources.
|
||||
// // else pumpPictureBox.Image = System.Resources.
|
||||
// //}
|
||||
// pumpOn = args.PumpOn;
|
||||
// diverterToTank = args.DivToTank;
|
||||
// Invalidate();
|
||||
//}
|
||||
}
|
||||
|
||||
void OnTestCompleted(object sender, TestCompletedEventArgs args)
|
||||
|
||||
@ -355,17 +355,17 @@ namespace TBF.Screens
|
||||
void OnTestProgress(object sender, TestProgressEventArgs args)
|
||||
{
|
||||
/// Top part
|
||||
airTempLabel.Text = args.AmbientTemp.ToString();
|
||||
airPressLabel.Text = args.AmbientPressure.ToString();
|
||||
airHumiLabel.Text = args.AmbientHumidity.ToString();
|
||||
//airTempLabel.Text = args.AmbientTemp.ToString();
|
||||
//airPressLabel.Text = args.AmbientPressure.ToString();
|
||||
//airHumiLabel.Text = args.AmbientHumidity.ToString();
|
||||
|
||||
refPulsesLabel.Text = args.RefPulses.ToString();
|
||||
refFreqLabel.Text = args.FlowMtrFreq.ToString();
|
||||
refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4);
|
||||
refVolumeLabel.Text = args.Volume.ToString();
|
||||
//refPulsesLabel.Text = args.RefPulses.ToString();
|
||||
//refFreqLabel.Text = args.FlowMtrFreq.ToString();
|
||||
//refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4);
|
||||
//refVolumeLabel.Text = args.Volume.ToString();
|
||||
|
||||
//regValvePosLabel.Text = args.RegValvePos.ToString();
|
||||
tDivLabel.Text = args.Tdiv.ToString();
|
||||
//tDivLabel.Text = args.Tdiv.ToString();
|
||||
|
||||
/// Bottom part
|
||||
/// TODO: Reimplement
|
||||
@ -437,29 +437,29 @@ namespace TBF.Screens
|
||||
//error3zLabel.Text = args.TestResult.CombinedMeters[2].VolumeErrorPct.ToString("F2");
|
||||
}
|
||||
|
||||
tInLabel.Text = args.Tin.ToString();
|
||||
tOutLabel.Text = args.Tout.ToString();
|
||||
prInLabel.Text = args.Pin.ToString();
|
||||
prOutLabel.Text = args.Pout.ToString();
|
||||
//tInLabel.Text = args.Tin.ToString();
|
||||
//tOutLabel.Text = args.Tout.ToString();
|
||||
//prInLabel.Text = args.Pin.ToString();
|
||||
//prOutLabel.Text = args.Pout.ToString();
|
||||
|
||||
massLabel.Text = args.Mass.ToString();
|
||||
//massLabel.Text = args.Mass.ToString();
|
||||
|
||||
if (args.Mass.Valid && args.StartMass.Valid)
|
||||
{
|
||||
massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
|
||||
}
|
||||
//if (args.Mass.Valid && args.StartMass.Valid)
|
||||
//{
|
||||
// massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
|
||||
//}
|
||||
|
||||
if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
|
||||
{
|
||||
//if (pumpOn != args.PumpOn)
|
||||
//{
|
||||
// if (pumpOn) pumpPictureBox.Image = System.Resources.
|
||||
// else pumpPictureBox.Image = System.Resources.
|
||||
//}
|
||||
pumpOn = args.PumpOn;
|
||||
diverterToTank = args.DivToTank;
|
||||
Invalidate();
|
||||
}
|
||||
//if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
|
||||
//{
|
||||
// //if (pumpOn != args.PumpOn)
|
||||
// //{
|
||||
// // if (pumpOn) pumpPictureBox.Image = System.Resources.
|
||||
// // else pumpPictureBox.Image = System.Resources.
|
||||
// //}
|
||||
// pumpOn = args.PumpOn;
|
||||
// diverterToTank = args.DivToTank;
|
||||
// Invalidate();
|
||||
//}
|
||||
}
|
||||
|
||||
void OnTestCompleted(object sender, TestCompletedEventArgs args)
|
||||
|
||||
@ -1285,6 +1285,7 @@
|
||||
<Compile Include="UiBridge\LogEventArgs.cs" />
|
||||
<Compile Include="UiBridge\ProcedureCompletedEventArgs.cs" />
|
||||
<Compile Include="UiBridge\ProcedureSelectedEventArgs.cs" />
|
||||
<Compile Include="UiBridge\ProcessDataEventArgs.cs" />
|
||||
<Compile Include="UiBridge\StateChangedEventArgs.cs" />
|
||||
<Compile Include="UiBridge\TestCompletedEventArgs.cs" />
|
||||
<Compile Include="UiBridge\TestProgressEventArgs.cs" />
|
||||
|
||||
46
TestBenchFramework/UiBridge/ProcessDataEventArgs.cs
Normal file
46
TestBenchFramework/UiBridge/ProcessDataEventArgs.cs
Normal file
@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.UiBridge
|
||||
{
|
||||
class ProcessDataEventArgs : EventArgs
|
||||
{
|
||||
public string TestName;
|
||||
public int Part;
|
||||
public int Repeats;
|
||||
public int RepetitionNr;
|
||||
|
||||
public Config.Entities.Progress Phase;
|
||||
public int Progress; /// value in the range 0..100
|
||||
public float OveralProgress;
|
||||
|
||||
|
||||
public int RefPulses; /// Reference pulses count since the test start
|
||||
public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0)
|
||||
public FloatBox FlowMtrFreq; /// Current reference flowmeter frequency in [Hz] (0 .. 2000.0 in case within range)
|
||||
public FloatBox Flow; /// Current flow in [m3/h]
|
||||
public FloatBox Volume; ///
|
||||
public float Time;
|
||||
public FloatBox Mass;
|
||||
public FloatBox StartMass;
|
||||
public bool PumpOn;
|
||||
public bool DivToTank;
|
||||
|
||||
public FloatBox Tin;
|
||||
public FloatBox Tout;
|
||||
public FloatBox Tdiv;
|
||||
public FloatBox Pin;
|
||||
public FloatBox Pout;
|
||||
public FloatBox AmbientTemp;
|
||||
public FloatBox AmbientPressure;
|
||||
public FloatBox AmbientHumidity;
|
||||
|
||||
|
||||
public ProcessDataEventArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,6 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using Config.Entities;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.UiBridge
|
||||
{
|
||||
@ -19,27 +17,6 @@ namespace TBF.UiBridge
|
||||
public float OveralProgress;
|
||||
|
||||
|
||||
public int RefPulses; /// Reference pulses count since the test start
|
||||
public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0)
|
||||
public FloatBox FlowMtrFreq; /// Current reference flowmeter frequency in [Hz] (0 .. 2000.0 in case within range)
|
||||
public FloatBox Flow; /// Current flow in [m3/h]
|
||||
public FloatBox Volume; ///
|
||||
public float Time;
|
||||
public FloatBox Mass;
|
||||
public FloatBox StartMass;
|
||||
public bool PumpOn;
|
||||
public bool DivToTank;
|
||||
|
||||
public FloatBox Tin;
|
||||
public FloatBox Tout;
|
||||
public FloatBox Tdiv;
|
||||
public FloatBox Pin;
|
||||
public FloatBox Pout;
|
||||
public FloatBox AmbientTemp;
|
||||
public FloatBox AmbientPressure;
|
||||
public FloatBox AmbientHumidity;
|
||||
|
||||
|
||||
#region Static and base constructor part
|
||||
|
||||
static int[] estimatedTime; /// Estimated time of each phase to calculate the progress [s]
|
||||
@ -47,6 +24,7 @@ namespace TBF.UiBridge
|
||||
static int currentPhaseStartTime;
|
||||
static Config.Entities.Progress currentPhase;
|
||||
|
||||
|
||||
static TestProgressEventArgs()
|
||||
{
|
||||
int[] estTime = new int[(int)Config.Entities.Progress.Count];
|
||||
@ -58,6 +36,7 @@ namespace TBF.UiBridge
|
||||
currentPhase = Config.Entities.Progress.JustStarted;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set estimated time of each phase in [s] (see Config.Entities.Progress).
|
||||
/// </summary>
|
||||
@ -73,6 +52,7 @@ namespace TBF.UiBridge
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base constructor which maintains currentPhase, currentPhaseStartTime
|
||||
/// and calculates 'Progress'.
|
||||
@ -110,11 +90,13 @@ namespace TBF.UiBridge
|
||||
RepetitionNr = repetitionNr;
|
||||
}
|
||||
|
||||
|
||||
public TestProgressEventArgs(Config.Entities.Test test, Config.Entities.Progress progress)
|
||||
: this(test, 1, progress)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used by iPearl communication dialog
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user