diff --git a/.gitignore b/.gitignore
index 755fbf4fc..4d3c945a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,8 @@ Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
+ResultsParser/bin/
+ResultsParser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
diff --git a/ResultsParser/App.config b/ResultsParser/App.config
new file mode 100644
index 000000000..56efbc7b5
--- /dev/null
+++ b/ResultsParser/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ResultsParser/Program.cs b/ResultsParser/Program.cs
new file mode 100644
index 000000000..452608c2e
--- /dev/null
+++ b/ResultsParser/Program.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FluentNHibernate.Cfg;
+using FluentNHibernate.Cfg.Db;
+using NHibernate;
+using NHibernate.Cfg;
+using Results;
+using Results.Entities;
+using System.IO;
+
+namespace ResultsParser
+{
+ class Program
+ {
+ static ISessionFactory sessionFactory;
+
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Bench: [WR15]");
+ string bench = Console.ReadLine();
+ if (bench == string.Empty) bench = "WR15";
+
+ string connStr = GetConnectionString(bench);
+
+ IList strangeWMs = new List();
+
+ try
+ {
+ var session = Fluently.Configure()
+ .Database(MySQLConfiguration.Standard.ConnectionString(connStr))
+ .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
+ .ExposeConfiguration(BuildSchema)
+ .BuildSessionFactory()
+ .OpenSession();
+
+ var mtrs1 = session.QueryOver()
+ .Where(mtr => mtr.Error < -2)
+ .And(mtr => mtr.Passed == true)
+ .List();
+
+ var mtrs2 = session.QueryOver()
+ .Where(mtr => mtr.Error > 2)
+ .And(mtr => mtr.Passed == true)
+ .List();
+
+ foreach (var lst in new IList[] { mtrs1, mtrs2 })
+ {
+ foreach (var mtr in lst)
+ {
+ if (mtr.TestRslt.Name() == "Q2" &&
+ mtr.WaterMeter.Passed &&
+ !string.IsNullOrEmpty(mtr.WaterMeter.SerialNr) &&
+ mtr.WaterMeter.WaterMeterData.MetrologicalClass == "R800")
+ {
+ strangeWMs.Add(mtr.WaterMeter);
+ }
+ }
+ }
+
+ using (TextWriter writer = new StreamWriter(string.Format("strangeWMs-{0}.csv", bench)))
+ {
+ foreach (var wm in strangeWMs)
+ {
+ writer.WriteLine(string.Format("'{0};{1};{2};{3};{4:dd.MM.yyyy HH:mm};{5:dd.MM.yyyy HH:mm};v.{6};{7}",
+ wm.SerialNr, bench, wm.WMPosition, wm.Batch.BatchNr, wm.Batch.StartTime, wm.Batch.EndTime, wm.Batch.ProgramVersion, wm.Batch.ProcedureName));
+ }
+ }
+
+ session.Close();
+ }
+ catch (Exception exc)
+ {
+ Console.WriteLine("Exception occured:");
+ Console.WriteLine(exc.Message);
+ if (exc.InnerException != null)
+ {
+ Console.WriteLine("Inner exception:");
+ Console.WriteLine(exc.InnerException.Message);
+ }
+
+ Console.ReadLine();
+ Console.WriteLine(exc.StackTrace);
+ }
+
+ Console.WriteLine(string.Format("{0} strange water meters found", strangeWMs.Count));
+ Console.WriteLine("Press ENTER to close");
+ Console.ReadLine();
+ }
+
+ static string GetConnectionString(string bench = "WR15")
+ {
+ Console.WriteLine("Server: [localhost]");
+ var server = Console.ReadLine();
+ if (server == string.Empty) server = "localhost";
+
+
+ Console.WriteLine(string.Format("Database: [st-{0}-r]", bench.ToLower()));
+ var db = Console.ReadLine();
+ if (db == string.Empty) db = string.Format("st-{0}-r", bench.ToLower());
+
+ Console.WriteLine("User: [root]");
+ var uid = Console.ReadLine();
+ if (uid == string.Empty) uid = "root";
+
+ Console.WriteLine("Password:");
+ var pw = Console.ReadLine();
+
+ var connStr = string.Format("SERVER={0}; DATABASE={1}; UID={2}; PASSWORD={3}; CHARSET=utf8;", server, db, uid, pw);
+ Console.WriteLine("Connection string is\r\n {0}", connStr);
+ Console.WriteLine();
+ return connStr;
+ }
+
+ static void BuildSchema(Configuration config)
+ {
+ /// This NHibernate tool takes a configuration with mapping info and exports a database schema
+ new NHibernate.Tool.hbm2ddl.SchemaExport(config).SetOutputFile("db_schema");
+ }
+ }
+}
diff --git a/ResultsParser/Properties/AssemblyInfo.cs b/ResultsParser/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..f83bb6e44
--- /dev/null
+++ b/ResultsParser/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ResultsParser")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ResultsParser")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("90a47d44-c3ab-4528-b19b-0440a521b9af")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ResultsParser/ResultsParser.csproj b/ResultsParser/ResultsParser.csproj
new file mode 100644
index 000000000..d2d519d0b
--- /dev/null
+++ b/ResultsParser/ResultsParser.csproj
@@ -0,0 +1,84 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}
+ Exe
+ Properties
+ ResultsParser
+ ResultsParser
+ v4.7.2
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\Production-Monitoring\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll
+
+
+ ..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll
+
+
+ ..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll
+
+
+ ..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {c8939821-ba5c-4988-a3d0-bf53b74865c7}
+ Common
+
+
+ {743df7db-c7b6-42eb-986d-0f485e5588e4}
+ Config
+
+
+ {9d0dcc88-dc81-47eb-9fdd-4c3907871bfb}
+ Results
+
+
+
+
+
\ No newline at end of file
diff --git a/TBF.sln b/TBF.sln
index a06434be4..6c7062682 100644
--- a/TBF.sln
+++ b/TBF.sln
@@ -83,6 +83,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeResultsDBs", "MergeRes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeatureVectorCalculator", "FeatureVectorCalculator\FeatureVectorCalculator.csproj", "{6280F3F9-139A-48E3-8C88-25EB4124E982}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsParser", "ResultsParser\ResultsParser.csproj", "{2E08C19B-C0A9-4056-8564-E5B74477959D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -367,6 +369,16 @@ Global
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6280F3F9-139A-48E3-8C88-25EB4124E982}.Release|x86.ActiveCfg = Release|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {2E08C19B-C0A9-4056-8564-E5B74477959D}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/clean.bat b/clean.bat
index 2c41ff7ee..1ccbcc49f 100644
--- a/clean.bat
+++ b/clean.bat
@@ -40,6 +40,8 @@ rmdir /s /q Results\bin
rmdir /s /q Results\obj
rmdir /s /q ResultsBrowser\bin
rmdir /s /q ResultsBrowser\obj
+rmdir /s /q ResultsParser\bin
+rmdir /s /q ResultsParser\obj
rmdir /s /q Statistics\bin
rmdir /s /q Statistics\obj
rmdir /s /q TBF\bin