Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0468b5a1f5 | ||
|
|
fd6f305f95 | ||
|
|
2ca9c104d2 | ||
|
|
994568799d | ||
|
|
7f8a5c83ed | ||
|
|
99b68f1dd6 | ||
|
|
604c59723f | ||
|
|
886d87c03d | ||
|
|
d4eb52d70e | ||
|
|
e2650736cd | ||
|
|
77b71d5a7d | ||
|
|
bd65ff5420 | ||
|
|
0449c38de2 | ||
|
|
eb6f76d6f5 | ||
|
|
6fdb030b9f | ||
|
|
6079c8419f | ||
|
|
ef6f21eb9e | ||
|
|
50db69e5cb | ||
|
|
9194871508 | ||
|
|
5dde27bad9 | ||
|
|
e61e5c59cb | ||
|
|
ff3118068d | ||
|
|
c3d5e157ec | ||
|
|
ef5320917a | ||
|
|
e37dd87ece | ||
|
|
128d71bcd8 | ||
|
|
da220f4e7f | ||
|
|
2d42ae95f8 | ||
|
|
e0af6a5c20 | ||
|
|
838ec17b29 | ||
|
|
b2b0be4097 | ||
|
|
142da5cbec |
@@ -29,5 +29,6 @@ Users/obj/
|
||||
UserManagement/bin/
|
||||
UserManagement/obj/
|
||||
Doc/
|
||||
.vs/
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</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;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -87,6 +87,7 @@
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
<Compile Include="Entities\TransitionSequence.cs" />
|
||||
<Compile Include="Entities\TransitionStep.cs" />
|
||||
<Compile Include="Entities\Uncertainty.cs" />
|
||||
<Compile Include="Entities\User.cs" />
|
||||
<Compile Include="Entities\VirtualBenchSequence.cs" />
|
||||
<Compile Include="Entities\VirtualBenchStep.cs" />
|
||||
@@ -108,6 +109,7 @@
|
||||
<Compile Include="Mappings\TestMap.cs" />
|
||||
<Compile Include="Mappings\TransitionSequenceMap.cs" />
|
||||
<Compile Include="Mappings\TransitionStepMap.cs" />
|
||||
<Compile Include="Mappings\UncertaintyMap.cs" />
|
||||
<Compile Include="Mappings\UserMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
@@ -19,6 +18,7 @@ namespace Config.Entities
|
||||
public virtual LogLevel Logging { get; set; }
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual IList<MeasurementCorrection> Corrections { get; set; }
|
||||
public virtual IList<Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Config.Entities
|
||||
Name = string.Empty;
|
||||
ClassName = string.Empty;
|
||||
Corrections = new List<MeasurementCorrection>();
|
||||
Uncertainties = new List<Uncertainty>();
|
||||
}
|
||||
|
||||
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace Config.Entities
|
||||
public virtual string RelTransAfter { get; set; }
|
||||
public virtual string TransitionAfter { get; set; }
|
||||
|
||||
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
|
||||
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
|
||||
|
||||
public virtual IList<ComponentTest> MoreParams { get; set; }
|
||||
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Uncertainty
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float MainUncertainty { get; set; }
|
||||
public virtual float Resolution { get; set; }
|
||||
public virtual float DriftPerYr { get; set; }
|
||||
public virtual float Conditions { get; set; }
|
||||
public virtual float UncertaintyOfCorrection { get; set; }
|
||||
|
||||
public Uncertainty() { }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -23,6 +23,9 @@ namespace Config.Mappings
|
||||
HasMany(x => x.Corrections)
|
||||
.OrderBy("Measurement")
|
||||
.Cascade.All();
|
||||
}
|
||||
HasMany(x => x.Uncertainties)
|
||||
.OrderBy("Measurement")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class UncertaintyMap : ClassMap<Uncertainty>
|
||||
{
|
||||
public UncertaintyMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Measurement);
|
||||
Map(x => x.MainUncertainty);
|
||||
Map(x => x.Resolution);
|
||||
Map(x => x.DriftPerYr);
|
||||
Map(x => x.Conditions);
|
||||
Map(x => x.UncertaintyOfCorrection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -12,7 +12,12 @@ 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.Password2);
|
||||
Map(x => x.Password3);
|
||||
Map(x => x.FullName).Column("Description");
|
||||
Map(x => x.LastPwChange);
|
||||
HasMany(x => x.Groups)
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1273.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1273.0")]
|
||||
[assembly: AssemblyVersion("2.24.1315.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1315.0")]
|
||||
|
||||
+10
-2
@@ -85,7 +85,15 @@ namespace Config
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a database name from a MySQL connection string.
|
||||
/// Extract and return a DB server from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBServer(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a DB name from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBName(string connectionString)
|
||||
{
|
||||
@@ -105,7 +113,7 @@ namespace Config
|
||||
/// </summary>
|
||||
public static string GetDBPassword(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=" });
|
||||
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -528,6 +528,12 @@ namespace Results.Entities
|
||||
return NokColor;
|
||||
}
|
||||
}
|
||||
else if (Disabled)
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
message = Strings.This_position_is_disabled;
|
||||
return NotCompletedColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
|
||||
+194
-298
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
@@ -18,43 +13,33 @@ namespace Results.Forms
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
|
||||
|
||||
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
bool loaded;
|
||||
|
||||
///
|
||||
/// Public members
|
||||
///
|
||||
public Results.BatchResults Results;
|
||||
public IList<Results.WMeterRsltItemSpec> Items;
|
||||
public MetersArrangement MetersArrangement;
|
||||
public TestsArrangement TestsArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
|
||||
public int[] RsltsClmnWidths { set { rsltsClmnWidths = value; } }
|
||||
|
||||
public bool ShowDisabledPositions;
|
||||
public int MinWidth;
|
||||
public int MinHeight;
|
||||
public int PopupResultsLeft;
|
||||
public int PopupResultsTop;
|
||||
public int PopupResultsWidth;
|
||||
public int PopupResultsHeight;
|
||||
public int[] RsltsClmnWidths;
|
||||
|
||||
public Results.BatchResults Results { set { Display(value); } }
|
||||
|
||||
///
|
||||
/// Private members
|
||||
///
|
||||
Results.BatchResults results;
|
||||
MetersKind metersKind;
|
||||
|
||||
OneWMResultsCtrl firstListView;
|
||||
public int[] rsltsClmnWidths;
|
||||
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
|
||||
|
||||
int lvWidth;
|
||||
int lvHeight;
|
||||
|
||||
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results.
|
||||
IOneWMResultsCtrl firstEnabledControl;
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
int metersInOneGroup;
|
||||
int nrGroups;
|
||||
|
||||
Timer timer;
|
||||
|
||||
@@ -62,310 +47,193 @@ namespace Results.Forms
|
||||
public BatchResultsDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Strings.Results;
|
||||
|
||||
firstEnabledControl = null;
|
||||
lastSizeChange = DateTime.Now;
|
||||
nrGroups = 1;
|
||||
metersInOneGroup = 1;
|
||||
|
||||
// Create a timer with a ten second interval.
|
||||
/// Create a timer with one second interval.
|
||||
timer = new Timer();
|
||||
timer.Interval = 500; /// ms
|
||||
timer.Interval = 1000; /// ms
|
||||
timer.Tick += new EventHandler(OnTimer);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void BatchResultsDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsHeight != 0) Height = PopupResultsHeight;
|
||||
|
||||
loaded = true;
|
||||
if (results != null) Redraw();
|
||||
}
|
||||
|
||||
public void Display(Results.BatchResults results)
|
||||
{
|
||||
this.results = results;
|
||||
if (loaded) Redraw();
|
||||
CreateControlsAndFillPanel(Results);
|
||||
UpdateColumnWidths(RsltsClmnWidths);
|
||||
UpdateResults(Results);
|
||||
}
|
||||
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
|
||||
///
|
||||
/// Handle double-click inside a water meter results control
|
||||
///
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
IList<Results.WMeterRsltItemSpec> srcItems;
|
||||
switch (metersKind)
|
||||
if (Results.WaterMeters != null && args.WMPosition > 0)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
|
||||
foreach (var wm in Results.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && (wm.WMPosition == args.WMPosition))
|
||||
{
|
||||
ShowMoreWMResults(wm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
|
||||
foreach (var it in srcItems) copiedItems.Add(it.Clone());
|
||||
return copiedItems;
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void UpdateColumnWidths(int[] columnWidths)
|
||||
{
|
||||
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
|
||||
}
|
||||
|
||||
void UpdateScrollpositions(int scrollStart)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Re-draw the results. Apply new settings if they changed.
|
||||
/// </summary>
|
||||
public void Redraw()
|
||||
void CreateControlsAndFillPanel(Results.BatchResults results)
|
||||
{
|
||||
lastRedraw = DateTime.Now;
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
try
|
||||
if ((results == null) || (results.WMPositionsCount == 0))
|
||||
{
|
||||
/// Determine how many water meters were enabled for result evaluation and printing
|
||||
int enabledWMsCount = 0;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
enabledWMsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
|
||||
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
|
||||
lvHeight = flowLayoutPanel.Height / nrGroups - 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
lvWidth = flowLayoutPanel.Width / nrGroups - 6;
|
||||
lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
|
||||
}
|
||||
/// There are no water meters at all
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
bool first = true;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
OneWMResultsCtrl lview = (TestsArrangement == TestsArrangement.Rows)
|
||||
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
|
||||
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (lview != null)
|
||||
{
|
||||
flowLayoutPanel.Controls.Add(lview);
|
||||
if (first)
|
||||
{
|
||||
firstListView = lview;
|
||||
first = false;
|
||||
}
|
||||
|
||||
lview.WMResultsClickedHandler += delegate(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), sender, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(sender, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.FatalFormat("Redrawing results failed : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
|
||||
}
|
||||
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get an empty ListView control with appropriate parameters.
|
||||
/// </summary>
|
||||
/// <returns>ListView control</returns>
|
||||
OneWMResultsCtrl GetListView(Color backColor, Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight, wm);
|
||||
}
|
||||
///
|
||||
OneWMResultsCtrl GetListView(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return GetListView(Color.White, wm);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message = string.Empty;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
#if ORACLE_DB
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lview.Columns.Add(item.Caption, (rsltsClmnCount > col) ? rsltsClmnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
#if ORACLE_DB
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int i = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if ( args.WM == null || args.WM.Disabled)
|
||||
{
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
|
||||
firstEnabledControl = null;
|
||||
return;
|
||||
}
|
||||
else if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(args.WM.SerialNr))
|
||||
|
||||
///
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedControlsCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg( args.WM, null).ShowDialog();
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
displayedControlsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Calculate geometry
|
||||
///
|
||||
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
|
||||
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
///
|
||||
/// Create controls and fill the FlowLayoutPanel
|
||||
///
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
|
||||
int ix = 0;
|
||||
firstEnabledControl = null;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
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;
|
||||
wmRsltsCtrl[ix].Update(Items);
|
||||
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(s, args);
|
||||
}
|
||||
};
|
||||
|
||||
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
|
||||
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
|
||||
ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
|
||||
lastRedraw = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
void UpdateResults(Results.BatchResults batchResults)
|
||||
{
|
||||
if ((batchResults != null) && (batchResults.WaterMeters != null))
|
||||
{
|
||||
int ctrlIx = 0;
|
||||
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
|
||||
{
|
||||
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ShowMoreWMResults(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
|
||||
{
|
||||
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == args.WM.SerialNr))
|
||||
.Where(x => (x.Code == wm.SerialNr))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
for (int i = 0; i < refRecords.Count; i++)
|
||||
@@ -391,7 +259,7 @@ namespace Results.Forms
|
||||
}
|
||||
}
|
||||
|
||||
new Results.Forms.MoreWMResultsDlg(args.WM, refRecords).ShowDialog();
|
||||
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,6 +273,7 @@ namespace Results.Forms
|
||||
PopupResultsHeight = Height;
|
||||
}
|
||||
|
||||
|
||||
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
lastSizeChange = DateTime.Now;
|
||||
@@ -414,13 +283,40 @@ namespace Results.Forms
|
||||
{
|
||||
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
|
||||
{
|
||||
/// The last size change was later then the last redraw
|
||||
/// The last size change was more recent then the last redraw
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
|
||||
{
|
||||
/// More then 1s since the last size change
|
||||
Redraw();
|
||||
/// More then 1 second since the last panel size change
|
||||
|
||||
/// Calculate geometry
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public interface IOneWMResultsCtrl
|
||||
{
|
||||
event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
|
||||
bool Disabled { get; } /// true when water meter position is disabled
|
||||
int WMPosition { get; } /// 1-based WM position
|
||||
int Width { get; set; } /// Control width
|
||||
int Height { get; set; } /// Control height
|
||||
ListView.ColumnHeaderCollection Columns { get; } /// Embedded ListView control columns
|
||||
|
||||
void Update(int[] columnWidths);
|
||||
void Update(IList<Results.WMeterRsltItemSpec> items);
|
||||
void Update(Results.Entities.WaterMeter wMtr);
|
||||
}
|
||||
}
|
||||
+11
-24
@@ -29,15 +29,13 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.allResultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.graphsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.messageLabel = new System.Windows.Forms.Label();
|
||||
this.tracingResultsListView = new System.Windows.Forms.ListView();
|
||||
this.oneWMResultsCtrl = new Results.Forms.OneWMResultsCtrl();
|
||||
this.allResultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.allResultsTabPage.SuspendLayout();
|
||||
this.productionTracingTabPage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
|
||||
this.productionTracingSplitContainer.Panel1.SuspendLayout();
|
||||
@@ -57,17 +55,6 @@
|
||||
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// allResultsTabPage
|
||||
//
|
||||
this.allResultsTabPage.Controls.Add(this.oneWMResultsCtrl);
|
||||
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.allResultsTabPage.Name = "allResultsTabPage";
|
||||
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.allResultsTabPage.TabIndex = 0;
|
||||
this.allResultsTabPage.Text = "All results";
|
||||
this.allResultsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// graphsTabPage
|
||||
//
|
||||
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
@@ -133,14 +120,15 @@
|
||||
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// oneWMResultsCtrl
|
||||
// allResultsTabPage
|
||||
//
|
||||
this.oneWMResultsCtrl.Caption = "";
|
||||
this.oneWMResultsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.oneWMResultsCtrl.Location = new System.Drawing.Point(3, 3);
|
||||
this.oneWMResultsCtrl.Name = "oneWMResultsCtrl";
|
||||
this.oneWMResultsCtrl.Size = new System.Drawing.Size(1181, 416);
|
||||
this.oneWMResultsCtrl.TabIndex = 0;
|
||||
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.allResultsTabPage.Name = "allResultsTabPage";
|
||||
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.allResultsTabPage.TabIndex = 0;
|
||||
this.allResultsTabPage.Text = "All results";
|
||||
this.allResultsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MoreWMResultsDlg
|
||||
//
|
||||
@@ -152,7 +140,6 @@
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Water meter results";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.allResultsTabPage.ResumeLayout(false);
|
||||
this.productionTracingTabPage.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.PerformLayout();
|
||||
@@ -166,12 +153,12 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage allResultsTabPage;
|
||||
private OneWMResultsCtrl oneWMResultsCtrl;
|
||||
private OneWMResultsRowsCtrl oneWMResultsCtrl;
|
||||
private System.Windows.Forms.TabPage graphsTabPage;
|
||||
private System.Windows.Forms.TabPage productionTracingTabPage;
|
||||
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
|
||||
private System.Windows.Forms.Label messageLabel;
|
||||
private System.Windows.Forms.ListView tracingResultsListView;
|
||||
private System.Windows.Forms.TabPage allResultsTabPage;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace Results.Forms
|
||||
if (refRecords == null)
|
||||
{
|
||||
tabControl1.SelectTab(1);
|
||||
tabControl1.TabPages[2].Hide();
|
||||
tabControl1.TabPages.RemoveAt(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -51,57 +51,57 @@ namespace Results.Forms
|
||||
/// <param name="wMtr">Water meter entity</param>
|
||||
void ShowAllResults(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
string message;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
|
||||
#if ORACLE_DB
|
||||
oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
// string message;
|
||||
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
|
||||
//#if ORACLE_DB
|
||||
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
//#else
|
||||
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
//#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
|
||||
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
|
||||
|
||||
// Header
|
||||
oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
|
||||
int i = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
oneWMResultsCtrl.Columns.Add(str, 100);
|
||||
i++;
|
||||
}
|
||||
// // Header
|
||||
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
|
||||
// int i = 1;
|
||||
// foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
// {
|
||||
// oneWMResultsCtrl.Columns.Add(str, 100);
|
||||
// i++;
|
||||
// }
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Name);
|
||||
// foreach (var item in items)
|
||||
// {
|
||||
// ListViewItem lvi = new ListViewItem(item.Name);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
// foreach (var mtr in wMtr.MeterTestRslts)
|
||||
// {
|
||||
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
// mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
// {
|
||||
// string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
// string[] texts = str.Split(new char[] { '|' });
|
||||
// if (texts.Length == 1)
|
||||
// {
|
||||
// lvi.SubItems.Add(str);
|
||||
// }
|
||||
// else if (texts.Length == 2)
|
||||
// {
|
||||
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
// lvi.UseItemStyleForSubItems = false;
|
||||
// lvi.SubItems.Add(texts[0]);
|
||||
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lvi.SubItems.Add(string.Empty);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
oneWMResultsCtrl.Items.Add(lvi);
|
||||
}
|
||||
// oneWMResultsCtrl.Items.Add(lvi);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsColumnsCtrl
|
||||
{
|
||||
/// <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.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tBox = new System.Windows.Forms.TextBox();
|
||||
this.lView = new System.Windows.Forms.ListView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.SplitterDistance = 25;
|
||||
this.splitContainer1.SplitterWidth = 1;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// tBox
|
||||
//
|
||||
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.tBox.Name = "tBox";
|
||||
this.tBox.Size = new System.Drawing.Size(352, 20);
|
||||
this.tBox.TabIndex = 0;
|
||||
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
|
||||
//
|
||||
// lView
|
||||
//
|
||||
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lView.FullRowSelect = true;
|
||||
this.lView.GridLines = true;
|
||||
this.lView.Location = new System.Drawing.Point(0, 0);
|
||||
this.lView.Name = "lView";
|
||||
this.lView.Size = new System.Drawing.Size(352, 292);
|
||||
this.lView.TabIndex = 0;
|
||||
this.lView.UseCompatibleStateImageBehavior = false;
|
||||
this.lView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// OneWMResultsCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "OneWMResultsCtrl";
|
||||
this.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox tBox;
|
||||
private System.Windows.Forms.ListView lView;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsColumnsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsColumnsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
/// Header
|
||||
lView.Columns.Add(wmPosition.ToString(), (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);
|
||||
col++;
|
||||
}
|
||||
|
||||
lView.Items.Clear();
|
||||
if (items == null || items.Count == 0) return;
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsCtrl : UserControl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(OneWMResultsCtrl));
|
||||
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
|
||||
public OneWMResultsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight, Results.Entities.WaterMeter wm)
|
||||
: this()
|
||||
{
|
||||
lView.BackColor = backColor;
|
||||
tBox.BackColor = backColor;
|
||||
Size = new System.Drawing.Size(lvWidth, lvHeight);
|
||||
WM = wm;
|
||||
}
|
||||
|
||||
public Results.Entities.WaterMeter WM;
|
||||
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
|
||||
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
|
||||
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
|
||||
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (WMResultsClickedHandler == null) return;
|
||||
try { WMResultsClickedHandler(sender, new WaterMeterEventArgs(WM)); }
|
||||
catch (Exception exc) { log.Error("WMResultsClickedHandler(...) failed", exc); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsCtrl
|
||||
partial class OneWMResultsRowsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -0,0 +1,169 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsRowsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsRowsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
|
||||
/// Always draw ListView header
|
||||
lView.Columns.Clear();
|
||||
lView.Columns.Add(wmPosition.ToString(), (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);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
Update(wMtr.WMPosition);
|
||||
|
||||
/// Update test results
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
lView.Items.Clear();
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ namespace Results.Forms
|
||||
{
|
||||
public class WaterMeterEventArgs : EventArgs
|
||||
{
|
||||
public Results.Entities.WaterMeter WM;
|
||||
public int WMPosition;
|
||||
|
||||
public WaterMeterEventArgs(Results.Entities.WaterMeter wm) { WM = wm; }
|
||||
public WaterMeterEventArgs(int wmPosition) { WMPosition = wmPosition; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -26,6 +26,16 @@ namespace Results.Mappings
|
||||
.Column("Custom1"); ;
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
Map(x => x.Counter6);
|
||||
Map(x => x.Counter7);
|
||||
Map(x => x.Counter8);
|
||||
Map(x => x.Counter9);
|
||||
Map(x => x.Counter10);
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.Dirty);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -12,6 +12,7 @@ namespace Results.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.CompoundMeterId);
|
||||
Map(x => x.RegReaderType);
|
||||
Map(x => x.PulsesMeter);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.PulsesPerLiter);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -16,6 +16,7 @@ namespace Results.Mappings
|
||||
References<Components>(x => x.Components);
|
||||
Map(x => x.Part);
|
||||
Map(x => x.RepetitionNr);
|
||||
Map(x => x.MethodClass);
|
||||
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Remark)
|
||||
@@ -24,9 +25,13 @@ namespace Results.Mappings
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.FlowSetTime);
|
||||
Map(x => x.TimeBtwnMassMsrmnts);
|
||||
Map(x => x.TestTime);
|
||||
Map(x => x.TestTimeCorrection);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.ConstMaster);
|
||||
Map(x => x.ConstMasterRaw);
|
||||
Map(x => x.ConstMasterCorr);
|
||||
Map(x => x.ConstMaster);
|
||||
Map(x => x.MassStartRaw);
|
||||
Map(x => x.MassStart);
|
||||
Map(x => x.MassEndRaw);
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Results.Mappings
|
||||
Map(x => x.MetrologicalClassAux);
|
||||
Map(x => x.ApprovalInfoAux);
|
||||
|
||||
Map(x => x.Medium);
|
||||
|
||||
Map(x => x.Text1);
|
||||
Map(x => x.Text2);
|
||||
Map(x => x.Text3);
|
||||
|
||||
+33
-10
@@ -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;
|
||||
@@ -22,9 +21,9 @@ namespace Results.Output
|
||||
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 = Config.Units.ConvertTo(flowUnit, 3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
|
||||
if (flow > 0)
|
||||
{
|
||||
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
|
||||
@@ -47,7 +46,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 +58,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1278.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1278.0")]
|
||||
[assembly: AssemblyVersion("2.24.1315.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1315.0")]
|
||||
|
||||
Generated
+9
@@ -1230,6 +1230,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This position is disabled.
|
||||
/// </summary>
|
||||
internal static string This_position_is_disabled {
|
||||
get {
|
||||
return ResourceManager.GetString("This_position_is_disabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to to.
|
||||
/// </summary>
|
||||
|
||||
@@ -333,4 +333,7 @@
|
||||
<data name="Flow" xml:space="preserve">
|
||||
<value>Průtok</value>
|
||||
</data>
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>Taro pozice je vypnuta</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -816,4 +816,7 @@
|
||||
<data name="Relative_error" xml:space="preserve">
|
||||
<value>Relative error</value>
|
||||
</data>
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>This position is disabled</value>
|
||||
</data>
|
||||
</root>
|
||||
+17
-7
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</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;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -75,6 +75,7 @@
|
||||
<Compile Include="Forms\BatchResultsDlg.Designer.cs">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\IOneWMResultsCtrl.cs" />
|
||||
<Compile Include="Forms\ListViewEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -87,11 +88,17 @@
|
||||
<Compile Include="Forms\MoreWMResultsDlg.Designer.cs">
|
||||
<DependentUpon>MoreWMResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsCtrl.cs">
|
||||
<Compile Include="Forms\OneWMResultsColumnsCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsCtrl.Designer.cs">
|
||||
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
|
||||
<Compile Include="Forms\OneWMResultsColumnsCtrl.designer.cs">
|
||||
<DependentUpon>OneWMResultsColumnsCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsRowsCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsRowsCtrl.Designer.cs">
|
||||
<DependentUpon>OneWMResultsRowsCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultsConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -187,8 +194,11 @@
|
||||
<EmbeddedResource Include="Forms\MoreWMResultsDlg.resx">
|
||||
<DependentUpon>MoreWMResultsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsColumnsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsColumnsCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsRowsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsRowsCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ResultsConfigCtrl.resx">
|
||||
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using ResultsBrowser.Resources;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</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;WARSAW_END;LANG_PL</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,7 +20,18 @@ namespace TBF.BenchControl
|
||||
public int ItemNr { get { return cfg.ItemNr; } }
|
||||
public DebugMode DebugLevel { get { return cfg.DebugLevel; } set { cfg.DebugLevel = value; } }
|
||||
public LogLevel LogLevel { get { return cfg.LogLevel; } }
|
||||
public IList<MeasurementCorrection> Corrections { get { return cfg.Corrections; } }
|
||||
|
||||
public IList<MeasurementCorrection> Corrections
|
||||
{
|
||||
get { return cfg.Corrections; }
|
||||
set { cfg.Corrections = value; }
|
||||
}
|
||||
|
||||
public IList<Uncertainty> Uncertainties
|
||||
{
|
||||
get { return cfg.Uncertainties; }
|
||||
set { cfg.Uncertainties = value; }
|
||||
}
|
||||
|
||||
|
||||
/// Constructor, components created in this way is used by
|
||||
|
||||
@@ -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;
|
||||
@@ -68,6 +68,15 @@ namespace TBF.BenchControl
|
||||
}
|
||||
IList<MeasurementCorrection> corrections;
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<Uncertainty> Uncertainties
|
||||
{
|
||||
get { return uncertainties; }
|
||||
set { uncertainties = value; }
|
||||
}
|
||||
IList<Uncertainty> uncertainties;
|
||||
|
||||
|
||||
protected ComponentCfgBase()
|
||||
{
|
||||
itemNr = 0;
|
||||
@@ -118,7 +127,8 @@ namespace TBF.BenchControl
|
||||
config.DebugLevel = cmpntEntity.Mode;
|
||||
config.LogLevel = cmpntEntity.Logging;
|
||||
config.Corrections = cmpntEntity.Corrections;
|
||||
config.Factory = factory;
|
||||
config.Uncertainties = cmpntEntity.Uncertainties;
|
||||
config.Factory = factory;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
Generated
+4
-4
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.Diverter
|
||||
{
|
||||
@@ -17,6 +18,11 @@ namespace TBF.BenchControl.Dummy.Diverter
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
FloatBox switchTimeStart;
|
||||
FloatBox switchTimeEnd;
|
||||
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
|
||||
public FloatBox SwitchTimeEnd { get { return switchTimeEnd; } }
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
@@ -24,6 +30,8 @@ namespace TBF.BenchControl.Dummy.Diverter
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
switchTimeStart = new FloatBox();
|
||||
switchTimeEnd = new FloatBox();
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -501,7 +501,7 @@ namespace TBF.BenchControl.Elde
|
||||
///
|
||||
void ShowEmergencyStopForm()
|
||||
{
|
||||
(new TBF.Forms.EmergencyStopForm()).Show();
|
||||
(new TBF.UI.Shared.EmergencyStopForm()).Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -652,7 +652,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="testName">Test name (without repetitions)</param>
|
||||
/// <param name="repetition">Repetition number</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, TBF.Boxes.FloatBox transitionTimeSec,
|
||||
public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
@@ -661,7 +661,7 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, transitionTimeSec, plotter, batchNr, testName, repetition);
|
||||
return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, toTank, plotter, batchNr, testName, repetition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
@@ -45,6 +46,10 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public int ThresholdLo { get { return diverterCfg.ThresholdLo; } }
|
||||
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
|
||||
|
||||
FloatBox switchTimeStart;
|
||||
FloatBox switchTimeEnd;
|
||||
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
|
||||
public FloatBox SwitchTimeEnd { get { return switchTimeEnd; } }
|
||||
|
||||
/// <summary>
|
||||
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||
@@ -70,7 +75,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 64) throw new ArgumentOutOfRangeException("position");
|
||||
this.mask = (((UInt128)1) << diverterCfg.BitPosition);
|
||||
|
||||
|
||||
switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
|
||||
switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
|
||||
|
||||
diverterNr0 = nextIdx++;
|
||||
///
|
||||
|
||||
@@ -19,13 +19,15 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int BitPosition; /// 0..63
|
||||
public int AdcNr; /// 0..15(?), number of the analog input
|
||||
public int AdcValueToSink; /// 0..1023
|
||||
public int AdcValueToTank; /// 0..1023
|
||||
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
|
||||
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
|
||||
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
|
||||
public int BitPosition; /// 0..63
|
||||
public int AdcNr; /// 0..15(?), number of the analog input
|
||||
public int AdcValueToSink; /// 0..1023
|
||||
public int AdcValueToTank; /// 0..1023
|
||||
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
|
||||
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
|
||||
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
|
||||
public int DfltSwithTimeStartMs; /// Default diverter transition time 'start' or 'to tank' in ms
|
||||
public int DfltSwithTimeEndMs; /// Default diverter transition time 'end' or 'to sink' in ms
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
string calibCertificateNr;
|
||||
|
||||
+92
-22
@@ -73,6 +73,12 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.thresholdHiTextBox = new System.Windows.Forms.TextBox();
|
||||
this.thresholdHiLabel = new System.Windows.Forms.Label();
|
||||
this.dfltSwitchTimeEndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.dfltSwitchTimeEndLabel = new System.Windows.Forms.Label();
|
||||
this.dfltSwitchTimeStartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.dfltSwitchTimeStartLabel = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
@@ -81,7 +87,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 41);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(144, 41);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@@ -89,7 +95,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 44);
|
||||
this.nameLabel.Location = new System.Drawing.Point(21, 44);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@@ -98,7 +104,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 17);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(141, 17);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
@@ -107,7 +113,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(27, 67);
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(21, 67);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
@@ -116,7 +122,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// bitPositionLabel
|
||||
//
|
||||
this.bitPositionLabel.AutoSize = true;
|
||||
this.bitPositionLabel.Location = new System.Drawing.Point(27, 91);
|
||||
this.bitPositionLabel.Location = new System.Drawing.Point(21, 91);
|
||||
this.bitPositionLabel.Name = "bitPositionLabel";
|
||||
this.bitPositionLabel.Size = new System.Drawing.Size(59, 13);
|
||||
this.bitPositionLabel.TabIndex = 5;
|
||||
@@ -125,7 +131,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// bitPositionTextBox
|
||||
//
|
||||
this.bitPositionTextBox.Enabled = false;
|
||||
this.bitPositionTextBox.Location = new System.Drawing.Point(137, 88);
|
||||
this.bitPositionTextBox.Location = new System.Drawing.Point(144, 88);
|
||||
this.bitPositionTextBox.Name = "bitPositionTextBox";
|
||||
this.bitPositionTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.bitPositionTextBox.TabIndex = 6;
|
||||
@@ -134,7 +140,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(137, 64);
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(144, 64);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
@@ -142,7 +148,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// startingEdgeTextBox
|
||||
//
|
||||
this.startingEdgeTextBox.Enabled = false;
|
||||
this.startingEdgeTextBox.Location = new System.Drawing.Point(137, 180);
|
||||
this.startingEdgeTextBox.Location = new System.Drawing.Point(144, 180);
|
||||
this.startingEdgeTextBox.Name = "startingEdgeTextBox";
|
||||
this.startingEdgeTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.startingEdgeTextBox.TabIndex = 14;
|
||||
@@ -150,7 +156,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// startingEdgeLabel
|
||||
//
|
||||
this.startingEdgeLabel.AutoSize = true;
|
||||
this.startingEdgeLabel.Location = new System.Drawing.Point(27, 183);
|
||||
this.startingEdgeLabel.Location = new System.Drawing.Point(21, 183);
|
||||
this.startingEdgeLabel.Name = "startingEdgeLabel";
|
||||
this.startingEdgeLabel.Size = new System.Drawing.Size(68, 13);
|
||||
this.startingEdgeLabel.TabIndex = 13;
|
||||
@@ -159,7 +165,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdLoTextBox
|
||||
//
|
||||
this.thresholdLoTextBox.Enabled = false;
|
||||
this.thresholdLoTextBox.Location = new System.Drawing.Point(137, 203);
|
||||
this.thresholdLoTextBox.Location = new System.Drawing.Point(144, 203);
|
||||
this.thresholdLoTextBox.Name = "thresholdLoTextBox";
|
||||
this.thresholdLoTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.thresholdLoTextBox.TabIndex = 17;
|
||||
@@ -167,7 +173,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdLoLabel
|
||||
//
|
||||
this.thresholdLoLabel.AutoSize = true;
|
||||
this.thresholdLoLabel.Location = new System.Drawing.Point(27, 206);
|
||||
this.thresholdLoLabel.Location = new System.Drawing.Point(21, 206);
|
||||
this.thresholdLoLabel.Name = "thresholdLoLabel";
|
||||
this.thresholdLoLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.thresholdLoLabel.TabIndex = 16;
|
||||
@@ -176,7 +182,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(190, 205);
|
||||
this.label2.Location = new System.Drawing.Point(197, 205);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(15, 13);
|
||||
this.label2.TabIndex = 18;
|
||||
@@ -185,7 +191,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(190, 183);
|
||||
this.label1.Location = new System.Drawing.Point(197, 183);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(15, 13);
|
||||
this.label1.TabIndex = 15;
|
||||
@@ -225,7 +231,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcToTankTextBox
|
||||
//
|
||||
this.adcToTankTextBox.Enabled = false;
|
||||
this.adcToTankTextBox.Location = new System.Drawing.Point(137, 157);
|
||||
this.adcToTankTextBox.Location = new System.Drawing.Point(144, 157);
|
||||
this.adcToTankTextBox.Name = "adcToTankTextBox";
|
||||
this.adcToTankTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcToTankTextBox.TabIndex = 12;
|
||||
@@ -233,7 +239,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcTankLabel
|
||||
//
|
||||
this.adcTankLabel.AutoSize = true;
|
||||
this.adcTankLabel.Location = new System.Drawing.Point(27, 160);
|
||||
this.adcTankLabel.Location = new System.Drawing.Point(21, 160);
|
||||
this.adcTankLabel.Name = "adcTankLabel";
|
||||
this.adcTankLabel.Size = new System.Drawing.Size(94, 13);
|
||||
this.adcTankLabel.TabIndex = 11;
|
||||
@@ -242,7 +248,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcToSinkTextBox
|
||||
//
|
||||
this.adcToSinkTextBox.Enabled = false;
|
||||
this.adcToSinkTextBox.Location = new System.Drawing.Point(137, 134);
|
||||
this.adcToSinkTextBox.Location = new System.Drawing.Point(144, 134);
|
||||
this.adcToSinkTextBox.Name = "adcToSinkTextBox";
|
||||
this.adcToSinkTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcToSinkTextBox.TabIndex = 10;
|
||||
@@ -250,7 +256,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcSinkLabel
|
||||
//
|
||||
this.adcSinkLabel.AutoSize = true;
|
||||
this.adcSinkLabel.Location = new System.Drawing.Point(27, 137);
|
||||
this.adcSinkLabel.Location = new System.Drawing.Point(21, 137);
|
||||
this.adcSinkLabel.Name = "adcSinkLabel";
|
||||
this.adcSinkLabel.Size = new System.Drawing.Size(92, 13);
|
||||
this.adcSinkLabel.TabIndex = 9;
|
||||
@@ -419,7 +425,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcNrTextBox
|
||||
//
|
||||
this.adcNrTextBox.Enabled = false;
|
||||
this.adcNrTextBox.Location = new System.Drawing.Point(137, 111);
|
||||
this.adcNrTextBox.Location = new System.Drawing.Point(144, 111);
|
||||
this.adcNrTextBox.Name = "adcNrTextBox";
|
||||
this.adcNrTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcNrTextBox.TabIndex = 8;
|
||||
@@ -427,7 +433,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(27, 114);
|
||||
this.label7.Location = new System.Drawing.Point(21, 114);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(76, 13);
|
||||
this.label7.TabIndex = 7;
|
||||
@@ -436,7 +442,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(190, 228);
|
||||
this.label8.Location = new System.Drawing.Point(197, 228);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(15, 13);
|
||||
this.label8.TabIndex = 29;
|
||||
@@ -445,7 +451,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdHiTextBox
|
||||
//
|
||||
this.thresholdHiTextBox.Enabled = false;
|
||||
this.thresholdHiTextBox.Location = new System.Drawing.Point(137, 226);
|
||||
this.thresholdHiTextBox.Location = new System.Drawing.Point(144, 226);
|
||||
this.thresholdHiTextBox.Name = "thresholdHiTextBox";
|
||||
this.thresholdHiTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.thresholdHiTextBox.TabIndex = 28;
|
||||
@@ -453,16 +459,74 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdHiLabel
|
||||
//
|
||||
this.thresholdHiLabel.AutoSize = true;
|
||||
this.thresholdHiLabel.Location = new System.Drawing.Point(27, 229);
|
||||
this.thresholdHiLabel.Location = new System.Drawing.Point(21, 229);
|
||||
this.thresholdHiLabel.Name = "thresholdHiLabel";
|
||||
this.thresholdHiLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.thresholdHiLabel.TabIndex = 27;
|
||||
this.thresholdHiLabel.Text = "Threshold Hi";
|
||||
//
|
||||
// dfltSwitchTimeEndTextBox
|
||||
//
|
||||
this.dfltSwitchTimeEndTextBox.Enabled = false;
|
||||
this.dfltSwitchTimeEndTextBox.Location = new System.Drawing.Point(144, 272);
|
||||
this.dfltSwitchTimeEndTextBox.Name = "dfltSwitchTimeEndTextBox";
|
||||
this.dfltSwitchTimeEndTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.dfltSwitchTimeEndTextBox.TabIndex = 33;
|
||||
//
|
||||
// dfltSwitchTimeEndLabel
|
||||
//
|
||||
this.dfltSwitchTimeEndLabel.AutoSize = true;
|
||||
this.dfltSwitchTimeEndLabel.Location = new System.Drawing.Point(21, 275);
|
||||
this.dfltSwitchTimeEndLabel.Name = "dfltSwitchTimeEndLabel";
|
||||
this.dfltSwitchTimeEndLabel.Size = new System.Drawing.Size(117, 13);
|
||||
this.dfltSwitchTimeEndLabel.TabIndex = 32;
|
||||
this.dfltSwitchTimeEndLabel.Text = "Default switch time end";
|
||||
//
|
||||
// dfltSwitchTimeStartTextBox
|
||||
//
|
||||
this.dfltSwitchTimeStartTextBox.Enabled = false;
|
||||
this.dfltSwitchTimeStartTextBox.Location = new System.Drawing.Point(144, 249);
|
||||
this.dfltSwitchTimeStartTextBox.Name = "dfltSwitchTimeStartTextBox";
|
||||
this.dfltSwitchTimeStartTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.dfltSwitchTimeStartTextBox.TabIndex = 31;
|
||||
//
|
||||
// dfltSwitchTimeStartLabel
|
||||
//
|
||||
this.dfltSwitchTimeStartLabel.AutoSize = true;
|
||||
this.dfltSwitchTimeStartLabel.Location = new System.Drawing.Point(21, 252);
|
||||
this.dfltSwitchTimeStartLabel.Name = "dfltSwitchTimeStartLabel";
|
||||
this.dfltSwitchTimeStartLabel.Size = new System.Drawing.Size(119, 13);
|
||||
this.dfltSwitchTimeStartLabel.TabIndex = 30;
|
||||
this.dfltSwitchTimeStartLabel.Text = "Default switch time start";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(197, 252);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(20, 13);
|
||||
this.label9.TabIndex = 34;
|
||||
this.label9.Text = "ms";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(197, 275);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(20, 13);
|
||||
this.label10.TabIndex = 35;
|
||||
this.label10.Text = "ms";
|
||||
//
|
||||
// DiverterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.dfltSwitchTimeEndTextBox);
|
||||
this.Controls.Add(this.dfltSwitchTimeEndLabel);
|
||||
this.Controls.Add(this.dfltSwitchTimeStartTextBox);
|
||||
this.Controls.Add(this.dfltSwitchTimeStartLabel);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.thresholdHiTextBox);
|
||||
this.Controls.Add(this.thresholdHiLabel);
|
||||
@@ -549,5 +613,11 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox thresholdHiTextBox;
|
||||
private System.Windows.Forms.Label thresholdHiLabel;
|
||||
private System.Windows.Forms.TextBox dfltSwitchTimeEndTextBox;
|
||||
private System.Windows.Forms.Label dfltSwitchTimeEndLabel;
|
||||
private System.Windows.Forms.TextBox dfltSwitchTimeStartTextBox;
|
||||
private System.Windows.Forms.Label dfltSwitchTimeStartLabel;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
startingEdgeTextBox.Text = config.StartingLevel.ToString();
|
||||
thresholdLoTextBox.Text = config.ThresholdLo.ToString();
|
||||
thresholdHiTextBox.Text = config.ThresholdHi.ToString();
|
||||
dfltSwitchTimeStartTextBox.Text = config.DfltSwithTimeStartMs.ToString();
|
||||
dfltSwitchTimeEndTextBox.Text = config.DfltSwithTimeEndMs.ToString();
|
||||
|
||||
adcTextBox1.Text = adc1.ToString();
|
||||
adcTextBox2.Text = adc2.ToString();
|
||||
@@ -98,6 +100,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
startingEdgeTextBox.Enabled = true;
|
||||
thresholdLoTextBox.Enabled = true;
|
||||
thresholdHiTextBox.Enabled = true;
|
||||
dfltSwitchTimeStartTextBox.Enabled = true;
|
||||
dfltSwitchTimeEndTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -160,6 +164,16 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
message += Environment.NewLine + "'Threshold HI' should be between 0 and 100%";
|
||||
}
|
||||
}
|
||||
if (!int.TryParse(dfltSwitchTimeStartTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default switch time start' should be positive integer";
|
||||
}
|
||||
if (!int.TryParse(dfltSwitchTimeEndTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default switch time end' should be positive integer";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -232,6 +246,20 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
tmp = int.Parse(dfltSwitchTimeStartTextBox.Text);
|
||||
if (config.DfltSwithTimeStartMs != tmp)
|
||||
{
|
||||
config.DfltSwithTimeStartMs = tmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
tmp = int.Parse(dfltSwitchTimeEndTextBox.Text);
|
||||
if (config.DfltSwithTimeEndMs != tmp)
|
||||
{
|
||||
config.DfltSwithTimeEndMs = tmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public class SwitchDiverterOp : IOperation
|
||||
{
|
||||
ControlBoardDev controlBoard;
|
||||
bool start;
|
||||
bool toTank;
|
||||
int flowMtrNr;
|
||||
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool start, int flowMtrNr)
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool toTank, int flowMtrNr)
|
||||
{
|
||||
this.controlBoard = controlBoard;
|
||||
this.start = start;
|
||||
this.toTank = toTank;
|
||||
this.flowMtrNr = flowMtrNr;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (start)
|
||||
if (toTank)
|
||||
{
|
||||
controlBoard.DiverterToTank(flowMtrNr);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace TBF.BenchControl.Elde
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly GenericDevices.IDiverter div;
|
||||
readonly bool toTank;
|
||||
readonly int runsCountWhenSendingCmd;
|
||||
readonly int runsCountWhenReadingDiv;
|
||||
readonly FloatBox transitionTimeSec;
|
||||
readonly Sequences.Statistics plotter;
|
||||
readonly int batchNr;
|
||||
readonly string testName;
|
||||
@@ -43,19 +43,19 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="method">Test method</param>
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv,
|
||||
FloatBox transitionTimeSec, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
if (div == null) throw new ArgumentNullException("div");
|
||||
if (runsCountWhenSendingCmd < 0) throw new ArgumentNullException("runsCountWhenSendingCmd");
|
||||
if (runsCountWhenReadingDiv <= runsCountWhenSendingCmd) throw new ArgumentNullException("runsCountWhenReadingDiv");
|
||||
if (transitionTimeSec == null) throw new ArgumentNullException("transitionTimeSec");
|
||||
|
||||
this.controlBoard = controlBoard;
|
||||
this.div = div;
|
||||
this.runsCountWhenSendingCmd = runsCountWhenSendingCmd;
|
||||
this.runsCountWhenReadingDiv = runsCountWhenReadingDiv;
|
||||
this.transitionTimeSec = transitionTimeSec;
|
||||
this.toTank = toTank;
|
||||
this.plotter = plotter;
|
||||
this.batchNr = batchNr;
|
||||
this.testName = testName;
|
||||
@@ -102,7 +102,7 @@ namespace TBF.BenchControl.Elde
|
||||
if (plotter == null)
|
||||
{
|
||||
ReadDiverterTransitionTimes();
|
||||
log.DebugFormat("Run() ... Reading diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
|
||||
log.DebugFormat("Run() ... Reading diverter {0} transition times: {1}s", div.Name, (toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
plotter.Stop();
|
||||
|
||||
log.DebugFormat("Run() ... Calculating diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
|
||||
log.DebugFormat("Run() ... Calculating diverter {0} transition times: {1}s", div.Name, (toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val);
|
||||
CalculateDiverterTransitionTimes();
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>true (always)</returns>
|
||||
bool ReadDiverterTransitionTimes()
|
||||
{
|
||||
transitionTimeSec.Val = (float)controlBoard.DivTime(2) - (float)controlBoard.DivTime(1);
|
||||
(toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val = (float)controlBoard.DivTime(2) - (float)controlBoard.DivTime(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
if ((startedRising || startedFalling) && stopped)
|
||||
{
|
||||
transitionTimeSec.Val = 0.002f * (float)(transitionEndIdx - transitionStartIdx); /// 2 ms per sample
|
||||
(toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val = 0.002f * (float)(transitionEndIdx - transitionStartIdx); /// 2 ms per sample
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Generic
|
||||
{
|
||||
public interface IComponent
|
||||
@@ -17,6 +19,10 @@ namespace TBF.BenchControl.Generic
|
||||
|
||||
IComponentCfg Cfg { get; }
|
||||
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; set; }
|
||||
|
||||
IList<Config.Entities.Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
void StartChangeHandler();
|
||||
|
||||
void StopChangeHandler();
|
||||
|
||||
@@ -43,6 +43,11 @@ namespace TBF.BenchControl.Generic
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction values
|
||||
/// </summary>
|
||||
IList<Config.Entities.Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new database entity 'Component' from the parameters
|
||||
/// </summary>
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
@@ -33,6 +34,9 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
int ThresholdHi { get; }
|
||||
|
||||
FloatBox SwitchTimeStart { get; }
|
||||
FloatBox SwitchTimeEnd { get; }
|
||||
|
||||
/// <summary>
|
||||
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
}
|
||||
|
||||
|
||||
IList<MeasurementCorrection> GetCorrections(Results.Entities.Batch batch, string diverterName)
|
||||
IList<MeasurementCorrection> CalculateCorrectionsFromResuls(Results.Entities.Batch batch, string diverterName)
|
||||
{
|
||||
/// Create a list of all test flows in this procedure
|
||||
IList<double> targetFlows = new List<double>();
|
||||
@@ -115,8 +115,8 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
/// Calculate a correction and add it to the list
|
||||
try
|
||||
{
|
||||
double factor = loTR.PulsesMaster / shTR.PulsesMaster * (shTR.MassEnd - shTR.MassStart) / (loTR.MassEnd - loTR.MassStart);
|
||||
double correction = loTR.TestTime / (myCfg.ShortTestDiversionsCount - 1) * (factor - 1.0);
|
||||
double factor = loTR.PulsesMaster / shTR.PulsesMaster * (loTR.MassEnd - loTR.MassStart) / (shTR.MassEnd - shTR.MassStart);
|
||||
double correction = (factor - 1.0) * loTR.TestTime / (myCfg.ShortTestDiversionsCount - 1);
|
||||
rslt.Add(new MeasurementCorrection { RangeIx = 0, Measurement = (float)trgtFlow, Correction = (float)correction });
|
||||
log.InfoFormat("Calculated diverter correction at {0} m3/h: {1} s", trgtFlow, correction);
|
||||
}
|
||||
@@ -132,29 +132,32 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
}
|
||||
|
||||
|
||||
void DeleteExistingCorrections(ISession session, Component cmpnt)
|
||||
void DeleteExistingCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt)
|
||||
{
|
||||
for (int i = cmpnt.Corrections.Count - 1; i >= 0; i--)
|
||||
for (int i = dbCmpnt.Corrections.Count - 1; i >= 0; i--)
|
||||
{
|
||||
session.Delete(cmpnt.Corrections[i]);
|
||||
cmpnt.Corrections.RemoveAt(i);
|
||||
session.Delete(dbCmpnt.Corrections[i]);
|
||||
}
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
dbCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
session.SaveOrUpdate(dbCmpnt);
|
||||
}
|
||||
|
||||
|
||||
void SaveNewCorrections(ISession session, Component cmpnt, IList<MeasurementCorrection> corrections)
|
||||
void SaveNewCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt, IList<MeasurementCorrection> corrections)
|
||||
{
|
||||
if (cmpnt.Corrections == null) cmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if (dbCmpnt.Corrections == null) dbCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if ((runtimeCmpnt != null) && (runtimeCmpnt.Corrections == null)) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
|
||||
foreach (var mc in corrections)
|
||||
{
|
||||
mc.RangeIx = 0;
|
||||
cmpnt.Corrections.Add(mc);
|
||||
dbCmpnt.Corrections.Add(mc);
|
||||
if (runtimeCmpnt != null) runtimeCmpnt.Corrections.Add(mc);
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
ICalibInfoCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibInfoCfg;
|
||||
ICalibInfoCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(dbCmpnt) as ICalibInfoCfg;
|
||||
if (cfg != null)
|
||||
{
|
||||
cfg.CalibCertificateNr = string.Format(myCfg.CertificateFmt, batch.StartTime, batch.EndTime, batch.BatchNr);
|
||||
@@ -162,10 +165,10 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
cfg.CalibValidDate = DateTime.Now + new TimeSpan(myCfg.ValidityDays, 0, 0, 0);
|
||||
|
||||
Component modified = cfg.CreateDbEntity();
|
||||
cmpnt.Parameters = modified.Parameters;
|
||||
dbCmpnt.Parameters = modified.Parameters;
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
session.SaveOrUpdate(dbCmpnt);
|
||||
}
|
||||
|
||||
|
||||
@@ -207,15 +210,17 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
.Where(cmpnt => (cmpnt.Name == diverterName))
|
||||
.List();
|
||||
|
||||
if (cmpntEntities.Count != 1)
|
||||
var runtimeComponent = TbfComponents.FindComponent(diverterName);
|
||||
|
||||
if ((cmpntEntities.Count != 1) || (runtimeComponent == null))
|
||||
{
|
||||
log.ErrorFormat("No unique diverter named {0}", diverterName);
|
||||
continue;
|
||||
}
|
||||
|
||||
newCorrections = GetCorrections(batch, diverterName);
|
||||
DeleteExistingCorrections(session, cmpntEntities[0]);
|
||||
SaveNewCorrections(session, cmpntEntities[0], newCorrections);
|
||||
newCorrections = CalculateCorrectionsFromResuls(batch, diverterName);
|
||||
DeleteExistingCorrections(session, cmpntEntities[0], runtimeComponent);
|
||||
SaveNewCorrections(session, cmpntEntities[0], runtimeComponent, newCorrections);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -119,32 +119,44 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
}
|
||||
|
||||
|
||||
void DeleteExistingCorrections(ISession session, Component cmpnt, int rangeIx)
|
||||
void DeleteExistingCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt, int rangeIx)
|
||||
{
|
||||
for (int i = cmpnt.Corrections.Count - 1; i >= 0; i--)
|
||||
/// Delete correction from DB entity
|
||||
for (int i = dbCmpnt.Corrections.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (cmpnt.Corrections[i].RangeIx == rangeIx)
|
||||
if (dbCmpnt.Corrections[i].RangeIx == rangeIx)
|
||||
{
|
||||
session.Delete(cmpnt.Corrections[i]);
|
||||
cmpnt.Corrections.RemoveAt(i);
|
||||
session.Delete(dbCmpnt.Corrections[i]);
|
||||
dbCmpnt.Corrections.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
session.SaveOrUpdate(dbCmpnt);
|
||||
|
||||
/// Delete corrections from runtime flowmeter component
|
||||
for (int i = runtimeCmpnt.Corrections.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (runtimeCmpnt.Corrections[i].RangeIx == rangeIx)
|
||||
{
|
||||
runtimeCmpnt.Corrections.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
}
|
||||
|
||||
|
||||
void SaveNewCorrections(ISession session, Component cmpnt, int rangeIx, IList<MeasurementCorrection> corrections)
|
||||
void SaveNewCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt, int rangeIx, IList<MeasurementCorrection> corrections)
|
||||
{
|
||||
if (cmpnt.Corrections == null) cmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if (dbCmpnt.Corrections == null) dbCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if ((runtimeCmpnt != null) && (runtimeCmpnt.Corrections == null)) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
|
||||
foreach (var mc in corrections)
|
||||
{
|
||||
mc.RangeIx = rangeIx;
|
||||
cmpnt.Corrections.Add(mc);
|
||||
dbCmpnt.Corrections.Add(mc);
|
||||
if (runtimeCmpnt != null) runtimeCmpnt.Corrections.Add(mc);
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
ICalibRangesCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibRangesCfg;
|
||||
ICalibRangesCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(dbCmpnt) as ICalibRangesCfg;
|
||||
if (cfg != null)
|
||||
{
|
||||
cfg.SetCalibDate(rangeIx, DateTime.Now);
|
||||
@@ -160,10 +172,10 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
}
|
||||
|
||||
Component modified = cfg.CreateDbEntity();
|
||||
cmpnt.Parameters = modified.Parameters;
|
||||
dbCmpnt.Parameters = modified.Parameters;
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
session.SaveOrUpdate(dbCmpnt);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +217,9 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
.Where(cmpnt => (cmpnt.Name == flowmeterName))
|
||||
.List();
|
||||
|
||||
if (cmpntEntities.Count != 1)
|
||||
var runtimeComponent = TbfComponents.FindComponent(flowmeterName);
|
||||
|
||||
if ((cmpntEntities.Count != 1) || (runtimeComponent == null))
|
||||
{
|
||||
log.ErrorFormat("No unique flowmeter named {0}", myCfg.GetFlowmeterName(fmtr));
|
||||
continue;
|
||||
@@ -218,8 +232,8 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
double tempRngLo = flowmeter.GetTempLo(rng);
|
||||
double tempRngHi = flowmeter.GetTempHi(rng);
|
||||
newCorrections = GetCorrections(batch, flowmeterName, rng, tempRngLo, tempRngHi);
|
||||
DeleteExistingCorrections(session, cmpntEntities[0], rng);
|
||||
SaveNewCorrections(session, cmpntEntities[0], rng, newCorrections);
|
||||
DeleteExistingCorrections(session, cmpntEntities[0], runtimeComponent, rng);
|
||||
SaveNewCorrections(session, cmpntEntities[0], runtimeComponent, rng, newCorrections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
|
||||
@@ -331,6 +331,28 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This function is called after a procedure was selected and all components procedure parameters of components were loaded
|
||||
/// </summary>
|
||||
void ClearSessionData()
|
||||
{
|
||||
///
|
||||
/// Clear iperlhead data (including PCB Number, avoid double use)
|
||||
///
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
(cmpnt as TestMethods.iPerlCommunication.iPerlHead.IperlHead).ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Main sequence
|
||||
/// </summary>
|
||||
@@ -480,16 +502,7 @@ namespace TBF.BenchControl.Sequences
|
||||
int newBatchNr = Program.LocalSettings.BatchNr;
|
||||
log.FatalFormat("New measurement session started: batch = {0}, procedure = {1}", newBatchNr, StateMachine.Procedure.Name);
|
||||
|
||||
///
|
||||
/// Clear iperlhead data (including PCB Number, avoid double use)
|
||||
///
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
(cmpnt as TestMethods.iPerlCommunication.iPerlHead.IperlHead).ClearData();
|
||||
}
|
||||
}
|
||||
ClearSessionData();
|
||||
|
||||
if (selection == Selection.RestoreBatch)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -48,6 +49,10 @@ namespace TBF.BenchControl.Sequences
|
||||
public static Results.BatchResults BatchRslts;
|
||||
|
||||
public static IRegisterReader[] RegisterReaders;
|
||||
|
||||
public static bool IsQ2PreCorrectionCalculated;
|
||||
public static int CalculatedQ2PreCorrectionLR;
|
||||
public static int CalculatedQ2PreCorrectionRL;
|
||||
///
|
||||
static ProcessData()
|
||||
{
|
||||
@@ -56,6 +61,10 @@ namespace TBF.BenchControl.Sequences
|
||||
/// RegisterReader[i] where i = 0..Config.Data.WMsCount-1 may be null and should always be tested
|
||||
///
|
||||
RegisterReaders = new IRegisterReader[Config.Data.WMsCount];
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
public const int FlowSettingTimeoutSec = 300; /// Flow setting timeout = 5 min.
|
||||
public const int StableMassMsrmntTimeoutSec = 300; /// Stable mass measurement timeout = 5 min.
|
||||
public const int CountWhenSendingRdDivCmd = 1; /// Passed to cBrd.ReadDiverterTransitionOp()
|
||||
public const int CountWhenReadingDiv = 3; /// Passed to cBrd.ReadDiverterTransitionOp()
|
||||
|
||||
|
||||
///------------------------------------------------------------
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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());
|
||||
@@ -93,6 +94,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.PMaxTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.PulsesTest.Factory());
|
||||
Factories.Add(new TestMethods.PulsesTestManual.Factory());
|
||||
Factories.Add(new TestMethods.Q2CorrectionFromHistory.Factory());
|
||||
Factories.Add(new TestMethods.SensitivityTest.Factory());
|
||||
Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication
|
||||
Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory());
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -96,10 +96,6 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -495,7 +491,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
//.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
//.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -611,7 +607,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -693,7 +689,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon))
|
||||
{
|
||||
tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume);
|
||||
tstRslt.TestTimeCorrection = testParams.DivRepetitions * outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume);
|
||||
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
|
||||
tstRslt.VolumeCTV /= tstRslt.TestTime;
|
||||
}
|
||||
@@ -710,11 +706,11 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -113,9 +113,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
|
||||
: ((compoundTestParams != null) ? compoundTestParams.NextTestVolume
|
||||
: heatMetersTestParams.NextTestVolume);
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
@@ -566,7 +563,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -667,7 +664,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -760,11 +757,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-7
@@ -131,9 +131,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -672,7 +669,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -771,7 +768,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -865,11 +862,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-8
@@ -119,10 +119,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
|
||||
Event retVal = Event.Done;
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int targetTotalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
int targetMassPulses = (int)(volumeToTank / LtrPerRefPulse + 0.5f);
|
||||
@@ -567,7 +563,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -666,7 +662,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -763,11 +759,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-8
@@ -112,10 +112,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -557,7 +553,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -658,7 +654,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -752,11 +748,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-7
@@ -107,9 +107,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -364,7 +361,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -444,7 +441,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
State.Create(string.Format("{0}({1}) : Waiting before the water level measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -525,11 +522,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ISimultTestMethod, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("TestMethods.GrabImage({0})", Cfg.ToString(1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return true; }
|
||||
public bool DoTransitions() { return false; }
|
||||
|
||||
readonly FromHistoryCfg cfg;
|
||||
|
||||
public bool SimultWithPrevious { get { return true; } }
|
||||
public bool SimultWithNext { get { return false; } }
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCfgChange(object sender, CfgChangeArgs args)
|
||||
{
|
||||
if (CfgChangeHandler == null) return;
|
||||
try { CfgChangeHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
|
||||
|
||||
public override void StartChangeHandler()
|
||||
{
|
||||
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
|
||||
{
|
||||
FromHistoryCfg tmpcfg = args.Cfg as FromHistoryCfg;
|
||||
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
cfg.UseLocalDB = tmpcfg.UseLocalDB;
|
||||
cfg.ProcedureName = tmpcfg.ProcedureName;
|
||||
cfg.ProcedureNameAlt1 = tmpcfg.ProcedureNameAlt1;
|
||||
cfg.ProcedureNameAlt2 = tmpcfg.ProcedureNameAlt2;
|
||||
cfg.UseWebService = tmpcfg.UseWebService;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
this.cfg = cfg as FromHistoryCfg;
|
||||
StartChangeHandler();
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition)
|
||||
{
|
||||
return (new FromHistorySeq()).Execute(test, repetitionNr, isLastRepetition, cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class Factory : 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 FromHistoryCfg(this, this.GetType().Namespace.Substring(29)); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(FromHistoryCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class FromHistoryCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FromHistoryCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new FromHistoryCfgCtrl(); }
|
||||
|
||||
|
||||
public bool UseWebService;
|
||||
public bool UseLocalDB;
|
||||
public string ProcedureName;
|
||||
public string ProcedureNameAlt1;
|
||||
public string ProcedureNameAlt2;
|
||||
public bool UseDefaultValues;
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
FromHistoryCfg() {}
|
||||
|
||||
public FromHistoryCfg(IComponentFactory factory, string name)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
|
||||
UseWebService = false;
|
||||
UseLocalDB = true;
|
||||
ProcedureName = "iPERL Smart Suez DN15 Q3_2.5 R800";
|
||||
ProcedureNameAlt1 = "iPERL Suez DN15 Q3_2.5 R800";
|
||||
ProcedureNameAlt2 = string.Empty;
|
||||
UseDefaultValues = true;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, UseLocalDB={1}, UseWebService={2}", Name, UseLocalDB, UseWebService);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public partial class FromHistoryCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(FromHistoryCfgCtrl));
|
||||
|
||||
private Label classNameLabel;
|
||||
private Label nameLabel;
|
||||
private TextBox nameTextBox;
|
||||
private CheckBox useLocalDBCheckBox;
|
||||
private Label procedureNameLabel;
|
||||
private TextBox procedureNameTextBox;
|
||||
private Label procedureNameAlt1Label;
|
||||
private TextBox procedureNameAlt1TextBox;
|
||||
private Label procedureNameAlt2Label;
|
||||
private TextBox procedureNameAlt2TextBox;
|
||||
private CheckBox useWebServiceCheckBox;
|
||||
private CheckBox useDefaultValuesCheckBox;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
FromHistoryCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as FromHistoryCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public FromHistoryCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void GrabImageCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
useWebServiceCheckBox.Checked = config.UseWebService;
|
||||
useLocalDBCheckBox.Checked = config.UseLocalDB;
|
||||
procedureNameTextBox.Text = config.ProcedureName;
|
||||
procedureNameAlt1TextBox.Text = config.ProcedureNameAlt1;
|
||||
procedureNameAlt2TextBox.Text = config.ProcedureNameAlt2;
|
||||
useDefaultValuesCheckBox.Checked = config.UseDefaultValues;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
useWebServiceCheckBox.Enabled = true;
|
||||
useLocalDBCheckBox.Enabled = true;
|
||||
procedureNameTextBox.Enabled = true;
|
||||
procedureNameAlt1TextBox.Enabled = true;
|
||||
procedureNameAlt2TextBox.Enabled = true;
|
||||
useDefaultValuesCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
}
|
||||
|
||||
if (config.UseWebService != useWebServiceCheckBox.Checked)
|
||||
{
|
||||
config.UseWebService = useWebServiceCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseLocalDB != useLocalDBCheckBox.Checked)
|
||||
{
|
||||
config.UseLocalDB = useLocalDBCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureName != procedureNameTextBox.Text)
|
||||
{
|
||||
config.ProcedureName = procedureNameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt1 != procedureNameAlt1TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt1 = procedureNameAlt1TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt2 != procedureNameAlt2TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt2 = procedureNameAlt2TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseDefaultValues != useDefaultValuesCheckBox.Checked)
|
||||
{
|
||||
config.UseDefaultValues = useDefaultValuesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
Component.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.procedureNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameLabel = new System.Windows.Forms.Label();
|
||||
this.useLocalDBCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.useWebServiceCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.procedureNameAlt1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameAlt1Label = new System.Windows.Forms.Label();
|
||||
this.procedureNameAlt2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameAlt2Label = new System.Windows.Forms.Label();
|
||||
this.useDefaultValuesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// procedureNameTextBox
|
||||
//
|
||||
this.procedureNameTextBox.Enabled = false;
|
||||
this.procedureNameTextBox.Location = new System.Drawing.Point(190, 124);
|
||||
this.procedureNameTextBox.Name = "procedureNameTextBox";
|
||||
this.procedureNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameTextBox.TabIndex = 6;
|
||||
//
|
||||
// procedureNameLabel
|
||||
//
|
||||
this.procedureNameLabel.AutoSize = true;
|
||||
this.procedureNameLabel.Location = new System.Drawing.Point(65, 127);
|
||||
this.procedureNameLabel.Name = "procedureNameLabel";
|
||||
this.procedureNameLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.procedureNameLabel.TabIndex = 5;
|
||||
this.procedureNameLabel.Text = "Procedure name";
|
||||
//
|
||||
// useLocalDBCheckBox
|
||||
//
|
||||
this.useLocalDBCheckBox.AutoSize = true;
|
||||
this.useLocalDBCheckBox.Enabled = false;
|
||||
this.useLocalDBCheckBox.Location = new System.Drawing.Point(38, 103);
|
||||
this.useLocalDBCheckBox.Name = "useLocalDBCheckBox";
|
||||
this.useLocalDBCheckBox.Size = new System.Drawing.Size(129, 17);
|
||||
this.useLocalDBCheckBox.TabIndex = 4;
|
||||
this.useLocalDBCheckBox.Text = "2. Use local database";
|
||||
this.useLocalDBCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// useWebServiceCheckBox
|
||||
//
|
||||
this.useWebServiceCheckBox.AutoSize = true;
|
||||
this.useWebServiceCheckBox.Enabled = false;
|
||||
this.useWebServiceCheckBox.Location = new System.Drawing.Point(38, 78);
|
||||
this.useWebServiceCheckBox.Name = "useWebServiceCheckBox";
|
||||
this.useWebServiceCheckBox.Size = new System.Drawing.Size(117, 17);
|
||||
this.useWebServiceCheckBox.TabIndex = 3;
|
||||
this.useWebServiceCheckBox.Text = "1. Use web service";
|
||||
this.useWebServiceCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(190, 45);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(132, 48);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(187, 16);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComponentName";
|
||||
//
|
||||
// procedureNameAlt1TextBox
|
||||
//
|
||||
this.procedureNameAlt1TextBox.Enabled = false;
|
||||
this.procedureNameAlt1TextBox.Location = new System.Drawing.Point(190, 147);
|
||||
this.procedureNameAlt1TextBox.Name = "procedureNameAlt1TextBox";
|
||||
this.procedureNameAlt1TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt1TextBox.TabIndex = 8;
|
||||
//
|
||||
// procedureNameAlt1Label
|
||||
//
|
||||
this.procedureNameAlt1Label.AutoSize = true;
|
||||
this.procedureNameAlt1Label.Location = new System.Drawing.Point(65, 150);
|
||||
this.procedureNameAlt1Label.Name = "procedureNameAlt1Label";
|
||||
this.procedureNameAlt1Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt1Label.TabIndex = 7;
|
||||
this.procedureNameAlt1Label.Text = "Procedure name Alt1";
|
||||
//
|
||||
// procedureNameAlt2TextBox
|
||||
//
|
||||
this.procedureNameAlt2TextBox.Enabled = false;
|
||||
this.procedureNameAlt2TextBox.Location = new System.Drawing.Point(190, 170);
|
||||
this.procedureNameAlt2TextBox.Name = "procedureNameAlt2TextBox";
|
||||
this.procedureNameAlt2TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt2TextBox.TabIndex = 10;
|
||||
//
|
||||
// procedureNameAlt2Label
|
||||
//
|
||||
this.procedureNameAlt2Label.AutoSize = true;
|
||||
this.procedureNameAlt2Label.Location = new System.Drawing.Point(65, 173);
|
||||
this.procedureNameAlt2Label.Name = "procedureNameAlt2Label";
|
||||
this.procedureNameAlt2Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt2Label.TabIndex = 9;
|
||||
this.procedureNameAlt2Label.Text = "Procedure name Alt2";
|
||||
//
|
||||
// useDefaultValuesCheckBox
|
||||
//
|
||||
this.useDefaultValuesCheckBox.AutoSize = true;
|
||||
this.useDefaultValuesCheckBox.Enabled = false;
|
||||
this.useDefaultValuesCheckBox.Location = new System.Drawing.Point(38, 202);
|
||||
this.useDefaultValuesCheckBox.Name = "useDefaultValuesCheckBox";
|
||||
this.useDefaultValuesCheckBox.Size = new System.Drawing.Size(126, 17);
|
||||
this.useDefaultValuesCheckBox.TabIndex = 11;
|
||||
this.useDefaultValuesCheckBox.Text = "3. Use default values";
|
||||
this.useDefaultValuesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FromHistoryCfgCtrl
|
||||
//
|
||||
this.Controls.Add(this.useDefaultValuesCheckBox);
|
||||
this.Controls.Add(this.procedureNameAlt2TextBox);
|
||||
this.Controls.Add(this.procedureNameAlt2Label);
|
||||
this.Controls.Add(this.procedureNameAlt1TextBox);
|
||||
this.Controls.Add(this.procedureNameAlt1Label);
|
||||
this.Controls.Add(this.procedureNameTextBox);
|
||||
this.Controls.Add(this.procedureNameLabel);
|
||||
this.Controls.Add(this.useLocalDBCheckBox);
|
||||
this.Controls.Add(this.useWebServiceCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "FromHistoryCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 250);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NHibernate;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class FromHistorySeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FromHistorySeq));
|
||||
|
||||
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, FromHistoryCfg cfg)
|
||||
{
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
|
||||
|
||||
bool success = false;
|
||||
|
||||
/// 1. Use a web service if enabled
|
||||
if (cfg.UseWebService)
|
||||
{
|
||||
success = ReadCorrectionsFromWebService(cfg);
|
||||
}
|
||||
|
||||
/// 2. Calculate pre-corrections from a local database if enabled
|
||||
if (!success && cfg.UseLocalDB)
|
||||
{
|
||||
success = ReadCorrectionsFromLocalDB(cfg);
|
||||
}
|
||||
|
||||
/// 3. Use pre-defined values (IperlHead procedure parameters) if enabled
|
||||
if (!success && cfg.UseDefaultValues)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
tstRslt.EndTime = DateTime.Now;
|
||||
tstRslt.TestDone = true;
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
if (meterRslt != null)
|
||||
{
|
||||
meterRslt.TestDone = true;
|
||||
meterRslt.Passed = success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
||||
|
||||
return new List<Event> { success ? Event.Done : Event.RecoverableError };
|
||||
}
|
||||
|
||||
|
||||
bool ReadCorrectionsFromWebService(FromHistoryCfg cfg)
|
||||
{
|
||||
/// Invalidate any previous Q2 Pre-Corrections
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
|
||||
try
|
||||
{
|
||||
return false;
|
||||
|
||||
/// TODO: Use webservice
|
||||
//IsQ2PreCorrectionCalculated = true;
|
||||
//return true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to calculate Q2 corrections: {0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ReadCorrectionsFromLocalDB(FromHistoryCfg cfg)
|
||||
{
|
||||
/// Invalidate any previous Q2 Pre-Corrections
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
|
||||
try
|
||||
{
|
||||
using (ISession session = Results.DB.CreateSession())
|
||||
{
|
||||
Batch btc = null;
|
||||
var batches = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureName))
|
||||
.List();
|
||||
|
||||
if (!string.IsNullOrEmpty(cfg.ProcedureNameAlt1))
|
||||
{
|
||||
IList<Batch> batches2 = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureNameAlt1))
|
||||
.List();
|
||||
foreach (var b in batches2) batches.Add(b);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cfg.ProcedureNameAlt2))
|
||||
{
|
||||
IList<Batch> batches3 = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureNameAlt2))
|
||||
.List();
|
||||
foreach (var b in batches3) batches.Add(b);
|
||||
}
|
||||
|
||||
int samplesCount = 0;
|
||||
double q2CorrLRsum = 0;
|
||||
double q2CorrRLsum = 0;
|
||||
|
||||
var sortedBatches = batches.OrderByDescending(b => b.EndTime);
|
||||
foreach (var b in sortedBatches)
|
||||
{
|
||||
foreach (var wm in b.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && wm.Passed)
|
||||
{
|
||||
#if IPERL
|
||||
q2CorrLRsum += wm.Q2CorrLR;
|
||||
q2CorrRLsum += wm.Q2CorrRL;
|
||||
#endif
|
||||
samplesCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (samplesCount >= 200) break;
|
||||
}
|
||||
|
||||
if (samplesCount >= 200)
|
||||
{
|
||||
IsQ2PreCorrectionCalculated = true;
|
||||
CalculatedQ2PreCorrectionLR = (int)Math.Round(q2CorrLRsum / samplesCount);
|
||||
CalculatedQ2PreCorrectionRL = (int)Math.Round(q2CorrRLsum / samplesCount);
|
||||
log.WarnFormat("Q2 corrections calculated OK: LR = {0}, RL = {1}", CalculatedQ2PreCorrectionLR, CalculatedQ2PreCorrectionRL);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Not enough samples to calculate Q2 corrections ({0})", samplesCount);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to calculate Q2 corrections: {0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
partial class GrabImageCfgCtrl
|
||||
{
|
||||
/// <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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.loResolutionCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.blackAndWhiteCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.imageNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.imageNameLabel = new System.Windows.Forms.Label();
|
||||
this.imageRotationLabel = new System.Windows.Forms.Label();
|
||||
this.imageRotationComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(149, 69);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(24, 72);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(95, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Test method name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(146, 43);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// loResolutionCheckBox
|
||||
//
|
||||
this.loResolutionCheckBox.AutoSize = true;
|
||||
this.loResolutionCheckBox.Enabled = false;
|
||||
this.loResolutionCheckBox.Location = new System.Drawing.Point(149, 149);
|
||||
this.loResolutionCheckBox.Name = "loResolutionCheckBox";
|
||||
this.loResolutionCheckBox.Size = new System.Drawing.Size(94, 17);
|
||||
this.loResolutionCheckBox.TabIndex = 6;
|
||||
this.loResolutionCheckBox.Text = "Low resolution";
|
||||
this.loResolutionCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// blackAndWhiteCheckBox
|
||||
//
|
||||
this.blackAndWhiteCheckBox.AutoSize = true;
|
||||
this.blackAndWhiteCheckBox.Enabled = false;
|
||||
this.blackAndWhiteCheckBox.Location = new System.Drawing.Point(149, 126);
|
||||
this.blackAndWhiteCheckBox.Name = "blackAndWhiteCheckBox";
|
||||
this.blackAndWhiteCheckBox.Size = new System.Drawing.Size(93, 17);
|
||||
this.blackAndWhiteCheckBox.TabIndex = 5;
|
||||
this.blackAndWhiteCheckBox.Text = "Black && White";
|
||||
this.blackAndWhiteCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// imageNameTextBox
|
||||
//
|
||||
this.imageNameTextBox.Enabled = false;
|
||||
this.imageNameTextBox.Location = new System.Drawing.Point(149, 95);
|
||||
this.imageNameTextBox.Name = "imageNameTextBox";
|
||||
this.imageNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.imageNameTextBox.TabIndex = 4;
|
||||
//
|
||||
// imageNameLabel
|
||||
//
|
||||
this.imageNameLabel.AutoSize = true;
|
||||
this.imageNameLabel.Location = new System.Drawing.Point(24, 98);
|
||||
this.imageNameLabel.Name = "imageNameLabel";
|
||||
this.imageNameLabel.Size = new System.Drawing.Size(81, 13);
|
||||
this.imageNameLabel.TabIndex = 3;
|
||||
this.imageNameLabel.Text = "Image file name";
|
||||
//
|
||||
// imageRotationLabel
|
||||
//
|
||||
this.imageRotationLabel.AutoSize = true;
|
||||
this.imageRotationLabel.Location = new System.Drawing.Point(24, 175);
|
||||
this.imageRotationLabel.Name = "imageRotationLabel";
|
||||
this.imageRotationLabel.Size = new System.Drawing.Size(103, 13);
|
||||
this.imageRotationLabel.TabIndex = 7;
|
||||
this.imageRotationLabel.Text = "Image rotation (ccw)";
|
||||
//
|
||||
// imageRotationComboBox
|
||||
//
|
||||
this.imageRotationComboBox.Enabled = false;
|
||||
this.imageRotationComboBox.FormattingEnabled = true;
|
||||
this.imageRotationComboBox.Location = new System.Drawing.Point(149, 172);
|
||||
this.imageRotationComboBox.Name = "imageRotationComboBox";
|
||||
this.imageRotationComboBox.Size = new System.Drawing.Size(93, 21);
|
||||
this.imageRotationComboBox.TabIndex = 8;
|
||||
//
|
||||
// GrabImageCfgCtrl
|
||||
//
|
||||
this.Controls.Add(this.imageRotationComboBox);
|
||||
this.Controls.Add(this.imageRotationLabel);
|
||||
this.Controls.Add(this.imageNameTextBox);
|
||||
this.Controls.Add(this.imageNameLabel);
|
||||
this.Controls.Add(this.blackAndWhiteCheckBox);
|
||||
this.Controls.Add(this.loResolutionCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "GrabImageCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 250);
|
||||
this.Load += new System.EventHandler(this.GrabImageCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox loResolutionCheckBox;
|
||||
private System.Windows.Forms.CheckBox blackAndWhiteCheckBox;
|
||||
private System.Windows.Forms.TextBox imageNameTextBox;
|
||||
private System.Windows.Forms.Label imageNameLabel;
|
||||
private System.Windows.Forms.Label imageRotationLabel;
|
||||
private System.Windows.Forms.ComboBox imageRotationComboBox;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1754,17 +1787,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
(rdData != null) && (rdData.Length == 2) && (rdData[0] == 0) && (rdData[1] == 0))
|
||||
{
|
||||
error = CommErr.None;
|
||||
resultStr = "Q2 correction factors reset to 0";
|
||||
ihead.Q2CorrectionFactor = 0;
|
||||
resultStr = string.Format("Q2 correction set to LR={0}, RL={1}", factorLR, factorRL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (error == CommErr.None)
|
||||
if (error == CommErr.None)
|
||||
{
|
||||
resultStr = "Q2 corrections reset to 0";
|
||||
ihead.Q2CorrRL = 0;
|
||||
resultStr = string.Format("Q2 correction set to LR={0}, RL={1}", factorLR, factorRL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1780,7 +1811,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
|
||||
if (wm.Pruefindex == 1)
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, ihead.InitQ2CorrLR, ihead.InitQ2CorrRL);
|
||||
if (TBF.BenchControl.Sequences.ProcessData.IsQ2PreCorrectionCalculated)
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, TBF.BenchControl.Sequences.ProcessData.CalculatedQ2PreCorrectionLR,
|
||||
TBF.BenchControl.Sequences.ProcessData.CalculatedQ2PreCorrectionRL);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, ihead.Q2PreCorrectionLR, ihead.Q2PreCorrectionRL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user