Compare commits
120
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc2342c385 | ||
|
|
498c8afbe4 | ||
|
|
0e6dce4750 | ||
|
|
7a74579c8b | ||
|
|
c23630a980 | ||
|
|
205df83c1c | ||
|
|
b26f65dab4 | ||
|
|
8d1ac8f41d | ||
|
|
115916fd36 | ||
|
|
6641ed9d96 | ||
|
|
5e3d408706 | ||
|
|
8fc9e3e5ce | ||
|
|
e7aa9731d0 | ||
|
|
0fc63655e9 | ||
|
|
86b47cb434 | ||
|
|
b3ec97d95c | ||
|
|
1620758545 | ||
|
|
5a2d51db95 | ||
|
|
c0e99364a4 | ||
|
|
371a27c646 | ||
|
|
4a06dcff3e | ||
|
|
0f54bf86ac | ||
|
|
921c524f0e | ||
|
|
a8df9b50de | ||
|
|
5da9b1e94e | ||
|
|
63871c9bcc | ||
|
|
e5b61825ff | ||
|
|
2d484ea993 | ||
|
|
b5b7d50742 | ||
|
|
19d77a9ad9 | ||
|
|
e77c0460de | ||
|
|
2ad5843f4f | ||
|
|
631ef5fe20 | ||
|
|
cd246e89c8 | ||
|
|
438374532f | ||
|
|
92609b9ead | ||
|
|
07b51f12a2 | ||
|
|
16494389c6 | ||
|
|
be86f0278f | ||
|
|
7e7ae86f65 | ||
|
|
3b2139d3df | ||
|
|
16c59b5c47 | ||
|
|
49cc584914 | ||
|
|
aeefac1d4e | ||
|
|
2b30607d9c | ||
|
|
cef8d3ff95 | ||
|
|
64646486e9 | ||
|
|
769e68d49b | ||
|
|
3dcb134aa1 | ||
|
|
81cb0eae64 | ||
|
|
4fad9925ec | ||
|
|
92d246eda0 | ||
|
|
34479778b9 | ||
|
|
163d209071 | ||
|
|
8eb601f24d | ||
|
|
ac9407b59d | ||
|
|
00dd0ed8fd | ||
|
|
6a53417b62 | ||
|
|
90f2b83fc0 | ||
|
|
3382c6e77a | ||
|
|
072de642e1 | ||
|
|
489ebd04aa | ||
|
|
2a68934b0e | ||
|
|
f3a502b7df | ||
|
|
2b0e66c71d | ||
|
|
e5c01a14d9 | ||
|
|
e5ef10beac | ||
|
|
4c3c499ad5 | ||
|
|
bdc7f5abd8 | ||
|
|
0ff78b9d4c | ||
|
|
41959d863f | ||
|
|
e7d495e47d | ||
|
|
e4f5be3f41 | ||
|
|
f42c1b7f0c | ||
|
|
9dbca87429 | ||
|
|
49ae2a84c4 | ||
|
|
34073844bc | ||
|
|
6f3b9be77e | ||
|
|
f675c7ada2 | ||
|
|
6aee0a71ed | ||
|
|
fa818c5cf8 | ||
|
|
0ef9505af1 | ||
|
|
bf69524fd8 | ||
|
|
58df07300e | ||
|
|
bef4928162 | ||
|
|
5995204d8d | ||
|
|
69b7c94176 | ||
|
|
540bc8ca74 | ||
|
|
03920d5b90 | ||
|
|
765637ce2d | ||
|
|
b4596ae6e9 | ||
|
|
4c92cb7af0 | ||
|
|
770b8447ac | ||
|
|
f3532fc3cb | ||
|
|
a7cfbc0b76 | ||
|
|
608dd087b8 | ||
|
|
5d2871b9ed | ||
|
|
779c870613 | ||
|
|
3cd585fe41 | ||
|
|
ff27ae7635 | ||
|
|
a41e805e8d | ||
|
|
9bcf3aa7f6 | ||
|
|
ff2248720c | ||
|
|
9bd2cd2634 | ||
|
|
9ba1b58d2e | ||
|
|
1d8728c7ce | ||
|
|
af68f35400 | ||
|
|
de269b66b5 | ||
|
|
ea894c2db5 | ||
|
|
bd9785c195 | ||
|
|
044046080d | ||
|
|
04efa02089 | ||
|
|
426a21fd0b | ||
|
|
8523324962 | ||
|
|
f06f819adb | ||
|
|
ac8e766476 | ||
|
|
a67a709782 | ||
|
|
9543de4170 | ||
|
|
79fea707f3 | ||
|
|
1034c8e752 |
+2
-2
@@ -8,8 +8,8 @@ GemCard/bin
|
||||
GemCard/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
MonitoringDB/bin
|
||||
MonitoringDB/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
+22
-4
@@ -14,25 +14,43 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
|
||||
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 3;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif FUZHOU300 || FUZHOU150 || PT200IL || PUCHONG_PT200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif TORINO50 || BADGER_MALA_TRAT || BERLIN
|
||||
#elif DUBAJ_50
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 5;
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif IZRAEL_50
|
||||
public const int WMsCount = 40;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif FUZHOU_100
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Config
|
||||
result.IsRealBench = IsRealBench;
|
||||
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
|
||||
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-61
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -127,41 +127,6 @@ namespace Config
|
||||
return SessionFactories[ix].OpenSession();
|
||||
}
|
||||
|
||||
public static void SaveToDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
SaveToDb(CreateSession(database), obj);
|
||||
}
|
||||
|
||||
public static void SaveToDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
session.SaveOrUpdate(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
DeleteFromDb(CreateSession(database), obj);
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.Delete(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
@@ -218,30 +183,5 @@ namespace Config
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty water meters database
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
//using (var session = sessionFactory.OpenSession())
|
||||
//{
|
||||
// using (var transaction = session.BeginTransaction())
|
||||
// {
|
||||
// /// Create one component
|
||||
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
|
||||
// session.SaveOrUpdate(cmpnt);
|
||||
// transaction.Commit();
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.928.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.928.0")]
|
||||
[assembly: AssemblyVersion("2.18.982.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.982.0")]
|
||||
|
||||
+34
-10
@@ -56,7 +56,10 @@ namespace DeviceTest
|
||||
|
||||
|
||||
static TBF.Boxes.FloatBox floatBox;
|
||||
static Event evnt;
|
||||
static TBF.Boxes.DoubleBox dblBox1;
|
||||
static TBF.Boxes.DoubleBox dblBox2;
|
||||
static TBF.Boxes.DoubleBox dblBox3;
|
||||
static Event evnt;
|
||||
|
||||
|
||||
static DeviceTestDlg()
|
||||
@@ -657,7 +660,13 @@ namespace DeviceTest
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -681,10 +690,16 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -708,10 +723,16 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -720,11 +741,14 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
|
||||
while (workerThreadRunning)
|
||||
int time = 0;
|
||||
while (workerThreadRunning)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (workerThreadRunning)
|
||||
StateMachine.Time = ++time;
|
||||
|
||||
if (workerThreadRunning)
|
||||
{
|
||||
foreach (var d in tbfDevices) d.RunDeviceBefore();
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
/// Configure and start logging
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(LocAppDataDir + log4netConfigFName));
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Path.Combine(LocAppDataDir, log4netConfigFName)));
|
||||
log = LogManager.GetLogger(typeof(Program));
|
||||
log.Fatal("--------------------------------------------------------------------------------");
|
||||
log.Fatal(string.Format("TBF ver.{0}", Version));
|
||||
log.FatalFormat("DeviceTest ver.{0}", Version);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
@@ -121,21 +121,6 @@
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
<COMReference Include="GemCardExLib">
|
||||
<Guid>{F1FF634B-BEDF-461C-A409-5B88E05F5117}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="SCARDSSPLib">
|
||||
<Guid>{82C38704-19F1-11D3-A11F-00C04F79F800}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
</COMReference>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MonitoringDB.Entities
|
||||
{
|
||||
public class Process
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Description { get; set; }
|
||||
public virtual ReleaseStatus ReleaseStatus { get; set; }
|
||||
public virtual DateTime TimeStamp { get; set; }
|
||||
public virtual string UserName { get; set; }
|
||||
|
||||
public virtual IList<Part> Parts { get; set; }
|
||||
public virtual IList<Workstep> Worksteps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default (private) constructor inicializing lists
|
||||
/// </summary>
|
||||
protected Process()
|
||||
{
|
||||
Parts = new List<Part>();
|
||||
Worksteps = new List<Workstep>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used when this process is created
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public Process(string name)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Description = string.Empty;
|
||||
ReleaseStatus = ReleaseStatus.In_preparation;
|
||||
TimeStamp = DateTime.Now;
|
||||
UserName = "admin";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a copy of a process with a new name
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Process Clone(string name)
|
||||
{
|
||||
Process rslt = new Process(name);
|
||||
rslt.Description = Description;
|
||||
|
||||
foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt));
|
||||
foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt));
|
||||
|
||||
return rslt;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} '{1}' ({2}) {3} {4}",
|
||||
ItemNr,
|
||||
Name,
|
||||
TimeStamp.Date.ToShortDateString(),
|
||||
(Description == null) ? string.Empty : Description,
|
||||
ReleaseStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
namespace MonitoringDB
|
||||
{
|
||||
public enum CodeType
|
||||
{
|
||||
UniqueNr,
|
||||
FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu
|
||||
FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom
|
||||
BatchNr,
|
||||
BatchNrContainingPartName,
|
||||
DateMMYY,
|
||||
QualityCheck,
|
||||
}
|
||||
|
||||
public enum CodeForm
|
||||
{
|
||||
Barcode,
|
||||
QRCode,
|
||||
Keyboard,
|
||||
OkNok,
|
||||
}
|
||||
|
||||
public enum CodeLocation
|
||||
{
|
||||
OnPart,
|
||||
OnPallet,
|
||||
}
|
||||
|
||||
public enum LifetimeManagement
|
||||
{
|
||||
None,
|
||||
OneYear,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ReleaseStatus
|
||||
{
|
||||
In_preparation,
|
||||
Released,
|
||||
ReleasedActive,
|
||||
Deactivated,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum Mode
|
||||
{
|
||||
Debug, // Debug mode - no Oracle database used
|
||||
Test, // Test database used
|
||||
Production, // Production database used
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum LoginLevel
|
||||
{
|
||||
None,
|
||||
TeamLeader,
|
||||
Administrator,
|
||||
MH,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ItemSpecID
|
||||
{
|
||||
RefRecordID = 0,
|
||||
|
||||
TimeStamp,
|
||||
Workstep,
|
||||
Workplace,
|
||||
UserName,
|
||||
Barcode,
|
||||
PartBarcode,
|
||||
|
||||
TimeStamp2,
|
||||
Workstep2,
|
||||
Workplace2,
|
||||
UserName2,
|
||||
Barcode2,
|
||||
PartBarcode2,
|
||||
|
||||
SerialNr,
|
||||
PurchaseOrder,
|
||||
TestResult,
|
||||
MaxPruefindex,
|
||||
|
||||
Process,
|
||||
}
|
||||
|
||||
public enum ItemSpecCaps
|
||||
{
|
||||
None = 0,
|
||||
ReferenceRecord = 1,
|
||||
AssociatedRecord = 2,
|
||||
OracleQuery = 4,
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MonitoringDB.Forms
|
||||
{
|
||||
public partial class SettingsDlg : Form
|
||||
{
|
||||
public string WorkplaceName
|
||||
{
|
||||
set { workplaceNameTextBox.Text = value; }
|
||||
get { return workplaceNameTextBox.Text; }
|
||||
}
|
||||
|
||||
public string ConnectionString
|
||||
{
|
||||
set { connectionStringTextBox.Text = value; }
|
||||
get { return connectionStringTextBox.Text; }
|
||||
}
|
||||
|
||||
public string UsersDBConnString
|
||||
{
|
||||
set { usersDBConnStringTextBox.Text = value; }
|
||||
get { return usersDBConnStringTextBox.Text; }
|
||||
}
|
||||
|
||||
public bool OracleBattery
|
||||
{
|
||||
set { oracleBatteryCheckBox.Checked = value; }
|
||||
get { return oracleBatteryCheckBox.Checked; }
|
||||
}
|
||||
|
||||
public bool CheckPcbIsInOracle
|
||||
{
|
||||
set { checkPcbIsInOracleCheckBox.Checked = value; }
|
||||
get { return checkPcbIsInOracleCheckBox.Checked; }
|
||||
}
|
||||
|
||||
public int ExtraBatterLifetime
|
||||
{
|
||||
get
|
||||
{
|
||||
int extraLifetime;
|
||||
if (int.TryParse(extraBatteryLifetimeTextBox.Text, out extraLifetime) && extraLifetime >= 0) return extraLifetime;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public MonitoringDB.Mode Mode
|
||||
{
|
||||
set
|
||||
{
|
||||
radioButton1.Checked = (value == MonitoringDB.Mode.Test);
|
||||
radioButton2.Checked = (value == MonitoringDB.Mode.Production);
|
||||
}
|
||||
get
|
||||
{
|
||||
return radioButton1.Checked ? MonitoringDB.Mode.Test : MonitoringDB.Mode.Production;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic configuration dialog
|
||||
/// </summary>
|
||||
/// <param name="isWorkplace">false = Konfiguracia pracovisk, true = Pracovisko</param>
|
||||
public SettingsDlg(bool isWorkplace)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (isWorkplace)
|
||||
{
|
||||
oracleGroupBox.Visible = true;
|
||||
}
|
||||
extraBatteryLifetimeTextBox.Text = "0";
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MonitoringDB.Forms
|
||||
{
|
||||
public partial class TrivialLoginDlg : Form
|
||||
{
|
||||
public LoginLevel LoginLevel;
|
||||
|
||||
public TrivialLoginDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoginLevel = LoginLevel.None;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (passwordTextBox.Text.ToLower().Equals("barcode"))
|
||||
{
|
||||
LoginLevel = LoginLevel.Administrator;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else if (passwordTextBox.Text.ToLower().Equals("teamleader"))
|
||||
{
|
||||
LoginLevel = LoginLevel.TeamLeader;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else if (passwordTextBox.Text.ToLower().Equals("kremik"))
|
||||
{
|
||||
LoginLevel = LoginLevel.MH;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
namespace MonitoringDB.Forms
|
||||
{
|
||||
partial class TrivialLoginDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.passwordGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.passwordTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.passwordGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// passwordGroupBox
|
||||
//
|
||||
this.passwordGroupBox.Controls.Add(this.passwordTextBox);
|
||||
this.passwordGroupBox.Location = new System.Drawing.Point(12, 10);
|
||||
this.passwordGroupBox.Name = "passwordGroupBox";
|
||||
this.passwordGroupBox.Size = new System.Drawing.Size(200, 49);
|
||||
this.passwordGroupBox.TabIndex = 0;
|
||||
this.passwordGroupBox.TabStop = false;
|
||||
this.passwordGroupBox.Text = "Heslo";
|
||||
//
|
||||
// passwordTextBox
|
||||
//
|
||||
this.passwordTextBox.Location = new System.Drawing.Point(51, 18);
|
||||
this.passwordTextBox.Name = "passwordTextBox";
|
||||
this.passwordTextBox.PasswordChar = '*';
|
||||
this.passwordTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.passwordTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(237, 18);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 39);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(330, 18);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 39);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// LoginDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(426, 73);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.passwordGroupBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "LoginDlg";
|
||||
this.Text = "LoginDlg";
|
||||
this.passwordGroupBox.ResumeLayout(false);
|
||||
this.passwordGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox passwordGroupBox;
|
||||
private System.Windows.Forms.TextBox passwordTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace MonitoringDB.Mappings
|
||||
{
|
||||
class ProcessMap : ClassMap<Entities.Process>
|
||||
{
|
||||
public ProcessMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Description);
|
||||
Map(x => x.ReleaseStatus);
|
||||
Map(x => x.TimeStamp);
|
||||
Map(x => x.UserName);
|
||||
|
||||
HasMany(x => x.Parts)
|
||||
.OrderBy("Name")
|
||||
.Cascade.All();
|
||||
HasMany(x => x.Worksteps)
|
||||
.OrderBy("WorkstepNr")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-5
@@ -27,8 +27,8 @@ namespace Results
|
||||
public Batch Batch;
|
||||
public WaterMeter[] WaterMeters;
|
||||
|
||||
public static BatchResults NewFromProcedure(int batchNr, int benchId, string user, int userNr, string programVer,
|
||||
Config.Entities.Procedure procedure,
|
||||
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
|
||||
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
|
||||
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
|
||||
{
|
||||
BatchResults d = new BatchResults(waterMeterDatas.Length);
|
||||
@@ -37,8 +37,14 @@ namespace Results
|
||||
/// Create new batch
|
||||
d.Batch = new Batch()
|
||||
{
|
||||
TestBenchId = benchId,
|
||||
BatchNr = batchNr,
|
||||
BatchNr = batchNr,
|
||||
TestBenchId = benchId,
|
||||
TestBenchName = benchName,
|
||||
Address1 = a1,
|
||||
Address2 = a2,
|
||||
Address3 = a3,
|
||||
Address4 = a4,
|
||||
Address5 = a5,
|
||||
ProgramVersion = programVer,
|
||||
UserName = user,
|
||||
UserNumber = userNr,
|
||||
@@ -199,8 +205,10 @@ namespace Results
|
||||
{
|
||||
foreach (var mtr in WaterMeters[i].MeterTestRslts)
|
||||
{
|
||||
if (mtr.TestData().Name.ToLower().Contains("adj"))
|
||||
if (mtr.TestData().Name.ToLower().Contains("adj") || mtr.TestData().Name.ToLower().Contains("just"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,13 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int BatchNr { get; set; }
|
||||
public virtual int TestBenchId { get; set; }
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual string UserName { get; set; }
|
||||
public virtual int UserNumber { get; set; }
|
||||
public virtual string ProcedureName { get; set; }
|
||||
|
||||
@@ -80,10 +80,18 @@ namespace Results.Entities
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
}
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public MeterTestRslt()
|
||||
{
|
||||
|
||||
@@ -26,8 +26,10 @@ namespace Results.Entities
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
/// When mass measurement is not available, corrected by a correction table.
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double MassStart { get; set; } /// [kg]
|
||||
public virtual double MassEndRaw { get; set; } /// [kg]
|
||||
@@ -40,7 +42,7 @@ namespace Results.Entities
|
||||
public virtual double FlowVolume { get; set; } /// [m3/h]
|
||||
public virtual double VolumeCTV { get; set; } /// [l] Volume conventional true value
|
||||
public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter
|
||||
public virtual double ErrorMaster { get; set; } /// [%]
|
||||
public virtual double ErrorMaster { get; set; } /// [%] Error of the master flow meter
|
||||
|
||||
public virtual float DiverterStart { get; set; } /// [s] Diverter switch time when test starts
|
||||
public virtual float DivStart10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
|
||||
@@ -107,7 +109,7 @@ namespace Results.Entities
|
||||
public virtual float FlowMean { get; set; } /// [m3/h] mean flow from the reference flowmeter
|
||||
public virtual float FlowStart { get; set; } /// [m3/h] flow at the start of test from the reference flowmeter
|
||||
public virtual float FlowEnd { get; set; } /// [m3/h] flow at the end of test from the reference flowmeter
|
||||
public virtual float FlowMin { get; set; } /// [m3/h] not mapped to DB
|
||||
public virtual float FlowMin { get; set; } /// [m3/h]
|
||||
public virtual float FlowMax { get; set; } /// [m3/h]
|
||||
|
||||
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
|
||||
|
||||
@@ -58,13 +58,15 @@ namespace Results.Entities
|
||||
|
||||
#if IPERL
|
||||
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual double OrigCalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA { get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Diff2Hz8Hz { get; set; }
|
||||
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
@@ -117,7 +119,7 @@ namespace Results.Entities
|
||||
ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off;
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
|
||||
if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
|
||||
if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode();
|
||||
}
|
||||
errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On)
|
||||
@@ -149,7 +151,7 @@ namespace Results.Entities
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr()) : eFlags;
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -209,9 +211,17 @@ namespace Results.Entities
|
||||
}
|
||||
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, true);
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -264,6 +274,21 @@ namespace Results.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool TryGetTestRslt(string testName, out TestRslt testRslt)
|
||||
{
|
||||
MeterTestRslt mtr = GetMeterTestRslt(testName);
|
||||
if (mtr != null)
|
||||
{
|
||||
testRslt = mtr.TestRslt;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testRslt = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual TestData GetTestData(string testName)
|
||||
{
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
@@ -276,6 +301,21 @@ namespace Results.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool TryGetTestData(string testName, out TestData testData)
|
||||
{
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.TestRslt.TestData.Name == testName)
|
||||
{
|
||||
testData = mtr.TestRslt.TestData;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
testData = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -312,8 +352,8 @@ namespace Results.Entities
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRFlow = src.Q2CorrRFlow;
|
||||
Q2CorrLFlow = src.Q2CorrLFlow;
|
||||
Q2CorrRL = src.Q2CorrRL;
|
||||
Q2CorrLR = src.Q2CorrLR;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
Diff2Hz8Hz = src.Diff2Hz8Hz;
|
||||
Hz2CorrectionDone = src.Hz2CorrectionDone;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct HDITEM
|
||||
{
|
||||
public Mask mask;
|
||||
public int cxy;
|
||||
[MarshalAs(UnmanagedType.LPTStr)]
|
||||
public string pszText;
|
||||
public IntPtr hbm;
|
||||
public int cchTextMax;
|
||||
public Format fmt;
|
||||
public IntPtr lParam;
|
||||
// _WIN32_IE >= 0x0300
|
||||
public int iImage;
|
||||
public int iOrder;
|
||||
// _WIN32_IE >= 0x0500
|
||||
public uint type;
|
||||
public IntPtr pvFilter;
|
||||
// _WIN32_WINNT >= 0x0600
|
||||
public uint state;
|
||||
|
||||
[Flags]
|
||||
public enum Mask
|
||||
{
|
||||
Format = 0x4, // HDI_FORMAT
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum Format
|
||||
{
|
||||
SortDown = 0x200, // HDF_SORTDOWN
|
||||
SortUp = 0x400, // HDF_SORTUP
|
||||
};
|
||||
};
|
||||
|
||||
public const int LVM_FIRST = 0x1000;
|
||||
public const int LVM_GETHEADER = LVM_FIRST + 31;
|
||||
|
||||
public const int HDM_FIRST = 0x1200;
|
||||
public const int HDM_GETITEM = HDM_FIRST + 11;
|
||||
public const int HDM_SETITEM = HDM_FIRST + 12;
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
|
||||
|
||||
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
|
||||
{
|
||||
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
|
||||
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
|
||||
{
|
||||
var columnPtr = new IntPtr(columnNumber);
|
||||
var item = new HDITEM
|
||||
{
|
||||
mask = HDITEM.Mask.Format
|
||||
};
|
||||
|
||||
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
if (order != SortOrder.None && columnNumber == columnIndex)
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case SortOrder.Ascending:
|
||||
item.fmt &= ~HDITEM.Format.SortDown;
|
||||
item.fmt |= HDITEM.Format.SortUp;
|
||||
break;
|
||||
|
||||
case SortOrder.Descending:
|
||||
item.fmt &= ~HDITEM.Format.SortUp;
|
||||
item.fmt |= HDITEM.Format.SortDown;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
|
||||
}
|
||||
|
||||
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public class LviIntColumnComparer : IComparer
|
||||
{
|
||||
int column;
|
||||
SortOrder order;
|
||||
|
||||
public LviIntColumnComparer()
|
||||
{
|
||||
column = 0;
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LviIntColumnComparer(int column, SortOrder order)
|
||||
{
|
||||
this.column = column;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
|
||||
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
|
||||
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public class LviTextColumnComparer : IComparer
|
||||
{
|
||||
private int column;
|
||||
SortOrder order;
|
||||
|
||||
public LviTextColumnComparer()
|
||||
{
|
||||
column = 0;
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LviTextColumnComparer(int column, SortOrder order)
|
||||
{
|
||||
this.column = column;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
string txtX = ((ListViewItem)x).SubItems[column].Text;
|
||||
string txtY = ((ListViewItem)y).SubItems[column].Text;
|
||||
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-1
@@ -71,7 +71,7 @@ namespace Results
|
||||
Pulse__liter, /// 61 Water meter constant (pulses per liter) specific for one test
|
||||
Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method)
|
||||
Reference_energy, /// 63
|
||||
Test_bench_ID, /// 64
|
||||
Bench_ID, /// 64 Test bench ID (int) obtained from a component implementing IBenchInfo
|
||||
Program_version, /// 65
|
||||
User_name, /// 66
|
||||
User_nr, /// 67
|
||||
@@ -251,6 +251,17 @@ namespace Results
|
||||
Flow_ctv_start, /// 217
|
||||
Flow_ctv_end, /// 218
|
||||
ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected
|
||||
Reference_error_corr, /// 220 Reference flow meter error after correction using correction curve
|
||||
|
||||
Proc_description, /// 221 Procedure description (CEVAK, not mapped to DB)
|
||||
Bench_name, /// 222 'Test bench name' (string) obtained from a component implementing IBenchInfo
|
||||
Bench_address1, /// 223 'Address 1' from IBenchInfo
|
||||
Bench_address2, /// 224 'Address 2' from IBenchInfo
|
||||
Bench_address3, /// 225 'Address 3' from IBenchInfo
|
||||
Bench_address4, /// 226 'Address 4' from IBenchInfo
|
||||
Bench_address5, /// 227 'Address 5' from IBenchInfo
|
||||
|
||||
Max_test_index, /// 228 MaxPruefindex % 100
|
||||
|
||||
Count,
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
|
||||
@@ -31,11 +31,17 @@ namespace Results.Mappings
|
||||
Map(x => x.SerialNrEx);
|
||||
Map(x => x.OrigCalibFactor);
|
||||
Map(x => x.CalibFactor);
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
#endif
|
||||
#if IPERL2
|
||||
Map(x => x.OrigCalibFactorLNA);
|
||||
Map(x => x.CalibFactorLNA);
|
||||
#endif
|
||||
#if IPERL
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrRFlow);
|
||||
Map(x => x.Q2CorrLFlow);
|
||||
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
|
||||
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
|
||||
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
|
||||
SizeF tableSize = table0.Measure(e);
|
||||
int wmSectionHeight = (int)tableSize.Height + 3 * SpacingOne4Header;
|
||||
int wmSectionHeight = (int)tableSize.Height + SpacingOne4Header * ((tableSize.Height > 0) ? 3 : 2);
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
@@ -239,7 +239,10 @@ namespace Results.Output.Printers.Enhanced
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
|
||||
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
|
||||
{
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
|
||||
}
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
@@ -265,7 +268,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Print the water meter number and the serial number
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
@@ -278,7 +281,14 @@ namespace Results.Output.Printers.Enhanced
|
||||
|
||||
Table table = Table.Create_TestsAreRows(wm, testItems, style);
|
||||
|
||||
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
|
||||
if (table.IsEmpty())
|
||||
{
|
||||
return top;
|
||||
}
|
||||
else
|
||||
{
|
||||
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,10 +57,21 @@ namespace Results.Output.Printers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when table has either rows or columns count == 0
|
||||
/// </summary>
|
||||
/// <returns>true when empty</returns>
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return (Rows == null || RowsCount == 0 || Rows[0] == null || Rows[0].Length == 0);
|
||||
}
|
||||
|
||||
|
||||
public SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
SizeF retVal = new SizeF(0, 0);
|
||||
if (RowsCount == 0) return retVal;
|
||||
|
||||
if (IsEmpty()) return retVal; /// Empty table => zero Size
|
||||
|
||||
float[] columnWidth = new float[ColumnsCount];
|
||||
float[] rowHeight = new float[RowsCount];
|
||||
@@ -117,10 +128,10 @@ namespace Results.Output.Printers
|
||||
|
||||
public float Draw(System.Drawing.Printing.PrintPageEventArgs e, float left, float top)
|
||||
{
|
||||
if (RowsCount == 0) return top;
|
||||
if (IsEmpty()) return top; /// Empty table
|
||||
|
||||
int tblColumnsCount = Rows[0].Length;
|
||||
|
||||
|
||||
float[] columnWidth = new float[tblColumnsCount];
|
||||
float[] columnPos = new float[tblColumnsCount];
|
||||
float[] vertLinePos = new float[tblColumnsCount + 1];
|
||||
|
||||
@@ -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.918.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.918.0")]
|
||||
[assembly: AssemblyVersion("2.18.1034.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1034.0")]
|
||||
|
||||
Generated
+36
@@ -69,6 +69,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Address.
|
||||
/// </summary>
|
||||
internal static string Address {
|
||||
get {
|
||||
return ResourceManager.GetString("Address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Alignment.
|
||||
/// </summary>
|
||||
@@ -123,6 +132,24 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bench ID.
|
||||
/// </summary>
|
||||
internal static string Bench_ID {
|
||||
get {
|
||||
return ResourceManager.GetString("Bench_ID", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bench name.
|
||||
/// </summary>
|
||||
internal static string Bench_name {
|
||||
get {
|
||||
return ResourceManager.GetString("Bench_name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
@@ -636,6 +663,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Procedure description.
|
||||
/// </summary>
|
||||
internal static string Procedure_description {
|
||||
get {
|
||||
return ResourceManager.GetString("Procedure_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Producer.
|
||||
/// </summary>
|
||||
|
||||
@@ -213,4 +213,43 @@
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Jednotka</value>
|
||||
</data>
|
||||
<data name="Approval" xml:space="preserve">
|
||||
<value>Schválení</value>
|
||||
</data>
|
||||
<data name="Bench" xml:space="preserve">
|
||||
<value>Stanice</value>
|
||||
</data>
|
||||
<data name="Density" xml:space="preserve">
|
||||
<value>Hustota</value>
|
||||
</data>
|
||||
<data name="Density_correction" xml:space="preserve">
|
||||
<value>Korekce hustoty</value>
|
||||
</data>
|
||||
<data name="End" xml:space="preserve">
|
||||
<value>Konec</value>
|
||||
</data>
|
||||
<data name="Procedure" xml:space="preserve">
|
||||
<value>Procedura</value>
|
||||
</data>
|
||||
<data name="Procedure_description" xml:space="preserve">
|
||||
<value>Popis procedury</value>
|
||||
</data>
|
||||
<data name="Start" xml:space="preserve">
|
||||
<value>Začátek</value>
|
||||
</data>
|
||||
<data name="User" xml:space="preserve">
|
||||
<value>Uživatel</value>
|
||||
</data>
|
||||
<data name="User_description" xml:space="preserve">
|
||||
<value>Popis uživatele</value>
|
||||
</data>
|
||||
<data name="Bench_ID" xml:space="preserve">
|
||||
<value>ID stanice</value>
|
||||
</data>
|
||||
<data name="Bench_name" xml:space="preserve">
|
||||
<value>Jméno stanice</value>
|
||||
</data>
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Adresa</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -723,4 +723,16 @@
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Unit</value>
|
||||
</data>
|
||||
<data name="Procedure_description" xml:space="preserve">
|
||||
<value>Procedure description</value>
|
||||
</data>
|
||||
<data name="Bench_ID" xml:space="preserve">
|
||||
<value>Bench ID</value>
|
||||
</data>
|
||||
<data name="Bench_name" xml:space="preserve">
|
||||
<value>Bench name</value>
|
||||
</data>
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -77,6 +77,9 @@
|
||||
<Compile Include="Forms\ListViewEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ListViewExtensions.cs" />
|
||||
<Compile Include="Forms\LviIntColumnComparer.cs" />
|
||||
<Compile Include="Forms\LviTextColumnComparer.cs" />
|
||||
<Compile Include="Forms\ResultsConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
||||
+2
-2
@@ -54,9 +54,9 @@ namespace Results
|
||||
|
||||
public static string PassedColorStr(bool passed, bool useRedGreenColor)
|
||||
{
|
||||
#if PUCHONG_PT200
|
||||
#if PUCHONG_200
|
||||
return (useRedGreenColor) ? (passed ? "OK|Green" : "NG|Red") : (passed ? "OK|White" : "NG|White");
|
||||
#elif BAHRAIN_50
|
||||
#elif BAHRAIN_50 || DUBAJ_50
|
||||
return (useRedGreenColor) ? (passed ? "PASSED|Green" : "FAILED|Red") : (passed ? "PASSED|White" : "FAILED|White");
|
||||
#elif LANG_PL
|
||||
return (useRedGreenColor) ? (passed ? "+|Green" : "-|Red") : (passed ? "+|White" : "-|White");
|
||||
|
||||
@@ -144,17 +144,18 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Separator, "Separator", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => string.Empty));
|
||||
|
||||
/// Common
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.ProcedureName())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.ProcedureName())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Proc_description, Strings.Procedure_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProcedureDescription)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())));
|
||||
|
||||
///
|
||||
/// Volume
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
|
||||
@@ -307,12 +308,14 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimHi())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster))));
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
|
||||
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
|
||||
@@ -374,8 +377,14 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndStateAux)));
|
||||
|
||||
/// Batch info
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.TestBenchId.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProgramVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_ID, Strings.Bench_ID, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.TestBenchId.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_name, Strings.Bench_name, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.TestBenchName) ? w.Batch.TestBenchName : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address1, Strings.Address + " 1", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address1) ? w.Batch.Address1 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address2, Strings.Address + " 2", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address2) ? w.Batch.Address2 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address3, Strings.Address + " 3", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address3) ? w.Batch.Address3 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address4, Strings.Address + " 4", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address4) ? w.Batch.Address4 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address5, Strings.Address + " 5", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address5) ? w.Batch.Address5 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProgramVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.UserNumber)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToUserName(w.Batch.UserName))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_description, Strings.User_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToFullName(w.Batch.UserName))));
|
||||
@@ -400,20 +409,23 @@ namespace Results
|
||||
#endif
|
||||
|
||||
#if IPERL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection",Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
|
||||
#endif
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).TestDone) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).Passed) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).Passed)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E2, "E2 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0002) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E3, "E3 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0004) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E4, "E4 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0008) != 0) ? Strings.Yes : Strings.No));
|
||||
@@ -446,9 +458,22 @@ namespace Results
|
||||
return string.IsNullOrEmpty(format) ? value : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatBool(string format, bool value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
return value ? Strings.Yes : Strings.No;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = format.Split(new char[] { '~' });
|
||||
return value ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatInt(string format, int value)
|
||||
{
|
||||
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
|
||||
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v)
|
||||
|
||||
@@ -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.856.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.856.0")]
|
||||
[assembly: AssemblyVersion("2.18.995.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.995.0")]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SENTEC</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -398,21 +398,21 @@ namespace ResultsBrowser
|
||||
{
|
||||
new Results.Output.Printers.Munich.MunichPrintDocument(string.Format("4/13 - {0}", BenchName()), wm, Config.Entities.PageOrientation.Portrait).Print();
|
||||
}
|
||||
#elif CEVAK_PT40_272
|
||||
#elif CEVAK_40
|
||||
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
if (!batches.Contains(wm.Batch)) batches.Add(wm.Batch);
|
||||
}
|
||||
|
||||
foreach (var batch in batches)
|
||||
{
|
||||
new Results.Output.Printers.Cevak.PrintDocumentCevak(batch,
|
||||
Config.Entities.PageOrientation.Portrait,
|
||||
60, 60, 60,
|
||||
"PT40 Z/E-35-A",
|
||||
"0111-OOP-C035-13").Print();
|
||||
}
|
||||
//foreach (var batch in batches)
|
||||
//{
|
||||
// new Results.Output.Printers.Cevak.PrintDocumentCevak(batch,
|
||||
// Config.Entities.PageOrientation.Portrait,
|
||||
// 60, 60, 60,
|
||||
// "PT40 Z/E-35-A",
|
||||
// "0111-OOP-C035-13").Print();
|
||||
//}
|
||||
#else
|
||||
if (string.IsNullOrEmpty(filtersConfig.PrinterClass))
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphLib", "GraphLib\GraphL
|
||||
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonitoringDB", "MonitoringDB\MonitoringDB.csproj", "{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TracingDB", "TracingDB\TracingDB.csproj", "{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GemCard", "GemCard\GemCard.csproj", "{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}"
|
||||
EndProject
|
||||
|
||||
@@ -23,8 +23,17 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
@@ -46,11 +49,6 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ToString(char a)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, ...", Name, ParentName);
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
@@ -69,6 +67,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
ApprovedBy = string.Empty;
|
||||
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
#if ORACLE_DB
|
||||
MaxTestIndex = 4;
|
||||
#endif
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@@ -84,6 +85,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
#if ORACLE_DB
|
||||
"Max.test index",
|
||||
#endif
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@@ -104,6 +108,11 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Bench name={1}, Bench Id={2}, Procedures={3}", Name, TestBenchName, TestBenchId, RemoteDBUse.ToDescription());
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TestBenchName;
|
||||
@@ -117,6 +126,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
#if ORACLE_DB
|
||||
case 11: return MaxTestIndex.ToString();
|
||||
#endif
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +165,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
#if ORACLE_DB
|
||||
case 11: MaxTestIndex = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
#endif
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +190,7 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
case 11:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
@@ -206,6 +221,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
#if ORACLE_DB
|
||||
prms.MaxTestIndex = this.MaxTestIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
|
||||
@@ -23,7 +23,15 @@ namespace TBF.BenchControl.BenchInfo.Munich
|
||||
|
||||
public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
|
||||
public string Address1 { get { return string.Empty; } }
|
||||
public string Address2 { get { return string.Empty; } }
|
||||
public string Address3 { get { return string.Empty; } }
|
||||
public string Address4 { get { return string.Empty; } }
|
||||
public string Address5 { get { return string.Empty; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return RemoteDBUse.LocalDBOnly; } }
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex { get { return 0; } }
|
||||
#endif
|
||||
|
||||
public Component()
|
||||
{
|
||||
|
||||
@@ -188,6 +188,12 @@ namespace TBF.BenchControl.Configs.ParamsProvider
|
||||
{
|
||||
flags |= paramsProvider.UpdateParam(itemNr, e.DisplayText);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(message);
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,311 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajík
|
||||
///
|
||||
namespace TBF.BenchControl.DB.SensusOracle
|
||||
{
|
||||
partial class DatabaseCfgCtrl
|
||||
{
|
||||
/// <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.destinationTextBox = new System.Windows.Forms.TextBox();
|
||||
this.destinationLabel = new System.Windows.Forms.Label();
|
||||
this.dayFoldersCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.destinationButton = new System.Windows.Forms.Button();
|
||||
this.yearFoldersCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.monthFoldersCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.separatorLabel = new System.Windows.Forms.Label();
|
||||
this.separatorComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.benchIdTextBox = new System.Windows.Forms.TextBox();
|
||||
this.benchIdLabel = new System.Windows.Forms.Label();
|
||||
this.dbUsedComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.dbUsedLabel = new System.Windows.Forms.Label();
|
||||
this.baujahrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.baujahrLabel = new System.Windows.Forms.Label();
|
||||
this.logsFolderButton = new System.Windows.Forms.Button();
|
||||
this.logsFolderTextBox = new System.Windows.Forms.TextBox();
|
||||
this.logsFolderLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(19, 33);
|
||||
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(107, 8);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// destinationTextBox
|
||||
//
|
||||
this.destinationTextBox.Enabled = false;
|
||||
this.destinationTextBox.Location = new System.Drawing.Point(110, 117);
|
||||
this.destinationTextBox.Name = "destinationTextBox";
|
||||
this.destinationTextBox.Size = new System.Drawing.Size(145, 20);
|
||||
this.destinationTextBox.TabIndex = 10;
|
||||
//
|
||||
// destinationLabel
|
||||
//
|
||||
this.destinationLabel.AutoSize = true;
|
||||
this.destinationLabel.Location = new System.Drawing.Point(19, 120);
|
||||
this.destinationLabel.Name = "destinationLabel";
|
||||
this.destinationLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.destinationLabel.TabIndex = 9;
|
||||
this.destinationLabel.Text = "Results folder";
|
||||
//
|
||||
// dayFoldersCheckBox
|
||||
//
|
||||
this.dayFoldersCheckBox.AutoSize = true;
|
||||
this.dayFoldersCheckBox.Enabled = false;
|
||||
this.dayFoldersCheckBox.Location = new System.Drawing.Point(207, 166);
|
||||
this.dayFoldersCheckBox.Name = "dayFoldersCheckBox";
|
||||
this.dayFoldersCheckBox.Size = new System.Drawing.Size(79, 17);
|
||||
this.dayFoldersCheckBox.TabIndex = 17;
|
||||
this.dayFoldersCheckBox.Text = "Day folders";
|
||||
this.dayFoldersCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// destinationButton
|
||||
//
|
||||
this.destinationButton.Enabled = false;
|
||||
this.destinationButton.Location = new System.Drawing.Point(261, 117);
|
||||
this.destinationButton.Name = "destinationButton";
|
||||
this.destinationButton.Size = new System.Drawing.Size(30, 20);
|
||||
this.destinationButton.TabIndex = 11;
|
||||
this.destinationButton.Text = "...";
|
||||
this.destinationButton.UseVisualStyleBackColor = true;
|
||||
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
|
||||
//
|
||||
// yearFoldersCheckBox
|
||||
//
|
||||
this.yearFoldersCheckBox.AutoSize = true;
|
||||
this.yearFoldersCheckBox.Enabled = false;
|
||||
this.yearFoldersCheckBox.Location = new System.Drawing.Point(23, 166);
|
||||
this.yearFoldersCheckBox.Name = "yearFoldersCheckBox";
|
||||
this.yearFoldersCheckBox.Size = new System.Drawing.Size(82, 17);
|
||||
this.yearFoldersCheckBox.TabIndex = 15;
|
||||
this.yearFoldersCheckBox.Text = "Year folders";
|
||||
this.yearFoldersCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// monthFoldersCheckBox
|
||||
//
|
||||
this.monthFoldersCheckBox.AutoSize = true;
|
||||
this.monthFoldersCheckBox.Enabled = false;
|
||||
this.monthFoldersCheckBox.Location = new System.Drawing.Point(111, 166);
|
||||
this.monthFoldersCheckBox.Name = "monthFoldersCheckBox";
|
||||
this.monthFoldersCheckBox.Size = new System.Drawing.Size(90, 17);
|
||||
this.monthFoldersCheckBox.TabIndex = 16;
|
||||
this.monthFoldersCheckBox.Text = "Month folders";
|
||||
this.monthFoldersCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// eliminateSpacesCheckBox
|
||||
//
|
||||
this.eliminateSpacesCheckBox.AutoSize = true;
|
||||
this.eliminateSpacesCheckBox.Enabled = false;
|
||||
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(111, 208);
|
||||
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
|
||||
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(165, 17);
|
||||
this.eliminateSpacesCheckBox.TabIndex = 20;
|
||||
this.eliminateSpacesCheckBox.Text = "Eliminate spaces in each field";
|
||||
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// separatorLabel
|
||||
//
|
||||
this.separatorLabel.AutoSize = true;
|
||||
this.separatorLabel.Location = new System.Drawing.Point(19, 188);
|
||||
this.separatorLabel.Name = "separatorLabel";
|
||||
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.separatorLabel.TabIndex = 18;
|
||||
this.separatorLabel.Text = "Separator";
|
||||
//
|
||||
// separatorComboBox
|
||||
//
|
||||
this.separatorComboBox.Enabled = false;
|
||||
this.separatorComboBox.FormattingEnabled = true;
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(110, 185);
|
||||
this.separatorComboBox.Name = "separatorComboBox";
|
||||
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.separatorComboBox.TabIndex = 19;
|
||||
//
|
||||
// benchIdTextBox
|
||||
//
|
||||
this.benchIdTextBox.Enabled = false;
|
||||
this.benchIdTextBox.Location = new System.Drawing.Point(110, 51);
|
||||
this.benchIdTextBox.Name = "benchIdTextBox";
|
||||
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
|
||||
this.benchIdTextBox.TabIndex = 4;
|
||||
//
|
||||
// benchIdLabel
|
||||
//
|
||||
this.benchIdLabel.AutoSize = true;
|
||||
this.benchIdLabel.Location = new System.Drawing.Point(19, 54);
|
||||
this.benchIdLabel.Name = "benchIdLabel";
|
||||
this.benchIdLabel.Size = new System.Drawing.Size(76, 13);
|
||||
this.benchIdLabel.TabIndex = 3;
|
||||
this.benchIdLabel.Text = "Test Bench ID";
|
||||
//
|
||||
// dbUsedComboBox
|
||||
//
|
||||
this.dbUsedComboBox.Enabled = false;
|
||||
this.dbUsedComboBox.FormattingEnabled = true;
|
||||
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 73);
|
||||
this.dbUsedComboBox.Name = "dbUsedComboBox";
|
||||
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
|
||||
this.dbUsedComboBox.TabIndex = 6;
|
||||
//
|
||||
// dbUsedLabel
|
||||
//
|
||||
this.dbUsedLabel.AutoSize = true;
|
||||
this.dbUsedLabel.Location = new System.Drawing.Point(19, 76);
|
||||
this.dbUsedLabel.Name = "dbUsedLabel";
|
||||
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
|
||||
this.dbUsedLabel.TabIndex = 5;
|
||||
this.dbUsedLabel.Text = "Database used";
|
||||
//
|
||||
// baujahrTextBox
|
||||
//
|
||||
this.baujahrTextBox.Enabled = false;
|
||||
this.baujahrTextBox.Location = new System.Drawing.Point(110, 95);
|
||||
this.baujahrTextBox.Name = "baujahrTextBox";
|
||||
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
|
||||
this.baujahrTextBox.TabIndex = 8;
|
||||
//
|
||||
// baujahrLabel
|
||||
//
|
||||
this.baujahrLabel.AutoSize = true;
|
||||
this.baujahrLabel.Location = new System.Drawing.Point(19, 98);
|
||||
this.baujahrLabel.Name = "baujahrLabel";
|
||||
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
|
||||
this.baujahrLabel.TabIndex = 7;
|
||||
this.baujahrLabel.Text = "Baujahr";
|
||||
//
|
||||
// logsFolderButton
|
||||
//
|
||||
this.logsFolderButton.Enabled = false;
|
||||
this.logsFolderButton.Location = new System.Drawing.Point(261, 139);
|
||||
this.logsFolderButton.Name = "logsFolderButton";
|
||||
this.logsFolderButton.Size = new System.Drawing.Size(30, 20);
|
||||
this.logsFolderButton.TabIndex = 14;
|
||||
this.logsFolderButton.Text = "...";
|
||||
this.logsFolderButton.UseVisualStyleBackColor = true;
|
||||
this.logsFolderButton.Click += new System.EventHandler(this.logsFolderButton_Click);
|
||||
//
|
||||
// logsFolderTextBox
|
||||
//
|
||||
this.logsFolderTextBox.Enabled = false;
|
||||
this.logsFolderTextBox.Location = new System.Drawing.Point(110, 139);
|
||||
this.logsFolderTextBox.Name = "logsFolderTextBox";
|
||||
this.logsFolderTextBox.Size = new System.Drawing.Size(145, 20);
|
||||
this.logsFolderTextBox.TabIndex = 13;
|
||||
//
|
||||
// logsFolderLabel
|
||||
//
|
||||
this.logsFolderLabel.AutoSize = true;
|
||||
this.logsFolderLabel.Location = new System.Drawing.Point(19, 142);
|
||||
this.logsFolderLabel.Name = "logsFolderLabel";
|
||||
this.logsFolderLabel.Size = new System.Drawing.Size(59, 13);
|
||||
this.logsFolderLabel.TabIndex = 12;
|
||||
this.logsFolderLabel.Text = "Logs folder";
|
||||
//
|
||||
// DatabaseCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.logsFolderButton);
|
||||
this.Controls.Add(this.logsFolderTextBox);
|
||||
this.Controls.Add(this.logsFolderLabel);
|
||||
this.Controls.Add(this.baujahrTextBox);
|
||||
this.Controls.Add(this.baujahrLabel);
|
||||
this.Controls.Add(this.dbUsedComboBox);
|
||||
this.Controls.Add(this.dbUsedLabel);
|
||||
this.Controls.Add(this.benchIdTextBox);
|
||||
this.Controls.Add(this.benchIdLabel);
|
||||
this.Controls.Add(this.separatorComboBox);
|
||||
this.Controls.Add(this.separatorLabel);
|
||||
this.Controls.Add(this.eliminateSpacesCheckBox);
|
||||
this.Controls.Add(this.monthFoldersCheckBox);
|
||||
this.Controls.Add(this.yearFoldersCheckBox);
|
||||
this.Controls.Add(this.destinationButton);
|
||||
this.Controls.Add(this.dayFoldersCheckBox);
|
||||
this.Controls.Add(this.destinationTextBox);
|
||||
this.Controls.Add(this.destinationLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "DatabaseCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 230);
|
||||
this.Load += new System.EventHandler(this.WriterCfgCtrl_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.TextBox destinationTextBox;
|
||||
private System.Windows.Forms.Label destinationLabel;
|
||||
private System.Windows.Forms.CheckBox dayFoldersCheckBox;
|
||||
private System.Windows.Forms.Button destinationButton;
|
||||
private System.Windows.Forms.CheckBox yearFoldersCheckBox;
|
||||
private System.Windows.Forms.CheckBox monthFoldersCheckBox;
|
||||
private System.Windows.Forms.CheckBox eliminateSpacesCheckBox;
|
||||
private System.Windows.Forms.Label separatorLabel;
|
||||
private System.Windows.Forms.ComboBox separatorComboBox;
|
||||
private System.Windows.Forms.TextBox benchIdTextBox;
|
||||
private System.Windows.Forms.Label benchIdLabel;
|
||||
private System.Windows.Forms.ComboBox dbUsedComboBox;
|
||||
private System.Windows.Forms.Label dbUsedLabel;
|
||||
private System.Windows.Forms.TextBox baujahrTextBox;
|
||||
private System.Windows.Forms.Label baujahrLabel;
|
||||
private System.Windows.Forms.Button logsFolderButton;
|
||||
private System.Windows.Forms.TextBox logsFolderTextBox;
|
||||
private System.Windows.Forms.Label logsFolderLabel;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -274,8 +274,11 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -313,8 +313,11 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -313,7 +313,10 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -272,8 +272,11 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -119,6 +120,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -286,7 +288,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { };
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -298,7 +300,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox3_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -310,7 +312,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -322,7 +324,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox5_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -334,7 +336,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox6_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -346,7 +348,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox7_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -358,7 +360,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation7.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation7.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox8_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -370,7 +372,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation8.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation8.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox9_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -382,7 +384,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation9.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation9.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox10_TextChanged(object sender, EventArgs e)
|
||||
@@ -395,7 +397,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation10.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation10.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox11_TextChanged(object sender, EventArgs e)
|
||||
@@ -408,7 +410,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation11.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation11.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox12_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -420,7 +422,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation12.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation12.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -272,7 +272,10 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -124,6 +125,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -289,7 +291,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { };
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -301,7 +303,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox3_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -313,7 +315,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -325,7 +327,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox5_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -337,7 +339,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox6_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -349,7 +351,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox7_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -361,7 +363,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation7.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation7.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox8_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -373,7 +375,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation8.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation8.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox9_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -385,7 +387,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation9.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation9.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox10_TextChanged(object sender, EventArgs e)
|
||||
@@ -398,7 +400,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation10.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation10.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox11_TextChanged(object sender, EventArgs e)
|
||||
@@ -411,7 +413,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation11.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation11.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox12_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -423,7 +425,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation12.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation12.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox13_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -435,7 +437,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation13.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation13.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox14_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -447,7 +449,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation14.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation14.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox15_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -459,7 +461,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation15.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation15.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox16_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -471,7 +473,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation16.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation16.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox17_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -483,7 +485,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation17.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation17.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox18_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -495,7 +497,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation18.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation18.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox19_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -507,7 +509,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation19.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation19.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox20_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -519,7 +521,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation20.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation20.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox21_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -531,7 +533,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation21.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation21.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox22_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -543,7 +545,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation22.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation22.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox23_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -555,7 +557,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation23.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation23.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox24_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -567,7 +569,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation24.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation24.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -272,8 +272,11 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -128,6 +129,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -294,7 +296,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox1, startTextBox1, exclamation1); }
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -285,8 +285,11 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
InitializeComponent();
|
||||
WMEndState = new double[waterMetersCount];
|
||||
@@ -218,7 +219,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { };
|
||||
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox2_TextChanged(object sender, EventArgs e)
|
||||
@@ -232,7 +233,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox3_TextChanged(object sender, EventArgs e)
|
||||
@@ -246,7 +247,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox4_TextChanged(object sender, EventArgs e)
|
||||
@@ -260,7 +261,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox5_TextChanged(object sender, EventArgs e)
|
||||
@@ -274,7 +275,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox6_TextChanged(object sender, EventArgs e)
|
||||
@@ -288,7 +289,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmStartStateTextBox1_KeyPress(object sender, KeyPressEventArgs e)
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
PurchaseOrder = orderComboBox.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
||||
ref Program.LocalSettings.PurchaseOrderHistory
|
||||
#if FUZHOU150 || FUZHOU300
|
||||
#if FUZHOU_150 || FUZHOU_300
|
||||
, 20
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -397,8 +397,11 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
}
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,10 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
{
|
||||
foreach (var wm in batchResults.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
|
||||
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
|
||||
{
|
||||
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
|
||||
EnduranceCycleStop = 13,
|
||||
}
|
||||
|
||||
#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_PT200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public enum StatusP : ulong
|
||||
{
|
||||
RefFlowMeterMask = 0x7, /// bits 0,1,2
|
||||
@@ -46,7 +46,7 @@ namespace TBF.BenchControl.Elde
|
||||
ErrorPressMeter4 = 0x8000000000000, /// bit 51
|
||||
EndurCycleRunning = 0x200000000000000, /// bit 57
|
||||
}
|
||||
#else // DN100 || MUNICH || FUZHOU150 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40
|
||||
#else // DN100 || MUNICH || FUZHOU_150 || TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50
|
||||
public enum StatusP : ulong
|
||||
{
|
||||
RefFlowMeterMask = 0x7,
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace TBF.BenchControl.Elde
|
||||
public int EtPulsesK { get { return controlCom.EtPulsesK; } }
|
||||
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
|
||||
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
|
||||
public uint RegulValveDAC { get { return controlCom.RegulValveDAC; } }
|
||||
public uint RegulValveDAC(int rvNr0) { return controlCom.RegulValveDAC(rvNr0); }
|
||||
public float Pressure(int prsNr0) { return controlCom.Pressure(prsNr0); }
|
||||
public float Temperature(int tmpNr0) { return controlCom.Temperature(tmpNr0); }
|
||||
public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)controlCom.RegulValveState(rvNr1); }
|
||||
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] DiverterEdge; /// Created and initialized in this.Initialize()
|
||||
|
||||
// Array length is the reference flowmeters count plus one
|
||||
#if DN100 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || SLM_150 || SENTEC
|
||||
#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || SLM_150 || SENTEC || CEVAK_200
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
|
||||
@@ -137,11 +137,15 @@ namespace TBF.BenchControl.Elde
|
||||
{100,500}, {100,500}, {100,500}, {100,500} };
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[7] { 1, 1, 1, 1, 1, 1, 1 };
|
||||
#elif MUNICH || TORINO50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || TURA_IPERL || TURA_SPECIAL || MURES_PT40 || FUZHOU_40 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif SLM_END || WARSAW_END
|
||||
#elif IZRAEL_50 || SLM_END
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[7]; /// Modbus addresses of Pr1, Pr2, Pr3, Pr4, Pr5, Pr6, T9 (Izrael) or Pr1, Pr2, Pr3, Pr4, T9, T10 (SLM END)
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif WARSAW_END
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
@@ -168,7 +172,7 @@ namespace TBF.BenchControl.Elde
|
||||
int totalRefPulses;
|
||||
int massRefPulses;
|
||||
TestMethods testMethods;
|
||||
float filterConstant;
|
||||
int[] filters;
|
||||
float[] FMFreq;
|
||||
int regConst;
|
||||
int shortImp;
|
||||
@@ -181,7 +185,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="power">Power (0.0f .. 100.0f)</param>
|
||||
public void SetFMFreq(int index, float power)
|
||||
{
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
#if DN100 || MUNICH || FUZHOU_150
|
||||
if ((FMFreq == null) || (FMFreq.Length != 2))
|
||||
{
|
||||
FMFreq = new float[2];
|
||||
@@ -247,7 +251,7 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
controlBoardCfg = cfg as ControlBoardCfg;
|
||||
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
#if DN100 || MUNICH || FUZHOU_150
|
||||
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
|
||||
#elif SLM_END || WARSAW_END
|
||||
FMFreq = new float[4] { 0, 0, 0, 0 };
|
||||
@@ -276,11 +280,11 @@ namespace TBF.BenchControl.Elde
|
||||
public void InitializeComponent(
|
||||
#if DN100
|
||||
ControlCom2VB.ControlCom2panel ctrlBrdComponent,
|
||||
#elif MUNICH || FUZHOU150
|
||||
#elif MUNICH || FUZHOU_150
|
||||
ControlComponent3Munich.UserControl1 ctrlBrdComponent,
|
||||
#elif FUZHOU300
|
||||
#elif FUZHOU_300
|
||||
ControlComponent3F300.UserControl1 ctrlBrdComponent,
|
||||
#elif PT200IL || PUCHONG_PT200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
|
||||
#else /// all newer benches
|
||||
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
|
||||
@@ -314,11 +318,10 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
int divertersCount = BenchControl.Elde.Diverter.Diverter.DivertersCount;
|
||||
|
||||
DiverterEdge = new uint[divertersCount * 2];
|
||||
DiverterEdge = new uint[divertersCount];
|
||||
for (int i = 0; i < divertersCount; i++)
|
||||
{
|
||||
DiverterEdge[2 * i] = (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdGate;
|
||||
DiverterEdge[2 * i + 1] = (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdGate;
|
||||
DiverterEdge[i] = (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdGate;
|
||||
controlCom.SetDivLimit(i, (uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdLo,
|
||||
(uint)BenchControl.Elde.Diverter.Diverter.Diverters[i].ThresholdHi);
|
||||
}
|
||||
@@ -421,7 +424,7 @@ namespace TBF.BenchControl.Elde
|
||||
this.testMethods = 0;
|
||||
this.stopDevs = 0;
|
||||
}
|
||||
this.filterConstant = 0;
|
||||
this.filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, };
|
||||
this.regConst = 0;
|
||||
this.shortImp = 0;
|
||||
}
|
||||
@@ -431,13 +434,18 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
uint filter = Convert.ToUInt32(filterConstant);
|
||||
uint[] uintFilters = new uint[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
|
||||
}
|
||||
|
||||
///
|
||||
if (sendCommandFlag)
|
||||
{
|
||||
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
|
||||
totalRefPulses, massRefPulses, testMethods,
|
||||
new uint[] { filter, filter, filter, filter, filter, filter, filter, filter },
|
||||
uintFilters,
|
||||
FMFreq, regConst, shortImp, stopDevs);
|
||||
}
|
||||
|
||||
@@ -471,7 +479,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="stopDevs">What to stop</param>
|
||||
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
|
||||
int totalRefPulses, int massRefPulses, TestMethods testMethods,
|
||||
float filterConstant, int regConst, int shortImp, StopDevs stopDevs)
|
||||
int[] filters, int regConst, int shortImp, StopDevs stopDevs)
|
||||
{
|
||||
this.cmd = cmd;
|
||||
this.refNr = refFlowmtrNr;
|
||||
@@ -479,7 +487,7 @@ namespace TBF.BenchControl.Elde
|
||||
this.totalRefPulses = totalRefPulses;
|
||||
this.massRefPulses = massRefPulses;
|
||||
this.testMethods = testMethods;
|
||||
this.filterConstant = filterConstant;
|
||||
this.filters = filters;
|
||||
this.regConst = regConst;
|
||||
this.shortImp = shortImp;
|
||||
this.stopDevs = stopDevs;
|
||||
@@ -562,7 +570,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StartMeasurementOp(OutputPath outputPath, TestMethods method,
|
||||
float requiredFlowLo, float requiredFlowHi,
|
||||
int refPulses, float filterConstant)
|
||||
int refPulses, int[] filterConstants)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
@@ -571,7 +579,7 @@ namespace TBF.BenchControl.Elde
|
||||
else
|
||||
{
|
||||
return new StartMeasurementOp(this, outputPath, method, requiredFlowLo, requiredFlowHi,
|
||||
refPulses, filterConstant);
|
||||
refPulses, filterConstants);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +593,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StartProlongedMeasurementOp(OutputPath outputPath, TestMethods method,
|
||||
float requiredFlowLo, float requiredFlowHi,
|
||||
int totalRefPulses, int massRefPulses, float filterConstant)
|
||||
int totalRefPulses, int massRefPulses, int[] filters)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
@@ -594,7 +602,7 @@ namespace TBF.BenchControl.Elde
|
||||
else
|
||||
{
|
||||
return new StartMeasurementOp(this, outputPath, method, requiredFlowLo, requiredFlowHi,
|
||||
totalRefPulses, massRefPulses, filterConstant);
|
||||
totalRefPulses, massRefPulses, filters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde
|
||||
return wMeterReference[wmNr1];
|
||||
}
|
||||
|
||||
public uint RegulValveDAC { get { return 0; } }
|
||||
public uint RegulValveDAC(int rvNr0) { return 0; }
|
||||
|
||||
public float Pressure(int prsNr0) { return 0; }
|
||||
public float Temperature(int tmpNr0) { return (float)(20 + tmpNr0); }
|
||||
@@ -197,11 +197,11 @@ namespace TBF.BenchControl.Elde
|
||||
this.cmd = cmd;
|
||||
this.refFlowmtrNr = refFlowmtrNr;
|
||||
|
||||
#if FUZHOU300
|
||||
#if FUZHOU_300
|
||||
///
|
||||
/// The following code deals with the situation that all FM controlled pums share bit #39.
|
||||
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
|
||||
/// (in FUZHOU300 the FM pump bit should be set set to value FMIndex+50).
|
||||
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
|
||||
///
|
||||
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
|
||||
route = route & 0xFF03FFFFFFFFFFFF;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
|
||||
///
|
||||
public StatusP StatusP { get { return (StatusP)ctrlBrdComponent.StatusP; } }
|
||||
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
#if DN100 || MUNICH || FUZHOU_150
|
||||
public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000
|
||||
#else /// all newer benches
|
||||
/// <summary>
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
|
||||
|
||||
#if GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#if GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#else
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
@@ -43,7 +43,16 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
|
||||
public int WMeterReference(int wmNr0) { return (int)ctrlBrdComponent.wMeterReference[wmNr0]; }
|
||||
public uint RegulValveDAC { get { return ctrlBrdComponent.StavDA; } }
|
||||
|
||||
public uint RegulValveDAC(int rvNr0)
|
||||
{
|
||||
#if CEVAK_200
|
||||
return ctrlBrdComponent.StavDA[rvNr0];
|
||||
#else
|
||||
return ctrlBrdComponent.StavDA;
|
||||
#endif
|
||||
}
|
||||
|
||||
public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; }
|
||||
public float Temperature(int tmpNr0) { return ctrlBrdComponent.temperature[tmpNr0]; }
|
||||
public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)ctrlBrdComponent.rValveStatus[rvNr1 - 1]; }
|
||||
@@ -53,7 +62,7 @@ namespace TBF.BenchControl.Elde
|
||||
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
|
||||
#endif
|
||||
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
|
||||
{
|
||||
@@ -72,7 +81,7 @@ namespace TBF.BenchControl.Elde
|
||||
public float ImpulseTime(int wmNr1) { return ctrlBrdComponent.ImpulseTime[wmNr1]; }
|
||||
#endif
|
||||
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
#if DN100 || MUNICH || FUZHOU_150
|
||||
public uint FmState { get { return ctrlBrdComponent.fMState; } }
|
||||
#else //if everything newer
|
||||
public uint FmState { get { return ctrlBrdComponent.fMState[0]; } } /// TODO: index
|
||||
@@ -84,13 +93,20 @@ namespace TBF.BenchControl.Elde
|
||||
//return ctrlBrdComponent.RValvePosition[rvNr1 - 1];
|
||||
return ctrlBrdComponent.Analogy[rvNr1 - 1]; /// Fixes bug: RValvePosition returns 0 all the time
|
||||
}
|
||||
public float DivSamples(int time, int divIx0) { return ctrlBrdComponent.DIVSamples[time, divIx0]; } /// Time unit is 2 ms
|
||||
public float DivSamples(int time, int divIx0)
|
||||
{
|
||||
#if MUNICH
|
||||
return ctrlBrdComponent.DIVSamples[time, 0];
|
||||
#else
|
||||
return ctrlBrdComponent.DIVSamples[time, divIx0];
|
||||
#endif
|
||||
} /// Time unit is 2 ms
|
||||
public int ScopeSamples(int i, int j, int k) { return ctrlBrdComponent.ScopeSamples[i, j, k]; }
|
||||
public ulong DigitalInputs { get { return (ulong)ctrlBrdComponent.Vstupy; } }
|
||||
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
|
||||
public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp
|
||||
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
public float TotalRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
public float MassRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
#else /// all new test benches
|
||||
@@ -106,7 +122,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] WMeterCont { get { return new uint[3]; } } /// Dummy
|
||||
#endif
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
|
||||
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public float ValveOpenCloseTime { get { return ctrlBrdComponent.ValveMoveTime[0]; } }
|
||||
#else
|
||||
public float ValveOpenCloseTime { get { return 0.001f; } }
|
||||
@@ -138,11 +154,11 @@ namespace TBF.BenchControl.Elde
|
||||
///
|
||||
#if DN100
|
||||
private ControlCom2VB.ControlCom2panel ctrlBrdComponent;
|
||||
#elif MUNICH || FUZHOU150
|
||||
#elif MUNICH || FUZHOU_150
|
||||
private ControlComponent3Munich.UserControl1 ctrlBrdComponent;
|
||||
#elif FUZHOU300
|
||||
#elif FUZHOU_300
|
||||
private ControlComponent3F300.UserControl1 ctrlBrdComponent;
|
||||
#elif PT200IL || PUCHONG_PT200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
private ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent;
|
||||
#else /// newer benches
|
||||
private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent;
|
||||
@@ -154,11 +170,11 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="ctrlBrdComponent"></param>
|
||||
#if DN100
|
||||
public ControlComWrap(ControlCom2VB.ControlCom2panel ctrlBrdComponent)
|
||||
#elif MUNICH || FUZHOU150
|
||||
#elif MUNICH || FUZHOU_150
|
||||
public ControlComWrap(ControlComponent3Munich.UserControl1 ctrlBrdComponent)
|
||||
#elif FUZHOU300
|
||||
#elif FUZHOU_300
|
||||
public ControlComWrap(ControlComponent3F300.UserControl1 ctrlBrdComponent)
|
||||
#elif PT200IL || PUCHONG_PT200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
public ControlComWrap(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent)
|
||||
#else /// all newer benches
|
||||
public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent)
|
||||
@@ -205,16 +221,16 @@ namespace TBF.BenchControl.Elde
|
||||
// rvCalib[0,0], rvCalib[0,1], rvCalib[1,0], rvCalib[1,1]));
|
||||
#if DN100
|
||||
log.FatalFormat("Component: {0}", ControlCom2VB.ControlCom2panel.ProgVersion);
|
||||
#elif MUNICH || FUZHOU150
|
||||
#elif MUNICH || FUZHOU_150
|
||||
log.FatalFormat("Component: {0}", ControlComponent3Munich.UserControl1.ProgVersion);
|
||||
#elif FUZHOU300
|
||||
#elif FUZHOU_300
|
||||
log.FatalFormat("Component: {0}", ControlComponent3F300.UserControl1.ProgVersion);
|
||||
#elif PT200IL || PUCHONG_PT200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
log.FatalFormat("Component: {0}", ControlComponent_Izrael2014.UserControl1.ProgVersion);
|
||||
#else /// newer benches
|
||||
log.FatalFormat("Component: {0}", ControlComponent_Torino2015.UserControl1.ProgVersion);
|
||||
#endif
|
||||
log.Fatal("SendCalibData(...)");
|
||||
log.Fatal("SendCalibData(...)");
|
||||
for (int i = 0; i < rvCalib.GetLength(0); i++)
|
||||
for (int j = 0; j < rvCalib.GetLength(1); j++)
|
||||
log.FatalFormat(" rvCalib[{0},{1}] = {2}", i, j, rvCalib[i,j]);
|
||||
@@ -229,8 +245,8 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
ctrlBrdComponent.ExternalCom = true;
|
||||
|
||||
#if SENTEC
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, (byte)123);
|
||||
#if SENTEC || CEVAK_200 || FUZHOU_100
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, (byte)0Xff);
|
||||
#else
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange);
|
||||
#endif
|
||||
@@ -263,7 +279,7 @@ namespace TBF.BenchControl.Elde
|
||||
///
|
||||
private void DoValveMove(int valveNo, RegulValveMode valveMode, float[] valveValue, int stableTime)
|
||||
{
|
||||
#if DN100 || MUNICH || FUZHOU150
|
||||
#if DN100 || MUNICH || FUZHOU_150
|
||||
log.InfoFormat("ValveMove(#={0}, md={1}, [{2}, {3}])", valveNo, valveMode, valveValue[0], valveValue[1]);
|
||||
ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue);
|
||||
#else /// all newer benches
|
||||
@@ -328,11 +344,11 @@ namespace TBF.BenchControl.Elde
|
||||
// stopDevs));
|
||||
|
||||
|
||||
#if FUZHOU300
|
||||
#if FUZHOU_300
|
||||
///
|
||||
/// The following code deals with the situation that all FM controlled pumps share bit #39.
|
||||
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
|
||||
/// (in FUZHOU300 the FM pump bit should be set set to value FMIndex+50).
|
||||
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
|
||||
///
|
||||
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
|
||||
route = route & 0xFF03FFFFFFFFFFFF;
|
||||
@@ -353,7 +369,7 @@ namespace TBF.BenchControl.Elde
|
||||
cmd, /// 0
|
||||
refFlowMeterNr, /// 1
|
||||
Utils.RouteToStr(route), /// 2
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
|
||||
fmFreq[0].ToString(), /// 7
|
||||
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
|
||||
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
|
||||
@@ -365,14 +381,18 @@ namespace TBF.BenchControl.Elde
|
||||
#if DN100 || MUNICH
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_40 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || TORINO50 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif BERLIN || SLM_150 || PETERSBURG_200
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif JUZNA_AFRIKA_50 || ZAMBIA || SENTEC
|
||||
#elif GENESIS
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
|
||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
readonly ulong mask; /// derived from bitPosition in the constructor
|
||||
readonly ulong target;
|
||||
readonly string message;
|
||||
readonly Users.Grp.GID bypassLevel;
|
||||
readonly Users.Grp.GID[] bypassLevel;
|
||||
|
||||
public CoverTest()
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
}
|
||||
|
||||
|
||||
CoverTestForm modelessDlg;
|
||||
CoverTestForm coverTestForm;
|
||||
bool completed = false;
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
///
|
||||
void OpenFormDlg(CoverTest myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CoverTestForm(message, bypassLevel, bypassLog);
|
||||
modelessDlg.Show();
|
||||
myRef.coverTestForm = new CoverTestForm(message, bypassLevel, bypassLog);
|
||||
coverTestForm.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
completed = true;
|
||||
}
|
||||
|
||||
if (completed || modelessDlg.Completed)
|
||||
if (completed || coverTestForm.Completed)
|
||||
{
|
||||
completed = true;
|
||||
CloseModelessDlg();
|
||||
@@ -127,10 +127,10 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
|
||||
void CloseModelessDlg()
|
||||
{
|
||||
if (modelessDlg is GenericDevices.IHasCompleted)
|
||||
if (coverTestForm != null)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseQandAForm(this, null);
|
||||
modelessDlg = null;
|
||||
coverTestForm.OnCloseThisForm(this, null);
|
||||
coverTestForm = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
public int BitPosition;
|
||||
public bool Invert;
|
||||
public string Message;
|
||||
public Users.Grp.GID BypassLevel;
|
||||
public Users.Grp.GID[] BypassLevel;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
CoverTestCfg()
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
Invert = false;
|
||||
Message = Strings.Close_the_cover;
|
||||
|
||||
BypassLevel = Users.Grp.GID.TestingSpecialists;
|
||||
BypassLevel = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists };
|
||||
}
|
||||
|
||||
public CoverTestCfg(IComponentFactory factory)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
bitPositionTextBox.Text = config.BitPosition.ToString();
|
||||
invertCheckBox.Checked = config.Invert;
|
||||
messageTextBox.Text = config.Message;
|
||||
bypassLevelComboBox.Text = config.BypassLevel.ToString();
|
||||
bypassLevelComboBox.Text = config.BypassLevel == null ? "---" : ((config.BypassLevel.Length > 0) ? config.BypassLevel[0].ToString() : "---");
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -93,11 +93,12 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
config.Invert = invertCheckBox.Checked;
|
||||
config.Message = messageTextBox.Text;
|
||||
|
||||
config.BypassLevel = null;
|
||||
for (Users.Grp.GID gid = 0; gid < Users.Grp.GID.NrOfGroups; gid++)
|
||||
{
|
||||
if (bypassLevelComboBox.Text == gid.ToString())
|
||||
{
|
||||
config.BypassLevel = gid;
|
||||
config.BypassLevel = new Users.Grp.GID[] { gid };
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Elde.CoverTest
|
||||
{
|
||||
public partial class CoverTestForm : Form, GenericDevices.IHasCompleted
|
||||
public partial class CoverTestForm : Form
|
||||
{
|
||||
ILog bypassLog;
|
||||
string message;
|
||||
@@ -18,9 +18,9 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
Users.Grp.GID bypassLevel;
|
||||
Users.Grp.GID[] bypassLevel;
|
||||
|
||||
public CoverTestForm(string message, Users.Grp.GID bypassLevel, ILog bypassLog)
|
||||
public CoverTestForm(string message, Users.Grp.GID[] bypassLevel, ILog bypassLog)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
@@ -74,12 +74,31 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
/// <summary>
|
||||
/// Used by CoverTest, AskYesNoOp and MessageBoxOp.
|
||||
/// </summary>
|
||||
public void OnCloseThisForm(object sender, EventArgs args)
|
||||
{
|
||||
if (CloseThisFormHandler == null) return;
|
||||
try
|
||||
{
|
||||
CloseThisFormHandler(sender, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> CloseThisFormHandler;
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
{
|
||||
UiBridge.Bridge.CloseQandAFormHandler += delegate(object sender, EventArgs args)
|
||||
CloseThisFormHandler += delegate(object sender, EventArgs args)
|
||||
{
|
||||
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
||||
else OnForceClose(sender, args);
|
||||
if (InvokeRequired)
|
||||
Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args);
|
||||
else
|
||||
OnForceClose(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -92,13 +92,19 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
}
|
||||
|
||||
|
||||
int divNrFromName = int.Parse(Name.Substring(3));
|
||||
#if GENESIS || PETERSBURG_50 || PETERSBURG_200 || FUZHOU_40 || FUZHOU150 || FUZHOU300
|
||||
int divNrFromName;
|
||||
if (!int.TryParse(Name.Substring(3), out divNrFromName))
|
||||
{
|
||||
divNrFromName = nextIdx;
|
||||
}
|
||||
#if GENESIS || PETERSBURG_50 || PETERSBURG_200 || FUZHOU_50 || FUZHOU_150 || FUZHOU_300
|
||||
flowMtrNr4Cmd = divNrFromName + 1;
|
||||
#elif BADGER_STREDNA_TRAT
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
|
||||
#elif BADGER_VELKA_TRAT
|
||||
flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
|
||||
#elif FUZHOU_100
|
||||
flowMtrNr4Cmd = divNrFromName;
|
||||
#else
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace TBF.BenchControl.Elde
|
||||
public void Start()
|
||||
{
|
||||
controlBoard.SyncRoute();
|
||||
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, 0, 20, 0, StopDevs.None);
|
||||
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 20, 0, StopDevs.None);
|
||||
opState = OpState.StartingCommand;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
|
||||
if (commandOnStopOp != Command.None)
|
||||
{
|
||||
controlBoard.SyncRoute();
|
||||
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, 0, 20, 0, StopDevs.None);
|
||||
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 20, 0, StopDevs.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Elde
|
||||
int EtPulsesK { get; }
|
||||
UInt16 WMeterPulses(int wmNr1);
|
||||
int WMeterReference(int wmNr0);
|
||||
uint RegulValveDAC { get; }
|
||||
uint RegulValveDAC(int rvNr0);
|
||||
float Pressure(int prsNr0);
|
||||
float Temperature(int tmpNr0);
|
||||
RegulValveState RegulValveState(int rvNr1);
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
|
||||
void SendCommand()
|
||||
{
|
||||
controlBoard.SyncRoute();
|
||||
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, 0, 0, 0, StopDevs.None);
|
||||
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 0, StopDevs.None);
|
||||
cmdSent = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -17,15 +17,18 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double PulsesPerLtr; /// [l^-1]
|
||||
public int Filter;
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
PulsesPerLtr = 1.0;
|
||||
Filter = 0;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.PulsesPerLtr,
|
||||
Strings.Filter,
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
@@ -35,7 +38,8 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
switch (i)
|
||||
{
|
||||
case 0: return PulsesPerLtr.ToString();
|
||||
default: return string.Empty;
|
||||
case 1: return Filter.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +49,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
switch (i)
|
||||
{
|
||||
case 0: PulsesPerLtr = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 1: Filter = int.Parse(strValue); return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
@@ -55,12 +60,18 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
message = string.Empty;
|
||||
|
||||
double dummy;
|
||||
int idummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (Utils.TryParseUDouble(strValue, out dummy)) return true;
|
||||
break;
|
||||
default:
|
||||
|
||||
case 1:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
@@ -72,6 +83,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
void CopyContentTo(RRProcedureParams prms)
|
||||
{
|
||||
prms.PulsesPerLtr = this.PulsesPerLtr;
|
||||
prms.Filter = this.Filter;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Pulses; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
|
||||
public int Filter { get { return registerReaderCfg.ProcParams.Filter; } }
|
||||
|
||||
public int WMPulses { get { return wmPulses; } }
|
||||
public int WMRefPulses { get { return wmRefPulses; } }
|
||||
|
||||
@@ -112,6 +112,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
adcChannel = (Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2);
|
||||
#elif SENTEC
|
||||
adcChannel = (Idx1 < 3) ? (Idx1 - 1) : (Idx1 - 2);
|
||||
#elif CEVAK_200
|
||||
adcChannel = Math.Max(Idx1 - 3, 0);
|
||||
#else
|
||||
adcChannel = Idx1 - 1;
|
||||
#endif
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -251,7 +251,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.ValveMoveToPosition1)
|
||||
@@ -453,7 +453,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route,
|
||||
50000, 50000, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
this.reTryCommands = reTryCmds;
|
||||
@@ -193,14 +193,14 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
log.WarnFormat("Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.ValveMoveToPosition1;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
log.WarnFormat("Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.ValveMoveToFlow1;
|
||||
@@ -214,7 +214,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -234,7 +234,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
if (flow <= reqFlowAve) currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
|
||||
log.InfoFormat("SetFlowOp:Run() rv#={0} pos={1}% freq={2} flow={3} curFlLo={4} curFlHi={5} state={6}",
|
||||
log.InfoFormat("Run() rv#={0} pos={1}% freq={2} flow={3} curFlLo={4} curFlHi={5} state={6}",
|
||||
regulValveNr, rvPosition.ToString("F1"), flowMtrFreq.ToString("F1"), flow.ToString("F3"), currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"), opState);
|
||||
|
||||
|
||||
@@ -244,14 +244,14 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat(" Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
log.InfoFormat(" Run() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"), targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.ValveMoveToPosition1;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat(" Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
log.InfoFormat(" Run() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"));
|
||||
|
||||
opState = OpState.ValveMoveToFlow1;
|
||||
@@ -265,7 +265,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
log.DebugFormat(" return Event.None");
|
||||
return Event.None;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
{
|
||||
/// Issues the appropriate ValveMove(...) command
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||
new float[2] { targetPositionLo, targetPositionHi },
|
||||
new float[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
||||
regulValve.StableTime);
|
||||
|
||||
opState = OpState.SettingPosition;
|
||||
@@ -314,7 +314,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
new float[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
||||
regulValve.StableTime);
|
||||
|
||||
log.InfoFormat(" SetFlowOp: ValveMove({0}, Position, {1}, {2}, {3})",
|
||||
log.InfoFormat(" Run() ValveMove({0}, Position, {1}, {2}, {3})",
|
||||
regulValveNr, (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2, regulValve.StableTime);
|
||||
|
||||
opState = OpState.ValveMoveToPosition3;
|
||||
@@ -355,14 +355,15 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
return Event.OpArgumentError;
|
||||
}
|
||||
|
||||
log.InfoFormat(" Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"));
|
||||
|
||||
float freqLo = 2000.0f * currentReqFlowLo / nominalFlow;
|
||||
float freqHi = 2000.0f * currentReqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { freqLo, freqHi },
|
||||
new float[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||
regulValve.StableTime);
|
||||
log.WarnFormat(" Run() ValveMove({0}, Freq., {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
||||
regulValveNr, (freqLo + freqHi) / 2, (freqLo + freqHi) / 2,
|
||||
regulValve.StableTime,
|
||||
flowMeterNr, currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"));
|
||||
|
||||
opState = OpState.ValveMoveToFlow3;
|
||||
log.DebugFormat(" return Event.None");
|
||||
@@ -389,11 +390,13 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
float freqLo = 2000.0f * currentReqFlowLo / nominalFlow;
|
||||
float freqHi = 2000.0f * currentReqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (freqLo + freqHi) / 2.0f, (freqLo + freqHi) / 2.0f },
|
||||
new float[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||
regulValve.StableTime);
|
||||
|
||||
log.InfoFormat(" SetFlowOp: ValveMove({0}, Frequency, {1}, {2}, {3})",
|
||||
regulValveNr, (freqLo + freqHi) / 2.0f, (freqLo + freqHi) / 2.0f, regulValve.StableTime);
|
||||
log.WarnFormat(" Run() ValveMove({0}, Frequency, {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
||||
regulValveNr, (freqLo + freqHi) / 2, (freqLo + freqHi) / 2,
|
||||
regulValve.StableTime,
|
||||
flowMeterNr, currentReqFlowLo.ToString("F3"), currentReqFlowHi.ToString("F3"));
|
||||
|
||||
opState = OpState.ValveMoveToFlow3;
|
||||
log.DebugFormat(" return Event.None");
|
||||
@@ -422,14 +425,14 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
{
|
||||
/// update the stored valve position
|
||||
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
log.InfoFormat(" Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||
log.InfoFormat(" Run() rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// store the valve position
|
||||
StoreTargetPosition(reqFlowAve, rvPosition);
|
||||
log.InfoFormat(" Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
|
||||
log.InfoFormat(" Run() rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
|
||||
}
|
||||
}
|
||||
@@ -480,7 +483,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route,
|
||||
50000, 50000, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
|
||||
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, (int)pidCoef, 0, sd);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -374,7 +374,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route,
|
||||
50000, 50000, tm,
|
||||
0.0f, 20, 0, sd);
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 20, 0, sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
{
|
||||
@@ -13,19 +14,18 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly IRegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly int regulValveStableTime;
|
||||
readonly int flowMeterNr;
|
||||
readonly float nominalFlow;
|
||||
readonly float reqFlowLo;
|
||||
readonly float reqFlowHi;
|
||||
readonly float reqFlowAve;
|
||||
readonly float pidCoef;
|
||||
readonly int totalRefPulses; /// Number of reference pulses for a complete test
|
||||
readonly int massRefPulses; /// Number of reference pulses for mass collection
|
||||
readonly TestMethods testMethod;
|
||||
readonly float filterConstant;
|
||||
readonly int[] filters;
|
||||
readonly int diverterNr;
|
||||
|
||||
bool started = false;
|
||||
@@ -55,8 +55,8 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
float requiredFlowLo, float requiredFlowHi,
|
||||
int refPulses, float filterConstant)
|
||||
: this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses, filterConstant)
|
||||
int refPulses, int[] filters)
|
||||
: this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses, filters)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
float requiredFlowLo, float requiredFlowHi,
|
||||
int totalRefPulses, int massRefPulses, float filterConstant)
|
||||
int totalRefPulses, int massRefPulses, int[] filters)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoard;
|
||||
@@ -79,19 +79,20 @@ namespace TBF.BenchControl.Elde
|
||||
if (outputPath.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
|
||||
flowMeterNr = outputPath.FlowMeter.Idx1;
|
||||
|
||||
if (outputPath.RegulValve is Elde.RegulValve.RegulValve)
|
||||
this.regulValve = outputPath.RegulValve;
|
||||
if (regulValve is Elde.RegulValve.RegulValve)
|
||||
{
|
||||
Elde.RegulValve.RegulValve rv = outputPath.RegulValve as Elde.RegulValve.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (outputPath.RegulValve is Elde.RegulValveCoax.RegulValve)
|
||||
else if (regulValve is Elde.RegulValveCoax.RegulValve)
|
||||
{
|
||||
Elde.RegulValveCoax.RegulValve rv = outputPath.RegulValve as Elde.RegulValveCoax.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (!(outputPath.RegulValve is Dummy.RegulValve.RegulValve))
|
||||
else if (!(regulValve is Dummy.RegulValve.RegulValve))
|
||||
{
|
||||
throw new ArgumentNullException("Regulation valve is not compatible with Elde Control Board");
|
||||
}
|
||||
@@ -105,13 +106,12 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
this.reqFlowLo = requiredFlowLo;
|
||||
this.reqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (reqFlowLo + reqFlowHi) / 2.0f;
|
||||
this.pidCoef = outputPath.PidCoef;
|
||||
|
||||
this.totalRefPulses = totalRefPulses;
|
||||
this.massRefPulses = massRefPulses;
|
||||
this.testMethod = method;
|
||||
this.filterConstant = filterConstant;
|
||||
this.filters = filters;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -127,11 +127,11 @@ namespace TBF.BenchControl.Elde
|
||||
int flowMeterIdxAndDiv = flowMeterNr;
|
||||
#endif
|
||||
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, {3}, {4}, 0, Stop.None)",
|
||||
flowMeterIdxAndDiv, totalRefPulses, testMethod, filterConstant, (int)pidCoef);
|
||||
flowMeterIdxAndDiv, totalRefPulses, testMethod, filters[0], (int)pidCoef);
|
||||
|
||||
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
|
||||
totalRefPulses, massRefPulses, testMethod,
|
||||
filterConstant, (int)pidCoef, 0, StopDevs.None);
|
||||
filters, (int)pidCoef, 0, StopDevs.None);
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
@@ -189,9 +189,18 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
float freqLo = 2000.0f * reqFlowLo / nominalFlow;
|
||||
float freqHi = 2000.0f * reqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { freqLo, freqHi },
|
||||
regulValveStableTime);
|
||||
if (regulValve.IsCoax)
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||
regulValveStableTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { freqLo, freqHi },
|
||||
regulValveStableTime);
|
||||
}
|
||||
|
||||
opState = OpState.OpCompleted;
|
||||
return Event.None;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace TBF.BenchControl.Elde
|
||||
controlBoard.Route, /// route
|
||||
0, 0, /// ref. pulses
|
||||
TestMethods.Diverter,
|
||||
0.0f,
|
||||
new int[] { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
20,
|
||||
0,
|
||||
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "TempMeterMeret"; } }
|
||||
|
||||
public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new TempMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TempMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
||||
public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", tempMeter.Name, eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
TempMeter tempMeter;
|
||||
Event eventDone;
|
||||
DoubleBox temp;
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempInDone, TempOutDone, TempDivDone or Error
|
||||
/// </summary>
|
||||
/// <param name="tempMeter">TempMeter reference</param>
|
||||
/// <param name="temp">Reference to the variable, value is in degree Celsius</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp, Event eventDone)
|
||||
{
|
||||
if (tempMeter == null) throw new ArgumentNullException("tempMeter");
|
||||
this.tempMeter = tempMeter;
|
||||
this.temp = temp;
|
||||
this.eventDone = eventDone;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp)
|
||||
: this(tempMeter, ref temp, Event.TempDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
temp.Val = tempMeter.ReadTemperature();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.TempInDone, Event.TempOutDone or Event.TempDivDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
temp.Val = tempMeter.ReadTemperature();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
||||
public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public TempMeter() {}
|
||||
|
||||
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
ControlBoard.MeretRS485Address[tempMtrCfg.MeretIdx0] = tempMtrCfg.ModbusAddress;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadTemperature()
|
||||
{
|
||||
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(tempMtrCfg.TempIdx0), Corrections);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: tempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <param name="tempDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp, tempDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
IList<string> parents = new List<string>();
|
||||
parents.Add("CB");
|
||||
// TODO:
|
||||
//if (StateMachine.Components != null)
|
||||
//{
|
||||
// foreach (var cmpnt in StateMachine.Components)
|
||||
// {
|
||||
// if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Modbus.Common.Factory)
|
||||
// {
|
||||
// parents.Add(cmpnt.Name);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, parents);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int TempIdx0; /// 0..19
|
||||
public byte ModbusAddress; /// 1..247
|
||||
public int MeretIdx0; /// Meter pressure meters count .. (Meter pressure meters count + Meter temperature meters count - 1)
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TempMeterCfg()
|
||||
{
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
}
|
||||
|
||||
public TempMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
TempIdx0 = 8;
|
||||
ModbusAddress = 1;
|
||||
MeretIdx0 = 4;
|
||||
}
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Temp. index (0)",
|
||||
"Modbus address",
|
||||
"Meret index (0)",
|
||||
};
|
||||
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("Name={0}, Parent={1}, TempIx0={2}, Modbus address={3}, MeretIx0={4}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
TempIdx0, ModbusAddress, MeretIdx0);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TempIdx0.ToString();
|
||||
case 1: return ModbusAddress.ToString();
|
||||
case 2: return MeretIdx0.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
int ival = int.Parse(strValue);
|
||||
if (TempIdx0 != ival)
|
||||
{
|
||||
TempIdx0 = ival;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
case 1:
|
||||
byte addr = byte.Parse(strValue);
|
||||
if (ModbusAddress != addr)
|
||||
{
|
||||
ModbusAddress = addr;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
case 2:
|
||||
int ival2 = int.Parse(strValue);
|
||||
if (MeretIdx0 != ival2)
|
||||
{
|
||||
MeretIdx0 = ival2;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
default:
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 0 && dummy <= 19) return true;
|
||||
break;
|
||||
case 1:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 1 && dummy <= 247) return true;
|
||||
message = ParamName(i) + " is invalid. Address range is 1 .. 247";
|
||||
return false;
|
||||
case 2:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 0 && dummy <= 19) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TempMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
prms.TempIdx0 = this.TempIdx0;
|
||||
prms.ModbusAddress = this.ModbusAddress;
|
||||
prms.MeretIdx0 = this.MeretIdx0;
|
||||
}
|
||||
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
TempMeterCfg pars = new TempMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public void UpdateEmbeddedDbEntity()
|
||||
{
|
||||
/// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl
|
||||
{
|
||||
@@ -93,6 +93,8 @@ namespace TBF.BenchControl
|
||||
TempInDone,
|
||||
TempOutDone,
|
||||
TempDivDone,
|
||||
LevelDone,
|
||||
VolumeDone,
|
||||
FlowMeasurementDone,
|
||||
FlowReached,
|
||||
PositionReached,
|
||||
@@ -175,7 +177,7 @@ namespace TBF.BenchControl
|
||||
OuterLoopStart,
|
||||
OuterLoopEnd,
|
||||
|
||||
/// Production monitoring
|
||||
/// Production tracing
|
||||
CheckDone,
|
||||
CheckNotDone,
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajík
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -14,6 +13,14 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
string TestBenchName { get; }
|
||||
int TestBenchId { get; }
|
||||
string Address1 { get; }
|
||||
string Address2 { get; }
|
||||
string Address3 { get; }
|
||||
string Address4 { get; }
|
||||
string Address5 { get; }
|
||||
RemoteDBUse RemoteDBUse { get; }
|
||||
}
|
||||
#if ORACLE_DB
|
||||
int MaxTestIndex { get; } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IHart : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
/// When the message length is N, however only bytes 1..N-2 have to be set.
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
void SendMessage(byte[] message);
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount);
|
||||
|
||||
Queue<byte[]>[] ReceivedTelegrams { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic level meter functions
|
||||
/// </summary>
|
||||
public interface ILevelMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: LevelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadLevelOp(ref DoubleBox level);
|
||||
|
||||
/// <summary>
|
||||
/// Events: levelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <param name="levelDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadLevelOp(ref DoubleBox level, Event levelDone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IVolumeMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume);
|
||||
|
||||
/// <summary>
|
||||
/// Events: volumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <param name="volumeDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume, Event volumeDone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Hart.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Hart(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Hart(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new HartCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(HartCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// </summary>
|
||||
public class Hart : ComponentBase, IDevice, GenericDevices.IModbus
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Hart));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
|
||||
private readonly HartCfg modbusCommonCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
public Hart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Hart(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as HartCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
~Hart()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
/// When the message length is N, however only bytes 1..N-2 have to be set.
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
byte[] message = new byte[8]
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
public class HartCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(HartCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
static readonly int[] AllBaudRates = new int[] { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
|
||||
static readonly Parity[] AllParities = new Parity[] { Parity.None, Parity.Even, Parity.Odd };
|
||||
static readonly int[] AllDataBits = new int[] { 7, 8 };
|
||||
static readonly StopBits[] AllStopBits = new StopBits[] { StopBits.None, StopBits.One, StopBits.OnePointFive, StopBits.Two };
|
||||
static readonly Handshake[] AllHandshakes = new Handshake[] { Handshake.None, Handshake.XOnXOff, Handshake.RequestToSend, Handshake.RequestToSendXOnXOff };
|
||||
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public int DataBits;
|
||||
public Parity Parity;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
HartCfg()
|
||||
{
|
||||
}
|
||||
|
||||
public HartCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Com port number",
|
||||
"Baud rate",
|
||||
"Data bits",
|
||||
"Parity",
|
||||
"Stop bits",
|
||||
"Handshake"
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
IList<string> list = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1: foreach (var v in AllBaudRates) list.Add(v.ToString()); break;
|
||||
case 2: foreach (var v in AllDataBits) list.Add(v.ToString()); break;
|
||||
case 3: foreach (var v in AllParities) list.Add(v.ToString()); break;
|
||||
case 4: foreach (var v in AllStopBits) list.Add(v.ToString()); break;
|
||||
case 5: foreach (var v in AllHandshakes) list.Add(v.ToString()); break;
|
||||
default: return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("Com{0}, {1}Bd, {2}-bits, parity={3}, stopBits={4}, {5}",
|
||||
ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return DataBits.ToString();
|
||||
case 3: return Parity.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (ComPortNr != int.Parse(strValue))
|
||||
{
|
||||
ComPortNr = int.Parse(strValue);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (BaudRate != v))
|
||||
{
|
||||
BaudRate = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 2:
|
||||
foreach (var v in AllDataBits)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (DataBits != v))
|
||||
{
|
||||
DataBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 3:
|
||||
foreach (var v in AllParities)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Parity != v))
|
||||
{
|
||||
Parity = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 4:
|
||||
foreach (var v in AllStopBits)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (StopBits != v))
|
||||
{
|
||||
StopBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Handshake != v))
|
||||
{
|
||||
Handshake = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
default:
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
int comPortNr;
|
||||
if (int.TryParse(strValue, out comPortNr) && comPortNr > 0 && comPortNr <= 999) return true;
|
||||
break;
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 2:
|
||||
foreach (var v in AllDataBits) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 3:
|
||||
foreach (var v in AllParities) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 4:
|
||||
foreach (var v in AllStopBits) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(HartCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.Parity = this.Parity;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
}
|
||||
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
HartCfg pars = new HartCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public void UpdateEmbeddedDbEntity()
|
||||
{
|
||||
/// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Nivotrack.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Nivotrack(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Nivotrack(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new NivotrackCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(NivotrackCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// </summary>
|
||||
public class Nivotrack : ComponentBase, IDevice, GenericDevices.IHart
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Nivotrack));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
|
||||
private readonly NivotrackCfg modbusCommonCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
public Nivotrack()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Nivotrack(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as NivotrackCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
~Nivotrack()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
/// When the message length is N, however only bytes 1..N-2 have to be set.
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
byte[] message = new byte[8]
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user