Compare commits

...
Author SHA1 Message Date
Milan Hanajik fae4841d18 Badger stredná trať : 8 vodomerov (bolo 4), ver. 2.30.1950 2022-08-30 09:54:46 +02:00
Milan Hanajik c8749ae7dc Badger stredna trať : Elde component updated, dated 23.8.2022 2022-08-30 09:21:59 +02:00
Milan Hanajik a9dc196974 Badger stredna trat : Network.Comet.Ambient fixed : UpdateProcessData() was missing, ver. 2.18.1822 2021-12-07 17:09:22 +01:00
Milan Hanajik 5829f37b27 BADGER_STREDNA_TRAT : Config.Data.WMsCount = 4 (originally 3), ver. 2.18.1732 2021-09-02 09:43:54 +02:00
Milan Hanajik 6dc970a2ee ELDE komponent Badger-stredna-trat pre 4 vodomery. 2021-07-26 12:58:38 +02:00
Milan Hanajik a7e58ceaca Quick changes in protocol. ver. 2.26.1684 2021-06-29 19:43:34 +02:00
Milan Hanajik 0dc2f56519 Reconfigured for BADGER-stredna-trat. 2021-04-28 12:56:31 +02:00
Milan Hanajik ec22907186 ver. 2.18.1638 2021-04-28 12:56:02 +02:00
Milan Hanajik d71a40f7ab Add 'Scale' results item, ver. 2.18.1637 2021-04-28 12:51:26 +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
Milan Hanajik 2ca9c104d2 DEWA_300 component upgraded. 2019-09-18 14:45:21 +02:00
Milan Hanajik 994568799d Refactorization: TBF.UI namespace, no change of function, ver. 2.18.1314 2019-09-17 10:58:44 +02:00
Milan Hanajik 7f8a5c83ed Users : Password change, password requirements, password history, BackupAndSecurity component, ver. 2.18.1313 2019-09-16 08:52:20 +02:00
Milan Hanajik 99b68f1dd6 Bug fix : Crash when closing TBF program (ModelessActivityForm). 2019-09-15 10:51:14 +02:00
Milan Hanajik 604c59723f (1) Production Tracing tab removed from MoreWMResultsDlg, (2) WMChart: testRslt.TestTime used instead of mtr.TestTime, AxisX Minimum and Maximum. 2019-09-15 06:24:42 +02:00
Milan Hanajik 886d87c03d Config.Mappins.UserMap fixed for TURA_IPERL, etc. (Tag) 2019-09-14 10:41:42 +02:00
Milan Hanajik d4eb52d70e RegulValve.SetFlowOp in progress 2019-09-12 13:50:53 +02:00
Milan Hanajik e2650736cd iPerlCommunication simulation 2019-09-12 13:50:47 +02:00
Milan Hanajik 77b71d5a7d LoginDlgWithBenchSelection : Logging with full name fixed, ver. 2.18.1308 2019-09-11 15:46:15 +02:00
Milan Hanajik bd65ff5420 Cosmetical changes 2019-09-10 10:57:58 +02:00
Milan Hanajik 0449c38de2 Polish language, ver. 2.18.1305 2019-09-09 09:35:43 +02:00
328 changed files with 6019 additions and 4153 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;BADGER_STREDNA_TRAT;LANG_CS</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;BADGER_STREDNA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+7 -1
View File
@@ -14,12 +14,18 @@ namespace Config
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
#elif DN100 || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif BADGER_STREDNA_TRAT
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
+5 -2
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.Collections.Generic;
@@ -11,8 +11,11 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description
public virtual int Number { get; set; }
public virtual string Tag { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; }
public virtual string Password2 { get; set; }
public virtual string Password3 { get; set; }
public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
+4 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
@@ -12,6 +12,9 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.UserName).Column("Name");
Map(x => x.Number);
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
Map(x => x.Tag);
#endif
Map(x => x.Password);
Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange);
+9 -10
View File
@@ -7,7 +7,6 @@ using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using System.Xml.Serialization;
@@ -27,11 +26,11 @@ namespace DeviceTest
IComponentCfg component2Cfg;
IComponentCfg component3Cfg;
static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
static IList<IDevice> tbfDevices;
static IList<IComponent> tbfComponents;
static IComponent tbfComponent1forOp;
static IComponent tbfComponent2forOp;
static IComponent tbfComponent3forOp;
static Thread workerThread;
static bool workerThreadRunning;
@@ -426,7 +425,7 @@ namespace DeviceTest
cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0;
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
@@ -455,7 +454,7 @@ namespace DeviceTest
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -489,7 +488,7 @@ namespace DeviceTest
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -524,7 +523,7 @@ namespace DeviceTest
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
+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;
}
+1
View File
@@ -135,6 +135,7 @@ namespace Results.Entities
public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; }
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; }
public virtual string Scale() { return (Components != null) ? Components.Scale : string.Empty; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest")) : true; }
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
+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]);
}
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Results.Forms
if (refRecords == null)
{
tabControl1.SelectTab(1);
tabControl1.TabPages[2].Hide();
tabControl1.TabPages.RemoveAt(2);
}
else
{
+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
View File
@@ -318,6 +318,19 @@ namespace Results
TimeBtwnMassMsrmnts, /// 270
TestTimeCorrection, /// 271
ThreeState, /// 272
Conduct, /// 273
Conduct_start, /// 274
Conduct_end, /// 275
Conduct_avg, /// 276
Conduct_min, /// 277
Conduct_max, /// 278
InfoFlags, /// 279
Scale, /// 280
Count,
}
}
+45 -12
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms.DataVisualization.Charting;
using Config.Entities;
using Results.Entities;
@@ -14,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.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{
double flow = Config.Units.ConvertTo(flowUnit, mtr.TestRslt.VolumeCTV / mtr.TestTime * 3.6 * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster);
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));
@@ -33,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",
@@ -47,7 +56,7 @@ namespace Results.Output
chArea.AxisX.Title = Strings.Flow;
chArea.AxisX.IsLogarithmic = true;
chArea.AxisX.LogarithmBase = 10;
chArea.AxisX.IsLabelAutoFit = false;
chArea.AxisX.IsLabelAutoFit = true;
List<double> xs = new List<double>() { 0.0001, 0.0002, 0.0005,
0.001, 0.002, 0.005,
@@ -59,19 +68,43 @@ namespace Results.Output
1000, 2000, 5000,
10000, 20000, 50000,
100000, 200000, 500000,
1000000, 2000000, 5000000 };
1000000, 2000000, 5000000,
10000000 };
double spacer = 0.8;
double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
for (int i = 1; i < xs.Count - 1; i++)
bool inRange = false;
for (int i = 0; i < xs.Count - 3; i += 3)
{
if ((xs[i + 1] > from) && (xs[i - 1] < to))
if (xs[i] <= from && from < xs[i + 3])
{
chArea.AxisX.Minimum = xs[i];
inRange = true;
}
if (inRange)
{
for (int j = i; j < i + 3; j++)
{
CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[j], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[j] * spacer);
cl.ToPosition = Math.Log10(xs[j] / spacer);
chArea.AxisX.CustomLabels.Add(cl);
}
}
if (xs[i] < to && to <= xs[i + 3])
{
chArea.AxisX.Maximum = xs[i + 3];
CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[i], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[i] * spacer);
cl.ToPosition = Math.Log10(xs[i] / spacer);
cl.Text = string.Format("{0} {1}", xs[i + 3], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[i + 3] * spacer);
cl.ToPosition = Math.Log10(xs[i + 3] / spacer);
chArea.AxisX.CustomLabels.Add(cl);
break;
}
}
+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;BADGER_STREDNA_TRAT;LANG_CS</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;BADGER_STREDNA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+1
View File
@@ -325,6 +325,7 @@ namespace Results
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
///
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
using TBF.BenchControl;
namespace ResultsBrowser.Forms
{
+1 -1
View File
@@ -91,7 +91,7 @@ namespace ResultsBrowser.Forms
cfgControl.Config = printerCfg;
cfgControl.Config.ItemNr = 0;
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
TBF.BenchControl.ComponentParametersDlg cfgForm = new TBF.BenchControl.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
+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;BADGER_STREDNA_TRAT;LANG_CS</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;BADGER_STREDNA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
-176
View File
@@ -1,176 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace TBF
{
/// <summary>
/// Data types and orientation of the table layout panel attached data.
/// </summary>
public enum Arrangement
{
RowOfIntegers,
RowOfDoubles,
RowOfStrings,
ColumnOfIntegers,
ColumnOfDoubles,
ColumnOfStrings,
}
/// <summary>
/// This class represents TextBox controls and data modified by them
/// that are attached to (=displayed inside) a TableLayoutPanel control.
/// </summary>
public class AttachedTextBoxes
{
///
/// Private fields
///
int count; /// Number of attached TextBoxes / cells
Arrangement arngmnt; /// Type of attachemnt (see above)
bool isRow; /// true if it is a row
TextBox[] textBoxes; /// TextBox controls to be aded to TableLayoutPanel
int[] intData; /// integer data |
double[] doubleData; /// double data |-> one of these three arrays is used
string[] stringData; /// string data |
/// <summary>
/// Constructor, which creates TextBox controls and adds them to the table layout panel.
/// </summary>
public AttachedTextBoxes(TableLayoutPanel tblLtPnl, Arrangement arngmnt, int firstColumn, int firstRow, int size)
{
this.count = size;
this.arngmnt = arngmnt;
isRow = (arngmnt == Arrangement.RowOfIntegers || arngmnt == Arrangement.RowOfDoubles || arngmnt == Arrangement.RowOfStrings);
textBoxes = new TextBox[count];
intData = new int[count];
doubleData = new double[count];
stringData = new string[count];
for (int i = 0; i < count; i++)
{
textBoxes[i] = new TextBox(); /// Crete a new TextBox control
if (isRow)
{
tblLtPnl.Controls.Add(textBoxes[i], firstColumn + i, firstRow);
}
else
{
tblLtPnl.Controls.Add(textBoxes[i], firstColumn, firstRow + i);
}
}
}
/// <summary>
/// Attached data array size
/// </summary>
public int Count { get { return count; } }
/// <summary>
/// Indexer returning a TextBox
/// </summary>
/// <param name="index">Index</param>
/// <returns>TextBox object reference</returns>
public TextBox this[int index]
{
get
{
if (index < 0 || index >= count)
{
return null;
}
else
{
return textBoxes[index];
}
}
}
/// <summary>
/// Retrieves data from the controls or detects a format error.
/// Wrong format in a cell interrupts data retrieving, so when the first control
/// contains data with wrong format, no data are retrieved at all.
/// </summary>
/// <returns>true if all data have correct format</returns>
public bool ValidateData()
{
switch (arngmnt)
{
case Arrangement.RowOfIntegers:
case Arrangement.ColumnOfIntegers:
for (int i = 0; i < count; i++)
{
if (!Int32.TryParse(textBoxes[i].Text, out intData[i])) return false;
}
return true;
case Arrangement.RowOfDoubles:
case Arrangement.ColumnOfDoubles:
for (int i = 0; i < count; i++)
{
if (!Double.TryParse(textBoxes[i].Text, out doubleData[i])) return false;
}
return true;
case Arrangement.RowOfStrings:
case Arrangement.ColumnOfStrings:
default:
return true;
}
}
/// <summary>
/// The following three methods provide initialization of controls with original data.
/// </summary>
public void SetData(int index, int value)
{
if (index < 0 || index >= count) return;
intData[index] = value;
textBoxes[index].Text = value.ToString();
}
public void SetData(int index, double value)
{
if (index < 0 || index >= count) return;
doubleData[index] = value;
textBoxes[index].Text = value.ToString();
}
public void SetData(int index, string value)
{
if (index < 0 || index >= count) return;
stringData[index] = value;
textBoxes[index].Text = value;
}
/// <summary>
/// The following three methods provide retrieving data from controls.
/// ValidateData() must be called first. The return value must be true.
/// </summary>
public int GetIntData(int index)
{
if (index < 0 || index >= count) return 0;
return intData[index];
}
public double GetDoubleData(int index)
{
if (index < 0 || index >= count) return 0;
return doubleData[index];
}
public string GetStringData(int index)
{
if (index < 0 || index >= count) return null;
return textBoxes[index].Text;
}
}
}
-75
View File
@@ -1,75 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Drawing;
using System.Windows.Forms;
namespace TBF
{
public class BarGraph
{
int originX; /// Left coordinate of the bar
int originY; /// Top coordinate of the bar
int barWidth; /// Bar width, the bar is actualy 1 pixel wider
int barHeight; /// Bar height the bat is actualy 1 pixel higher
Color barColor; /// Bar color
Color backColor; /// Background color (above the bar)
/// Bar border is always black, 1 pixel wide
int barValue; /// The actual bar size (the bar is drawn from bottom)
System.Windows.Forms.Control control;
Rectangle rect;
/// Use this setter to update the bar size
public float FValue
{
get { return (float)barValue/(float)barHeight; }
set
{
Value = (int)(value * (float)barHeight);
control.Invalidate();
}
}
/// Use this setter to update the bar size
public int Value
{
get { return barValue; }
set
{
if (value < 0) barValue = 0;
else if (value >= barHeight) barValue = barHeight;
else barValue = value;
control.Invalidate();
}
}
/// <summary>
/// Constructor
/// </summary>
public BarGraph(System.Windows.Forms.Control control, int originX, int originY, int barWidth, int barHeight, Color barColor, Color backColor)
{
this.control = control;
this.originX = originX;
this.originY = originY;
this.barWidth = barWidth;
this.barHeight = barHeight;
this.barColor = barColor;
this.backColor = backColor;
rect = new Rectangle(originX, originY, barWidth + 1, barHeight + 1);
barValue = 0;
}
/// <summary>
/// Call this function in Form1_Paint(..), pass the arguments without any modifications
/// </summary>
public void Paint(Graphics g)
{
g.FillRectangle(new SolidBrush(backColor), originX + 1, originY + 1, barWidth, barHeight - barValue);
g.FillRectangle(new SolidBrush(barColor), originX + 1, originY + barHeight + 1 - barValue, barWidth, barValue);
g.DrawRectangle(new Pen(Color.Black, 2.0F), originX, originY, barWidth + 1, barHeight + 1);
}
}
}
@@ -0,0 +1,38 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Users;
using log4net;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
/// <summary>
/// Holds backup and security options.
/// </summary>
public class Component : ComponentBase, GenericDevices.IBackupAndSecurity
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("BackupAndSecurity.Default({0})", Cfg.ToString(1)); }
readonly ComponentCfg myCfg;
public int MinPasswdLength { get { return myCfg.MinPasswdLength; } }
public int PasswdExpirationPeriodDays { get { return myCfg.PasswdExpirationPeriodDays; } }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
log.Debug(this.ToString());
}
}
}
@@ -0,0 +1,125 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
/// <summary>
/// Holds backup and security options - serializable configuration.
/// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
///
public int MinPasswdLength;
public int PasswdExpirationPeriodDays; /// 0 = validity is not limited
/// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg() {}
public ComponentCfg(IComponentFactory factory)
: this()
{
Factory = factory;
Name = "BackupAndSecurity";
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
MinPasswdLength = 6;
PasswdExpirationPeriodDays = 0;
}
string[] paramNames = new string[]
{
"Minimum password length (characters)",
"Password expiration period (days)",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}: Min. password length = {1} characters, Password expiration period = {2} days", Name, MinPasswdLength, PasswdExpirationPeriodDays);
}
switch (i)
{
case 0: return MinPasswdLength.ToString();
case 1: return PasswdExpirationPeriodDays.ToString();;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: MinPasswdLength = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
case 1: PasswdExpirationPeriodDays = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
int idummy;
switch (i)
{
case 0:
case 1:
/// Positive integers and zero are allowed
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ComponentCfg prms)
{
prms.MinPasswdLength = this.MinPasswdLength;
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
}
public Config.Entities.IParamsProvider Clone()
{
ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BackupAndSecurity.Default
{
public class ComponentFactory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
}
}
}
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
namespace TBF
namespace TBF.BenchControl
{
partial class ComponentParametersDlg
{
@@ -32,7 +32,7 @@ namespace TBF
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.sharedButtons = new TBF.UiControls.SharedButtons();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
@@ -84,6 +84,6 @@ namespace TBF
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
private UiControls.SharedButtons sharedButtons;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -7,10 +7,10 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.UiControls;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF
namespace TBF.BenchControl
{
public partial class ComponentParametersDlg : Form
{
@@ -134,7 +134,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
private void batchRemarkButton_Click(object sender, EventArgs e)
{
TBF.Forms.RemarkDlg dlg = new TBF.Forms.RemarkDlg() { Remark = ((BatchRemark == null) ? string.Empty : BatchRemark) };
TBF.UI.Shared.RemarkDlg dlg = new TBF.UI.Shared.RemarkDlg() { Remark = ((BatchRemark == null) ? string.Empty : BatchRemark) };
if (dlg.ShowDialog() == DialogResult.OK)
{
BatchRemark = dlg.Remark;
@@ -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;
}
}
}
+4 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2017 Sensus Metering Systems
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -40,19 +40,19 @@ namespace TBF.BenchControl.Dummy.Balance
public float BuoyancyPress { get { return 1.013f; } }
public float BuoyancyHumi { get { return 50.0f; } }
public IOperation TaringOp(ref TBF.Boxes.DoubleBox tara)
public IOperation TaringOp(ref Boxes.DoubleBox tara)
{
tara.Val = 0;
return this;
}
public IOperation ReadMassOp(ref TBF.Boxes.DoubleBox mass)
public IOperation ReadMassOp(ref Boxes.DoubleBox mass)
{
mass.Val = 0;
return this;
}
public IOperation ReadStableMassOp(ref TBF.Boxes.DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
public IOperation ReadStableMassOp(ref Boxes.DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
{
mass.Val = 0;
return this;
@@ -2,11 +2,11 @@
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public partial class FlowMeterCfgCtrl : UserControl, IComponentCfgCtrl
+5 -3
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;
@@ -43,7 +43,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); }
@@ -501,7 +503,7 @@ namespace TBF.BenchControl.Elde
///
void ShowEmergencyStopForm()
{
(new TBF.Forms.EmergencyStopForm()).Show();
(new TBF.UI.Shared.EmergencyStopForm()).Show();
}
+3 -1
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
+7
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]; }
@@ -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)
@@ -2,8 +2,6 @@
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
@@ -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());
}
@@ -2,8 +2,6 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
@@ -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);
@@ -2,7 +2,6 @@
/// Copyright (c) 2017 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.FlowMeterTwins
@@ -15,8 +16,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
public readonly Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly Elde.FlowMeter.FlowMeter FlowMeter2;
public int Idx1 { get { return 0; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
@@ -44,10 +45,10 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
FlowMeter1 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components);
FlowMeter1 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components) as Elde.FlowMeter.FlowMeter;
if (FlowMeter1 == null) throw new Exception("Cannot find FlowMeter1 component");
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
FlowMeter2 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components) as Elde.FlowMeter.FlowMeter;
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
@@ -2,7 +2,6 @@
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
+4 -2
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);
@@ -2,7 +2,6 @@
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
+11 -7
View File
@@ -385,20 +385,24 @@ namespace TBF.BenchControl.Elde.RegulValve
}
else if (opState == OpState.SettingFlow)
{
///
/// Repeated untill the required flow is reached
///
if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi))
/// Regulation valve is setting flow to the required value
if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi))
{
if (flowWithinBoundsTime++ >= regulValve.FlowStableSec)
/// Flow is within range
if (flowWithinBoundsTime++ >= regulValve.FlowStableSec)
{
if (regulValve.RegulValveCfg.StoredPositionReuse)
/// Flow is within range for sufficiently long time
if (regulValve.RegulValveCfg.StoredPositionReuse)
{
float storedPosition;
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
{
/// update the stored valve position
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
}
@@ -2,7 +2,6 @@
/// Copyright (c) 2015 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -0,0 +1,17 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Backup and security options
/// </summary>
public interface IBackupAndSecurity : IComponent
{
int MinPasswdLength { get; }
int PasswdExpirationPeriodDays { get; }
}
}
@@ -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;
@@ -9,7 +9,7 @@ namespace TBF.BenchControl.Network.Camera
/// </summary>
public class JpegFrame : RtpFrame
{
static readonly ILog log = LogManager.GetLogger(typeof(MainWnd));
static readonly ILog log = LogManager.GetLogger(typeof(TBF.UI.MainWnd));
#region Statics
@@ -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)
{
@@ -149,7 +149,11 @@ namespace TBF.BenchControl.Network.Comet.Ambient
state = State.Idle;
}
}
}
UpdateProcessData(temperature, pressure, humidity);
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
@@ -220,6 +224,13 @@ namespace TBF.BenchControl.Network.Comet.Ambient
public void StopDevice2() { }
void UpdateProcessData(float temperature, float pressure, float humidity)
{
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
}
///
/// Boxes for the operation result
///
@@ -2,7 +2,6 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -2,7 +2,6 @@
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
@@ -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)
{
@@ -721,7 +753,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)
{
@@ -296,12 +296,15 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
wrtr.Write(leftColumn[i]);
#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
#else
if (!writerCfg.EliminateSpaces)
{
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
}
wrtr.Write(separatorStr);
#endif
wrtr.WriteLine(rightColumn[i]);
}
@@ -386,7 +389,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
string horizontalLine = new String('-', totalWidth);
#if !BADGER_MALA_TRAT && !BADGER_STREDNA_TRAT && !BADGER_VELKA_TRAT
if (!writerCfg.EliminateSpaces)
#endif
{
wr.WriteLine(horizontalLine); /// Horizontal line above the header
}
@@ -413,7 +418,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
}
}
#if !BADGER_MALA_TRAT && !BADGER_STREDNA_TRAT && !BADGER_VELKA_TRAT
if (!writerCfg.EliminateSpaces)
#endif
{
wr.WriteLine(horizontalLine); /// Horizontal line between the header and the body
}
@@ -459,7 +466,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
}
}
#if !BADGER_MALA_TRAT && !BADGER_STREDNA_TRAT && !BADGER_VELKA_TRAT
if (!writerCfg.EliminateSpaces)
#endif
{
wr.WriteLine(horizontalLine); /// Horizontal line below the body
}
+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>
+4 -1
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)
+2 -1
View File
@@ -7,7 +7,8 @@ namespace TBF.BenchControl.Sequences
{
public class ProcessData
{
public static IBenchInfo BenchInfo;
public static IBackupAndSecurity BackupAndSecurity;
public static IBenchInfo BenchInfo;
public static IErrorFlags ErrorFlagsComp;
public static Output.DB.SensusOracle.Database OracleDB;
public static IList<Output.SensusTestInfo> RawTestInfos; /// Incomplete raw test infos from Oracle DB
+2 -1
View File
@@ -228,7 +228,8 @@ namespace TBF.BenchControl
foreach (var cmpnt in components)
{
if (cmpnt is Elde.ControlBoardDev) ControlBoard = cmpnt as Elde.ControlBoardDev;
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
if (cmpnt is IBackupAndSecurity) ProcessData.BackupAndSecurity = cmpnt as IBackupAndSecurity;
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
if ((cmpnt is Output.DB.SensusOracle.Database) && (ProcessData.OracleDB == null))
{
+3 -1
View File
@@ -15,7 +15,8 @@ namespace TBF.BenchControl
{
Factories = new List<IComponentFactory>();
Factories.Add(new BenchInfo.Munich.ComponentFactory());
Factories.Add(new BackupAndSecurity.Default.ComponentFactory());
Factories.Add(new BenchInfo.Munich.ComponentFactory());
Factories.Add(new BenchInfo.Extended.ComponentFactory());
Factories.Add(new BenchInfo.iPerl.ComponentFactory());
Factories.Add(new Elde.ControlBoardFactory());
@@ -55,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());
@@ -1,11 +1,10 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Text;
namespace TBF
namespace TBF.BenchControl
{
public class Telegram
{
@@ -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.ChangeFlowDirection({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);
}
}
}
@@ -7,10 +7,11 @@ using System.Windows.Forms;
using log4net;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl.TestMethods.Endurance
{
public partial class CycleDlg : Form, TBF.UiControls.IParentOfListViewEx
public partial class CycleDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(CycleDlg));
@@ -30,7 +31,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
public IList<IValve> Valves;
TBF.UiControls.ITabWithListViewEx seqStepsCtrl;
ITabWithListViewEx seqStepsCtrl;
public CycleDlg()
@@ -47,10 +48,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.Metrologists };
sharedButtons.OptionalButtons = TBF.UiControls.SharedButtons.Buttons.Add |
TBF.UiControls.SharedButtons.Buttons.Remove |
TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down;
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
SharedButtons.Buttons.Remove |
SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down;
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
@@ -59,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
sharedButtons.UpClicked += upButton_Click;
sharedButtons.DownClicked += downButton_Click;
seqStepsCtrl = new CycleStepsCtrl();
seqStepsCtrl = new CycleStepsCtrl() as ITabWithListViewEx;
/// Prepare a list of valves for the endurance test
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config));
@@ -98,7 +99,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
{
Localize();
TBF.LocalSettings ls = Program.LocalSettings;
LocalSettings ls = Program.LocalSettings;
Width = (ls.EnduranceDlgWidth > 0) ? ls.EnduranceDlgWidth : 1050;
Height = (ls.EnduranceDlgHeight > 0) ? ls.EnduranceDlgHeight : 360;
Left = (ls.EnduranceDlgLeft != 0) ? ls.EnduranceDlgLeft : 150;
@@ -177,8 +178,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
seqStepsCtrl.OkBtnClicked();
}
slctdTab = tabControl.SelectedIndex;
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Add);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Remove);
sharedButtons.EnableButtons(SharedButtons.Buttons.Add);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
RefreshAllTabs();
}
@@ -202,32 +203,32 @@ namespace TBF.BenchControl.TestMethods.Endurance
if (seqStepsCtrl != null) seqStepsCtrl.MoveDownSelected();
}
public void UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos selectedItemPos)
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.None)
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
}
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.First)
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
{
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
sharedButtons.EnableButtons(SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
}
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.Last)
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
{
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.EnableButtons(SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
}
else if (selectedItemPos == TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast)
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
{
sharedButtons.DisableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
}
else
{
sharedButtons.EnableButtons(TBF.UiControls.SharedButtons.Buttons.Up |
TBF.UiControls.SharedButtons.Buttons.Down);
sharedButtons.EnableButtons(SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
}
}
@@ -240,23 +241,23 @@ namespace TBF.BenchControl.TestMethods.Endurance
Results.Forms.ListViewEx listViewEx = sender as Results.Forms.ListViewEx;
if (listViewEx.SelectedItems.Count != 1)
{
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
else if (listViewEx.Items.Count == 1)
{
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.FirstAndLast);
UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
}
else if (listViewEx.SelectedIndices[0] == 0)
{
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.First);
UpdateButtonStates(SharedButtons.SelectedItemPos.First);
}
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
{
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Last);
UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
}
else
{
UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.Middle);
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
}
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleDlg));
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
this.tabControl = new System.Windows.Forms.TabControl();
this.sharedButtons = new TBF.UiControls.SharedButtons();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
this.mainSplitContainer.Panel1.SuspendLayout();
this.mainSplitContainer.Panel2.SuspendLayout();
@@ -86,6 +86,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
private System.Windows.Forms.SplitContainer mainSplitContainer;
private System.Windows.Forms.TabControl tabControl;
private UiControls.SharedButtons sharedButtons;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
@@ -7,10 +7,11 @@ using System.Windows.Forms;
using log4net;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl.TestMethods.Endurance
{
public partial class CycleStepsCtrl : TBF.UiControls.BaseWithListViewEx<CycleStep>, TBF.UiControls.ITabWithListViewEx
public partial class CycleStepsCtrl : BaseWithListViewEx<CycleStep>, ITabWithListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(CycleStepsCtrl));
@@ -54,13 +55,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
///
/// ListViewEx columns
///
Columns.Add(Strings.Duration_ms, 100 * parent.Dpi / PathsDlg.Dpi100pct);
//Columns.Add(Strings.Message, 100 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Duration_ms, 100 * parent.Dpi / UI.Constants.Dpi100pct);
//Columns.Add(Strings.Message, 100 * parent.Dpi / UI.Constants.Dpi100pct);
///
vCount = 0;
foreach (var vlv in parent.Valves)
{
Columns.Add(vlv.Cfg.Name, 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(vlv.Cfg.Name, 50 * parent.Dpi / UI.Constants.Dpi100pct);
vCount++;
}
@@ -256,7 +257,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
bool lastItemRemoved = base.RemoveSelected();
if (lastItemRemoved && parent != null)
{
parent.UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
}
}
@@ -174,13 +174,46 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <param name="threadID">0..3</param>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by readRequestPort(...)</returns>
public static unsafe int ReadRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int lenght, out byte[] buffer, int timeout)
public static unsafe int ReadRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer, int timeout)
{
buffer = new byte[lenght];
if (iperlHead.DebugLevel != DebugMode.Normal) return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
if (iperlHead.DebugLevel != DebugMode.Normal)
{
///
/// Simulation
///
if ((messageID == MessageID.Configuration) && (offset == 0) && (length == ConfigStruct.Length))
{
buffer = new byte[ConfigStruct.Length] { 3, 3, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0, 1,2,3,4,5, 160, 0,0,0,0, 0,0, 0,0, 0,0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStruct.Length))
{
buffer = new byte[CalibrationStruct.Length] { 3, 0, 150,10, 0, 0, 0,0, 0,0,0,0,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0, 1,2,3,4,5, 0, 0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStructV4.Length))
{
buffer = new byte[CalibrationStructV4.Length] { 3, 0, 150,10, 0, 0, 0,0, 0,0,0,0,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0, 1,2,3,4,5, 0, 0, 150,10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 2) && (length == 2))
{
buffer = new byte[2] { 150,10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 34) && (length == 2))
{
buffer = new byte[2] { 150,10 };
}
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
{
buffer = new byte[2] { 0, 0 };
}
else
{
buffer = new byte[length];
}
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
}
buffer = new byte[length];
byte[] buf = new byte[200];
///
fixed (byte* pBuf = buf)
@@ -190,32 +223,32 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
switch (threadID)
{
default:
case 0: retv = readRequestPort1(messageID, offset, lenght, pBuf, timeout); break;
case 1: retv = readRequestPort2(messageID, offset, lenght, pBuf, timeout); break;
case 2: retv = readRequestPort3(messageID, offset, lenght, pBuf, timeout); break;
case 3: retv = readRequestPort4(messageID, offset, lenght, pBuf, timeout); break;
case 0: retv = readRequestPort1(messageID, offset, length, pBuf, timeout); break;
case 1: retv = readRequestPort2(messageID, offset, length, pBuf, timeout); break;
case 2: retv = readRequestPort3(messageID, offset, length, pBuf, timeout); break;
case 3: retv = readRequestPort4(messageID, offset, length, pBuf, timeout); break;
}
for (int i = 0; i < lenght; i++) buffer[i] = buf[i];
for (int i = 0; i < length; i++) buffer[i] = buf[i];
///
/// Logging
///
string name = string.Format("{0}({1})", iperlHead.Name, iperlHead.SerialNr);
if ((messageID == MessageID.Configuration) && (offset == 0) && (lenght == ConfigStruct.Length))
if ((messageID == MessageID.Configuration) && (offset == 0) && (length == ConfigStruct.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : ConfigStruct.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 0) && (lenght == CalibrationStruct.Length))
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStruct.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : CalibrationStruct.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 0) && (lenght == CalibrationStructV4.Length))
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStructV4.Length))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : CalibrationStructV4.FromByteArray(buffer).ToString());
else if ((messageID == MessageID.Calibration) && (offset == 2) && (lenght == 2))
else if ((messageID == MessageID.Calibration) && (offset == 2) && (length == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},2,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("Cal={0}", buf[0] + 256 * buf[1]));
else if ((messageID == MessageID.Calibration) && (offset == 34) && (lenght == 2))
else if ((messageID == MessageID.Calibration) && (offset == 34) && (length == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},34,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("CalLNA={0}", buf[0] + 256 * buf[1]));
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (lenght == 2))
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1},6264,2,...) returned {2} {3}", name, messageID, retv, (retv != 0) ? "!" : string.Format("LR={0} RL={1}", (int)buf[0], (int)buf[1]));
else
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1}, {2}, {3}, ...) returned {4} {5}", name, messageID, offset, lenght, retv, (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: ReadRequestPort({1}, {2}, {3}, ...) returned {4} {5}", name, messageID, offset, length, retv, (retv != 0) ? "!" : "");
return retv;
}
@@ -227,7 +260,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <param name="threadID">0..3</param>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by writeRequestPort(...)</returns>
public static unsafe int WriteRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int lenght, byte[] buffer, int timeout)
public static unsafe int WriteRequestPort(int threadID, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer, int timeout)
{
if (iperlHead.DebugLevel != DebugMode.Normal) return 0;
@@ -238,10 +271,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
switch (threadID)
{
default:
case 0: retv = writeRequestPort1(messageID, offset, lenght, pBuf, timeout); break;
case 1: retv = writeRequestPort2(messageID, offset, lenght, pBuf, timeout); break;
case 2: retv = writeRequestPort3(messageID, offset, lenght, pBuf, timeout); break;
case 3: retv = writeRequestPort4(messageID, offset, lenght, pBuf, timeout); break;
case 0: retv = writeRequestPort1(messageID, offset, length, pBuf, timeout); break;
case 1: retv = writeRequestPort2(messageID, offset, length, pBuf, timeout); break;
case 2: retv = writeRequestPort3(messageID, offset, length, pBuf, timeout); break;
case 3: retv = writeRequestPort4(messageID, offset, length, pBuf, timeout); break;
}
Thread.Sleep(250);
@@ -250,9 +283,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Logging
///
string name = string.Format("{0}({1})", iperlHead.Name, iperlHead.SerialNr);
if (lenght == 1)
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5}) returned {1} {6}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), (retv != 0) ? "!" : "");
else if (lenght == 2)
if (length == 1)
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5}) returned {1} {6}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), (retv != 0) ? "!" : "");
else if (length == 2)
{
if (messageID == MessageID.Calibration && offset == 2)
{
@@ -265,10 +298,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidDataLogger.InfoFormat("{0}: WriteRequestPort(CalLNA={1}) returned {2} {3}", name, calibFactor, retv, (retv != 0) ? "!" : "");
}
else
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6}) returned {1} {7}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6}) returned {1} {7}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
}
else
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6} ...) returned {1} {7}", name, retv, messageID, offset, lenght, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
rfidDataLogger.InfoFormat("{0}: WriteRequestPort({2}, {3}, {4}, {5} {6} ...) returned {1} {7}", name, retv, messageID, offset, length, pBuf[0].ToString("X2"), pBuf[1].ToString("X2"), (retv != 0) ? "!" : "");
return retv;
}
@@ -7,7 +7,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class CalibrationStruct
{
public static readonly int Length = 35;
public const int Length = 35;
public Byte Version;
public MeterType MeterType;
@@ -7,7 +7,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class CalibrationStructV4
{
public static readonly int Length = 37;
public const int Length = 37;
public Byte Version;
public MeterType MeterType;
-86
View File
@@ -1,86 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TBF
{
/// <summary>
/// This static class maintains a set of text box styles at one place, it is then sufficient
/// to use the static method CustomStyle.Apply(id, textBox(es)) to apply this style to text box(es).
/// </summary>
public static class CustomStyle
{
const int setsCount = 20; /// Number of styles / attribute sets
static DockStyle[] dockStyles; /// Docking style
static System.Drawing.Color[] backColors; /// Background color
static BorderStyle[] borderStyles; /// Border style
static bool[] readOnly; /// Read only
static System.Drawing.Font[] fonts; /// Font
static CustomStyle()
{
dockStyles = new DockStyle[setsCount];
backColors = new System.Drawing.Color[setsCount];
borderStyles = new BorderStyle[setsCount];
readOnly = new bool[setsCount];
fonts = new System.Drawing.Font[setsCount];
}
/// <summary>
/// Set attributes of the set selected by 'set' parameter
/// </summary>
/// <param name="id">Attribute set ID</param>
/// <param name="dockStyle">Docking style</param>
/// <param name="backColor">Background color</param>
/// <param name="readOnly">true for read only (aka label)</param>
/// <param name="borderStyle">Border style</param>
public static void Set(int id, DockStyle dockStyle, System.Drawing.Color backColor, BorderStyle borderStyle, bool readOnly, System.Drawing.Font font)
{
if (id < 0 || id >= setsCount) return;
CustomStyle.dockStyles[id] = dockStyle;
CustomStyle.backColors[id] = backColor;
CustomStyle.borderStyles[id] = borderStyle;
CustomStyle.readOnly[id] = readOnly;
CustomStyle.fonts[id] = font;
}
/// <summary>
/// Apply one of the attribute sets to a TextBox instance
/// </summary>
public static void Apply(int id, TextBox textBox)
{
if (id < 0 || id >= setsCount) return;
textBox.Dock = dockStyles[id];
textBox.BackColor = backColors[id];
textBox.BorderStyle = borderStyles[id];
textBox.ReadOnly = readOnly[id];
textBox.Font = fonts[id];
}
/// <summary>
/// Apply one of the attribute sets to a AttachedTextBoxes text boxes
/// </summary>
public static void Apply(int id, AttachedTextBoxes textBoxes)
{
if (id < 0 || id >= setsCount) return;
for (int i = 0; i < textBoxes.Count; i++)
{
textBoxes[i].Dock = dockStyles[id];
textBoxes[i].BackColor = backColors[id];
textBoxes[i].BorderStyle = borderStyles[id];
textBoxes[i].ReadOnly = readOnly[id];
textBoxes[i].Font = fonts[id];
}
}
}
}
-34
View File
@@ -1,34 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using TBF.Forms;
using TBF.Resources;
namespace TBF.ErrorHandler {
public static class ErrorHandler
{
public static DialogResult HandleError(Exception e, string Message, string Origin)
{
//catch (FluentNHibernate.Cfg.FluentConfigurationException fe)
// {
// string message;
// if (fe.InnerException != null)
// {
// message = fe.InnerException.Message;
// }
// else
// {
// message = fe.Message;
// }
// MessageBox.Show( message, "RetVal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
ErrorDlg dlg = new ErrorDlg(Strings.Unhandled_error_occured_in_ + Origin + Environment.NewLine + Message + Environment.NewLine + e.ToString() + Environment.NewLine + e.InnerException.ToString());
dlg.ShowDialog();
return dlg.returnvalue;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB

+8 -8
View File
@@ -9,7 +9,7 @@ using log4net;
using Config.Entities;
using Users;
using TBF.Resources;
using TBF.Forms;
using TBF.UI.Shared;
namespace TBF
{
@@ -54,7 +54,7 @@ namespace TBF
/// <summary>
/// Main window object.
/// </summary>
public static MainWnd MainWnd;
public static UI.MainWnd MainWnd;
/// <summary>
@@ -207,9 +207,9 @@ namespace TBF
log.Warn("No test benches in the local configuration -> display an appropriate dialog.");
/// Ask what to do, ask for the password, open 'DatabaseSetingsDlg' and continue on OK
if ((new Forms.NoBenchOrDatabaseDlg { Message = Strings.NoBenchMsg }.ShowDialog() != DialogResult.OK) ||
if ((new NoBenchOrDatabaseDlg { Message = Strings.NoBenchMsg }.ShowDialog() != DialogResult.OK) ||
(new Users.Forms.LoginDlg(true).ShowDialog() == DialogResult.Cancel) ||
(new BenchesDlg().ShowDialog() == DialogResult.Cancel))
(new TBF.UI.Settings.BenchesDlg().ShowDialog() == DialogResult.Cancel))
{
return; /// Exit program
}
@@ -391,7 +391,7 @@ namespace TBF
}
/// Ask what to do
switch ((new Forms.NoBenchOrDatabaseDlg { Message = Strings.NoDatabaseMsg, ShowRetry = true }).ShowDialog())
switch ((new NoBenchOrDatabaseDlg { Message = Strings.NoDatabaseMsg, ShowRetry = true }).ShowDialog())
{
case DialogResult.Abort:
return; /// Exit program
@@ -400,13 +400,13 @@ namespace TBF
break; /// Retry connection to the database, stay inside the loop
case DialogResult.Yes:
new UpgradeSelectionDlg().ShowDialog();
new TBF.UI.Settings.UpgradeSelectionDlg().ShowDialog();
break; /// Stay inside the loop
default:
/// Open 'DatabaseSetingsDlg' and retry DB connect on OK
if (new Users.Forms.LoginDlg(true).ShowDialog() == DialogResult.Cancel ||
new BenchesDlg().ShowDialog() == DialogResult.Cancel)
new TBF.UI.Settings.BenchesDlg().ShowDialog() == DialogResult.Cancel)
{
return; /// Exit program
}
@@ -444,7 +444,7 @@ namespace TBF
{
/// Open the main application window
log.Info("Creating the main window");
MainWnd = new MainWnd();
MainWnd = new UI.MainWnd();
log.Info("Opening the main window");
Application.Run(MainWnd);
log.Info("The main window was closed");
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("TestBenchFramework")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1303.0")]
[assembly: AssemblyFileVersion("2.18.1303.0")]
[assembly: AssemblyVersion("2.18.1950.0")]
[assembly: AssemblyFileVersion("2.18.1950.0")]
+45
View File
@@ -879,6 +879,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Conditions.
/// </summary>
internal static string Conditions {
get {
return ResourceManager.GetString("Conditions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Configuration.
/// </summary>
@@ -1329,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>
@@ -2832,6 +2850,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to No info available.
/// </summary>
internal static string No_info_available {
get {
return ResourceManager.GetString("No_info_available", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No results to print.
/// </summary>
@@ -5481,6 +5508,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Uncertainty.
/// </summary>
internal static string Uncertainty {
get {
return ResourceManager.GetString("Uncertainty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Uncertainty [%].
/// </summary>
@@ -5526,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>
+2 -2
View File
@@ -472,7 +472,7 @@
<value>Wybór metody sprawdzania</value>
</data>
<data name="Metrological_class" xml:space="preserve">
<value>Klasa metrologiczna</value>
<value>Klasa obciążeń</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Legalizator</value>
@@ -634,7 +634,7 @@
<value>Procedura</value>
</data>
<data name="Procedures" xml:space="preserve">
<value>Procedury</value>
<value>Wodomierzy</value>
</data>
<data name="Producer" xml:space="preserve">
<value>Producent</value>
+15
View File
@@ -2053,4 +2053,19 @@
<data name="Program_must_be_closed" xml:space="preserve">
<value>Program must be closed.</value>
</data>
<data name="Conditions" xml:space="preserve">
<value>Conditions</value>
</data>
<data name="Uncertainty" xml:space="preserve">
<value>Uncertainty</value>
</data>
<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>
-208
View File
@@ -1,208 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Screens
{
partial class MeasurementTabPageCtrl
{
/// <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 Component 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.measurementLabel5 = new System.Windows.Forms.Label();
this.measurementLabel4 = new System.Windows.Forms.Label();
this.measurementLabel3 = new System.Windows.Forms.Label();
this.measurementLabel2 = new System.Windows.Forms.Label();
this.measurementLabel = new System.Windows.Forms.Label();
this.measurementTableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.measurementTableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.measurementTableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.measurementTableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.SuspendLayout();
//
// measurementLabel5
//
this.measurementLabel5.AutoSize = true;
this.measurementLabel5.Font = new System.Drawing.Font("Verdana", 11.25F);
this.measurementLabel5.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.measurementLabel5.Location = new System.Drawing.Point(471, 136);
this.measurementLabel5.Name = "measurementLabel5";
this.measurementLabel5.Size = new System.Drawing.Size(74, 18);
this.measurementLabel5.TabIndex = 17;
this.measurementLabel5.Text = "Time Bar";
//
// measurementLabel4
//
this.measurementLabel4.AutoSize = true;
this.measurementLabel4.Font = new System.Drawing.Font("Verdana", 11.25F);
this.measurementLabel4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.measurementLabel4.Location = new System.Drawing.Point(328, 136);
this.measurementLabel4.Name = "measurementLabel4";
this.measurementLabel4.Size = new System.Drawing.Size(74, 18);
this.measurementLabel4.TabIndex = 16;
this.measurementLabel4.Text = "Time Bar";
//
// measurementLabel3
//
this.measurementLabel3.AutoSize = true;
this.measurementLabel3.Font = new System.Drawing.Font("Verdana", 11.25F);
this.measurementLabel3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.measurementLabel3.Location = new System.Drawing.Point(484, 164);
this.measurementLabel3.Name = "measurementLabel3";
this.measurementLabel3.Size = new System.Drawing.Size(45, 18);
this.measurementLabel3.TabIndex = 15;
this.measurementLabel3.Text = "Total";
//
// measurementLabel2
//
this.measurementLabel2.AutoSize = true;
this.measurementLabel2.Font = new System.Drawing.Font("Verdana", 11.25F);
this.measurementLabel2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.measurementLabel2.Location = new System.Drawing.Point(323, 164);
this.measurementLabel2.Name = "measurementLabel2";
this.measurementLabel2.Size = new System.Drawing.Size(87, 18);
this.measurementLabel2.TabIndex = 14;
this.measurementLabel2.Text = "Actual test";
//
// measurementLabel
//
this.measurementLabel.AutoSize = true;
this.measurementLabel.Font = new System.Drawing.Font("Verdana", 11.25F);
this.measurementLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.measurementLabel.Location = new System.Drawing.Point(639, 514);
this.measurementLabel.Name = "measurementLabel";
this.measurementLabel.Size = new System.Drawing.Size(108, 18);
this.measurementLabel.TabIndex = 13;
this.measurementLabel.Text = "Target values";
//
// measurementTableLayoutPanel4
//
this.measurementTableLayoutPanel4.ColumnCount = 3;
this.measurementTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.measurementTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.measurementTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.measurementTableLayoutPanel4.Location = new System.Drawing.Point(642, 544);
this.measurementTableLayoutPanel4.Name = "measurementTableLayoutPanel4";
this.measurementTableLayoutPanel4.RowCount = 4;
this.measurementTableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.measurementTableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.measurementTableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.measurementTableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.measurementTableLayoutPanel4.Size = new System.Drawing.Size(216, 101);
this.measurementTableLayoutPanel4.TabIndex = 12;
//
// measurementTableLayoutPanel3
//
this.measurementTableLayoutPanel3.ColumnCount = 3;
this.measurementTableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
this.measurementTableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
this.measurementTableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34F));
this.measurementTableLayoutPanel3.Location = new System.Drawing.Point(521, 11);
this.measurementTableLayoutPanel3.Name = "measurementTableLayoutPanel3";
this.measurementTableLayoutPanel3.RowCount = 2;
this.measurementTableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.measurementTableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.measurementTableLayoutPanel3.Size = new System.Drawing.Size(348, 55);
this.measurementTableLayoutPanel3.TabIndex = 11;
//
// measurementTableLayoutPanel2
//
this.measurementTableLayoutPanel2.ColumnCount = 2;
this.measurementTableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.measurementTableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.measurementTableLayoutPanel2.Location = new System.Drawing.Point(11, 245);
this.measurementTableLayoutPanel2.Name = "measurementTableLayoutPanel2";
this.measurementTableLayoutPanel2.RowCount = 12;
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel2.Size = new System.Drawing.Size(177, 303);
this.measurementTableLayoutPanel2.TabIndex = 10;
//
// measurementTableLayoutPanel1
//
this.measurementTableLayoutPanel1.ColumnCount = 3;
this.measurementTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.measurementTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.measurementTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.measurementTableLayoutPanel1.Location = new System.Drawing.Point(11, 21);
this.measurementTableLayoutPanel1.Name = "measurementTableLayoutPanel1";
this.measurementTableLayoutPanel1.RowCount = 7;
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.measurementTableLayoutPanel1.Size = new System.Drawing.Size(283, 183);
this.measurementTableLayoutPanel1.TabIndex = 9;
//
// MeasurementTabPageCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(180)))), ((int)(((byte)(200)))));
this.Controls.Add(this.measurementLabel5);
this.Controls.Add(this.measurementLabel4);
this.Controls.Add(this.measurementLabel3);
this.Controls.Add(this.measurementLabel2);
this.Controls.Add(this.measurementLabel);
this.Controls.Add(this.measurementTableLayoutPanel4);
this.Controls.Add(this.measurementTableLayoutPanel3);
this.Controls.Add(this.measurementTableLayoutPanel2);
this.Controls.Add(this.measurementTableLayoutPanel1);
this.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "MeasurementTabPageCtrl";
this.Size = new System.Drawing.Size(900, 689);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.measurement_Paint);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label measurementLabel5;
private System.Windows.Forms.Label measurementLabel4;
private System.Windows.Forms.Label measurementLabel3;
private System.Windows.Forms.Label measurementLabel2;
private System.Windows.Forms.Label measurementLabel;
private System.Windows.Forms.TableLayoutPanel measurementTableLayoutPanel4;
private System.Windows.Forms.TableLayoutPanel measurementTableLayoutPanel3;
private System.Windows.Forms.TableLayoutPanel measurementTableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel measurementTableLayoutPanel1;
}
}
-183
View File
@@ -1,183 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using TBF.UiBridge;
namespace TBF.Screens
{
public partial class MeasurementTabPageCtrl : UserControl
{
static readonly ILog log = LogManager.GetLogger(typeof(MeasurementTabPageCtrl));
AttachedTextBoxes measurementTbl1Row1; /// Table 1
AttachedTextBoxes measurementTbl1Col1;
AttachedTextBoxes measurementTbl1Col2;
AttachedTextBoxes measurementTbl1Col3;
AttachedTextBoxes measurementTbl2Row1; /// Table 2
AttachedTextBoxes measurementTbl2Col1;
AttachedTextBoxes measurementTbl2Col2;
AttachedTextBoxes measurementTbl3Row1; /// Table 3
AttachedTextBoxes measurementTbl3Row2;
AttachedTextBoxes measurementTbl4Col1;
AttachedTextBoxes measurementTbl4Col2;
AttachedTextBoxes measurementTbl4Col3;
BarGraph measurementBar1;
BarGraph measurementBar2;
public MeasurementTabPageCtrl()
{
InitializeComponent();
//Bridge.TestSelectedHandler += delegate(object sender, TestSelectedEventArgs args)
//{
// if (InvokeRequired)
// {
// Invoke(new EventHandler<TestSelectedEventArgs>(OnTestSelected), sender, args);
// }
// else OnTestSelected(sender, args);
//};
//Bridge.TestProgressHandler += delegate(object sender, TestProgressEventArgs args)
//{
// if (InvokeRequired)
// {
// Invoke(new EventHandler<TestProgressEventArgs>(OnTestProgress), sender, args);
// }
// else OnTestProgress(sender, args);
//};
//Bridge.TestCompletedHandler += delegate(object sender, TestCompletedEventArgs args)
//{
// if (InvokeRequired)
// {
// Invoke(new EventHandler<TestCompletedEventArgs>(OnTestCompleted), sender, args);
// }
// else OnTestCompleted(sender, args);
//};
Init();
}
private void Init()
{
measurementTbl1Row1 = new AttachedTextBoxes(measurementTableLayoutPanel1, Arrangement.RowOfStrings, 1, 0, 2);
measurementTbl1Col1 = new AttachedTextBoxes(measurementTableLayoutPanel1, Arrangement.ColumnOfStrings, 0, 1, 6);
measurementTbl1Col2 = new AttachedTextBoxes(measurementTableLayoutPanel1, Arrangement.ColumnOfDoubles, 1, 1, 6);
measurementTbl1Col3 = new AttachedTextBoxes(measurementTableLayoutPanel1, Arrangement.ColumnOfDoubles, 2, 1, 6);
measurementTbl2Row1 = new AttachedTextBoxes(measurementTableLayoutPanel2, Arrangement.RowOfStrings, 1, 0, 1);
measurementTbl2Col1 = new AttachedTextBoxes(measurementTableLayoutPanel2, Arrangement.ColumnOfStrings, 0, 1, 11);
measurementTbl2Col2 = new AttachedTextBoxes(measurementTableLayoutPanel2, Arrangement.ColumnOfDoubles, 1, 1, 11);
measurementTbl3Row1 = new AttachedTextBoxes(measurementTableLayoutPanel3, Arrangement.RowOfStrings, 0, 0, 3);
measurementTbl3Row2 = new AttachedTextBoxes(measurementTableLayoutPanel3, Arrangement.RowOfDoubles, 0, 1, 3);
measurementTbl4Col1 = new AttachedTextBoxes(measurementTableLayoutPanel4, Arrangement.ColumnOfStrings, 0, 0, 4);
measurementTbl4Col2 = new AttachedTextBoxes(measurementTableLayoutPanel4, Arrangement.ColumnOfDoubles, 1, 0, 4);
measurementTbl4Col3 = new AttachedTextBoxes(measurementTableLayoutPanel4, Arrangement.ColumnOfStrings, 2, 0, 4);
CustomStyle.Apply(1, measurementTbl1Row1);
CustomStyle.Apply(1, measurementTbl1Col1);
CustomStyle.Apply(1, measurementTbl1Col2);
CustomStyle.Apply(1, measurementTbl1Col3);
CustomStyle.Apply(1, measurementTbl2Row1);
CustomStyle.Apply(1, measurementTbl2Col1);
CustomStyle.Apply(1, measurementTbl2Col2);
CustomStyle.Apply(1, measurementTbl3Row1);
CustomStyle.Apply(1, measurementTbl3Row2);
CustomStyle.Apply(1, measurementTbl4Col1);
CustomStyle.Apply(1, measurementTbl4Col2);
CustomStyle.Apply(1, measurementTbl4Col3);
measurementTbl1Row1.SetData(0, "Vmer");
measurementTbl1Row1.SetData(1, "Emer");
for (int i = 0; i < Config.Data.WMsCount; i++) measurementTbl1Col1.SetData(i, "Meter" + (i + 1).ToString());
measurementTbl2Row1.SetData(0, "Ergebnise");
measurementTbl2Col1.SetData(0, "IMP");
measurementTbl2Col1.SetData(1, "Zeit");
measurementTbl2Col1.SetData(2, "V_etn");
measurementTbl2Col1.SetData(3, "Temp up");
measurementTbl2Col1.SetData(4, "Temp dn");
measurementTbl2Col1.SetData(5, "T Kl");
measurementTbl2Col1.SetData(6, "Druck up");
measurementTbl2Col1.SetData(7, "Druck dn");
measurementTbl2Col1.SetData(8, "Durchfl. act");
measurementTbl2Col1.SetData(9, "Zeit Kl in");
measurementTbl2Col1.SetData(10, "Zeit Kl out");
measurementTbl3Row1.SetData(0, "Temp. Luft");
measurementTbl3Row1.SetData(1, "Druck Luft");
measurementTbl3Row1.SetData(2, "Humi. Luft");
measurementTbl4Col1.SetData(0, "Durchfl. Tar Min");
measurementTbl4Col1.SetData(1, "Durchfl. Tar Max");
measurementTbl4Col1.SetData(2, "Volumen Tar");
measurementTbl4Col1.SetData(3, "Dauer");
//measurementTbl4Col2.SetData(0, 1.5);
//measurementTbl4Col2.SetData(1, 1.65);
//measurementTbl4Col2.SetData(2, 50);
//measurementTbl4Col2.SetData(3, 114.29);
measurementTbl4Col3.SetData(0, "m3/h");
measurementTbl4Col3.SetData(1, "m3/h");
measurementTbl4Col3.SetData(2, "l");
measurementTbl4Col3.SetData(3, "s");
measurementBar1 = new BarGraph(this, 320, 200, 100, 400, Color.DarkBlue, Color.WhiteSmoke);
measurementBar2 = new BarGraph(this, 470, 200, 100, 400, Color.DarkBlue, Color.WhiteSmoke);
}
private void measurement_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
if (measurementBar1 != null) measurementBar1.Paint(g);
if (measurementBar2 != null) measurementBar2.Paint(g);
g.DrawRectangle(new Pen(Color.Black, 2.0F), 500, -2, 402, 80);
g.DrawRectangle(new Pen(Color.Black, 2.0F), 620, 500, 282, 250);
}
public void OnTestSelected(object sender, TestSelectedEventArgs data)
{
measurementTbl4Col2.SetData(0, data.Test.Qfrom.ToString("F2"));
measurementTbl4Col2.SetData(1, data.Test.Qto.ToString("F2"));
measurementTbl4Col2.SetData(2, data.Test.Volume.ToString("F1"));
measurementTbl4Col2.SetData(3, data.Test.TstTime.ToString("F1"));
}
public void OnTestProgress(object sender, TestProgressEventArgs data)
{
/// TODO: Reimplement
//if (data.TestResult != null)
//{
// int count = Math.Min(Config.Data.WMsCount, data.TestResult.Meters.Count);
// for (int i = 0; i < count; i++)
// {
// measurementTbl1Col2.SetData(i, data.TestResult.Meters[i].VolumeMeter.ToString("F1"));
// measurementTbl1Col3.SetData(i, data.TestResult.Meters[i].VolumeErrorPct.ToString("F1"));
// }
//}
//measurementTbl2Col2.SetData(0, data.RefPulses);
//measurementTbl2Col2.SetData(1, data.Time.ToString("F1"));
//measurementTbl2Col2.SetData(3, data.Tin.ToString());
//measurementTbl2Col2.SetData(4, data.Tout.ToString());
//measurementTbl2Col2.SetData(5, data.Tdiv.ToString());
//measurementTbl2Col2.SetData(6, data.Pin.ToString());
//measurementTbl2Col2.SetData(7, data.Pout.ToString());
//measurementTbl2Col2.SetData(8, data.Flow.ToString());
//measurementTbl3Row2.SetData(0, data.AmbientTemp.ToString());
//measurementTbl3Row2.SetData(1, data.AmbientPressure.ToString());
//measurementTbl3Row2.SetData(2, data.AmbientHumidity.ToString());
//measurementBar1.FValue = data.Progress;
}
public void OnTestCompleted(object sender, TestCompletedEventArgs data)
{
}
}
}
+577 -622
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF
namespace TBF.UI.Bench.Components
{
partial class ComponentsManagerDlg
{
@@ -33,8 +33,8 @@ namespace TBF
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComponentsManagerDlg));
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.listViewEx = new Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UiControls.SharedButtons();
this.listViewEx = new global::Results.Forms.ListViewEx();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@@ -68,7 +68,7 @@ namespace TBF
this.listViewEx.Name = "listViewEx";
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SubItemRightClicked += new Results.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
this.listViewEx.SubItemRightClicked += new global::Results.Forms.SubItemEventHandler(this.listViewEx_SubItemRightClicked);
this.listViewEx.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx_ColumnClick);
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.componentsListView_SelectedIndexChanged);
this.listViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewEx_MouseDoubleClick);
@@ -96,8 +96,8 @@ namespace TBF
#endregion
private Results.Forms.ListViewEx listViewEx;
private global::Results.Forms.ListViewEx listViewEx;
private System.Windows.Forms.SplitContainer splitContainer;
private UiControls.SharedButtons sharedButtons;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}

Some files were not shown because too many files have changed in this diff Show More