Compare commits

...
Author SHA1 Message Date
Milan Hanajik c8f61ea5d9 Reconfigured for iPerl 2019-10-24 08:57:08 +02:00
Milan Hanajik b24ec4ea2d ver. 2.18.1350 2019-10-24 08:55:44 +02:00
Milan Hanajik f3ed9a64f7 Transition sequences and hydraulic paths are not displayed and cannot be edited for test methods with DoTranisitions( ) == false. 2019-10-24 08:55:41 +02:00
Milan Hanajik 866939abbd (1) TBF.BenchControl.Elde.SendCommandArgs class and cbCommandQueue (2) DiverterToTank, DiverterToSink commands modified. 2019-10-24 08:55:40 +02:00
Milan Hanajik 248f51fa69 TransitionContext.AfterTestWithOverlap, PID coef. set earlier as well, nextHydroTest in MainSeq. 2019-10-24 08:55:31 +02:00
Milan Hanajik b4dc83e7fa (1) Modifications for WR20, WR21 (2) ProcessData.BenchInfo.TestBenchId/TextBenchName are always used by Oracle and ProductionTracing. 2019-10-22 12:48:58 +02:00
Milan Hanajik 0bb6a2cd8c ver. 2.18.1331 2019-10-15 09:35:45 +02:00
Milan Hanajik c3d3a8c987 (1) "Fix' possible for user 'milan' even when previous records are missing, (2) More OracleWZTypSelection, ver. 2.18.1330 2019-10-11 16:56:20 +02:00
Milan Hanajik 825230d9e9 ver. 2.18.1328 2019-10-09 14:41:00 +02:00
Milan Hanajik cb13e3f108 ver. 2.18.1327 2019-10-09 14:34:01 +02:00
Milan Hanajik 2552949c59 ver. 2.18.1326 2019-10-09 14:22:51 +02:00
Milan Hanajik 317e0f16cb (1) TestMethods.Dummy component, (2) Three custom shared buttons, (3) ProcedureDlg and Procedures.TestWizard modified. 2019-10-09 14:00:08 +02:00
Milan Hanajik 8e046046cd SensusTestInfo extended 2019-10-09 13:59:56 +02:00
Milan Hanajik e440981068 'ShowDisabledPositions' supported when displaying previous results. 2019-10-08 09:48:37 +02:00
Milan Hanajik 299f3ecb68 ver. 2.18.1325 2019-10-01 12:02:30 +02:00
Milan Hanajik 39aa02f9ab Oracle DB only : Refactorization : TBF.UI namespace, no change of function, part 2. 2019-10-01 11:12:51 +02:00
Milan Hanajik d502873d17 FlowMeter, FlowmeterTriplet : Condiiton (flow < 0.1 * NominalFlow) removed from LtrPerPulseCorrected( ), ver. 2.18.1324 2019-09-26 15:53:00 +02:00
Milan Hanajik da192a207c (1) StandardCamera.TestStartEndForm fixed (exclamation), (2) Simulate mode for camera with sample.bmp, ver. 2.18.1322 2019-09-23 08:03:16 +02:00
Milan Hanajik 23560f1702 Bug fix : Program crashed when on-screen result items were defined for the first time on a PC (columnWidths == null). 2019-09-23 07:16:35 +02:00
Milan Hanajik 36a6fba408 (1) FlowMeteDewa uses EtPulses2, EtPulses3, (2) WMChart fixed, Q4 displayed, (3) Minor MainSeq bug fix, ver. 2.18.1318 2019-09-22 17:11:48 +02:00
78 changed files with 2810 additions and 706 deletions
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+36
View File
@@ -234,6 +234,42 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
{
for (int ix = 0; ix < Tests.Count; ix++)
{
Test test = Tests[ix];
if (test.Name.Equals(expandedTestName))
{
/// Name is not expanded => Repeats==1
testIx = ix;
repetNr = 1;
return test;
}
for (int r = 1; r <= test.Repeats; r++)
{
if (test.GetExpandedTestName(r).Equals(expandedTestName))
{
testIx = ix;
repetNr = r;
return test;
}
}
}
testIx = 0;
repetNr = 1;
return null;
}
public override string ToString()
{
return string.Format("{0}, rev.{1}", Name, Revision);
+27
View File
@@ -313,6 +313,33 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Return test title for a this test and a given repetition number
/// </summary>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public virtual string GetExpandedTestName(int repetitionNr)
{
if (Repeats == 1)
{
if (Part == 0)
{
/// Single test
return Name;
}
else
{
/// A part of a single test
return string.Format("{0} ({1})", Name, Part);
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
}
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
{
if (ErrLimLo <= ErrLimHi)
+11 -5
View File
@@ -130,13 +130,19 @@ namespace Results
public static BatchResults FromBatch(Batch batch)
{
int wmCount = batch.WaterMeters.Count;
if (wmCount == 0) return null;
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return null;
BatchResults batchResults = new BatchResults(wmCount);
int wmPosMax = 0;
foreach (var wm in batch.WaterMeters) if (wm.WMPosition > wmPosMax) wmPosMax = wm.WMPosition;
BatchResults batchResults = new BatchResults(wmPosMax);
batchResults.Batch = batch;
batchResults.WaterMeters = new WaterMeter[wmCount];
for (int i = 0; i < wmCount; i++) batchResults.WaterMeters[i] = batch.WaterMeters[i];
batchResults.WaterMeters = new WaterMeter[wmPosMax];
for (int i = 0; i < batch.WaterMeters.Count; i++)
{
WaterMeter wm = batch.WaterMeters[i];
batchResults.WaterMeters[wm.WMPosition - 1] = wm;
}
return batchResults;
}
+25 -22
View File
@@ -126,12 +126,9 @@ namespace Results.Forms
int displayedControlsCount = 0;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
{
displayedControlsCount++;
}
displayedControlsCount++;
}
}
@@ -170,16 +167,23 @@ namespace Results.Forms
firstEnabledControl = null;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (!results.WaterMeters[i].Disabled || ShowDisabledPositions)
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if ((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if ((firstEnabledControl == null) && (results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
firstEnabledControl = wmRsltsCtrl[ix];
}
//wmRsltsCtrl[ix].Update(results.WaterMeters[i].WMPosition);
wmRsltsCtrl[ix].Update(Items);
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
{
@@ -192,11 +196,10 @@ namespace Results.Forms
OnDoubleClick(s, args);
}
};
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
ix++;
}
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
ix++;
}
}
@@ -206,16 +209,16 @@ namespace Results.Forms
}
void UpdateResults(Results.BatchResults batchResults)
void UpdateResults(Results.BatchResults results)
{
if ((batchResults != null) && (batchResults.WaterMeters != null))
if ((results != null) && (results.WaterMeters != null))
{
int ctrlIx = 0;
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.WaterMeters[i]);
}
}
}
+2 -2
View File
@@ -90,11 +90,11 @@ namespace Results.Forms
#endif
/// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
lView.Columns.Add(str, (columnWidths.Length > col) ? columnWidths[col] : 70);
lView.Columns.Add(str, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
+2 -2
View File
@@ -67,13 +67,13 @@ namespace Results.Forms
/// Always draw ListView header
lView.Columns.Clear();
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
if (items == null || items.Count == 0) return;
int col = 1;
foreach (var item in items)
{
lView.Columns.Add(item.Caption, (columnWidths.Length > col) ? columnWidths[col] : 70);
lView.Columns.Add(item.Caption, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
}
+13 -3
View File
@@ -13,17 +13,25 @@ namespace Results.Output
{
public static Chart GetChart(WaterMeter wm, bool isPrinter)
{
return GetChart(wm, isPrinter, Config.Unit.lph, false);
return GetChart(wm, isPrinter, Config.Unit.lph);
}
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit, bool isQ4)
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit)
{
double maxFlow_m3h = 0;
IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{
double flow = Config.Units.ConvertTo(flowUnit, 3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
double flow_m3h = (mtr.TestTime != 0)
? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestTime * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster)
: (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow_m3h > maxFlow_m3h) maxFlow_m3h = flow_m3h;
double flow = Config.Units.ConvertTo(flowUnit, flow_m3h); /// Convert to specified units
if (flow > 0)
{
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
@@ -32,6 +40,8 @@ namespace Results.Output
}
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
bool isQ4 = (maxFlow_m3h > 1.1 * wm.WaterMeterData.Q3_Qn);
Chart chart = new Chart
{
Name = "chart",
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1290.0")]
[assembly: AssemblyFileVersion("2.18.1290.0")]
[assembly: AssemblyVersion("2.18.1340.0")]
[assembly: AssemblyFileVersion("2.18.1340.0")]
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+5 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -30,6 +30,8 @@ namespace Results
case 10: return 38; /// WR14
case 11: return 39; /// WR18
case 12: return 40; /// WR19
case 13: return 41; /// WR20
case 14: return 42; /// WR21
default: return 0;
}
}
@@ -47,6 +49,8 @@ namespace Results
case 10: return "WR14";
case 11: return "WR18";
case 12: return "WR19";
case 13: return "WR20";
case 14: return "WR21";
default: return string.Empty;
}
}
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -471,17 +471,20 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
///
void UpdateExclamation(int uiCtrlPos) /// uiCtrlPos = 0 .. TextBoxesCount-1
{
try
{
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (err > warningLimHi);
}
catch
{
exclamations[uiCtrlPos].Visible = false;
}
if ((mode == Tst.End) || (mode == Tst.Both))
{
try
{
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
}
catch
{
exclamations[uiCtrlPos].Visible = false;
}
}
}
+107 -136
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -18,6 +18,8 @@ namespace TBF.BenchControl.Elde
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
const int FiltersCount = 8;
readonly ControlBoardCfg controlBoardCfg;
///
@@ -43,7 +45,9 @@ namespace TBF.BenchControl.Elde
public StatusP StatusP { get { return controlCom.StatusP; } }
public int EtPulses(int wmNr1) { return controlCom.EtPulses(wmNr1); }
public int EtPulsesK { get { return controlCom.EtPulsesK; } }
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public int EtPulses2 { get { return controlCom.EtPulses2; } } /// DEWA_300: pulses from I12
public int EtPulses3 { get { return controlCom.EtPulses3; } } /// DEWA_300: pulses from I13
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
public uint RegulValveDAC(int rvNr0) { return controlCom.RegulValveDAC(rvNr0); }
public float Pressure(int prsNr0) { return controlCom.Pressure(prsNr0); }
@@ -77,48 +81,22 @@ namespace TBF.BenchControl.Elde
bool previousEmergencyStop;
private int flowmeterNr4DiverterTest;
private bool scheduleDiverterToTank;
private bool scheduleDiverterToSink;
private bool scheduleReadDiverterTransition;
private bool pumpPowerChanged;
///
public void DiverterToTank(int flowmeterNr)
public void DiverterToTank(int flowMtrNr)
{
if (!scheduleDiverterToSink && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToTank = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
}
///
public void DiverterToSink(int flowmeterNr)
public void DiverterToSink(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToSink = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation));
}
///
public void ReadDiverterTransition(int flowmeterNr)
public void ReadDiverterTransition(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleDiverterToSink && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleReadDiverterTransition = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.ReadDivTransition, flowMtrNr, 0, 0, TestMethods.Diverter, 0));
}
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
///
/// Initialization data updated by constructors of children components
/// and sent to 'controlCom2panel' by SendCalibData() method.
@@ -175,21 +153,22 @@ namespace TBF.BenchControl.Elde
public uint[] BalanceRange = new uint[2];
///
/// Private values sent by the last SendCommand()
///
bool sendCommandFlag;
Command cmd;
int refNr;
Queue<SendCommandArgs> cbCommandQueue;
/// <summary>
/// Route: 128-bit word representing the current state of all valves and pumps
/// </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 benchModelRoute;
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
int[] filters;
float[] FMFreq;
int regConst;
int shortImp;
StopDevs stopDevs;
/// <summary>
@@ -212,6 +191,8 @@ namespace TBF.BenchControl.Elde
/// <param name="power">Power (0.0f .. 100.0f)</param>
public void SetFMFreq(int index, float power)
{
bool pumpPowerChanged = false;
#if DN100 || MUNICH || FUZHOU_150
if ((FMFreq == null) || (FMFreq.Length != 2))
{
@@ -290,6 +271,9 @@ namespace TBF.BenchControl.Elde
{
controlBoardCfg = cfg as ControlBoardCfg;
cbCommandQueue = new Queue<SendCommandArgs>();
lastSentFilters = new uint[FiltersCount];
#if DN100 || MUNICH || FUZHOU_150
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
#elif SLM_END || WARSAW_END
@@ -377,7 +361,9 @@ namespace TBF.BenchControl.Elde
log.FatalFormat("Successfully initialized device {0}", ToString());
}
/// <summary>Run this device</summary>
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceBefore()
{
if (DebugLevel == DebugMode.Simulate) return;
@@ -398,95 +384,89 @@ namespace TBF.BenchControl.Elde
{
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
}
if (emergencyStop)
{
/// SendCommand() arguments to clear the emergency stop state
sendCommandFlag = true;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.cmd = Command.Stop;
this.testMethods = 0;
this.stopDevs = StopDevs.All;
}
else if (scheduleDiverterToTank)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Start;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = int.MaxValue;
this.massRefPulses = int.MaxValue;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleDiverterToTank = false;
}
else if (scheduleDiverterToSink)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Stop;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = StopDevs.Diverter;
scheduleDiverterToSink = false;
}
else if (scheduleReadDiverterTransition)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.ReadDivTransition;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleReadDiverterTransition = false;
}
else if (pumpPowerChanged)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.None;
pumpPowerChanged = false;
}
else
{
/// Reset all SendCommand() arguments
sendCommandFlag = false;
this.cmd = Command.None;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = 0;
this.stopDevs = 0;
}
if (this.filters == null) this.filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, };
}
/// <summary>Run this device</summary>
///
/// Used in RunDeviceAfter() when sending commands
///
UInt128 lastSentRoute;
uint[] lastSentFilters;
float[] lastSentFMFreq;
int lastsentRegConst;
int lastSentShortImp;
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceAfter()
{
if (DebugLevel == DebugMode.Simulate) return;
UpdateWeights();
uint[] uintFilters = new uint[8];
for (int i = 0; i < 8; i++)
/// Modify queue in case of emergency stop
if (emergencyStop && !previousEmergencyStop)
{
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
/// SendCommand() arguments to clear the emergency stop state
cbCommandQueue.Clear();
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, 0, StopDevs.All));
}
///
if (sendCommandFlag)
/// Prepare uintFilters array and evaluate changes
uint[] uintFilters = new uint[FiltersCount];
uintFilters[0] = (filters != null && filters.Length > 0) ? (uint)filters[0] : 0;
bool filtersAreDifferent = (uintFilters[0] != lastSentFilters[0]);
for (int i = 1; i < FiltersCount; i++)
{
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
totalRefPulses, massRefPulses, testMethods,
uintFilters, FMFreq, regConst, shortImp, stopDevs);
uintFilters[i] = (filters != null && filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
filtersAreDifferent |= (uintFilters[i] != lastSentFilters[i]);
}
/// Evaluate FMFreq changes
bool fmFreqsAreDifferent = false;
if ((FMFreq == null) || (lastSentFMFreq == null) || (FMFreq.Length != lastSentFMFreq.Length))
{
fmFreqsAreDifferent = true;
}
else
{
for (int i = 0; i < FMFreq.Length; i++)
{
if (FMFreq[i] != lastSentFMFreq[i])
{
fmFreqsAreDifferent = true;
break;
}
}
}
if (cbCommandQueue.Count > 0)
{
/// There is a command in the queue
///
controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
}
else if (((benchModelRoute & routeMask) != lastSentRoute) ||
filtersAreDifferent ||
fmFreqsAreDifferent ||
(lastsentRegConst != regConst) ||
(lastSentShortImp != shortImp))
{
/// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed
///
controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
}
controlCom.RunDeviceAfter();
@@ -510,25 +490,17 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="totalRefPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods, StopDevs stopDevs)
public void SendCommand(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
this.cmd = cmd;
this.refNr = refFlowmtrNr;
this.benchModelRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.stopDevs = stopDevs;
sendCommandFlag = true;
cbCommandQueue.Enqueue(new SendCommandArgs(cmd, refFlowmtrNr, totalRefPulses, massRefPulses, testMethods, stopDevs));
}
/// <summary>
@@ -543,7 +515,6 @@ namespace TBF.BenchControl.Elde
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
sendCommandFlag = true;
return oldRoute ^ benchModelRoute;
}
+18 -18
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -28,6 +28,8 @@ namespace TBF.BenchControl.Elde
}
public int EtPulsesK { get { return 1; } }
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
double[] errFactor = new double[Config.Data.WMsCount + 1]; /// Internal
double[] wMeterPulsesF = new double[Config.Data.WMsCount + 1]; /// Internal
@@ -167,7 +169,7 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
@@ -175,17 +177,15 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
cmd, refFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
sendCommandArgs.Cmd, sendCommandArgs.RefFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
@@ -197,8 +197,8 @@ namespace TBF.BenchControl.Elde
/// Simulation
///
Command lastCmd = this.cmd;
this.cmd = cmd;
this.refFlowmtrNr = refFlowmtrNr;
this.cmd = sendCommandArgs.Cmd;
this.refFlowmtrNr = sendCommandArgs.RefFlowmtrNr;
#if FUZHOU_300
///
@@ -212,14 +212,14 @@ namespace TBF.BenchControl.Elde
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
#endif
TestBenchSim.SimRoute = this.simRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.filterConstants = filterConstants;
this.totalRefPulses = sendCommandArgs.TotalRefPulses;
this.massRefPulses = sendCommandArgs.MassRefPulses;
this.testMethods = sendCommandArgs.TestMethods;
this.stopDevs = sendCommandArgs.StopDevs;
this.filterConstants = filterConstants;
this.FMFreq = fmFreq;
this.regConst = regConst;
this.shortImp = shortImp;
this.stopDevs = stopDevs;
#pragma warning disable
statusP = (StatusP)(((ulong)statusP & (ulong)0xFFFFFFFFFFFFFFF8L) | (ulong)refFlowmtrNr);
+95 -65
View File
@@ -50,6 +50,13 @@ namespace TBF.BenchControl.Elde
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
#endif
#if DEWA_300
public int EtPulses2 { get { return (int)ctrlBrdComponent.EtPulses2; } }
public int EtPulses3 { get { return (int)ctrlBrdComponent.EtPulses3; } }
#else
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
#endif
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
public int WMeterReference(int wmNr0) { return (int)ctrlBrdComponent.wMeterReference[wmNr0]; }
@@ -301,63 +308,35 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Sends a command to the control board.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowMeterNr">Reference flow meter number (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="refPulses">Test duration as a number of reference flow meter pulses</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstants">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
/// <param name="sendCommandArgs">Arguments</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
if (Program.MainWnd.InvokeRequired)
{
/// When SendCommand(...) called from the worker thread
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
testMethods, filterConstants, fmFreq, regConst, shortImp, stopDevs };
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
/// From another thread ... use Invoke()
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, new object[] { sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp });
}
else
{
/// When SendCommand(...) called from the UI thread
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
filterConstants, fmFreq, regConst, shortImp, stopDevs);
/// Call DoSendCommand() directly
DoSendCommand(sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp);
}
}
///
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
delegate void SendCommandDlgt(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
///
private void DoSendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
private void DoSendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
// DateTime.Now.ToLongTimeString(),
// cmd,
// refFlowMeterNr,
// route.ToString("X"),
// totalRefPulses,
// testMethods,
// filterConstant,
// fmFreq[0],
// fmFreq[1],
// regConst,
// shortImp,
// stopDevs));
#if FUZHOU_300
///
/// The following code deals with the situation that all FM controlled pumps share bit #39.
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
/// (in FUZHOU_300 the FM pump bit should be set to value FMIndex+50).
///
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
route = route & 0xFF03FFFFFFFFFFFF;
@@ -374,49 +353,100 @@ namespace TBF.BenchControl.Elde
route = route & (~(((UInt128)1) << 80));
#endif
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
cmd, /// 0
refFlowMeterNr, /// 1
Utils.RouteToStr(route), /// 2
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
sendCommandArgs.Cmd, /// 0
sendCommandArgs.RefFlowmtrNr, /// 1
Utils.RouteToStr(route), /// 2
sendCommandArgs.TotalRefPulses,
sendCommandArgs.MassRefPulses,
sendCommandArgs.TestMethods,
filterConstants, /// 3, 4, 5, 6
fmFreq[0].ToString(), /// 7
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 10
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 11
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 12
regConst, shortImp, stopDevs); /// 13, 14, 15
regConst, /// 13
shortImp, /// 14
sendCommandArgs.StopDevs); /// 15
#if DN100 || MUNICH
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq[0],
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BERLIN || SLM_150 || PETERSBURG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif GENESIS || DEWA_300
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#else /// if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || PUCHONG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#endif
log.DebugFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
{
UInt128 rRoute = RRoute;
Program.MainWnd.UpdateRoute(string.Format("{0} ({1})", Utils.RouteToStr(route), Utils.RouteToStr(rRoute)));
lastRoute = route;
lastRoute = route;
}
}
+2 -2
View File
@@ -56,7 +56,7 @@ namespace TBF.BenchControl.Elde
public void Start()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStartOp, 0, 0, 0, testMethod, StopDevs.None);
opState = OpState.StartingCommand;
}
@@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
if (commandOnStopOp != Command.None)
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStopOp, 0, 0, 0, testMethod, StopDevs.None);
}
}
}
@@ -22,8 +22,6 @@ namespace TBF.BenchControl.Elde.FlowMeter
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>();
foreach (var corr in Corrections)
@@ -28,22 +28,66 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public double NominalFlow { get { return nominalFlow; } }
public double LtrPerPulse { get { return ltrPerPulse; } }
double[] refFreq;
double[] refFreq; /// 0..sum, 1..I11, 2..I12, 3..I13
int[] refPulses;
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
log.DebugFormat("LtrPerPulseCorrected({0}, {1}) started", flow, rangeIx);
refFreq[0] = controlBoard.ReferenceFreqs(0);
refFreq[1] = controlBoard.ReferenceFreqs(1);
refFreq[2] = controlBoard.ReferenceFreqs(2);
refFreq[3] = controlBoard.ReferenceFreqs(3);
log.DebugFormat("refFreq[] = ({0}, {1}, {2}, {3})", refFreq[0], refFreq[1], refFreq[2], refFreq[3]);
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null) ltrPerPulseCorrected += refFreq[1] * flowMeter1.LtrPerPulseCorrected(flow * refFreq[1] / refFreq[0], rangeIx);
if (flowMeter2 != null) ltrPerPulseCorrected += refFreq[2] * flowMeter2.LtrPerPulseCorrected(flow * refFreq[2] / refFreq[0], rangeIx);
if (flowMeter3 != null) ltrPerPulseCorrected += refFreq[3] * flowMeter3.LtrPerPulseCorrected(flow * refFreq[3] / refFreq[0], rangeIx);
return ltrPerPulseCorrected / refFreq[0];
refPulses[0] = controlBoard.EtPulses(0);
refPulses[2] = controlBoard.EtPulses2;
refPulses[3] = controlBoard.EtPulses3;
refPulses[1] = refPulses[0] - refPulses[2] - refPulses[3];
log.DebugFormat("refPulses[] = ({0}, {1}, {2}, {3})", refPulses[0], refPulses[1], refPulses[2], refPulses[3]);
double flow1, flow2, flow3;
double contribution1, contribution2, contribution3;
if (refFreq[0] != 0)
{
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null)
{
double ratio = (double)refPulses[flowMeter1.Idx1] / (double)refPulses[0];
flow1 = flow * ratio;
contribution1 = flowMeter1.LtrPerPulseCorrected(flow1, rangeIx) * ratio;
ltrPerPulseCorrected += contribution1;
log.DebugFormat("flowmeter1 = {0}, flow1 = {1}, contribution1 = {2}", flowMeter1.Name, flow1, contribution1);
}
if (flowMeter2 != null)
{
double ratio = (double)refPulses[flowMeter2.Idx1] / (double)refPulses[0];
flow2 = flow * ratio;
contribution2 = flowMeter2.LtrPerPulseCorrected(flow2, rangeIx) * ratio;
ltrPerPulseCorrected += contribution2;
log.DebugFormat("flowmeter2 = {0}, flow2 = {1}, contribution2 = {2}", flowMeter2.Name, flow2, contribution2);
}
if (flowMeter3 != null)
{
double ratio = (double)refPulses[flowMeter3.Idx1] / (double)refPulses[0];
flow3 = flow * ratio;
contribution3 = flowMeter3.LtrPerPulseCorrected(flow3, rangeIx) * ratio;
ltrPerPulseCorrected += contribution3;
log.DebugFormat("flowmeter3 = {0}, flow3 = {1}, contribution3 = {2}", flowMeter3.Name, flow3, contribution3);
}
log.DebugFormat("LtrPerPulseCorrected() returns {0}", ltrPerPulseCorrected);
return ltrPerPulseCorrected;
}
else
{
log.DebugFormat("LtrPerPulseCorrected() returns 1");
return 1;
}
}
@@ -56,7 +100,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public FlowMeter()
{
}
refFreq = new double[4];
refPulses = new int[4];
}
public FlowMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
@@ -80,6 +126,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
refFreq = new double[4];
refPulses = new int[4];
log.Debug(this.ToString());
}
@@ -22,8 +22,6 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections);
return (LtrPerPulse * correctedFlow / flow);
+11 -15
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
@@ -11,7 +11,9 @@ namespace TBF.BenchControl.Elde
StatusP StatusP { get; }
int EtPulses(int wmNr1);
int EtPulsesK { get; }
UInt16 WMeterPulses(int wmNr1);
int EtPulses2 { get; }
int EtPulses3 { get; }
UInt16 WMeterPulses(int wmNr1);
int WMeterReference(int wmNr0);
uint RegulValveDAC(int rvNr0);
float Pressure(int prsNr0);
@@ -59,19 +61,13 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Updates a command that is regularly sent to the control board by SendCommand.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="totalRefPulses">Kolko impulzov ma trvat skuska</param>
/// <param name="massRefPulses">Pri 'MassAndContinue' metode kolko impulzov ma trvat mass measurement</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
void SendCommand(Command cmd, int refNr, UInt128 route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
/// <param name="sendCommandArgs">Arguments, see SendCommandArgs class</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
/// <summary>
/// Control of regulating valves.
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
void SendCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, StopDevs.None);
controlBoard.SendCommand(Command.ReadDivTransition, 0, 0, 0, 0, StopDevs.None);
cmdSent = true;
}
+31 -34
View File
@@ -198,16 +198,17 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.None, Event.FlowReached, Event.RegulValveTimeOut, Event.OpArgumentError
/// Event.OpArgumentError
/// Event.Starting
/// Event.Busy
/// Event.FlowReached
/// Event.RegulValveTimeOut
/// </returns>
public Event Run()
{
@@ -246,17 +247,14 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
return Event.None;
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition1)
{
opState = OpState.ValveMoveToPosition2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition2) /// Move to position
{
@@ -266,7 +264,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition3)
{
@@ -278,14 +276,14 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingPosition;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStatePosition) /// Verify
{
if (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
{
@@ -298,12 +296,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, targetPositionLo, targetPositionHi, regulValve.StableTime);
opState = OpState.ValveMoveToPosition3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
}
else if (opState == OpState.SettingPosition)
@@ -313,12 +311,12 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.ValveMoveToFlow1;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow1)
{
opState = OpState.ValveMoveToFlow2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow2) /// Move to flow
{
@@ -340,7 +338,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow3)
{
@@ -352,7 +350,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingFlow;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStateFlow) /// Verify the flow setting
{
@@ -360,7 +358,7 @@ namespace TBF.BenchControl.Elde.RegulValve
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
{
@@ -375,12 +373,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, freqLo, freqHi, regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingFlow;
return Event.None;
return Event.Busy;
}
}
else if (opState == OpState.SettingFlow)
@@ -423,7 +421,7 @@ namespace TBF.BenchControl.Elde.RegulValve
else
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2}, FLOW_OK_TIMER={3}s)", flow, currentReqFlowLo, currentReqFlowHi, flowWithinBoundsTime);
return Event.None;
return Event.Busy;
}
}
else if (StateMachine.Time > expireTime)
@@ -434,7 +432,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2})", flow, currentReqFlowLo, currentReqFlowHi);
flowWithinBoundsTime = 0;
return Event.None;
return Event.Busy;
}
}
else /// opState == OpState.FlowReached
@@ -447,14 +445,13 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <summary>Start this operation</summary>
public void Stop()
{
opState = OpState.Idle;
if (!leaveMeasurementRunning)
{
/// Stop measurement
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, 50000, 50000, 0, StopDevs.RegValveRegulation); /// TestMethods=0
}
if (leaveMeasurementRunning) return;
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route, 50000, 50000, tm, sd);
opState = OpState.Idle;
}
}
}
@@ -212,8 +212,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -262,8 +261,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
log.DebugFormat(" return Event.None");
return Event.None;
}
@@ -479,7 +477,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
}
@@ -217,8 +217,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -371,7 +370,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
namespace TBF.BenchControl.Elde
{
public class SendCommandArgs
{
public Command Cmd;
public int RefFlowmtrNr;
public int TotalRefPulses;
public int MassRefPulses;
public TestMethods TestMethods;
public StopDevs StopDevs;
public SendCommandArgs()
{
}
public SendCommandArgs(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
Cmd = cmd;
RefFlowmtrNr = refFlowmtrNr;
TotalRefPulses = totalRefPulses;
MassRefPulses = massRefPulses;
TestMethods = testMethods;
StopDevs = stopDevs;
}
}
}
+1 -2
View File
@@ -125,8 +125,7 @@ namespace TBF.BenchControl.Elde
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, Stop.None)",
flowMeterIdxAndDiv, totalRefPulses, testMethod);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
totalRefPulses, massRefPulses, testMethod, StopDevs.None);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, totalRefPulses, massRefPulses, testMethod, StopDevs.None);
}
/// <summary>Start this operation</summary>
@@ -35,12 +35,7 @@ namespace TBF.BenchControl.Elde
void SendStopFlowRegulationCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
flowMeterNr, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
0,
StopDevs.RegValveRegulation);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
}
+1 -5
View File
@@ -43,11 +43,7 @@ namespace TBF.BenchControl.Elde
void SendStopCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
TestMethods.Diverter,
controlBoard.SendCommand(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
}
+1
View File
@@ -73,6 +73,7 @@ namespace TBF.BenchControl
public enum Event
{
None = 0,
Starting, /// During initial phase of some process, sending a command to a device, etc.
Busy, /// Useful when waiting in state until at least one is busy (all are done)
Done, /// Useful when waiting in state until the first is done, the rest miht still be busy
MakeSecondPass, /// Test completed OK but 2nd pass (evaluation) is required
@@ -32,9 +32,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
this.GetType().Namespace.Substring(17),
CameraCfg.Name,
CameraCfg.HardwareAddress,
ipAddress == null ? "not detected" : ipAddress.ToString(),
string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr,
string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer);
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : ((ipAddress == null) ? "not detected" : ipAddress.ToString()),
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr),
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer));
}
@@ -161,13 +161,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
{
cameraIdx = GetCameraIdx();
if (CameraCfg.DebugLevel == DebugMode.Simulate) return;
if (CameraCfg.DebugLevel == DebugMode.Simulate)
{
UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n {1} si simulated", Name, CameraCfg.HardwareAddress));
return;
}
/// Detect a camera
bool cameraDetected = DetectCamera(CameraCfg.HardwareAddress % 100, ref ipAddress, true,
out cpuHardware, out cpuRevision, out cpuSerialNr, out sdCardVer);
if (CameraCfg.DebugLevel == DebugMode.AutoDetect)
{
CameraCfg.DebugLevel = cameraDetected ? DebugMode.DetectedOn : DebugMode.DetectedOff;
@@ -219,46 +222,55 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public void StopDevice()
{
running = false;
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
running = false;
stopScpThreadFlag = true;
stopRtpListenerFlag = true;
stopMsrmntListenerFlag = true;
stopScpThreadFlag = true;
stopRtpListenerFlag = true;
stopMsrmntListenerFlag = true;
if (Telnet != null)
{
Telnet.Dispose();
Telnet = null;
}
if (Telnet != null)
{
Telnet.Dispose();
Telnet = null;
}
}
}
public void StopDevice2()
{
if (scpThread != null) scpThread.Join(50);
if (rtpListenerThread != null) rtpListenerThread.Join(50);
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
if (scpThread != null) scpThread.Join(50);
if (rtpListenerThread != null) rtpListenerThread.Join(50);
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
if (rtpUdpClient != null)
{
rtpUdpClient.Close();
rtpUdpClient = null;
}
if (rtpUdpClient != null)
{
rtpUdpClient.Close();
rtpUdpClient = null;
}
if (msrmntUdpClient != null)
{
msrmntUdpClient.Close();
msrmntUdpClient = null;
}
if (msrmntUdpClient != null)
{
msrmntUdpClient.Close();
msrmntUdpClient = null;
}
}
}
public void RunDeviceBefore()
{
if (sha1sumResponse != null && !sha1sumResponseProcessed)
{
scpThread = new Thread(new ThreadStart(ScpWorker));
scpThread.Start();
sha1sumResponseProcessed = true;
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
if (sha1sumResponse != null && !sha1sumResponseProcessed)
{
scpThread = new Thread(new ThreadStart(ScpWorker));
scpThread.Start();
sha1sumResponseProcessed = true;
}
}
}
public void RunDeviceAfter() { }
@@ -50,10 +50,13 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
grabImageCommandSent = false;
transferringGrabbedImage = false;
telnet.promptReceivedHandler += delegate(object sndr, PromptReceivedEventArgs a)
{
OnPromptReceived(sndr, a);
};
if (camera.DebugLevel == DebugMode.Normal || camera.DebugLevel == DebugMode.DetectedOn)
{
telnet.promptReceivedHandler += delegate(object sndr, PromptReceivedEventArgs a)
{
OnPromptReceived(sndr, a);
};
}
}
void OnPromptReceived(object sndr, PromptReceivedEventArgs a)
@@ -65,33 +68,58 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public void Start()
{
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
grabImageCommandSent = false;
transferringGrabbedImage = false;
if (File.Exists(imgFileNames[0])) File.Delete(imgFileNames[0]);
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
{
///
/// An image specified, (1) delete previous image, (2) check if this is a simulation
///
File.Delete(imgFileNames[0]);
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate || camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image
///
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
}
}
}
public Event Run()
{
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return Event.None;
if (imgFileNames.Length < 1 || imgFileNames[0] == null)
if ((imgFileNames == null) || (imgFileNames.Length < 1) || (imgFileNames[0] == null))
{
return Event.GrabPassed;
///
/// No images to be grabbed => Done
///
return Event.GrabPassed;
}
else if (!grabImageCommandSent)
else if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image and complete
///
return Event.GrabPassed;
}
else if (!grabImageCommandSent)
{
///
/// Normal operation, no command sent yet => (1) wait until telnet state = Inactive, (2) send a command
///
if (camera.Running && (telnet.State == TelnetClient.TelnetState.Inactive))
{
//
// State variables
//
///
/// State variables
///
response = null;
//
// Prepare command
//
///
/// Prepare a command
///
int rotation = 0;
if (imageRotation == ImageRotation.Deg90)
rotation = 90;
@@ -119,7 +147,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
}
else if (grabPassed)
{
if (transferringGrabbedImage)
///
/// Normal operation, grab passed => transfer/transferring the image
///
if (transferringGrabbedImage)
{
/// Grab passed and image transfer is in progress
return Event.GrabPassed;
@@ -138,12 +169,17 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
}
else if (grabFailed)
{
/// Grab failed, there in no image to transfer
///
/// Normal operation, grab failed => there in no image to transfer
///
return Event.GrabFailed;
}
else if (response != null)
{
if (response.Contains("completed"))
///
/// Normal operation
///
if (response.Contains("completed"))
{
grabPassed = true;
@@ -127,17 +127,11 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
public IOperation GrabImageOp(string imageFileName)
{
if (NetCamera != null)
{
/// TODO: Implement support for sharing one camera by multiple ROI-s
return NetCamera.GrabImagesOp(new string[] { imageFileName }, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
else
return null;
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
public IOperation GrabImageOp(string imageFileName, bool blackAndWhite,
bool lowResolution, Config.Entities.ImageRotation imageRotation)
public IOperation GrabImageOp(string imageFileName,
bool blackAndWhite, bool lowResolution, Config.Entities.ImageRotation imageRotation)
{
if (NetCamera != null)
{
@@ -17,7 +17,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public IComponentCfgCtrl GetControl() { return new TracingCfgCtrl(); }
public string Workplace;
public string ConnStr;
public string NetAdapter;
public bool CheckPreviousRecords;
@@ -28,7 +27,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
MonitoringCfg()
{
ParentName = string.Empty;
Workplace = "WR10";
NetAdapter = string.Empty;
ConnStr = "SERVER=10.42.128.16; DATABASE=sledovanie2019; UID=vyroba2019; PASSWORD=qwerty; CHARSET=utf8;";
CheckPreviousRecords = true;
@@ -44,9 +42,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string ToString(int i)
{
return string.Format("Name={0}, Workplace={1}, CheckPreviousRecords={2}, SaveTracingRecords={3}, ConnStr={4}",
return string.Format("Name={0}, CheckPreviousRecords={1}, SaveTracingRecords={2}, ConnStr={3}",
Name,
Workplace,
CheckPreviousRecords,
SaveTracingRecords,
ConnStr);
@@ -35,7 +35,14 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public const string WorkstepName = "Test_bench";
MonitoringCfg tracingCfg;
string workplace { get { return tracingCfg.Workplace; } }
string workplace
{
get
{
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return (benchInfo != null) ? benchInfo.TestBenchName : "TestBench";
}
}
readonly IPAddress ipAddress;
readonly IPAddress netMask;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -46,7 +46,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
workplaceTextBox.Text = config.Workplace;
connStrTextBox.Text = config.ConnStr;
checkPreviousRecordsCheckBox.Checked = config.CheckPreviousRecords;
saveTracingRecordsCheckBox.Checked = config.SaveTracingRecords;
@@ -102,7 +101,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public void Unlock()
{
nameTextBox.Enabled = true;
workplaceTextBox.Enabled = true;
connStrTextBox.Enabled = true;
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
@@ -126,7 +124,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
}
flags |= UpdateDifferent(ref config.Workplace, workplaceTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.ConnStr, connStrTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.CheckPreviousRecords, checkPreviousRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.SaveTracingRecords, saveTracingRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
@@ -34,8 +34,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.workplaceTextBox = new System.Windows.Forms.TextBox();
this.workplaceLabel = new System.Windows.Forms.Label();
this.connStrTextBox = new System.Windows.Forms.TextBox();
this.connStrLabel = new System.Windows.Forms.Label();
this.saveTracingRecordsCheckBox = new System.Windows.Forms.CheckBox();
@@ -47,7 +45,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 41);
this.nameTextBox.Location = new System.Drawing.Point(110, 51);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -55,7 +53,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(15, 44);
this.nameLabel.Location = new System.Drawing.Point(15, 54);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -64,33 +62,16 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 19);
this.classNameLabel.Location = new System.Drawing.Point(107, 26);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// workplaceTextBox
//
this.workplaceTextBox.Enabled = false;
this.workplaceTextBox.Location = new System.Drawing.Point(110, 67);
this.workplaceTextBox.Name = "workplaceTextBox";
this.workplaceTextBox.Size = new System.Drawing.Size(146, 20);
this.workplaceTextBox.TabIndex = 4;
//
// workplaceLabel
//
this.workplaceLabel.AutoSize = true;
this.workplaceLabel.Location = new System.Drawing.Point(15, 70);
this.workplaceLabel.Name = "workplaceLabel";
this.workplaceLabel.Size = new System.Drawing.Size(59, 13);
this.workplaceLabel.TabIndex = 3;
this.workplaceLabel.Text = "Workplace";
//
// connStrTextBox
//
this.connStrTextBox.Enabled = false;
this.connStrTextBox.Location = new System.Drawing.Point(110, 93);
this.connStrTextBox.Location = new System.Drawing.Point(110, 76);
this.connStrTextBox.Name = "connStrTextBox";
this.connStrTextBox.Size = new System.Drawing.Size(327, 20);
this.connStrTextBox.TabIndex = 6;
@@ -98,7 +79,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// connStrLabel
//
this.connStrLabel.AutoSize = true;
this.connStrLabel.Location = new System.Drawing.Point(15, 96);
this.connStrLabel.Location = new System.Drawing.Point(15, 79);
this.connStrLabel.Name = "connStrLabel";
this.connStrLabel.Size = new System.Drawing.Size(89, 13);
this.connStrLabel.TabIndex = 5;
@@ -108,7 +89,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.saveTracingRecordsCheckBox.AutoSize = true;
this.saveTracingRecordsCheckBox.Enabled = false;
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 177);
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 159);
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
this.saveTracingRecordsCheckBox.TabIndex = 10;
@@ -119,7 +100,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.checkPreviousRecordsCheckBox.AutoSize = true;
this.checkPreviousRecordsCheckBox.Enabled = false;
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 154);
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 136);
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
this.checkPreviousRecordsCheckBox.TabIndex = 9;
@@ -129,7 +110,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterLabel
//
this.netAdapterLabel.AutoSize = true;
this.netAdapterLabel.Location = new System.Drawing.Point(15, 122);
this.netAdapterLabel.Location = new System.Drawing.Point(15, 104);
this.netAdapterLabel.Name = "netAdapterLabel";
this.netAdapterLabel.Size = new System.Drawing.Size(86, 13);
this.netAdapterLabel.TabIndex = 7;
@@ -138,7 +119,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterComboBox
//
this.netAdapterComboBox.FormattingEnabled = true;
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 119);
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 101);
this.netAdapterComboBox.Name = "netAdapterComboBox";
this.netAdapterComboBox.Size = new System.Drawing.Size(327, 21);
this.netAdapterComboBox.TabIndex = 11;
@@ -153,8 +134,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.Controls.Add(this.checkPreviousRecordsCheckBox);
this.Controls.Add(this.connStrTextBox);
this.Controls.Add(this.connStrLabel);
this.Controls.Add(this.workplaceTextBox);
this.Controls.Add(this.workplaceLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
@@ -171,8 +150,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox workplaceTextBox;
private System.Windows.Forms.Label workplaceLabel;
private System.Windows.Forms.TextBox connStrTextBox;
private System.Windows.Forms.Label connStrLabel;
private System.Windows.Forms.CheckBox saveTracingRecordsCheckBox;
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// <param name="wmTypeId">Water meter type Id</param>
/// <param name="wmTypeRevision">Water meter type revision</param>
/// <returns>SensusTestInfos array</returns>
IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision)
public static IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision, out string wzTyp, out string metrolKlasse, out string zulasszeichen, out string materialNr, out double q3, out DateTime timeStamp, out string remark)
{
///
/// Read 'incomplete' TestInfo from Oracle database containing only flowId-s ad qBezeichnung-s
@@ -147,7 +147,15 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// For a given 'wmTypeId' find the most recent active 'wmTypeRevision'
///
wmTypeRevision = -1;
OracleCommand cmd = new OracleCommand("select REV_WZTYP from VT_WZTYP_SD where ANBID=4 and ID_WZTyp=:1 and AKTIV=:2", conn);
wzTyp = string.Empty;
metrolKlasse = string.Empty;
zulasszeichen = string.Empty;
materialNr = string.Empty;
q3 = 0;
timeStamp = DateTime.MinValue;
remark = string.Empty;
OracleCommand cmd = new OracleCommand("select REV_WZTYP, WZTYP, METROLKLASSE, ZULASSZEICHEN, MATERIALNR, QMAX, AENDERUNGSDATUM, BEMERKUNG from VT_WZTYP_SD where ANBID=4 and ID_WZTyp=:1 and AKTIV=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 }); ///:2
///
@@ -155,12 +163,19 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
while (dr.Read())
{
wmTypeRevision = dr.GetInt32(0);
wzTyp = dr.GetString(1);
metrolKlasse = dr.GetString(2);
zulasszeichen = dr.GetString(3);
materialNr = dr.GetString(4);
q3 = dr.GetDouble(5);
timeStamp = dr.GetDateTime(6);
remark = dr.GetString(7);
}
dr.Close();
if (wmTypeRevision == -1) return null; /// No 'wmTypeRevision' found
cmd = new OracleCommand("select PruefungsNr, PosFehlerKalt, QBezeichnung from VT_PRUEFPUNKT_SOLL_SD where ANBID=4 and ID_WZTyp=:1 and Rev_WZTyp=:2", conn);
cmd = new OracleCommand("select PRUEFUNGSNR, Q_SOLL, PRUEFZEIT, POSFEHLERKALT, NEGFEHLERKALT, PRUEFBEREICHMIN, PRUEFBEREICHMAX, QBEZEICHNUNG from VT_PRUEFPUNKT_SOLL_SD where ANBID=4 and ID_WZTyp=:1 and Rev_WZTyp=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision }); ///:2
///
@@ -168,9 +183,19 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
while (dr.Read())
{
int pruefungsNr = dr.GetInt32(0);
double errLimHi = dr.GetDouble(1);
string qBezeichnung = dr.GetString(2);
oraDbTinfos.Add(new SensusTestInfo(null, pruefungsNr, qBezeichnung, 0, null, 0, null, Range.Undefined));
double flow = Config.Units.ConvertFrom(Unit.lph, dr.GetDouble(1));
int testTime = dr.GetInt32(2);
double errLimHi = dr.GetDouble(3);
double errLimLo = dr.GetDouble(4);
int flowRangeMin = dr.GetInt32(5);
int flowRangeMax = dr.GetInt32(6);
string qBezeichnung = dr.GetString(7);
Range rng = (flowRangeMin == 90 && flowRangeMax == 100) ? Range.R90_100 :
((flowRangeMin == 95 && flowRangeMax == 105) ? Range.R95_105 :
((flowRangeMin == 100 && flowRangeMax == 110) ? Range.R100_110 : Range.Undefined));
oraDbTinfos.Add(new SensusTestInfo(pruefungsNr, qBezeichnung, flow, testTime, errLimLo, errLimHi, rng));
}
dr.Close();
@@ -356,7 +381,14 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// Currnet test info. is not walid => Get a new one from Oracle and SensusTestInfo table
///
int wmTR;
IList<SensusTestInfo> rti = GetOracleTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR);
string wzTypStr;
string metroKlasse;
string zulasszeichen;
string materialNr;
double q3 = 0;
DateTime timeStamp;
string remark;
IList<SensusTestInfo> rti = GetOracleTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
if (rti != null)
{
@@ -629,8 +661,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
int MAX_Pruefindex = 100 * dbCfg.TestBenchId + maxpruefindexLowPart + 1;
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
int Hydr_Pruefung;
if (wm.Passed)
@@ -721,7 +754,14 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if ((oracleTestInfo == null) || (wmTypeId != b.WaterMeters[0].WaterMeterData.WMTypeId) || (wmTypeRevision == 0) || (procedureSignature != procedureSignatureSB.ToString()))
{
int wmTR = 0;
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR);
string wzTypStr;
string metroKlasse;
string zulasszeichen;
string materialNr;
double q3 = 0;
DateTime timeStamp;
string remark;
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
if (ti != null)
{
@@ -34,7 +34,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }
public int TestBenchId;
public DBUsed DBUsed;
public int Baujahr; /// Written to the database
public bool ReadStartInfo;
@@ -48,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
Name = "Sensus-Oracle-DB";
ParentName = string.Empty;
TestBenchId = 1;
DBUsed = DBUsed.Test;
Baujahr = 2015;
ReadStartInfo = true;
@@ -65,9 +63,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, BenchId={1}, DB={2}, Bjahr={3}, RdStartInfo={4}, SaveRslts={5}, StartInfoRqrd={6}, TestMode={7}",
return string.Format("Name={0}, DB={1}, Bjahr={2}, RdStartInfo={3}, SaveRslts={4}, StartInfoRqrd={5}, TestMode={6}",
Name,
TestBenchId,
DBUsed,
Baujahr,
ReadStartInfo,
@@ -47,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
benchIdTextBox.Text = config.TestBenchId.ToString();
dbUsedComboBox.Text = config.DBUsed.ToString();
baujahrTextBox.Text = config.Baujahr.ToString();
readStartInfoCheckBox.Checked = config.ReadStartInfo;
@@ -59,7 +58,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public void Unlock()
{
nameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
dbUsedComboBox.Enabled = true;
baujahrTextBox.Enabled = true;
readStartInfoCheckBox.Enabled = true;
@@ -72,13 +70,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int tmp;
if (!int.TryParse(benchIdTextBox.Text, out tmp) || tmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Test bench ID'";
}
int tmp;
if (!int.TryParse(baujahrTextBox.Text, out tmp) || tmp < 2015 || tmp > 2099)
{
flags |= CfgUpdateFlags.Error;
@@ -105,13 +97,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
flags |= CfgUpdateFlags.RestartRqrd;
}
int benchId = int.Parse(benchIdTextBox.Text);
if (config.TestBenchId != benchId)
{
config.TestBenchId = benchId;
flags |= CfgUpdateFlags.RestartRqrd;
}
int baujahr = int.Parse(baujahrTextBox.Text);
if (config.Baujahr != baujahr)
{
@@ -36,8 +36,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.classNameLabel = new System.Windows.Forms.Label();
this.readStartInfoCheckBox = new System.Windows.Forms.CheckBox();
this.saveResultsCheckBox = new System.Windows.Forms.CheckBox();
this.benchIdTextBox = new System.Windows.Forms.TextBox();
this.benchIdLabel = new System.Windows.Forms.Label();
this.dbUsedComboBox = new System.Windows.Forms.ComboBox();
this.dbUsedLabel = new System.Windows.Forms.Label();
this.baujahrTextBox = new System.Windows.Forms.TextBox();
@@ -49,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
this.nameTextBox.Location = new System.Drawing.Point(110, 55);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -57,7 +55,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 33);
this.nameLabel.Location = new System.Drawing.Point(19, 58);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -66,7 +64,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 8);
this.classNameLabel.Location = new System.Drawing.Point(107, 27);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
@@ -94,28 +92,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.saveResultsCheckBox.Text = "Save results";
this.saveResultsCheckBox.UseVisualStyleBackColor = true;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(110, 53);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
this.benchIdTextBox.TabIndex = 4;
//
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(19, 56);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(76, 13);
this.benchIdLabel.TabIndex = 3;
this.benchIdLabel.Text = "Test Bench ID";
//
// dbUsedComboBox
//
this.dbUsedComboBox.Enabled = false;
this.dbUsedComboBox.FormattingEnabled = true;
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 76);
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 79);
this.dbUsedComboBox.Name = "dbUsedComboBox";
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
this.dbUsedComboBox.TabIndex = 6;
@@ -123,7 +104,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// dbUsedLabel
//
this.dbUsedLabel.AutoSize = true;
this.dbUsedLabel.Location = new System.Drawing.Point(19, 78);
this.dbUsedLabel.Location = new System.Drawing.Point(19, 81);
this.dbUsedLabel.Name = "dbUsedLabel";
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
this.dbUsedLabel.TabIndex = 5;
@@ -132,7 +113,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrTextBox
//
this.baujahrTextBox.Enabled = false;
this.baujahrTextBox.Location = new System.Drawing.Point(110, 100);
this.baujahrTextBox.Location = new System.Drawing.Point(110, 104);
this.baujahrTextBox.Name = "baujahrTextBox";
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
this.baujahrTextBox.TabIndex = 8;
@@ -140,7 +121,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrLabel
//
this.baujahrLabel.AutoSize = true;
this.baujahrLabel.Location = new System.Drawing.Point(19, 103);
this.baujahrLabel.Location = new System.Drawing.Point(19, 107);
this.baujahrLabel.Name = "baujahrLabel";
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
this.baujahrLabel.TabIndex = 7;
@@ -178,8 +159,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.Controls.Add(this.baujahrLabel);
this.Controls.Add(this.dbUsedComboBox);
this.Controls.Add(this.dbUsedLabel);
this.Controls.Add(this.benchIdTextBox);
this.Controls.Add(this.benchIdLabel);
this.Controls.Add(this.saveResultsCheckBox);
this.Controls.Add(this.readStartInfoCheckBox);
this.Controls.Add(this.nameTextBox);
@@ -200,8 +179,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox readStartInfoCheckBox;
private System.Windows.Forms.CheckBox saveResultsCheckBox;
private System.Windows.Forms.TextBox benchIdTextBox;
private System.Windows.Forms.Label benchIdLabel;
private System.Windows.Forms.ComboBox dbUsedComboBox;
private System.Windows.Forms.Label dbUsedLabel;
private System.Windows.Forms.TextBox baujahrTextBox;
+31
View File
@@ -49,6 +49,13 @@ namespace TBF.BenchControl.Output
public string QBezeichnungLog; /// Flow name in Oracle database
public Range Range; /// Range.R90_100 or Range.R100_110 (flow range in % of a target flow)
public double Flow;
public int TestTime;
public double ErrLimLoFromDB;
public double ErrLimHiFromDB;
public double Uncertainty;
public string TestMethod;
public SensusTestInfo(string tstName, int pnDB, string qbDB, int pnOpto, string qbOpto, int pnLog, string qbLog, Range range)
{
TestName = tstName;
@@ -59,6 +66,30 @@ namespace TBF.BenchControl.Output
PruefungsNrLog = pnLog;
QBezeichnungLog = qbLog;
Range = range;
Flow = 0;
TestTime = 0;
ErrLimLoFromDB = 0;
ErrLimHiFromDB = 0;
Uncertainty = 0;
TestMethod = string.Empty;
}
public SensusTestInfo(int pnDB, string qbDB, double flow, int testTime, double errLimLo, double errLimHi, Range range)
{
TestName = null;
PruefungsNrDB = pnDB;
QBezeichnungDB = qbDB;
PruefungsNrOpto = 0;
QBezeichnungOpto = null;
PruefungsNrLog = 0;
QBezeichnungLog = null;
Range = range;
Flow = flow;
TestTime = testTime;
ErrLimLoFromDB = errLimLo;
ErrLimHiFromDB = errLimHi;
Uncertainty = 0;
TestMethod = string.Empty;
}
/// <summary>
+100 -33
View File
@@ -488,7 +488,10 @@ namespace TBF.BenchControl.Sequences
Debug.WriteLine(string.Format("Procedure {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("Procedure.MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.MoreParams) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("Procedure.Tests {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("Procedure.Tests[0].MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests[0].MoreParams) ? "initialized" : "NOT initialized"));
if (StateMachine.Procedure.Tests.Count > 0)
{
Debug.WriteLine(string.Format("Procedure.Tests[0].MoreParams {0}", NHibernateUtil.IsInitialized(StateMachine.Procedure.Tests[0].MoreParams) ? "initialized" : "NOT initialized"));
}
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
@@ -520,10 +523,26 @@ namespace TBF.BenchControl.Sequences
for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
{
WaterMeter wm = BatchRslts.WaterMeters[i];
if (wm != null && wm.Passed)
if (wm != null)
{
/// Water meter passed and was already saved to Oracle, do not reload & fix it now
wm.Disabled = true;
if (wm.Passed)
{
/// Water meter passed and was already saved to Oracle, do not reload & fix it now
wm.Disabled = true;
}
else if (!wm.Disabled && Users.GlobalData.GetCurrentUserName() == "milan")
{
/// Water meter not passed and not disabled and user is 'milan' => reset flag E28
wm.ErrorFlags = wm.ErrorFlags & (~(int)ErrorFlagMask.E28);
foreach (var mtr in wm.MeterTestRslts)
{
if (mtr.TestData().Evaluate && (mtr.TestData().Name == "Kontrola montaze") && (mtr.TestData().Method == "iPerlCommunication"))
{
mtr.TestDone = true;
mtr.Passed = true;
}
}
}
}
}
}
@@ -694,7 +713,7 @@ namespace TBF.BenchControl.Sequences
log.ErrorFormat("StartInfoReader failed to read data from the database");
/// TODO: Message for an operator? Error?
}
else if (selection == Selection.RestoreAndFixBatch)
else if ((selection == Selection.RestoreAndFixBatch) && (Users.GlobalData.GetCurrentUserName() != "milan"))
{
/// Restore and fix a batch - part 2
for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
@@ -800,9 +819,9 @@ namespace TBF.BenchControl.Sequences
{
//--------------------------------
State.Create("MainSeq : Continue in the cycle?")
.AddOperation(new Operations.AskYesNoOp(Strings.Continue_in_the_cycle))
.AddOperation(checkUiOp)
.EnterState();
.AddOperation(new Operations.AskYesNoOp(Strings.Continue_in_the_cycle))
.AddOperation(checkUiOp)
.EnterState();
while (true)
{
e = StateMachine.WaitRunDevsRunOps();
@@ -829,23 +848,14 @@ namespace TBF.BenchControl.Sequences
///
if (selection == Selection.RestOfCycle) /// ... otherwise
{
Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
if (slctdTest == null)
Test slctdTest = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out selsctedTestIx, out repetNr);
if (slctdTest == null || (selsctedTestIx < simultWithPurgingCount)
|| (selsctedTestIx >= StateMachine.Tests.Count - simultWithEvacuationCount))
{
/// Invalid test selection
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
goto select_cycle_or_test;
}
selsctedTestIx = -1;
for (int i = simultWithPurgingCount; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
{
if (slctdTest == StateMachine.Tests[i])
{
selsctedTestIx = i;
break;
}
}
if (selsctedTestIx == -1) goto select_cycle_or_test; /// goto ... when selection is not valid
}
@@ -859,8 +869,8 @@ namespace TBF.BenchControl.Sequences
/// Try to fetch all test paths and transitions
/// to detect configuration errors as early as possible.
string errorMsg;
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
string errorMsg;
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
@@ -880,15 +890,65 @@ namespace TBF.BenchControl.Sequences
int outerLoopRepeats = 0;
while (currentTestIx < StateMachine.Tests.Count - simultWithEvacuationCount)
{
Test test = StateMachine.Tests[currentTestIx];
Test nextTest = (currentTestIx + 1 < StateMachine.Tests.Count - simultWithEvacuationCount)
? StateMachine.Tests[currentTestIx + 1]
: null;
/// Fetch the test paths and transitions
string errorMsg;
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
Test nextHydroTest = null;
for (int i = currentTestIx + 1; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
{
Test tst = StateMachine.Tests[i];
if (tst != null)
{
ITestMethod tm = TbfComponents.FindComponent(tst.Method) as ITestMethod;
if (tm != null && tm.DoTransitions())
{
nextHydroTest = tst;
break;
}
}
}
if (nextHydroTest != null)
{
/// Fetch paths and 'transition before' of the next test
TBF.BenchControl.Generic.IComponent nextTestMethodComp = TbfComponents.FindComponent(nextHydroTest.Method);
TransitionSequence dummy2, dummy3;
string errorMsg2;
if (!(nextTestMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(nextTestMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(nextHydroTest, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
out nextInPath, out nextBenchPath, out nextOutPath, out nextSensPath,
out nextHeatMetersPath,
out nextTransitionBefore, out dummy2, out dummy3,
out errorMsg2))
{
UiBridge.Bridge.OnError(this, errorMsg2);
goto select_cycle_or_test;
}
nextQfrom = nextHydroTest.Qfrom;
nextQto = nextHydroTest.Qto;
nextPumpPower = nextHydroTest.PumpPower;
nextTolerRed = nextHydroTest.TolerRed;
nextPidCoef = (nextOutPath != null) ? nextOutPath.PidCoef : 1.0F;
}
else
{
/// Clear paths and 'transition before' of the next test it does not exist
nextInPath = null;
nextBenchPath = null;
nextOutPath = null;
nextSensPath = null;
nextHeatMetersPath = null;
nextTransitionBefore = null;
}
/// Fetch paths and transitions of this test
Test test = StateMachine.Tests[currentTestIx];
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
string errorMsg;
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
out inPath, out benchPath, out outPath, out sensPath,
@@ -901,9 +961,12 @@ namespace TBF.BenchControl.Sequences
}
/// Update format for the water mass
Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Scale.Format;
if (outPath != null && outPath.Scale != null && !string.IsNullOrEmpty(outPath.Scale.Format))
{
Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Scale.Format;
}
ITestMethod testMethod = testMethodComp as ITestMethod;
@@ -989,7 +1052,10 @@ namespace TBF.BenchControl.Sequences
if (testMethod.DoTransitions() && !e.Contains(Event.RecoverableError))
{
/// Make a transition after the last test repetition
TransitionContext endContext = currentTestFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
TransitionContext endContext =
!currentTestFinished ? TransitionContext.Stop
: ((nextTransitionBefore != null) && (nextTransitionBefore.Name.ToLower().Contains("fastflow"))) ? TransitionContext.AfterTestWithOverlap
: TransitionContext.AfterTest;
rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", test.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
}
@@ -1097,7 +1163,8 @@ namespace TBF.BenchControl.Sequences
/// Single test will be executed
int repetNr;
Test test = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
int testIx;
Test test = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out testIx, out repetNr);
if (test == null)
{
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
+195 -18
View File
@@ -68,6 +68,21 @@ namespace TBF.BenchControl.Sequences
protected static TransitionSequence transitionBetween;
protected static TransitionSequence transitionAfter;
/// <summary>
/// Advanced information about the next test
/// </summary>
protected static BenchControl.FeedingPath nextInPath;
protected static BenchControl.BenchPath nextBenchPath;
protected static BenchControl.OutputPath nextOutPath;
protected static BenchControl.MetersPath nextSensPath;
protected static BenchControl.HeatMetersPath nextHeatMetersPath;
protected static TransitionSequence nextTransitionBefore;
protected static float nextQfrom;
protected static float nextQto;
protected static float nextPumpPower;
protected static float nextPidCoef;
protected static double nextTolerRed;
protected IOperation readRegistersOp;
protected IOperation queryEnd1;
@@ -439,10 +454,11 @@ namespace TBF.BenchControl.Sequences
public enum TransitionContext
{
PurgeBegin,
BeforeTest,
BetweenTests,
AfterTest,
PurgeEnd,
BeforeTest, /// Before starting a test, paths are always applied aftr this sequence
BetweenTests, /// Between two repetitions of the same test
AfterTest, /// After completing a test
AfterTestWithOverlap, /// After completing transition sequence paths of the next test are selected and flow setting starts
PurgeEnd,
Stop,
}
@@ -482,7 +498,12 @@ namespace TBF.BenchControl.Sequences
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
case TransitionContext.BeforeTest: message = Strings.Test_start_sequence_i_n; break;
case TransitionContext.BetweenTests: message = Strings.Between_tests_sequence_i_n; break;
case TransitionContext.AfterTest: message = Strings.Test_stop_sequence_i_n; break;
case TransitionContext.AfterTestWithOverlap:
case TransitionContext.AfterTest:
message = Strings.Test_stop_sequence_i_n;
break;
case TransitionContext.PurgeEnd: message = Strings.Emptying_i_n; break;
case TransitionContext.Stop: message = Strings.Test_stop_sequence_i_n; break;
default: message = "Transition"; break;
@@ -495,7 +516,7 @@ namespace TBF.BenchControl.Sequences
///
/// No transition sequence defined --> Default action
///
if (context == TransitionContext.AfterTest)
if ((context == TransitionContext.AfterTest) || (context == TransitionContext.AfterTestWithOverlap))
{
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
@@ -680,7 +701,8 @@ namespace TBF.BenchControl.Sequences
for (int first = 1; first <= lastStartedRV; first++)
{
log.DebugFormat("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose);
State stepStop = State.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
State stepStop = State
.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
.AddOperation(checkUiOp)
.AddOperation(conditionOperation)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
@@ -717,11 +739,10 @@ namespace TBF.BenchControl.Sequences
/// Stop the pump
///
State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
.EnterState();
do
{
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
}
@@ -730,17 +751,19 @@ namespace TBF.BenchControl.Sequences
}
else if (context == TransitionContext.BeforeTest)
{
if (inPath != null && benchPath != null && outPath != null)
///
/// Always set route at the beginning of this test
///
if (inPath != null && benchPath != null && outPath != null)
{
State.Create("SequenceBase : Transition : TestStart - Default action")
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
@@ -748,8 +771,54 @@ namespace TBF.BenchControl.Sequences
while (e.Contains(Event.ValvesBusy));
}
}
else if ((context == TransitionContext.AfterTestWithOverlap) && (nextInPath != null) && (nextBenchPath != null) && (nextOutPath != null))
{
/// Set route for the next test
State.Create("SequenceBase : AfterTestWithOverlap : Default action")
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard
.SetValvesOp(GenericDevices.ValveBase.Merge(nextInPath.ValvesOpen, nextBenchPath.ValvesOpen, nextOutPath.ValvesOpen),
GenericDevices.ValveBase.Merge(nextInPath.ValvesClose, nextBenchPath.ValvesClose, nextOutPath.ValvesClose)))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (e.Contains(Event.ValvesBusy));
/// Set PID coefficient, etc.
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
StateMachine.ControlBoard.SetFiltersPidShortPulses(filters, nextPidCoef, (nextTolerRed == 0) ? 0 : 1);
/// Set pump power
if (nextInPath.Pump is GenericDevices.IPumpFM) (nextInPath.Pump as GenericDevices.IPumpFM).TurnOn(nextPumpPower);
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
/// Set flow for the next test
State.Create(string.Format("SequenceBase : AfterTestWithOverlap - Setting the flow to {0} - {1} m3/h", nextQfrom, nextQto))
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(nextOutPath.RegulValve.SetFlowAndMeasureOp(nextOutPath.FlowMeter, nextQfrom, nextQto, RefFlow, FlowSettingTimeoutSec, 0))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.OpArgumentError)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.RegulValveTimeOut))
{
Bridge.OnError(this, Strings.Flow_adjustment_failed);
return Event.UiCmdStop;
}
}
while (!e.Contains(Event.Busy) && !e.Contains(Event.FlowReached));
}
if (errorFlag)
return Event.Error;
else if (stopFlag)
@@ -866,6 +935,114 @@ namespace TBF.BenchControl.Sequences
}
protected Event SetFlowEtc(Test test, IFlowMeter flowMeter, IRegulValve regulValve, IValve pump, IValve stopBFValve, IList<IOperation> extraOperations, bool doNotWait)
{
IList<Event> e;
Event retVal = Event.Done;
if (pump is GenericDevices.IPumpFM) (pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(extraOperations)
.AddOperation(pump != null ? StateMachine.ControlBoard.SetValvesOp(pump, null) : null)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.Error)) return Event.Error;
}
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
if (test.TimePump2StartV > 0)
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (!e.Contains(Event.TimerExpired));
}
if (stopBFValve != null)
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(stopBFValve, null))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.Error)) return Event.Error;
}
while (!e.Contains(Event.ValvesSet));
}
if (test.TimeBeforeFlow > 0)
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (!e.Contains(Event.TimerExpired));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(doNotWait ? regulValve.SetFlowAndMeasureOp(flowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec, 0)
: regulValve.SetFlowOp(flowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.OpArgumentError)) return Event.OpArgumentError;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.RegulValveTimeOut))
{
Bridge.OnError(this, Strings.Flow_adjustment_failed);
return Event.RecoverableError;
}
if (e.Contains(Event.Next)) return Event.Done;
}
while (!(e.Contains(Event.FlowReached) || (doNotWait && e.Contains(Event.Busy)))); /// Stay in the loop while e.Contains(Event.Starting)
return retVal;
}
/// <summary>
/// Main loop where measurements are collected.
/// </summary>
@@ -1638,7 +1815,7 @@ namespace TBF.BenchControl.Sequences
/// <summary>
/// Returns true and makes a log when 'e' contains Event.UiCmdStop
/// </summary>
/// <param name="test"></param>
/// <param name="test">test or null (only for logs)</param>
/// <param name="e"></param>
/// <returns></returns>
protected bool TestAndLogUiCmdStop(Test test, IList<Event> e)
+8 -30
View File
@@ -575,31 +575,6 @@ namespace TBF.BenchControl
}
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public static Config.Entities.Test GetTest(string selectedTestName, out int repetNr)
{
repetNr = 1;
foreach (var test in Tests)
{
if (test.Name.Equals(selectedTestName)) return test; /// Test name specified, keep repetNr = 1
for (int i = 1; i <= test.Repeats; i++)
{
if (Utils.TestTitle(test, i).Equals(selectedTestName))
{
repetNr = i;
return test;
}
}
}
return null;
}
/// <summary>
/// Called from the sequence to update paths based on the selected test
/// </summary>
@@ -624,6 +599,9 @@ namespace TBF.BenchControl
out TransitionSequence transitionAfter,
out string errorMsg)
{
ITestMethod tm = TbfComponents.FindComponent(test.Method) as ITestMethod;
bool isHydroTest = (tm != null) ? tm.DoTransitions() : false;
pfeed = null;
pben = null;
pout = null;
@@ -649,12 +627,12 @@ namespace TBF.BenchControl
pmtrs = GetMetersPath(test);
if (pfeed == null) errorMsg = Strings.Cannot_load_feeding_path;
else if (pben == null) errorMsg = Strings.Cannot_load_bench_path;
else if (pout == null) errorMsg = Strings.Cannot_load_output_path;
if (isHydroTest && (pfeed == null)) errorMsg = Strings.Cannot_load_feeding_path;
else if (isHydroTest && (pben == null)) errorMsg = Strings.Cannot_load_bench_path;
else if (isHydroTest && (pout == null)) errorMsg = Strings.Cannot_load_output_path;
else if (pmtrs == null) errorMsg = Strings.Cannot_load_sensor_path;
else errorMsg = string.Empty;
if ((pfeed == null) || (pben == null) || (pout == null) || (pmtrs == null))
if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null))
{
return false;
}
@@ -678,7 +656,7 @@ namespace TBF.BenchControl
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
}
if (pout.Scale == null)
if (isHydroTest && pout.Scale == null)
{
errorMsg = string.Format("No balance specified in path {0}", test.OutputPath);
return false;
+1
View File
@@ -56,6 +56,7 @@ namespace TBF.BenchControl
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
Factories.Add(new TestMethods.Counter.Factory());
Factories.Add(new TestMethods.DiverterTest.Factory());
Factories.Add(new TestMethods.Dummy.Factory());
Factories.Add(new TestMethods.Endurance.Factory());
Factories.Add(new TestMethods.FixedStart.Single.Factory());
Factories.Add(new TestMethods.FixedStart.Compound.Factory());
@@ -0,0 +1,64 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class DummySeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(DummySeq));
/// <summary>
/// Adjustment method sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode)
{
IList<Event> e = new List<Event>(); /// Events from currently running operations
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
///
/// Show a dialog with OK button and an appropriate message
///
Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnActivity(this, test.Method);
State.Create(string.Format("{0}({1}) : Dummy", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.BenchWaitingOp)
.AddOperation(new Operations.MessageBoxOp(string.Format("Dummy test {0}", test.Name)))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
if (e.Contains(Event.Error)) goto stopTest;
if (TestAndLogUiCmdStop(test, e)) goto stopTest;
}
while (!e.Contains(Event.OK));
return new List<Event> { Event.Done };
stopTest:
return new List<Event> { Event.UiCmdStop };
}
}
}
@@ -0,0 +1,30 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponent DummyComponent() { return new TestMethod(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TestMethod(cfg); }
public IComponentCfg DefaultConfig()
{
return new TestMethodCfg(this.GetType().Namespace.Substring(29), this);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,35 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
namespace TBF.BenchControl.TestMethods.Dummy
{
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.Dummy({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
public TestMethod()
{
}
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Debug(this.ToString());
}
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new DummySeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
}
}
}
@@ -693,11 +693,19 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
UpdateRfidCommResult(tests); /// TODO: Pass the test info in a correct way
}
long checkboxStates = GetCheckBoxStates();
if (Program.LocalSettings.iPerlCommunicationsFormLeft != Location.X ||
Program.LocalSettings.iPerlCommunicationsFormTop != Location.Y ||
Program.LocalSettings.iPerlCommunicationsFormCheckboxes != checkboxStates)
{
/// Update local settings
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = checkboxStates;
Program.LocalSettings.Save();
}
formCompleted = true;
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = GetCheckBoxStates();
Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
Close();
Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB

+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1314.0")]
[assembly: AssemblyFileVersion("2.18.1314.0")]
[assembly: AssemblyVersion("2.18.1350.0")]
[assembly: AssemblyFileVersion("2.18.1350.0")]
+18
View File
@@ -1338,6 +1338,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Do you want to update &apos;Use wizard&apos; tests ?.
/// </summary>
internal static string Do_you_want_to_update_tests_QM {
get {
return ResourceManager.GetString("Do_you_want_to_update_tests_QM", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Down.
/// </summary>
@@ -5553,6 +5562,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Update.
/// </summary>
internal static string Update {
get {
return ResourceManager.GetString("Update", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use {0}.
/// </summary>
+6
View File
@@ -1488,4 +1488,10 @@
<data name="Program_must_be_closed" xml:space="preserve">
<value>Program musí být uzavřen.</value>
</data>
<data name="Do_you_want_to_update_tests_QM" xml:space="preserve">
<value>Chcete modifikovat 'Use wizard' testy ?</value>
</data>
<data name="Update" xml:space="preserve">
<value>Modifikovat</value>
</data>
</root>
+6
View File
@@ -2062,4 +2062,10 @@
<data name="No_info_available" xml:space="preserve">
<value>No info available</value>
</data>
<data name="Do_you_want_to_update_tests_QM" xml:space="preserve">
<value>Do you want to update 'Use wizard' tests ?</value>
</data>
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
</root>
+71 -14
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -49,7 +49,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,7 +67,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,8 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\iPerlST\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -572,6 +572,7 @@
<Compile Include="BenchControl\Elde\RegulValveCoax\Factory.cs" />
<Compile Include="BenchControl\Elde\RegulValveCoax\SetFlowOp.cs" />
<Compile Include="BenchControl\Elde\RegulValveCoax\SetRegulValvePositionOp.cs" />
<Compile Include="BenchControl\Elde\SendCommandArgs.cs" />
<Compile Include="BenchControl\Elde\SetValvesOp.cs" />
<Compile Include="BenchControl\Elde\StopFlowRegulationOp.cs" />
<Compile Include="BenchControl\Elde\TempMeterInternal\ReadTempOp.cs" />
@@ -1120,6 +1121,9 @@
<Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\Dummy\DummySeq.cs" />
<Compile Include="BenchControl\TestMethods\Dummy\Factory.cs" />
<Compile Include="BenchControl\TestMethods\Dummy\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" />
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
@@ -2164,36 +2168,64 @@
<Compile Include="UI\Procedures\TestParamsCtrl.designer.cs">
<DependentUpon>TestParamsCtrl.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.Designer.cs">
<DependentUpon>ConfirmUpdatingTests.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\FlowSelection.designer.cs">
<DependentUpon>FlowSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\HeatMetersSelection.designer.cs">
<DependentUpon>HeatMetersSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\MethodSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\MethodSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\MethodSelection.designer.cs">
<DependentUpon>MethodSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\OracleWZTypSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\OracleWZTypSelection.designer.cs">
<DependentUpon>OracleWZTypSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\PressureSelection.designer.cs">
<DependentUpon>PressureSelection.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi1.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi1.designer.cs">
<DependentUpon>Roi1.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi2.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi2.designer.cs">
<DependentUpon>Roi2.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi3.cs" />
<Compile Include="UI\Procedures\TestWizard\Roi3.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\Roi3.designer.cs">
<DependentUpon>Roi3.cs</DependentUpon>
</Compile>
<Compile Include="UI\Procedures\TestWizard\RoiData.cs" />
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.cs" />
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Procedures\TestWizard\VolumeAndErrorSelection.designer.cs">
<DependentUpon>VolumeAndErrorSelection.cs</DependentUpon>
</Compile>
@@ -3087,6 +3119,9 @@
<EmbeddedResource Include="UI\Procedures\TestParamsCtrl.resx">
<DependentUpon>TestParamsCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\ConfirmUpdatingTests.resx">
<DependentUpon>ConfirmUpdatingTests.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\FlowSelection.resx">
<DependentUpon>FlowSelection.cs</DependentUpon>
</EmbeddedResource>
@@ -3096,6 +3131,9 @@
<EmbeddedResource Include="UI\Procedures\TestWizard\MethodSelection.resx">
<DependentUpon>MethodSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\OracleWZTypSelection.resx">
<DependentUpon>OracleWZTypSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Procedures\TestWizard\PressureSelection.resx">
<DependentUpon>PressureSelection.cs</DependentUpon>
</EmbeddedResource>
@@ -3268,6 +3306,24 @@
<None Include="Resources\RoiStyle1.bmp" />
<None Include="Resources\RoiStyle2.bmp" />
<None Include="Resources\RoiStyle3.bmp" />
<Content Include="libgcc_s_dw2-1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid2.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid3.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid4.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libstdc++-6.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Pictures\forward_dir_left.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -3280,6 +3336,7 @@
<Content Include="Pictures\reversed_dir_right.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Pictures\sample.bmp" />
<Content Include="Resources\empty.png" />
<Content Include="Resources\switch-off.png" />
<Content Include="Resources\switch-on.png" />
+2 -2
View File
@@ -54,9 +54,9 @@ namespace TBF.UI
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl48();
this.insertTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPageCtrl = new TBF.UI.Results.ResultsTabPageCtrl();
+303 -43
View File
@@ -13,6 +13,8 @@ using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
using TBF.BenchControl.Output;
using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.UI.Procedures
{
@@ -63,15 +65,23 @@ namespace TBF.UI.Procedures
InitializeComponent();
/// SharedDlgButtons configuration
#if KEMPNO_50
/// SharedDlgButtons configuration
#if KEMPNO_50 || KRAKOW_50
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
#else
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
#endif
#if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
sharedButtons.Unlocked += Unlocked;
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |SharedButtons.Buttons.Custom1;
sharedButtons.Custom1Caption = string.Format("Načítaj testy{0}iPerl z Oracle", Environment.NewLine);
sharedButtons.Custom1Clicked += iPerlWizardButton_Click;
#else
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
#endif
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click;
@@ -108,17 +118,19 @@ namespace TBF.UI.Procedures
this.usedNames = usedNames;
this.openUnlocked = openUnlocked;
#if KEMPNO_50
#if KEMPNO_50 || KRAKOW_50
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority }
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
#else
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
#endif
/// Prepare a list of components and a list of all valves in the test bench
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
{
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session);
///
/// Prepare a list of components and a list of all valves in the test bench
///
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session);
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);
RegulValves = new List<IRegulValve>();
TestMethods = new List<ITestMethod>();
@@ -129,6 +141,7 @@ namespace TBF.UI.Procedures
fileWriter2ComboBox.Items.Add("---");
fileWriter3ComboBox.Items.Add("---");
fileWriter4ComboBox.Items.Add("---");
foreach (var cmpnt in TbfComponents)
{
if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve);
@@ -147,12 +160,11 @@ namespace TBF.UI.Procedures
fileWriter4ComboBox.Items.Add(cmpnt.Cfg.Name);
}
}
}
/// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
{
feedingPaths = session.QueryOver<FeedingPath>().List();
///
/// Loads paths, this must be done before PrepareMetrology12AndProcessTabs() call
///
feedingPaths = session.QueryOver<FeedingPath>().List();
benchPaths = session.QueryOver<BenchPath>().List();
outputPaths = session.QueryOver<OutputPath>().List();
metersPaths = session.QueryOver<MetersPath>().List();
@@ -316,11 +328,11 @@ namespace TBF.UI.Procedures
LoadUISettings();
/// Enable/disable/show/hide controls in General tab
#if IPERL
#if KEMPNO_50 || KRAKOW_50
altProcNameLabel.Visible = true;
altProcNameTextBox.Visible = true;
altProcPeriodLabel.Visible = true;
altProcPeriodTextBox.Visible = true;
//altProcPeriodLabel.Visible = true;
//altProcPeriodTextBox.Visible = true;
#endif
procNameTextBox.Enabled = false;
descriptionTextBox.Enabled = false;
@@ -404,6 +416,7 @@ namespace TBF.UI.Procedures
label15.Text = Strings.Date;
label18.Text = Strings.Notes;
watermetersLabel.Text = Strings.Meter_types_tested;
altProcNameLabel.Text = Strings.Conditions;
protectedCheckBox.Text = Strings.Protected_procedure;
mustBeCompleteCheckBox.Text = Strings.All_tests_must_be_completed;
manualControlDisabledCheckBox.Text = Strings.Manual_control_disabled;
@@ -1237,22 +1250,46 @@ namespace TBF.UI.Procedures
void AddToProcessTab(Test test)
{
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
///
/// Process item with subitems
///
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
if (tm != null && tm.DoTransitions())
{
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
}
else
{
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
}
lvi.SubItems.Add(test.MetersPath);
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
if (tm != null && tm.DoTransitions())
{
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
}
else
{
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
}
processListViewEx.Items.Add(lvi);
}
@@ -1277,21 +1314,32 @@ namespace TBF.UI.Procedures
entity.Part = part;
}
if ((processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Feeding].Text))
int column = (int)ProcessClmn.Feeding;
string subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.FeedingPath = lvi.SubItems[(int)ProcessClmn.Feeding].Text;
entity.FeedingPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Bench].Text))
column = (int)ProcessClmn.Bench;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.BenchPath = lvi.SubItems[(int)ProcessClmn.Bench].Text;
entity.BenchPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Output].Text))
column = (int)ProcessClmn.Output;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.OutputPath = lvi.SubItems[(int)ProcessClmn.Output].Text;
entity.OutputPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Sensor].Text))
column = (int)ProcessClmn.Sensor;
subItemText = lvi.SubItems[column].Text;
if ((processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.MetersPath = lvi.SubItems[(int)ProcessClmn.Sensor].Text;
entity.MetersPath = subItemText;
}
#if HEAT_METERS
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
@@ -1299,17 +1347,25 @@ namespace TBF.UI.Procedures
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
}
#endif
if ((processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStart].Text))
column = (int)ProcessClmn.TrnStart;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBefore = lvi.SubItems[(int)ProcessClmn.TrnStart].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStart].Text;
entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
if ((processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnBetween].Text))
column = (int)ProcessClmn.TrnBetween;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBetween = lvi.SubItems[(int)ProcessClmn.TrnBetween].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnBetween].Text;
entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
if ((processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStop].Text))
column = (int)ProcessClmn.TrnStop;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.TransitionAfter = lvi.SubItems[(int)ProcessClmn.TrnStop].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStop].Text;
entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
}
}
@@ -1321,6 +1377,18 @@ namespace TBF.UI.Procedures
return;
}
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
if (tm != null && (tm.DoTransitions() == false) && ((e.SubItem == (int)ProcessClmn.Feeding) ||
(e.SubItem == (int)ProcessClmn.Bench) ||
(e.SubItem == (int)ProcessClmn.Output) ||
(e.SubItem == (int)ProcessClmn.TrnStart) ||
(e.SubItem == (int)ProcessClmn.TrnBetween) ||
(e.SubItem == (int)ProcessClmn.TrnStop)))
{
return;
}
processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem);
}
@@ -1951,15 +2019,13 @@ namespace TBF.UI.Procedures
private void addButton_Click(object sender, EventArgs e)
{
ListViewEx listViewEx;
switch (selectedTab)
{
case ProcedureTabs.Metrology1: listViewEx = metrology1ListViewEx; break;
case ProcedureTabs.Metrology2: listViewEx = metrology2ListViewEx; break;
case ProcedureTabs.Process: listViewEx = processListViewEx; break;
case ProcedureTabs.Parameters: listViewEx = parametersListViewEx; break;
default: return;
default: return;
}
/// Find an unused test name
@@ -2115,10 +2181,13 @@ namespace TBF.UI.Procedures
AddToParametersTab(test);
foreach (var ctrl in testParamsCtrls) ctrl.AddOne(test);
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
if (listViewEx != null)
{
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
}
private void removeButton_Click(object sender, EventArgs e)
@@ -2380,5 +2449,196 @@ namespace TBF.UI.Procedures
}
}
}
/// <summary>
/// Queries an Oracle database and loads ... array/list
/// </summary>
private void iPerlWizardButton_Click(object sender, EventArgs e)
{
ListViewEx listViewEx = null;
switch (selectedTab)
{
case ProcedureTabs.General:
UpdateFromGeneralTab();
break;
case ProcedureTabs.History:
UpdateFromHistoryTab();
break;
case ProcedureTabs.Metrology1:
listViewEx = metrology1ListViewEx;
UpdateFromMetrology1Tab();
break;
case ProcedureTabs.Metrology2:
listViewEx = metrology2ListViewEx;
UpdateFromMetrology2Tab();
break;
case ProcedureTabs.Process:
listViewEx = processListViewEx;
UpdateFromProcessTab();
break;
case ProcedureTabs.Parameters:
listViewEx = parametersListViewEx;
UpdateFromParametersTab();
break;
default:
foreach (var ctrl in testParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
foreach (var ctrl in procedureParamsCtrls) if (!ctrl.UpdateAll()) MessageBox.Show(string.Format(Strings.Error_saving_parameters_of_0, ctrl.Name));
break;
}
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
{
IList<Test> testsToBeUpdated = new List<Test>();
foreach (var test in LoadedProcedure.Tests)
{
foreach (var tetsMethod in TestMethods)
{
if (tetsMethod.Name == test.Method && tetsMethod.ClassName == "TestMethods.Dummy")
{
testsToBeUpdated.Add(test);
break;
}
}
}
if (testsToBeUpdated.Count == 0)
{
MessageBox.Show("There are no tests to be updated");
return;
}
/// Run a wizard
TestWizard.OracleWZTypSelection oracleDlg = new TestWizard.OracleWZTypSelection(LoadedProcedure, TestMethods);
TestWizard.ConfirmUpdatingTests confirmationDlg = new TestWizard.ConfirmUpdatingTests(LoadedProcedure, TestMethods);
Form[] forms = new Form[] { oracleDlg, confirmationDlg };
int step = 0; /// 1st step
while ((step >= 0) && (step < forms.Length))
{
switch (forms[step].ShowDialog())
{
case DialogResult.OK:
/// Next
step++;
break;
case DialogResult.Retry:
/// Back
step--;
break;
case DialogResult.Cancel:
default:
return;
}
}
if (step == forms.Length)
{
///
/// Update tests
///
foreach (var ti in oracleDlg.SelectedTestInfos)
{
foreach (var test in testsToBeUpdated)
{
if (ti.TestName == test.Name)
{
///
/// Update this test with information obtained from Oracle
///
double qfrom, qto;
switch (ti.Range)
{
case Range.R90_100:
qfrom = 0.9 * ti.Flow;
qto = ti.Flow;
break;
case Range.R95_105:
qfrom = 0.95 * ti.Flow;
qto = 1.05 * ti.Flow;
break;
case Range.R100_110:
qfrom = ti.Flow;
qto = 1.1 * ti.Flow;
break;
default:
qfrom = qto = ti.Flow;
break;
}
double volume = ti.TestTime * (qfrom + qto) / 7.2;
test.Qfrom = (float)qfrom;
test.Qto = (float)qto;
test.TstTime = (float)ti.TestTime;
test.Volume = (float)volume;
test.ErrLimLo = (float)(ti.ErrLimLoFromDB - ti.Uncertainty);
test.ErrLimHi = (float)(ti.ErrLimHiFromDB + ti.Uncertainty);
test.Uncertainty = (float)ti.Uncertainty;
test.Method = ti.TestMethod;
}
}
}
///
/// Update iPerls and water meters
///
foreach (var ppCtrl in procedureParamsCtrls)
{
foreach (var pp in ppCtrl.CmpntsParams)
{
var ihpp = pp as TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead.ProcParams;
if (ihpp != null)
{
ihpp.WMType_ID = oracleDlg.WMTypeId;
ihpp.MeterType = oracleDlg.MeterType;
}
var wmpp = pp as TBF.BenchControl.WaterMeters.WaterMeter.ProcParams;
if (wmpp != null)
{
wmpp.MetrologicalClass = oracleDlg.MetrolKlasse;
wmpp.ApprovalInfo = oracleDlg.Zulasszeichen;
wmpp.Qn = (float)oracleDlg.Q3;
switch (oracleDlg.MeterType)
{
case MeterType.DN15: wmpp.DN = 15.0F; break;
case MeterType.DN20: wmpp.DN = 20.0F; break;
case MeterType.DN25: wmpp.DN = 25.0F; break;
case MeterType.DN26: wmpp.DN = 25.0F; break;
case MeterType.DN32: wmpp.DN = 32.0F; break;
case MeterType.DN40: wmpp.DN = 40.0F; break;
default:
case MeterType.AutoDetect: wmpp.DN = 0; break;
}
}
}
}
RefreshMetrology12AndProcessTabs();
RefreshOtherTabs();
if (listViewEx != null)
{
listViewEx.Focus();
listViewEx.SelectedItems.Clear();
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
}
}
}
}
}
}
+5 -4
View File
@@ -25,7 +25,8 @@ namespace TBF.UI.Procedures
bool showSensorsColumn;
int nrFixedColumns;
IList<IComponent> selectedCmpnts;
IList<IParamsProvider> cmpntsParams;
public IList<IParamsProvider> CmpntsParams;
int paramsCount;
Control[] editors;
@@ -35,7 +36,7 @@ namespace TBF.UI.Procedures
public ProcedureParamsCtrl()
{
InitializeComponent();
cmpntsParams = new List<IParamsProvider>();
CmpntsParams = new List<IParamsProvider>();
}
public ProcedureParamsCtrl(ProcedureDlg parent, IList<IComponent> selectedCmpnts, bool showSensorsColumn)
@@ -81,7 +82,7 @@ namespace TBF.UI.Procedures
}
}
cmpntsParams.Add(procedureParams);
CmpntsParams.Add(procedureParams);
}
if (sampleToCreateHeader != null)
@@ -176,7 +177,7 @@ namespace TBF.UI.Procedures
public void RedrawAll()
{
listViewEx.Items.Clear();
foreach (var item in cmpntsParams) DrawOne(item);
foreach (var item in CmpntsParams) DrawOne(item);
}
void DrawOne(IParamsProvider item)
@@ -0,0 +1,103 @@
namespace TBF.UI.Procedures.TestWizard
{
partial class ConfirmUpdatingTests
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
this.messageLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(185, 77);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 30;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// nextButton
//
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.nextButton.Location = new System.Drawing.Point(104, 77);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 29;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
//
// backButton
//
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.backButton.Location = new System.Drawing.Point(23, 77);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 28;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Location = new System.Drawing.Point(20, 33);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(208, 13);
this.messageLabel.TabIndex = 31;
this.messageLabel.Text = "Do you want to update \'Use wizard\' tests ?";
//
// ConfirmUpdatingTests
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 136);
this.Controls.Add(this.messageLabel);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.nextButton);
this.Controls.Add(this.backButton);
this.Name = "ConfirmUpdatingTests";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Confirmation";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.Label messageLabel;
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
namespace TBF.UI.Procedures.TestWizard
{
public partial class ConfirmUpdatingTests : Form
{
Procedure loadedProcedure;
IList<ITestMethod> testMethods;
public ConfirmUpdatingTests(Procedure loadedProcedure, IList<ITestMethod> testMethods)
{
this.loadedProcedure = loadedProcedure;
this.testMethods = testMethods;
InitializeComponent();
Text = Strings.Confirmation;
messageLabel.Text = Strings.Do_you_want_to_update_tests_QM;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.Update;
cancelButton.Text = Strings.CancelBtnText;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,433 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Procedures.TestWizard
{
partial class OracleWZTypSelection
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.horizSplitContainer2 = new System.Windows.Forms.SplitContainer();
this.meterTypeComboBox = new System.Windows.Forms.ComboBox();
this.dnLabel = new System.Windows.Forms.Label();
this.q3TextBox = new System.Windows.Forms.TextBox();
this.q3Label = new System.Windows.Forms.Label();
this.approvalTextBox = new System.Windows.Forms.TextBox();
this.approvalLabel = new System.Windows.Forms.Label();
this.metroClassTextBox = new System.Windows.Forms.TextBox();
this.metroClassLabel = new System.Windows.Forms.Label();
this.testInfoNameLabel = new System.Windows.Forms.Label();
this.timeStampTextBox = new System.Windows.Forms.TextBox();
this.timeStampLabel = new System.Windows.Forms.Label();
this.remarkTextBox = new System.Windows.Forms.TextBox();
this.remarkLabel = new System.Windows.Forms.Label();
this.wzTypTextBox = new System.Windows.Forms.TextBox();
this.wzTypLabel = new System.Windows.Forms.Label();
this.revWZTypLabel = new System.Windows.Forms.Label();
this.revWZTypTextBox = new System.Windows.Forms.TextBox();
this.searchButton = new System.Windows.Forms.Button();
this.materialCodeTextBox = new System.Windows.Forms.TextBox();
this.idWZTypTextBox = new System.Windows.Forms.TextBox();
this.materialCodeRadioButton = new System.Windows.Forms.RadioButton();
this.idWZTypRadioButton = new System.Windows.Forms.RadioButton();
this.listViewEx = new TracingDB.Forms.ListViewEx();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
this.horizSplitContainer.Panel1.SuspendLayout();
this.horizSplitContainer.Panel2.SuspendLayout();
this.horizSplitContainer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).BeginInit();
this.horizSplitContainer2.Panel1.SuspendLayout();
this.horizSplitContainer2.Panel2.SuspendLayout();
this.horizSplitContainer2.SuspendLayout();
this.SuspendLayout();
//
// horizSplitContainer
//
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
this.horizSplitContainer.Name = "horizSplitContainer";
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.horizSplitContainer2);
//
// horizSplitContainer.Panel2
//
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
this.horizSplitContainer.Panel2.Controls.Add(this.backButton);
this.horizSplitContainer.Size = new System.Drawing.Size(820, 363);
this.horizSplitContainer.SplitterDistance = 283;
this.horizSplitContainer.TabIndex = 0;
//
// horizSplitContainer2
//
this.horizSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.horizSplitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.horizSplitContainer2.IsSplitterFixed = true;
this.horizSplitContainer2.Location = new System.Drawing.Point(0, 0);
this.horizSplitContainer2.Name = "horizSplitContainer2";
this.horizSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// horizSplitContainer2.Panel1
//
this.horizSplitContainer2.Panel1.Controls.Add(this.meterTypeComboBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.dnLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.q3TextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.q3Label);
this.horizSplitContainer2.Panel1.Controls.Add(this.approvalTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.approvalLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.metroClassLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.testInfoNameLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.timeStampLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.remarkTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.remarkLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.wzTypLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypLabel);
this.horizSplitContainer2.Panel1.Controls.Add(this.revWZTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.searchButton);
this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypTextBox);
this.horizSplitContainer2.Panel1.Controls.Add(this.materialCodeRadioButton);
this.horizSplitContainer2.Panel1.Controls.Add(this.idWZTypRadioButton);
//
// horizSplitContainer2.Panel2
//
this.horizSplitContainer2.Panel2.Controls.Add(this.listViewEx);
this.horizSplitContainer2.Size = new System.Drawing.Size(820, 283);
this.horizSplitContainer2.SplitterDistance = 115;
this.horizSplitContainer2.TabIndex = 0;
//
// meterTypeComboBox
//
this.meterTypeComboBox.FormattingEnabled = true;
this.meterTypeComboBox.Location = new System.Drawing.Point(73, 85);
this.meterTypeComboBox.Name = "meterTypeComboBox";
this.meterTypeComboBox.Size = new System.Drawing.Size(65, 21);
this.meterTypeComboBox.TabIndex = 17;
//
// dnLabel
//
this.dnLabel.AutoSize = true;
this.dnLabel.Location = new System.Drawing.Point(31, 88);
this.dnLabel.Name = "dnLabel";
this.dnLabel.Size = new System.Drawing.Size(23, 13);
this.dnLabel.TabIndex = 16;
this.dnLabel.Text = "DN";
//
// q3TextBox
//
this.q3TextBox.Location = new System.Drawing.Point(103, 61);
this.q3TextBox.Name = "q3TextBox";
this.q3TextBox.Size = new System.Drawing.Size(35, 20);
this.q3TextBox.TabIndex = 11;
this.q3TextBox.TextChanged += new System.EventHandler(this.q3TextBox_TextChanged);
//
// q3Label
//
this.q3Label.AutoSize = true;
this.q3Label.Location = new System.Drawing.Point(31, 64);
this.q3Label.Name = "q3Label";
this.q3Label.Size = new System.Drawing.Size(46, 13);
this.q3Label.TabIndex = 10;
this.q3Label.Text = "Q3 / Qn";
//
// approvalTextBox
//
this.approvalTextBox.Location = new System.Drawing.Point(220, 61);
this.approvalTextBox.Name = "approvalTextBox";
this.approvalTextBox.Size = new System.Drawing.Size(275, 20);
this.approvalTextBox.TabIndex = 13;
this.approvalTextBox.TextChanged += new System.EventHandler(this.approvalTextBox_TextChanged);
//
// approvalLabel
//
this.approvalLabel.AutoSize = true;
this.approvalLabel.Location = new System.Drawing.Point(150, 64);
this.approvalLabel.Name = "approvalLabel";
this.approvalLabel.Size = new System.Drawing.Size(49, 13);
this.approvalLabel.TabIndex = 12;
this.approvalLabel.Text = "Approval";
//
// metroClassTextBox
//
this.metroClassTextBox.Location = new System.Drawing.Point(596, 37);
this.metroClassTextBox.Name = "metroClassTextBox";
this.metroClassTextBox.Size = new System.Drawing.Size(104, 20);
this.metroClassTextBox.TabIndex = 9;
this.metroClassTextBox.TextChanged += new System.EventHandler(this.metroClassTextBox_TextChanged);
//
// metroClassLabel
//
this.metroClassLabel.AutoSize = true;
this.metroClassLabel.Location = new System.Drawing.Point(517, 40);
this.metroClassLabel.Name = "metroClassLabel";
this.metroClassLabel.Size = new System.Drawing.Size(78, 13);
this.metroClassLabel.TabIndex = 8;
this.metroClassLabel.Text = "Metrolog. class";
//
// testInfoNameLabel
//
this.testInfoNameLabel.AutoSize = true;
this.testInfoNameLabel.Location = new System.Drawing.Point(595, 88);
this.testInfoNameLabel.Name = "testInfoNameLabel";
this.testInfoNameLabel.Size = new System.Drawing.Size(0, 13);
this.testInfoNameLabel.TabIndex = 20;
//
// timeStampTextBox
//
this.timeStampTextBox.Enabled = false;
this.timeStampTextBox.Location = new System.Drawing.Point(596, 61);
this.timeStampTextBox.Name = "timeStampTextBox";
this.timeStampTextBox.Size = new System.Drawing.Size(104, 20);
this.timeStampTextBox.TabIndex = 15;
//
// timeStampLabel
//
this.timeStampLabel.AutoSize = true;
this.timeStampLabel.Location = new System.Drawing.Point(517, 64);
this.timeStampLabel.Name = "timeStampLabel";
this.timeStampLabel.Size = new System.Drawing.Size(73, 13);
this.timeStampLabel.TabIndex = 14;
this.timeStampLabel.Text = "Date and time";
//
// remarkTextBox
//
this.remarkTextBox.Enabled = false;
this.remarkTextBox.Location = new System.Drawing.Point(220, 85);
this.remarkTextBox.Name = "remarkTextBox";
this.remarkTextBox.Size = new System.Drawing.Size(346, 20);
this.remarkTextBox.TabIndex = 19;
//
// remarkLabel
//
this.remarkLabel.AutoSize = true;
this.remarkLabel.Location = new System.Drawing.Point(150, 88);
this.remarkLabel.Name = "remarkLabel";
this.remarkLabel.Size = new System.Drawing.Size(44, 13);
this.remarkLabel.TabIndex = 18;
this.remarkLabel.Text = "Remark";
//
// wzTypTextBox
//
this.wzTypTextBox.Enabled = false;
this.wzTypTextBox.Location = new System.Drawing.Point(220, 37);
this.wzTypTextBox.Name = "wzTypTextBox";
this.wzTypTextBox.Size = new System.Drawing.Size(275, 20);
this.wzTypTextBox.TabIndex = 7;
//
// wzTypLabel
//
this.wzTypLabel.AutoSize = true;
this.wzTypLabel.Location = new System.Drawing.Point(150, 40);
this.wzTypLabel.Name = "wzTypLabel";
this.wzTypLabel.Size = new System.Drawing.Size(65, 13);
this.wzTypLabel.TabIndex = 6;
this.wzTypLabel.Text = "Water meter";
//
// revWZTypLabel
//
this.revWZTypLabel.AutoSize = true;
this.revWZTypLabel.Location = new System.Drawing.Point(31, 40);
this.revWZTypLabel.Name = "revWZTypLabel";
this.revWZTypLabel.Size = new System.Drawing.Size(66, 13);
this.revWZTypLabel.TabIndex = 4;
this.revWZTypLabel.Text = "Rev WZTyp";
//
// revWZTypTextBox
//
this.revWZTypTextBox.Enabled = false;
this.revWZTypTextBox.Location = new System.Drawing.Point(103, 37);
this.revWZTypTextBox.Name = "revWZTypTextBox";
this.revWZTypTextBox.Size = new System.Drawing.Size(35, 20);
this.revWZTypTextBox.TabIndex = 5;
//
// searchButton
//
this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.searchButton.Location = new System.Drawing.Point(722, 17);
this.searchButton.Name = "searchButton";
this.searchButton.Size = new System.Drawing.Size(75, 42);
this.searchButton.TabIndex = 21;
this.searchButton.Text = "Search";
this.searchButton.UseVisualStyleBackColor = true;
this.searchButton.Click += new System.EventHandler(this.searchButton_Click);
//
// materialCodeTextBox
//
this.materialCodeTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.materialCodeTextBox.Location = new System.Drawing.Point(220, 13);
this.materialCodeTextBox.Name = "materialCodeTextBox";
this.materialCodeTextBox.Size = new System.Drawing.Size(480, 20);
this.materialCodeTextBox.TabIndex = 3;
this.materialCodeTextBox.TextChanged += new System.EventHandler(this.productCodeTextBox_TextChanged);
//
// idWZTypTextBox
//
this.idWZTypTextBox.Location = new System.Drawing.Point(103, 13);
this.idWZTypTextBox.Name = "idWZTypTextBox";
this.idWZTypTextBox.Size = new System.Drawing.Size(35, 20);
this.idWZTypTextBox.TabIndex = 1;
this.idWZTypTextBox.TextChanged += new System.EventHandler(this.wzTypTextBox_TextChanged);
//
// materialCodeRadioButton
//
this.materialCodeRadioButton.AutoSize = true;
this.materialCodeRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.materialCodeRadioButton.Location = new System.Drawing.Point(153, 14);
this.materialCodeRadioButton.Name = "materialCodeRadioButton";
this.materialCodeRadioButton.Size = new System.Drawing.Size(62, 17);
this.materialCodeRadioButton.TabIndex = 2;
this.materialCodeRadioButton.TabStop = true;
this.materialCodeRadioButton.Text = "Material";
this.materialCodeRadioButton.UseVisualStyleBackColor = true;
//
// idWZTypRadioButton
//
this.idWZTypRadioButton.AutoSize = true;
this.idWZTypRadioButton.Location = new System.Drawing.Point(15, 14);
this.idWZTypRadioButton.Name = "idWZTypRadioButton";
this.idWZTypRadioButton.Size = new System.Drawing.Size(75, 17);
this.idWZTypRadioButton.TabIndex = 0;
this.idWZTypRadioButton.TabStop = true;
this.idWZTypRadioButton.Text = "ID WZTyp";
this.idWZTypRadioButton.UseVisualStyleBackColor = true;
this.idWZTypRadioButton.CheckedChanged += new System.EventHandler(this.idWZTypRadioButton_CheckedChanged);
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(820, 164);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SubItemClicked += new TracingDB.Forms.SubItemEventHandler(this.listViewEx_SubItemClicked);
this.listViewEx.SubItemEndEditing += new TracingDB.Forms.SubItemEndEditingEventHandler(this.listViewEx_SubItemEndEditing);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(722, 17);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 27;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// nextButton
//
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.Location = new System.Drawing.Point(641, 17);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 26;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// backButton
//
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.Location = new System.Drawing.Point(560, 17);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 25;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
this.backButton.Click += new System.EventHandler(this.backButton_Click);
//
// OracleWZTypSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(820, 363);
this.Controls.Add(this.horizSplitContainer);
this.Name = "OracleWZTypSelection";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Výber typu vodomera (WZTyp alebo 25-miestny kód)";
this.Load += new System.EventHandler(this.OracleWZTypSelection_Load);
this.horizSplitContainer.Panel1.ResumeLayout(false);
this.horizSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
this.horizSplitContainer.ResumeLayout(false);
this.horizSplitContainer2.Panel1.ResumeLayout(false);
this.horizSplitContainer2.Panel1.PerformLayout();
this.horizSplitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer2)).EndInit();
this.horizSplitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer horizSplitContainer;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.SplitContainer horizSplitContainer2;
private System.Windows.Forms.TextBox materialCodeTextBox;
private System.Windows.Forms.TextBox idWZTypTextBox;
private System.Windows.Forms.RadioButton materialCodeRadioButton;
private System.Windows.Forms.RadioButton idWZTypRadioButton;
private System.Windows.Forms.Button searchButton;
private TracingDB.Forms.ListViewEx listViewEx;
private System.Windows.Forms.Label remarkLabel;
private System.Windows.Forms.TextBox wzTypTextBox;
private System.Windows.Forms.Label wzTypLabel;
private System.Windows.Forms.Label revWZTypLabel;
private System.Windows.Forms.TextBox revWZTypTextBox;
private System.Windows.Forms.TextBox remarkTextBox;
private System.Windows.Forms.TextBox timeStampTextBox;
private System.Windows.Forms.Label timeStampLabel;
private System.Windows.Forms.Label testInfoNameLabel;
private System.Windows.Forms.TextBox metroClassTextBox;
private System.Windows.Forms.Label metroClassLabel;
private System.Windows.Forms.TextBox q3TextBox;
private System.Windows.Forms.Label q3Label;
private System.Windows.Forms.TextBox approvalTextBox;
private System.Windows.Forms.Label approvalLabel;
private System.Windows.Forms.ComboBox meterTypeComboBox;
private System.Windows.Forms.Label dnLabel;
}
}
@@ -0,0 +1,362 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using log4net;
using Oracle.DataAccess.Client;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Output;
using TBF.BenchControl.Output.DB.SensusOracle;
using TBF.Resources;
using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.UI.Procedures.TestWizard
{
public partial class OracleWZTypSelection : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(OracleWZTypSelection));
public IList<SensusTestInfo> SelectedTestInfos;
public int WMTypeId;
public string MetrolKlasse;
public string Zulasszeichen;
public double Q3;
public MeterType MeterType;
Procedure loadedProcedure;
IList<ITestMethod> testMethods;
TextBox uncertaintyTB;
ComboBox testMethodCB;
public OracleWZTypSelection(Procedure loadedProcedure, IList<ITestMethod> testMethods)
{
this.loadedProcedure = loadedProcedure;
this.testMethods = testMethods;
InitializeComponent();
Text = Strings.Method_selection;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
for (MeterType mt = 0; mt < MeterType.Count; mt++)
{
meterTypeComboBox.Items.Add(mt.ToString());
}
meterTypeComboBox.Text = MeterType.AutoDetect.ToString();
listViewEx.Columns.Add("ID", 30);
listViewEx.Columns.Add("Test name", 70);
listViewEx.Columns.Add("QBezeichnung", 85);
listViewEx.Columns.Add(Strings.Q_from_m3h, 80);
listViewEx.Columns.Add(Strings.Q_to_m3h, 70);
listViewEx.Columns.Add(Strings.Test_time_s_chdr, 70);
listViewEx.Columns.Add(string.Format("{0} [l]", Strings.Volume, 60));
listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
listViewEx.Columns.Add(Strings.Uncertainty_pct_chdr, 85);
listViewEx.Columns.Add(Strings.Test_method, 200);
uncertaintyTB = new TextBox();
Controls.Add(uncertaintyTB);
testMethodCB = new ComboBox();
if (testMethods != null)
{
foreach (var tm in testMethods) testMethodCB.Items.Add(tm.Name);
}
Controls.Add(testMethodCB);
backButton.Visible = false;
nextButton.Enabled = false;
SelectedTestInfos = null;
}
private void OracleWZTypSelection_Load(object sender, EventArgs e)
{
}
bool IsFormValidForSearch()
{
if (idWZTypRadioButton.Checked)
{
int idummy;
return (int.TryParse(idWZTypTextBox.Text, out idummy) && (idummy > 0));
}
else
{
return (materialCodeTextBox.Text.Length == 25);
}
}
bool IsFormValid()
{
double dummy;
return IsFormValidForSearch() &&
(listViewEx.Items.Count > 0) &&
Utils.TryParseUDouble(q3TextBox.Text, out dummy) &&
!string.IsNullOrEmpty(metroClassTextBox.Text) &&
!string.IsNullOrEmpty(approvalTextBox.Text) &&
meterTypeComboBox.Items.Contains(meterTypeComboBox.Text);
}
private void idWZTypRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (idWZTypRadioButton.Checked)
{
idWZTypTextBox.Enabled = true;
materialCodeTextBox.Enabled = false;
}
else
{
idWZTypTextBox.Enabled = false;
materialCodeTextBox.Enabled = true;
}
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void wzTypTextBox_TextChanged(object sender, EventArgs e)
{
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void productCodeTextBox_TextChanged(object sender, EventArgs e)
{
searchButton.Enabled = IsFormValidForSearch();
nextButton.Enabled = false;
}
private void backButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Retry;
Close();
}
private void nextButton_Click(object sender, EventArgs e)
{
MetrolKlasse = metroClassTextBox.Text;
Zulasszeichen = approvalTextBox.Text;
Q3 = Utils.ParseUDouble(q3TextBox.Text);
for (MeterType mt = 0; mt < MeterType.Count; mt++)
{
if (meterTypeComboBox.Text == mt.ToString())
{
MeterType = mt;
break;
}
}
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void searchButton_Click(object sender, EventArgs e)
{
if (!IsFormValidForSearch())
{
MessageBox.Show("Invalid data");
nextButton.Enabled = false;
return;
}
bool found = ReadTestInfosFromOracle();
if (!found)
{
MessageBox.Show("No water meter specification found in Oracle");
}
nextButton.Enabled = IsFormValid();
}
bool ReadTestInfosFromOracle()
{
IList<string> wmTestNames = new List<string>();
StringBuilder procedureSignatureSB = new StringBuilder();
foreach (var t in loadedProcedure.Tests)
{
if (t.Publish != (byte)Config.Entities.Publish.Never)
{
wmTestNames.Add(global::Results.Utils.GetTestName(t.Name, 1, 1));
}
}
try
{
WMTypeId = int.Parse(idWZTypTextBox.Text);
int wmTypeRevision;
string wzTypStr;
string materialNr;
DateTime timeStamp;
string remark;
string testInfoName;
OracleConnection conn = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
conn.Open();
SelectedTestInfos = Database.GetOracleTestInfo(conn, WMTypeId, out wmTypeRevision, out wzTypStr, out MetrolKlasse, out Zulasszeichen, out materialNr, out Q3, out timeStamp, out remark);
conn.Close();
SensusTestInfo[] completeTestInfos = SensusTestInfo.GetBestMatch(SelectedTestInfos, wmTestNames, out testInfoName);
foreach (var sti in SelectedTestInfos)
{
foreach (var cti in completeTestInfos) if (cti.PruefungsNrOpto == sti.PruefungsNrDB) sti.TestName = cti.TestName;
}
materialCodeTextBox.Text = materialNr;
revWZTypTextBox.Text = wmTypeRevision.ToString();
wzTypTextBox.Text = wzTypStr;
metroClassTextBox.Text = MetrolKlasse;
approvalTextBox.Text = Zulasszeichen;
q3TextBox.Text = Q3.ToString();
remarkTextBox.Text = remark;
timeStampTextBox.Text = timeStamp.ToString("dd.MM.yyyy HH:mm");
testInfoNameLabel.Text = testInfoName;
listViewEx.Items.Clear();
foreach (var ti in SelectedTestInfos)
{
double Qfrom, Qto;
switch (ti.Range)
{
case Range.R90_100:
Qfrom = 0.9 * ti.Flow;
Qto = ti.Flow;
break;
case Range.R95_105:
Qfrom = 0.95 * ti.Flow;
Qto = 1.05 * ti.Flow;
break;
case Range.R100_110:
Qfrom = ti.Flow;
Qto = 1.1 * ti.Flow;
break;
default:
Qfrom = Qto = ti.Flow;
break;
}
double volumeLtr = ti.TestTime * (Qfrom + Qto) / 7.2;
ListViewItem lvi = new ListViewItem(new string[] { ti.PruefungsNrDB.ToString(),
(string.IsNullOrEmpty(ti.TestName) ? string.Empty : ti.TestName),
ti.QBezeichnungDB,
Qfrom.ToString(),
Qto.ToString(),
ti.TestTime.ToString(),
volumeLtr.ToString(Config.Utils.SignificantDigitsToFmt(volumeLtr, 4)),
(ti.ErrLimLoFromDB - ti.Uncertainty).ToString(),
(ti.ErrLimHiFromDB + ti.Uncertainty).ToString(),
ti.Uncertainty.ToString(),
ti.TestMethod,
});
lvi.Tag = ti;
listViewEx.Items.Add(lvi);
}
return true;
}
catch (Exception)
{
revWZTypTextBox.Text = string.Empty;
wzTypTextBox.Text = "No info found";
metroClassTextBox.Text = string.Empty;
approvalTextBox.Text = string.Empty;
q3TextBox.Text = string.Empty;
remarkTextBox.Text = string.Empty;
timeStampTextBox.Text = string.Empty;
testInfoNameLabel.Text = string.Empty;
return false;
}
}
private void listViewEx_SubItemClicked(object sender, TracingDB.Forms.SubItemEventArgs e)
{
if (e.SubItem == listViewEx.Columns.Count - 2)
{
/// Uncertainty column clicked (column before the last one)
listViewEx.StartEditing(uncertaintyTB, e.Item, e.SubItem);
}
else if (e.SubItem == listViewEx.Columns.Count - 1)
{
/// Test method column clicked (the last column)
listViewEx.StartEditing(testMethodCB, e.Item, e.SubItem);
}
}
private void listViewEx_SubItemEndEditing(object sender, TracingDB.Forms.SubItemEndEditingEventArgs e)
{
if (e.SubItem == listViewEx.Columns.Count - 2)
{
double uncertainty;
if (Utils.TryParseUDouble(e.DisplayText, out uncertainty))
{
/// Uncertainty OK
SensusTestInfo ti = e.Item.Tag as SensusTestInfo;
if (ti != null) ti.Uncertainty = uncertainty;
e.Item.SubItems[listViewEx.Columns.Count - 4].Text = (ti.ErrLimLoFromDB - ti.Uncertainty).ToString();
e.Item.SubItems[listViewEx.Columns.Count - 3].Text = (ti.ErrLimHiFromDB + ti.Uncertainty).ToString();
}
else
{
/// Uncertainty NOK -> revert changes
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
else if (e.SubItem == listViewEx.Columns.Count - 1)
{
if (testMethodCB.Items.Contains(e.DisplayText))
{
/// TestMethod OK
SensusTestInfo ti = e.Item.Tag as SensusTestInfo;
if (ti != null) ti.TestMethod = e.DisplayText;
}
else
{
/// TestMethod NOK -> revert changes
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
}
private void q3TextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
private void metroClassTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
private void approvalTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+3 -1
View File
@@ -4,11 +4,13 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Results.Entities;
using NHibernate;
using log4net;
using Oracle.DataAccess.Client;
using Results;
using Results.Entities;
using TBF.Resources;
using TBF.BenchControl.Output.DB.SensusOracle;
namespace TBF.UI.Results
{
+1 -1
View File
@@ -186,7 +186,7 @@ namespace TBF.UI.Shared
{
for (int i = 1; i <= test.Repeats; i++)
{
testComboBox.Items.Add(Utils.TestTitle(test, i));
testComboBox.Items.Add(test.GetExpandedTestName(i));
}
}
+43 -1
View File
@@ -47,6 +47,9 @@ namespace TBF.UI.Shared
this.exportButton = new System.Windows.Forms.Button();
this.importButton = new System.Windows.Forms.Button();
this.compareButton = new System.Windows.Forms.Button();
this.customButton1 = new System.Windows.Forms.Button();
this.customButton2 = new System.Windows.Forms.Button();
this.customButton3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// removeButton
@@ -225,10 +228,46 @@ namespace TBF.UI.Shared
this.compareButton.UseVisualStyleBackColor = true;
this.compareButton.Click += new System.EventHandler(this.compareButton_Click);
//
// customButton1
//
this.customButton1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton1.Location = new System.Drawing.Point(10, 755);
this.customButton1.Name = "customButton1";
this.customButton1.Size = new System.Drawing.Size(80, 40);
this.customButton1.TabIndex = 16;
this.customButton1.Text = "Custom 1";
this.customButton1.UseVisualStyleBackColor = true;
this.customButton1.Click += new System.EventHandler(this.customButton1_Click);
//
// customButton2
//
this.customButton2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton2.Location = new System.Drawing.Point(10, 798);
this.customButton2.Name = "customButton2";
this.customButton2.Size = new System.Drawing.Size(80, 40);
this.customButton2.TabIndex = 17;
this.customButton2.Text = "Custom 2";
this.customButton2.UseVisualStyleBackColor = true;
this.customButton2.Click += new System.EventHandler(this.customButton2_Click);
//
// customButton3
//
this.customButton3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.customButton3.Location = new System.Drawing.Point(10, 841);
this.customButton3.Name = "customButton3";
this.customButton3.Size = new System.Drawing.Size(80, 40);
this.customButton3.TabIndex = 18;
this.customButton3.Text = "Custom 3";
this.customButton3.UseVisualStyleBackColor = true;
this.customButton3.Click += new System.EventHandler(this.customButton3_Click);
//
// SharedButtons
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.customButton3);
this.Controls.Add(this.customButton2);
this.Controls.Add(this.customButton1);
this.Controls.Add(this.compareButton);
this.Controls.Add(this.importButton);
this.Controls.Add(this.exportButton);
@@ -246,7 +285,7 @@ namespace TBF.UI.Shared
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Name = "SharedButtons";
this.Size = new System.Drawing.Size(100, 805);
this.Size = new System.Drawing.Size(100, 908);
this.Load += new System.EventHandler(this.SharedDlgButtons_Load);
this.ResumeLayout(false);
@@ -270,5 +309,8 @@ namespace TBF.UI.Shared
private System.Windows.Forms.Button exportButton;
private System.Windows.Forms.Button importButton;
private System.Windows.Forms.Button compareButton;
private System.Windows.Forms.Button customButton1;
private System.Windows.Forms.Button customButton2;
private System.Windows.Forms.Button customButton3;
}
}
+15 -1
View File
@@ -30,6 +30,9 @@ namespace TBF.UI.Shared
RenameTab = (1 << 10), /// optional
RemoveTab = (1 << 11), /// optional
More = (1 << 12), /// optional
Custom1 = (1 << 13), /// optional
Custom2 = (1 << 14), /// optional
Custom3 = (1 << 15), /// optional
}
readonly System.Windows.Forms.Button[] buttonCtrls;
@@ -40,6 +43,10 @@ namespace TBF.UI.Shared
/// </summary>
public Buttons OptionalButtons;
public string Custom1Caption { set { customButton1.Text = value; } }
public string Custom2Caption { set { customButton2.Text = value; } }
public string Custom3Caption { set { customButton3.Text = value; } }
public enum LockState
{
Locked, /// 'Unlock', 'Close' (=OK) are shown, all the othere are hidden
@@ -84,6 +91,7 @@ namespace TBF.UI.Shared
addButton, removeButton, upButton, downButton, editButton, copyButton,
exportButton, importButton, compareButton,
newTabButton, renameTabButton, removeTabButton, moreButton,
customButton1, customButton2, customButton3,
};
OptionalButtons = Buttons.None;
buttonsRepositionsed = false;
@@ -208,10 +216,13 @@ namespace TBF.UI.Shared
public event EventHandler NewTabClicked;
public event EventHandler RenameTabClicked;
public event EventHandler RemoveTabClicked;
public event EventHandler MoreClicked;
public event EventHandler ExportClicked;
public event EventHandler ImportClicked;
public event EventHandler CompareClicked;
public event EventHandler MoreClicked;
public event EventHandler Custom1Clicked;
public event EventHandler Custom2Clicked;
public event EventHandler Custom3Clicked;
/// <summary>
/// 'Unlock' button handler
@@ -288,5 +299,8 @@ namespace TBF.UI.Shared
private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); }
private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); }
private void customButton1_Click(object s, EventArgs e) { if (Custom1Clicked != null) Custom1Clicked(s, e); }
private void customButton2_Click(object s, EventArgs e) { if (Custom2Clicked != null) Custom2Clicked(s, e); }
private void customButton3_Click(object s, EventArgs e) { if (Custom3Clicked != null) Custom3Clicked(s, e); }
}
}
+2 -2
View File
@@ -121,7 +121,7 @@ namespace TBF.UI
string test2Name = global::Results.Utils.GetTestName(test2.Name, test2.Repeats, r);
TestProgressCtrl progress =
new TestProgressCtrl(test2.Id, test2Name, test2.Part, Utils.TestTitle(test2, r), r, test2.Repeats);
new TestProgressCtrl(test2.Id, test2Name, test2.Part, test2.GetExpandedTestName(r), r, test2.Repeats);
progresses.Add(progress);
parent.Controls.Add(progress);
Console.WriteLine(test2Name);
@@ -131,7 +131,7 @@ namespace TBF.UI
{
string testName = global::Results.Utils.GetTestName(test.Name, test.Repeats, r);
TestProgressCtrl progress =
new TestProgressCtrl(test.Id, testName, test.Part, Utils.TestTitle(test, r), r, test.Repeats);
new TestProgressCtrl(test.Id, testName, test.Part, test.GetExpandedTestName(r), r, test.Repeats);
progresses.Add(progress);
parent.Controls.Add(progress);
Console.WriteLine(testName);
-26
View File
@@ -265,32 +265,6 @@ namespace TBF
return wmPartNr;
}
/// <summary>
/// Return test title for a given test and a repetition number
/// </summary>
/// <param name="test">Test entity</param>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public static string TestTitle(Test test, int repetitonNr)
{
if (test.Repeats == 1)
{
if (test.Part == 0)
{
return test.Name; /// Single test
}
else
{
return string.Format("{0} ({1})", test.Name, test.Part); /// A part of a single test
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", test.Name, repetitonNr, test.Repeats);
}
}
/// <summary>
/// Return test title for a given test data and a repetition number
/// </summary>
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>DEBUG;TRACE;TURA_IPERL;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -26,7 +26,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;TURA_IPERL;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>