Compare commits

...
Author SHA1 Message Date
Jan Augustin 2463a19af7 Increased number of meters from 20 to 26. 2024-04-18 09:10:47 +02:00
Milan Hanajik ce556762c7 Dummy.FlowMeter: Flow from mass increases, OoR values are orange, Fixes, etc, ver. 3.0.1635 2021-04-26 11:01:59 +02:00
Milan Hanajik 56a9984626 IControlBoard.SpecifyInvertedValves instead of InitializeComponent 2021-02-19 16:45:55 +01:00
Milan Hanajik 29d64c69eb InfoFlagsStr in Results as an item in WMeterRsltItemSpec. 2021-02-19 11:19:43 +01:00
Milan Hanajik 63a15fc1de Constructors of components : Logging level increased to WARN 2021-02-19 09:50:48 +01:00
Milan Hanajik d2f3a937ec Telegram class moved to Common project. 2021-02-18 13:38:30 +01:00
Milan Hanajik 8c15fe34ee DataEntry.Standard24.CycleBeginningForm : Auto s/n feature. 2021-02-17 10:56:51 +01:00
Milan Hanajik 57793ed382 DeviceTest shutdown bug fix, OptoTelegramRaw comment, ver. 3.1.1593 2021-02-17 10:56:31 +01:00
Milan Hanajik fea9b01922 MettlerToledo.Standard.BalanceDev/Old/NewDev clean-up, units (oz), 1st after draining, etc. 2021-02-16 11:40:14 +01:00
Milan Hanajik a33e4de467 BenchControlPanel : Four main buttons are disabled on TBF start. 2021-02-08 10:16:48 +01:00
Milan Hanajik 5a1d77dd87 Bug fix in MetrologyDlgFlowMeterTab, etc. when ranges are enabled 2021-02-08 10:09:02 +01:00
Milan Hanajik ea05871b19 SensusOracle.Database : (1) ProcedureParams modified, (2) SQL style changes 2021-01-28 13:55:00 +01:00
Milan Hanajik 229c87f920 RealDensity, AtTemperature, Buoyancy are stored in Results DB in Batch table. 2021-01-28 13:33:38 +01:00
Milan Hanajik dd8feaa963 Changes in MainSeq, Procedure, BenchControlPanel, TestProgressControls, etc. 2021-01-25 12:54:16 +01:00
Milan Hanajik 8507511776 (1) FlyingStartMassCollProlonged fixed, (2) Password of day. 2021-01-25 12:54:05 +01:00
Milan Hanajik 1e8d2975f0 PMaxTestSeq and LeakTestSeq.CheckDeviceCaps implemented, ver. 3.1.1578 2021-01-20 12:44:33 +01:00
Milan Hanajik 1fb76a2167 (1) PreviousResultsDlg with filters, (2) Procedure history can be inspected. 2021-01-19 09:28:05 +01:00
Milan Hanajik 34f8bb226f MainSeqUtils.CreateNewBatchResults( ) bug fix. 2021-01-14 09:51:24 +01:00
Milan Hanajik bc3fb0f8a0 Output.FileWriters.Enhanced with formatted WM subtitles 2021-01-14 09:51:24 +01:00
Milan Hanajik 9416b79b38 TracingDB synchronized with Production-Monitoring project. 2021-01-14 09:51:15 +01:00
Milan Hanajik 20171e99a6 Q2 corr.: Correction inside range -0.5 .. 0.5 % 2020-11-27 09:03:50 +01:00
Milan Hanajik 822ef33da8 Saving events to Events DB : Fixed bugs when connection string was not defined. 2020-11-18 10:44:53 +01:00
Milan Hanajik 3bfb34a6ea DB.SensusOracle.Database : (1) Procedure params., (2) S620 support, (3) SensusTestInfo for 620. 2020-11-13 11:57:22 +01:00
Milan Hanajik c28828fcdd Register readers cleanup, IRegReaderPulses added. 2020-11-13 11:55:20 +01:00
Milan Hanajik 889a370f90 iPerlCommunicationForm bug fix : Crash when swithing to Active mode after saving results. 2020-11-13 10:31:30 +01:00
Milan Hanajik a369127850 UI.Procedures.ProceduresCtrl : More column content is optional. 2020-11-13 10:27:09 +01:00
Milan Hanajik 82a3574222 Statistics : IP addresses updated, export in CSV format implemented. 2020-11-13 10:25:00 +01:00
Milan Hanajik f3fc3d3ba4 UI.Procedures.ProcedureDlg 'Copy' a test feature added 2020-11-13 10:23:44 +01:00
Milan Hanajik a5a139aff6 TBF/CameraBinaryFiles2 folder with synchronization for SD v.2.x (!!! file upload NOK). 2020-11-13 10:23:44 +01:00
Milan Hanajik 09da203962 DataEntry.Camera (1) loads next image after 'Enter' key, (2) dealing with test parts fixed. 2020-11-13 10:23:44 +01:00
Milan Hanajik 77ad6a529d MettlerToledo.Standard always reads immediate mass when idle. 2020-11-13 10:23:32 +01:00
Milan Hanajik 54658bdd38 US and English units added. 2020-09-09 09:06:33 +02:00
Milan Hanajik 809897342a Output.EventTriggers.Standard bug fix (E13 cannot be changed). 2020-09-09 09:06:33 +02:00
Milan Hanajik 70767de3fc In all FixedStart methods there is 10s delay after start of a test before the flow regulation starts. 2020-08-12 10:05:46 +02:00
Milan Hanajik d62c1ff106 Heat Meters related fixes. 2020-08-07 14:00:46 +02:00
Milan Hanajik bf583e3061 Camera.CLP1611 : More comments, TODO list 2020-08-05 10:26:26 +02:00
Milan Hanajik 270a46982d (1) Compound WM results displayed correctly, (2) Diverter.flowMtrNr4Cmd for SLM_150. 2020-08-05 10:25:31 +02:00
Milan Hanajik 659315c519 Bug fix in CombinedWithDetectionSeq related to test.Part 2020-08-03 09:07:22 +02:00
Milan Hanajik 04db3f975e ReserBatchNr project added to the solution. 2020-07-31 08:52:26 +02:00
Milan Hanajik c0e18458aa Elde components removed 2020-07-29 13:49:31 +02:00
Milan Hanajik d09316a34a Barcode printing in Output.Printers.Enhanced and Output.Printers.OnePerMeter. 2020-07-29 13:42:43 +02:00
Milan Hanajik 8c0ebcb871 Diverter : 'static int nextIdx' not incremented when DebugLevel == DebugMode.Off 2020-07-09 10:10:16 +02:00
Milan Hanajik fcdf1ea16b German resources the same as in branch 2.26 2020-07-08 10:21:06 +02:00
Milan Hanajik d6261e4d80 (1) Units : Quantity.Enumerated added, (2) LoginDlgWithBenchSelection : List of benches is alphabetically sorted. 2020-06-25 12:11:43 +02:00
Milan Hanajik 9f5c4e7347 ResultsBrowser: 1 WR13 IP addr.updated, 2 default DbType=MySql, 3 changes in progress. 2020-06-24 11:57:36 +02:00
Milan Hanajik 90e58266a9 SchematicDrawing : Intersections of pipes drawn as a bow having darker color. 2020-06-18 22:59:22 +02:00
Milan Hanajik 5b5f0ac41e SchematicDrawing : Dijkstra algorithm uses minimum heap. 2020-06-18 09:38:03 +02:00
Milan Hanajik ddca028eb2 MettlerToledo : Zero instead of Taring, cleanup, ver. 3.1.1495 2020-06-17 13:01:32 +02:00
Milan Hanajik fea7d0dc85 Papouch.CBoard communication change, inputs regularly read, ver. 3.1.1492 2020-06-14 13:04:14 +02:00
Milan Hanajik 1f67899a5c Schematic drawing with live function, bench control by mouse, Dijkstra algo, vacuum, etc. 2020-06-14 13:01:53 +02:00
Milan Hanajik 2945049288 Reconfigured for Juzna-Afrika-NEW 2020-06-02 12:02:37 +02:00
Milan Hanajik 070a76aade SchematicDrawing: Editing completed, TODO: Display 2020-06-02 12:00:45 +02:00
Milan Hanajik 2c100c7150 DataEntryForm can be displayed in transition before a test (FixedStartStopMassCollAdvanced only), ver. 3.1.1473 2020-05-29 13:09:13 +02:00
Milan Hanajik 19b23ea212 FixedStartMassColl(Advanced) bug fix, ver. 3.1.1472 2020-05-26 14:07:27 +02:00
Milan Hanajik e5edb90bfd TestMethods.FlowAdjustment, TestMethods.FixedStartMassCollAdvanced, DataEntry24 changes, ver. 3.1.1471 2020-05-25 14:24:50 +02:00
Milan Hanajik 2ec611964f Changes for Juzna-Afrika-NEW, JUZNA_AFRIKA_NEW symbol, ver. 3.1.1470 2020-05-21 18:57:41 +02:00
Milan Hanajik c007bca797 Modbus: Data receive improved, Meret.TempMeter, Meret.PressureMeter, Danfoss.VLT added, QuidoRS modified. 2020-05-21 18:32:21 +02:00
Milan Hanajik 767796662e Critical bug fix in many sequences - STOP not functioning !!! 2020-05-21 16:43:35 +02:00
Milan Hanajik 7b321abb30 ControlBoards, IControlBoard iface, Devices, test methods. 2020-05-21 15:55:02 +02:00
887 changed files with 24842 additions and 17223 deletions
+34
View File
@@ -4,6 +4,10 @@ Config/bin/
Config/obj/
DataStreamInterface/bin/
DataStreamInterface/obj/
DataStreamInterfaceTest/bin/
DataStreamInterfaceTest/obj/
DataStreamMeter/bin/
DataStreamMeter/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/
@@ -16,20 +20,28 @@ EventViewer/bin/
EventViewer/obj/
Events/bin/
Events/obj/
FeatureVectorCalculator/bin/
FeatureVectorCalculator/obj/
GemCard/bin
GemCard/obj
GenCode128/bin
GenCode128/obj
GraphLib/bin
GraphLib/obj
MergeResultsDBs/bin
MergeResultsDBs/obj
TracingDB/bin
TracingDB/obj
ResetBatchNr/bin
ResetBatchNr/obj
RestClient/bin
RestClient/obj
Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
ResultsParser/bin/
ResultsParser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
@@ -42,6 +54,28 @@ Users/bin/
Users/obj/
UserManagement/bin/
UserManagement/obj/
DataMatrix4Net/bin/
DataMatrix4Net/obj/
GenericTest/bin/
GenericTest/obj/
LabelPrinting/bin/
LabelPrinting/obj/
OrderManagement/bin/
OrderManagement/obj/
ProductionTracing/bin/
ProductionTracing/obj/
RecordProcessing/bin/
RecordProcessing/obj/
S640TestApp/bin/
S640TestApp/obj/
SchematicDrawing/bin/
SchematicDrawing/obj/
SharedDatabase/bin/
SharedDatabase/obj/
WorkflowConfigurator/bin/
WorkflowConfigurator/obj/
Workplace/bin/
Workplace/obj/
.vs/
*.suo
*.bak
+1
View File
@@ -42,6 +42,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="SerializableDictionary.cs" />
<Compile Include="Telegram.cs" />
<Compile Include="UIControls\CoolButtonCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
+4 -1
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
@@ -1,10 +1,10 @@
///
/// Copyright (c) 2013-2019 Sensus Metering Systems
/// Copyright (c) 2013-2021 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace TBF.BenchControl
namespace Common
{
public class Telegram
{
@@ -39,10 +39,11 @@ namespace TBF.BenchControl
/// </summary>
/// <param name="data">Data telegram</param>
/// <returns>Calculated CRC</returns>
public static UInt16 ClaculateTelegramCRC(byte[] data)
public static UInt16 CalculateTelegramCRC(byte[] data, int enforcedLen = 0)
{
int len = (enforcedLen != 0) ? Math.Min(enforcedLen, data.Length) : data.Length;
UInt16 crc = crcSeed;
for (int i = 0; i < data.Length - 2; i++) UpdateCRC(data[i], ref crc);
for (int i = 0; i < len - 2; i++) UpdateCRC(data[i], ref crc);
return crc;
}
@@ -58,7 +59,7 @@ namespace TBF.BenchControl
int len = data.Length;
if (len < 2) return;
UInt16 crc = ClaculateTelegramCRC(data);
UInt16 crc = CalculateTelegramCRC(data);
data[len - 2] = (byte)(crc & 0xFF);
data[len - 1] = (byte)(crc >> 8);
@@ -72,12 +73,14 @@ namespace TBF.BenchControl
/// </summary>
/// <param name="data">Data telegram</param>
/// <returns>true if the CRC in the telegram is correct</returns>
public static bool VerifyTelegramCRC(byte[] data)
public static bool VerifyTelegramCRC(byte[] data, int enforcedLen = 0)
{
int len = data.Length;
if (data == null || data.Length == 0 || enforcedLen > data.Length) return false;
int len = (enforcedLen != 0) ? enforcedLen : data.Length;
if (len < 2) return false;
UInt16 crc = ClaculateTelegramCRC(data);
UInt16 crc = CalculateTelegramCRC(data, len);
return (data[len - 2] == (byte)(crc & 0xFF)) && (data[len - 1] == (byte)(crc >> 8));
}
@@ -173,7 +176,6 @@ namespace TBF.BenchControl
}
public static string LogTelegram(string intro, byte[] data, int from = 0, int len = -1)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(256);
@@ -194,6 +196,7 @@ namespace TBF.BenchControl
return sb.ToString();
}
public static string LogTelegram(string intro, IList<byte> data, int from = 0, int len = -1)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(256);
@@ -215,7 +218,6 @@ namespace TBF.BenchControl
}
public static string LogTelegram(string intro, string data)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(80);
+10 -1
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,5 +11,11 @@ namespace Common
{
public class Utils
{
public static string GetTestName(string name, int repeats, int repetitionNr)
{
if (name == null) return null;
if (repeats == 1) return name;
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
}
}
}
+7 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -91,6 +91,7 @@
<Compile Include="Entities\Profile.cs" />
<Compile Include="Entities\PTest.cs" />
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TestInstance.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\Uncertainty.cs" />
@@ -141,6 +142,10 @@
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
<Name>Users</Name>
+10 -4
View File
@@ -14,13 +14,13 @@ namespace Config
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
#elif BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200 || DN100
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 FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
#elif FUZHOU_150 || FUZHOU_300 || GENESIS || IZRAEL_200 || PETERSBURG_200 || SLM_150
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
@@ -56,18 +56,24 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN || GELSENWASSER
#elif BADGER_MALA_TRAT || BERLIN || GELSENWASSER || TORINO_50
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_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || MURES_40 || PETERSBURG_50 || TORUN_50 || ZAMBIA || ZODINO
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif JUZNA_AFRIKA_NEW
public const int WMsCount = 26;
public const int LineSize = 13;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
+7 -1
View File
@@ -10,7 +10,7 @@ namespace Config
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable
public class DatabaseSettings : ICloneable, IComparable
{
// Public fields
public string BenchName;
@@ -45,6 +45,12 @@ namespace Config
return result;
}
public int CompareTo(object dbs2)
{
if (!(dbs2 is DatabaseSettings)) return 0;
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
}
public override string ToString()
{
return string.Format("{0} config={1} results={2} events={3} users={4}",
+70 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ namespace Config.Entities
/// <summary>
/// Stores one test procedure, supports revisions and history log
/// </summary>
public class Procedure : IHasName, IHasItemNr
public class Procedure : IHasName, IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
@@ -53,14 +53,13 @@ namespace Config.Entities
public virtual IList<ComponentProcedure> MoreParams { get; set; }
public virtual IList<Test> Tests { get; set; }
TestInstance[] testInstances;
/// Wrapper
public virtual IList<Test> RegularTests()
{
IList<Test> rslt = new List<Test>();
foreach (var t in Tests)
{
if ((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]")) rslt.Add(t);
}
foreach (var t in Tests) if (t.IsRegular()) rslt.Add(t);
return rslt;
}
@@ -70,6 +69,7 @@ namespace Config.Entities
{
MoreParams = new List<ComponentProcedure>();
Tests = new List<Test>();
testInstances = null;
///
/// Default values
@@ -96,6 +96,70 @@ namespace Config.Entities
ItemNr = itemNr;
}
public virtual TestInstance[] UpdateTestInstances(IList<string> loopStartNames, IList<string> loopEndNames, IList<string> autoTests = null)
{
List<TestInstance> instances = new List<TestInstance>();
if (Tests != null)
{
int i = 0;
while (i < Tests.Count)
{
if (!loopStartNames.Contains(Tests[i].Method) && !loopEndNames.Contains(Tests[i].Method)) /// Loop.End is ignored outside a loop
{
///
/// Outside a loop
///
for (int j = 1; j <= Tests[i].Repeats; j++)
if (Tests[i].BelongsTo(autoTests))
instances.Add(new TestInstance(Tests[i], j));
}
else if (loopStartNames.Contains(Tests[i].Method))
{
///
/// Entering a loop
///
int loopsCount = Tests[i].Repeats;
List<Test> testsInsideLoop = new List<Test>();
i++;
while (i < Tests.Count && !loopEndNames.Contains(Tests[i].Method))
{
///
/// Inside a loop
///
if (Tests[i].Repeats == loopsCount && !loopStartNames.Contains(Tests[i].Method)) /// Loop.Start is ignored inside a loop
{
if (Tests[i].BelongsTo(autoTests))
testsInsideLoop.Add(Tests[i]);
}
i++;
}
///
/// Append instances of tests inside the last loop to the list
///
for (int j = 1; j <= loopsCount; j++)
{
foreach (var t in testsInsideLoop)
instances.Add(new TestInstance(t, j));
}
}
i++;
}
}
testInstances = instances.ToArray();
return testInstances;
}
public virtual TestInstance[] GetTestInstances()
{
return testInstances;
}
public virtual Procedure Clone()
{
Procedure result = new Procedure();
+17 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -108,6 +108,22 @@ namespace Config.Entities
Procedure = procedure;
}
public virtual bool IsRegular()
{
/// Irregular / event triggered test names have form "[event] TestName"
return (Name.Length > 0 && Name[0] != '[') || !Name.Contains("]");
}
public virtual bool BelongsTo(IList<string> autoTests)
{
if (IsRegular()) return true;
if (autoTests == null) return false;
string action = Name.Substring(1, Name.IndexOf(']') - 1);
return autoTests.Contains(action);
}
// Makes a new copy of this object (not just a reference)
public virtual Test Clone()
{
+32
View File
@@ -0,0 +1,32 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class TestInstance
{
public Test Test;
public int Repetition;
public string Name
{
get
{
return (Test != null) ? Common.Utils.GetTestName(Test.Name, Test.Repeats, Repetition) : string.Empty;
}
}
public TestInstance(Test test, int repetition)
{
Test = test;
Repetition = repetition;
}
public override string ToString()
{
return Name;
}
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.26.1458.0")]
[assembly: AssemblyFileVersion("2.26.1458.0")]
[assembly: AssemblyVersion("3.1.1464.0")]
[assembly: AssemblyFileVersion("3.1.1464.0")]
+3 -3
View File
@@ -118,15 +118,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Failed" xml:space="preserve">
<value>NiO</value>
<value>Nicht OK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>iO</value>
<value>OK</value>
</data>
<data name="Error" xml:space="preserve">
<value>Fehler</value>
</data>
<data name="Cannot_open_DB_Cause_0" xml:space="preserve">
<value>Datenbank kann nicht geöffnet.\\r\\nUrsache:\\r\\n{0}</value>
<value>Datenbank kann nicht geöffnet werden.\\r\\nUrsache:\\r\\n{0}</value>
</data>
</root>
+170 -130
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
@@ -17,24 +17,32 @@ namespace Config
#else
[Description("degree")] degree,
#endif
[Description("ml")] ml, /// 1 ml = 0.001 l
[Description("l")] l, /// * 1 liter
[Description("dm3")] dm3, /// 1 dm3 = 1 liter
[Description("m3")] m3, /// 1000 l
[Description("gal(UK)")] gal_UK, /// 1 gal(UK) = 4.54609 l
[Description("gal(US)")] gal_US, /// 1 gal(US) = 3.78541178 l
[Description("dm3")] dm3, /// 1 dm3 = 1 l
[Description("US gal")] USgal, /// 1 US gallon = 3.78541178 l
[Description("imper.gal")] UKgal, /// 1 imperial gallon = 4.54609 l
[Description("cf")] cf, /// 1 cubic foot = 28.316846592 l
[Description("m3")] m3, /// 1 m3 = 1000 l
[Description("l/h")] lph, /// 1 liter/h
[Description("m3/h")] m3ph, /// * 1 m3/h = 1000 l/h
[Description("l/h")] lph, /// 1 l/h = 0.001 m3/h
[Description("l/m")] lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
[Description("m3/h")] m3ph, /// * 1 m3/h
[Description("l/s")] lps, /// 1 liter/s = 3.6 m3/h
[Description("US gal/s")] USgalps, /// 1 US gallon per second = 13.627482408 m3/h
[Description("m3/m")] m3pm, /// 1 m3/m = 60 m3/h
[Description("cf/s")] cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
[Description("g")] g, /// 0.001 kg
[Description("oz")] oz, /// 0.0283495231 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("kg")] kg, /// * 1 kilogram
[Description("t")] t, /// 1000 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("s")] s, /// * 1 second
[Description("min")] min, /// 1 min = 60 s
[Description("hr")] hour, /// 1 hour = 60 min = 3600 s
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("°C")] C, /// * degree Celsius (°C)
[Description("°F")] F, /// degree Fahrenheit
@@ -42,21 +50,25 @@ namespace Config
[Description("Pa")] Pa, /// 1 Pa = 0.01 hPa
[Description("hPa")] hPa, /// 1 hPa = 100 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 HPa
[Description("MPa")] MPa, /// 1 MPa = 10000 hPa
[Description("mbar")] mbar, /// 1 mbar = 1 hPa = 100 Pa
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 hPa = 1000 Pa
[Description("inHg")] inHg, /// 1 inHg = 33.864 hPa
[Description("psi")] psi, /// 1 psi = 0.0689475729 bar
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("MPa")] MPa, /// 1 MPa = 10000 hPa
[Description("R%")] RPct, /// * 1 R%
[Description("%")] Pct, /// * 1 %
[Description("promile")] Promile, /// 1 promile = 0.1 %
[Description("%")] Pct, /// * 1 %
[Description("mm")] mm, /// * 1 millimeter
[Description("cm")] cm, /// 1 cm = 10 mm
[Description("m")] m, /// 1 m = 1000 mm
[Description("in")] inch, /// 1 inch = 25.4 mm
[Description("dm")] dm, /// 1 dm = 100 mm
[Description("ft")] foot, /// 1 foot = 304.8 mm
[Description("yd")] yard, /// 1 yard = 914.4 mm
[Description("m")] m, /// 1 m = 1000 mm
[Description("kg/m3")] kgpm3, /// * 1 kg/m3 = 0.001 kg/l
[Description("kg/l")] kgpl, /// 1 kg/l = 1000 kg/m3
@@ -69,6 +81,7 @@ namespace Config
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
[Description("uS/cm")] uSpcm, /// * 1 uS/cm
[Description("mS/m")] mSpm, /// 1 mS/m = 10 uS/cm
#if LANG_PL
[Description("imp/l")] ppl, /// * 1 pulse/l
@@ -81,17 +94,17 @@ namespace Config
[Description("dm3/stopień")] dm3pdeg, /// * 1 dm3/degree
#else
[Description("pulse/l")] ppl, /// * 1 pulse/l
[Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3
[Description("degree/l")] degpl, /// * 1 degree/l
[Description("degree/dm3")] degpdm3, /// * 1 degree/dm3
[Description("l/pulse")] lpp, /// * 1 l/pulse
[Description("dm3/pulse")] dm3pp, /// * 1 dm3/pulse
[Description("l/degree")] lpdeg, /// * 1 l/degree
[Description("dm3/degree")] dm3pdeg, /// * 1 dm3/degree
[Description("pulse/dm3")] ppdm3, /// 1 pulse/dm3
[Description("degree/l")] degpl, /// 1 degree/l
[Description("degree/dm3")] degpdm3, /// 1 degree/dm3
[Description("l/pulse")] lpp, /// 1 l/pulse
[Description("dm3/pulse")] dm3pp, /// 1 dm3/pulse
[Description("l/degree")] lpdeg, /// 1 l/degree
[Description("dm3/degree")] dm3pdeg, /// 1 dm3/degree
#endif
///
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
[Description("kWh/pulse")] kWhpp, /// 1 kWh/pulse
Count
}
@@ -121,6 +134,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum und Uhrzeit")] DateTime,
[Description("Aufgezählt")] Enumerated,
#elif LANG_PL
[Description("Objętość")] Volume,
[Description("Przepływ")] Flow,
@@ -143,6 +157,7 @@ namespace Config
[Description("Tekst")] String,
[Description("Boolean")] Boolean,
[Description("Data i czas")] DateTime,
[Description("Wyliczone")] Enumerated,
#elif LANG_CS
[Description("Objem")] Volume,
[Description("Průtok")] Flow,
@@ -165,6 +180,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum a čas")] DateTime,
[Description("Vyjmenované")] Enumerated,
#elif LANG_IT
[Description("Volume")] Volume,
[Description("Flusso")] Flow,
@@ -187,6 +203,7 @@ namespace Config
[Description("Stringa")] String,
[Description("Boolean")] Boolean,
[Description("Data e ora")] DateTime,
[Description("Enumerato")] Enumerated,
#else
[Description("Volume")] Volume,
[Description("Flow")] Flow,
@@ -209,7 +226,7 @@ namespace Config
[Description("String")] String,
[Description("Boolean")] Boolean,
[Description("Date and time")] DateTime,
[Description("Enum")] Enum,
[Description("Enumerated")] Enumerated,
#endif
Count,
}
@@ -223,8 +240,9 @@ namespace Config
public static bool IsDefaultUnit(Unit unit)
{
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C || unit == Unit.bar || unit == Unit.RPct ||
unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 || unit == Unit.J || unit == Unit.ppl || unit == Unit.ppkWh || unit == Unit.uSpcm;
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static bool IsQuantity(Unit units, Quantity quantity)
@@ -238,61 +256,73 @@ namespace Config
{
case Unit.pulse:
case Unit.degree:
return Config.Quantity.Pulses;
return Quantity.Pulses;
case Unit.ml:
case Unit.l:
case Unit.dm3:
case Unit.USgal:
case Unit.UKgal:
case Unit.cf:
case Unit.m3:
case Unit.gal_UK:
case Unit.gal_US:
return Config.Quantity.Volume;
return Quantity.Volume;
case Unit.lph:
case Unit.lpm:
case Unit.m3ph:
return Config.Quantity.Flow;
case Unit.lps:
case Unit.USgalps:
case Unit.m3pm:
case Unit.cfs:
return Quantity.Flow;
case Unit.g:
case Unit.oz:
case Unit.lb:
case Unit.kg:
case Unit.t:
case Unit.lb:
return Config.Quantity.Mass;
return Quantity.Mass;
case Unit.ms:
case Unit.s:
case Unit.min:
case Unit.hour:
case Unit.ms:
return Config.Quantity.Time;
return Quantity.Time;
case Unit.C:
case Unit.F:
case Unit.K:
return Config.Quantity.Temperature;
return Quantity.Temperature;
case Unit.Pa:
case Unit.hPa:
case Unit.mbar:
case Unit.kPa:
case Unit.inHg:
case Unit.psi:
case Unit.bar:
case Unit.MPa:
case Unit.inHg:
return Config.Quantity.Pressure;
return Quantity.Pressure;
case Unit.RPct:
return Config.Quantity.Humidity;
return Quantity.Humidity;
case Unit.Pct:
case Unit.Promile:
return Config.Quantity.Error;
case Unit.Pct:
return Quantity.Error;
case Unit.mm:
case Unit.cm:
case Unit.m:
case Unit.inch:
return Config.Quantity.Length;
case Unit.dm:
case Unit.foot:
case Unit.yard:
case Unit.m:
return Quantity.Length;
case Unit.kgpm3:
case Unit.kgpl:
return Config.Quantity.Density;
return Quantity.Density;
case Unit.J:
case Unit.kJ:
@@ -300,7 +330,11 @@ namespace Config
case Unit.Wh:
case Unit.kWh:
case Unit.MWh:
return Config.Quantity.Energy;
return Quantity.Energy;
case Unit.uSpcm:
case Unit.mSpm:
return Quantity.Conductivity;
case Unit.ppl:
case Unit.ppdm3:
@@ -310,17 +344,14 @@ namespace Config
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg:
return Config.Quantity.PulsePerLtr;
return Quantity.PulsePerLtr;
case Unit.ppkWh:
case Unit.kWhpp:
return Config.Quantity.PulsePerKWh;
case Unit.uSpcm:
return Config.Quantity.Conductivity;
return Quantity.PulsePerKWh;
default:
return Config.Quantity.Number;
return Quantity.Number;
}
}
@@ -341,77 +372,81 @@ namespace Config
public static bool IsConductivity(Unit units) { return IsQuantity(units, Config.Quantity.Conductivity); }
public static double ConvertTo(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.dm3:
case Unit.l: return v; /// 1 liter
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
case Unit.gal_UK: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.gal_US: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.ml: return 1000 * v; /// 1 ml = 0.001 l
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 1000 * v; /// 1 liter/h
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
case Unit.lph: return 1000 * v; /// 1 l/h
case Unit.lpm: return v / 0.06; /// 1 l/m
case Unit.lps: return v / 3.6; /// 1 l/s
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
case Unit.m3pm: return v / 60; /// 1 m3/m
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.kg: return v; /// 1 kilogram
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.oz: return 35.273962 * v; /// 1 oz = 0.0283495231 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.s: return v;
case Unit.ms: return 1000 * v;
case Unit.min: return v / 60;
case Unit.hour: return v / 3600;
case Unit.ms: return 1000 * v;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 29.53 * v; /// 1 inHg = 33.864 hPa
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 29.53 * v; /// 1 inHg =
case Unit.psi: return 14.5037738 * v; /// 1 psi =
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Relative error: internal representation in %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.mm: return v; /// 1 mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpm3: return v;
case Unit.kgpl: return 0.001 * v;
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 0.1 * v;
/// Invert pulses
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v <= float.Epsilon) ? 0 : 1 / v);
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v;
default: return v; /// Do not convert
}
}
@@ -420,71 +455,76 @@ namespace Config
switch (units)
{
/// Volume: internal representation in l
case Unit.dm3:
case Unit.l: return v; /// 1 liter
case Unit.m3: return 1000 * v; /// 1000 l
case Unit.gal_UK: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.gal_US: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.ml: return 0.001 * v; /// 0.001 l
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 1000 * v; /// 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 0.001 * v; /// 1 liter/h
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
case Unit.lph: return 0.001 * v; /// 1 l/h
case Unit.lpm: return 0.06 * v; /// 1 l/m
case Unit.lps: return 3.6 * v; /// 1 l/s
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
case Unit.m3pm: return 60 * v; /// 1 m3/m
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.kg: return v; /// 1 kilogram
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.oz: return 0.0283495231 * v; /// 1 oz = 0.0283495231 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.s: return v;
case Unit.ms: return 0.001 * v;
case Unit.min: return 60 * v;
case Unit.hour: return 3600 * v;
case Unit.ms: return v / 1000;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
case Unit.F: return 5 * (v-32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Relative error: internal representation in %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.mm: return v; /// 1 mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpm3: return v;
case Unit.kgpl: return 1000 * v;
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 10 * v;
/// Invert
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v;
default: return v; /// Do not convert
}
}
}
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterface</RootNamespace>
<AssemblyName>DataStreamInterface</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
+324 -18
View File
@@ -13,22 +13,28 @@ namespace DataStreamInterface
degree,
/// Volume
ml, /// 0.001 l
l, /// * 1 liter = 1 l
ml, /// 1 ml = 0.001 l
l, /// * 1 liter
dm3, /// 1 dm3 = 1 l
m3, /// 1000 l
gal_UK, /// 1 gal(UK) = 4.54609 l
gal_US, /// 1 gal(US) = 3.78541178 l
USgal, /// 1 US gallon = 3.78541178 l
UKgal, /// 1 imperial gallon = 4.54609 l
cf, /// 1 cubic foot = 28.316846592 l
m3, /// 1 m3 = 1000 l
/// Flow
lph, /// 1 liter/h
m3ph, /// * 1 m3/h = 1000 l/h
lph, /// 1 l/h = 0.001 m3/h
lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
m3ph, /// * 1 m3/h
lps, /// 1 liter/s = 3.6 m3/h
USgalps, /// 1 US gallon per second = 13.627482408 m3/h
m3pm, /// 1 m3/m = 60 m3/h
cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
/// Mass
g, /// 0.001 kg
lb, /// 0.45359237 kg
kg, /// * 1 kilogram
t, /// 1000 kg
lb, /// 0.45359237 kg
/// Time
ms, /// 1 ms = 0.001 s
@@ -47,6 +53,7 @@ namespace DataStreamInterface
mbar, /// 1 mbar = 1 hPa = 100 Pa
kPa, /// 1 kPa = 10 HPa
inHg, /// 1 inHg = 33.864 hPa
psi, /// 1 psi = 0.0689475729 bar
bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
MPa, /// 1 MPa = 10000 hPa
@@ -61,7 +68,9 @@ namespace DataStreamInterface
mm, /// * 1 millimeter
cm, /// 1 cm = 10 mm
inch, /// 1 inch = 25.4 mm
dm, /// 1 dm = 100 mm
foot, /// 1 foot = 304.8 mm
yard, /// 1 yard = 914.4 mm
m, /// 1 m = 1000 mm
/// Density
@@ -76,20 +85,317 @@ namespace DataStreamInterface
kWh, /// 1 kWh = 3600000 J
MWh, /// 1 MWh = 3600000000 J
/// Electrical conductivity
uSpcm, /// * 1 uS/cm
mSpm, /// 1 mS/m = 10 uS/cm
/// Meter coefficient - volume
ppl, /// * 1 pulse/l
ppdm3, /// * 1 pulse/dm3
degpl, /// * 1 degree/l
degpdm3, /// * 1 degree/dm3
lpp, /// * 1 l/pulse
dm3pp, /// * 1 dm3/pulse
lpdeg, /// * 1 l/degree
dm3pdeg, /// * 1 dm3/degree
ppdm3, /// 1 pulse/dm3
degpl, /// 1 degree/l
degpdm3, /// 1 degree/dm3
lpp, /// 1 l/pulse
dm3pp, /// 1 dm3/pulse
lpdeg, /// 1 l/degree
dm3pdeg, /// 1 dm3/degree
/// Meter coefficient - energy
ppkWh, /// * 1 pulse/kWh
kWhpp, /// * 1 kWh/pulse
Count
kWhpp, /// 1 kWh/pulse
}
public enum Quantity
{
/// Quantities with units and conversions (double -> double)
Volume,
Flow,
Mass,
Time,
Temperature,
Pressure,
Humidity,
Error,
Length,
Density,
Energy,
Pulses,
PulsePerLtr,
PulsePerKWh,
Conductivity,
/// Quantities without units and conversions
Number,
String,
Boolean,
DateTime,
Enumerated,
}
public static class Units
{
public static bool IsDefaultUnit(Unit unit)
{
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static Quantity GetQuantity(Unit units)
{
switch (units)
{
case Unit.pulse:
case Unit.degree:
return Quantity.Pulses;
case Unit.ml:
case Unit.l:
case Unit.dm3:
case Unit.USgal:
case Unit.UKgal:
case Unit.cf:
case Unit.m3:
return Quantity.Volume;
case Unit.lph:
case Unit.lpm:
case Unit.m3ph:
case Unit.lps:
case Unit.USgalps:
case Unit.m3pm:
case Unit.cfs:
return Quantity.Flow;
case Unit.g:
case Unit.lb:
case Unit.kg:
case Unit.t:
return Quantity.Mass;
case Unit.ms:
case Unit.s:
case Unit.min:
case Unit.hour:
return Quantity.Time;
case Unit.C:
case Unit.F:
case Unit.K:
return Quantity.Temperature;
case Unit.Pa:
case Unit.hPa:
case Unit.mbar:
case Unit.kPa:
case Unit.inHg:
case Unit.psi:
case Unit.bar:
case Unit.MPa:
return Quantity.Pressure;
case Unit.RPct:
return Quantity.Humidity;
case Unit.Promile:
case Unit.Pct:
return Quantity.Error;
case Unit.mm:
case Unit.cm:
case Unit.inch:
case Unit.dm:
case Unit.foot:
case Unit.yard:
case Unit.m:
return Quantity.Length;
case Unit.kgpm3:
case Unit.kgpl:
return Quantity.Density;
case Unit.J:
case Unit.kJ:
case Unit.MJ:
case Unit.Wh:
case Unit.kWh:
case Unit.MWh:
return Quantity.Energy;
case Unit.uSpcm:
case Unit.mSpm:
return Quantity.Conductivity;
case Unit.ppl:
case Unit.ppdm3:
case Unit.degpl:
case Unit.degpdm3:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg:
return Quantity.PulsePerLtr;
case Unit.ppkWh:
case Unit.kWhpp:
return Quantity.PulsePerKWh;
default:
return Quantity.Number;
}
}
public static double ConvertTo(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.ml: return 1000 * v; /// 1 l = 1000 ml
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 1000 * v; /// 1 l/h
case Unit.lpm: return v / 0.06; /// 1 l/m
case Unit.lps: return v / 3.6; /// 1 l/s
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
case Unit.m3pm: return v / 60; /// 1 m3/m
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.ms: return 1000 * v;
case Unit.min: return v / 60;
case Unit.hour: return v / 3600;
/// Temperature: internal representation in °C
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 100000 * v;
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 29.53 * v; /// 1 inHg =
case Unit.psi: return 14.5037738 * v; /// 1 psi =
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
/// Relative error: internal representation in %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpl: return 0.001 * v;
/// Energy, internal representation in Joul
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 0.1 * v;
/// Invert pulses
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v; /// Do not convert
}
}
public static double ConvertFrom(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.ml: return 0.001 * v; /// 0.001 l
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 1000 * v; /// 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 0.001 * v; /// 1 l/h
case Unit.lpm: return 0.06 * v; /// 1 l/m
case Unit.lps: return 3.6 * v; /// 1 l/s
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
case Unit.m3pm: return 60 * v; /// 1 m3/m
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.ms: return 0.001 * v;
case Unit.min: return 60 * v;
case Unit.hour: return 3600 * v;
/// Temperature: internal representation in °C
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
/// Relative error: internal representation in %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpl: return 1000 * v;
/// Energy, internal representation in Joul
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 10 * v;
/// Invert
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v; /// Do not convert
}
}
}
}
+4
View File
@@ -94,6 +94,10 @@
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\SchematicDrawing\SchematicDrawing.csproj">
<Project>{0f79ca69-9dbc-41f3-a6fc-5a2937365343}</Project>
<Name>SchematicDrawing</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}</Project>
<Name>TBF</Name>
+14 -11
View File
@@ -5,9 +5,10 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Serialization;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using System.Xml.Serialization;
using TBF.UI.Bench.Components;
namespace DeviceTest
@@ -426,7 +427,7 @@ namespace DeviceTest
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.CmpntEntities = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@@ -458,7 +459,7 @@ namespace DeviceTest
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@@ -493,7 +494,7 @@ namespace DeviceTest
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
if (component1Factory != null && component1Cfg != null) compEntities.Add(component1Cfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@@ -529,7 +530,7 @@ namespace DeviceTest
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
if (component1Factory != null && component1Cfg != null) compEntities.Add(component1Cfg.CreateDbEntity());
if (component2Factory != null && component2Cfg != null) compEntities.Add(component2Cfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
@@ -645,6 +646,7 @@ namespace DeviceTest
MessageBoxIcon.Exclamation);
foreach (var dev in tbfDevices) dev.StopDevice();
foreach (var dev in tbfDevices) dev.StopDevice2();
tbfDevices.Clear();
startButton.Enabled = true;
@@ -662,9 +664,9 @@ namespace DeviceTest
int previousOperation = 0;
if (tbfComponent1forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent1forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent1forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
{
@@ -701,9 +703,9 @@ namespace DeviceTest
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent2forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent2forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
{
@@ -740,9 +742,9 @@ namespace DeviceTest
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent3forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent3forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
{
@@ -856,6 +858,7 @@ namespace DeviceTest
}
foreach (var d in tbfDevices) d.StopDevice();
foreach (var d in tbfDevices) d.StopDevice2();
}
private void stopButton_Click(object sender, EventArgs e)
+1 -1
View File
@@ -35,7 +35,7 @@
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
+46
View File
@@ -0,0 +1,46 @@
using System;
using System.IO;
using TBF;
namespace ResetBatchNr
{
class Program
{
static LocalSettings ls;
static void Main(string[] args)
{
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
Environment.CurrentDirectory = TBF.Program.ConfigDir;
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
if (ls == null || ls.TestBenches == null)
{
/// Loading local seetings from regular config file failed. Use the backup
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
if (ls == null || ls.TestBenches == null)
{
/// Neither config.xml, nor config.backup.xml could be loaded
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
Console.ReadLine();
return;
}
}
else
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
}
///
/// Process local settings so that windows are shifted to the 1st monitor
///
ls.BatchNr = 1;
ls.Save();
Console.WriteLine("BatchNr was reset to 1");
Console.ReadLine();
return;
}
}
}
+36
View File
@@ -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("ResetBatchNr")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ResetBatchNr")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("de8130eb-2f43-46a6-9f5b-bf96432a0c7c")]
// 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")]
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D7F5A111-B2DF-4761-9574-AB730DF573A6}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResetBatchNr</RootNamespace>
<AssemblyName>ResetBatchNr</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>
<Name>TBF</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6e5cb0e9-e1b6-4e5d-ac6e-b1049e180f2b}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+13 -8
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -40,7 +43,7 @@ namespace Results
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)
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double realDensity, double atTemperature, double buoyancy)
{
BatchResults d = new BatchResults(waterMeterDatas.Length);
int year = DateTime.Now.Year;
@@ -65,8 +68,10 @@ namespace Results
ProcedureRevision = procedure.Revision,
ProtocolTitle = string.Empty,
StartTime = DateTime.Now,
DensityCorr = (float)densityCorr,
Compound = (procedure.MetersKind == Config.Entities.MetersKind.Combined),
RealDensity = realDensity,
AtTemperature = atTemperature,
Buoyancy = buoyancy,
Compound = (procedure.MetersKind == Config.Entities.MetersKind.Combined),
#if HEAT_METERS
HeatMeter = (procedure.MetersKind == Config.Entities.MetersKind.HeatMeter),
#endif
@@ -156,10 +161,10 @@ namespace Results
if (batch.WaterMeters[wmNr0].WMPosition > wmNr0 + 1)
{
batch.WaterMeters.Insert(wmNr0, new WaterMeter() { Batch = batch,
WaterMeterData = null,
WMPosition = wmNr0 + 1,
YearOfProduction = 0,
Disabled = true, });
WaterMeterData = null,
WMPosition = wmNr0 + 1,
YearOfProduction = 0,
Disabled = true, });
}
}
+5 -4
View File
@@ -66,13 +66,13 @@ namespace Results
switch (dbType)
{
default:
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Users.Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
}
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>());
@@ -311,6 +311,7 @@ namespace Results
batch.TestRslts = session.QueryOver<TestRslt>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
batch.WaterMeters = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
+15 -30
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -28,9 +28,9 @@ namespace Results.Entities
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
public virtual string ProtocolTitle { get; set; }
public virtual string Remark { get; set; }
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
public virtual float Custom2 { get; set; }
public virtual float Custom3 { get; set; }
public virtual double RealDensity { get; set; } /// Density correction in [kg/m3]
public virtual double AtTemperature { get; set; }
public virtual double Buoyancy { get; set; }
public virtual int Counter6 { get; set; }
public virtual int Counter7 { get; set; }
public virtual int Counter8 { get; set; }
@@ -117,6 +117,9 @@ namespace Results.Entities
ProtocolTitle = string.Empty;
ProtocolTitle = string.Empty;
Remark = string.Empty;
RealDensity = Config.Data.RealDensity;
AtTemperature = Config.Data.AtTemperature;
Buoyancy = Config.Data.Buoyancy;
}
public virtual int PassedMetersCount()
@@ -263,24 +266,6 @@ namespace Results.Entities
return 0;
}
public virtual double Buoyancy()
{
double timeSum = 0;
double sum = 0;
foreach (var tr in TestRslts)
{
if (tr.TestData.Evaluate && tr.TestDone)
{
double duration = (tr.EndTime - tr.StartTime).TotalSeconds;
timeSum += duration;
sum += (tr.Buoyancy * duration);
}
}
return (timeSum == 0) ? 0 : (sum / timeSum);
}
public virtual TestRslt GetTestRslt(string name, int part)
{
foreach (var tr in TestRslts)
@@ -297,10 +282,10 @@ namespace Results.Entities
public virtual string ToString(int i)
{
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} DensityCorr={10} Custom2={11} Custom3={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
ProtocolTitle, Remark, DensityCorr, Custom2, Custom3,
ProtocolTitle, Remark, RealDensity, AtTemperature, Buoyancy,
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted);
}
@@ -325,9 +310,9 @@ namespace Results.Entities
writer.Write((WatermetersStr != null) ? WatermetersStr : string.Empty);
writer.Write((ProtocolTitle != null) ? ProtocolTitle : string.Empty);
writer.Write((Remark != null) ? Remark : string.Empty);
writer.Write(DensityCorr);
writer.Write(Custom2);
writer.Write(Custom3);
writer.Write(RealDensity);
writer.Write(AtTemperature);
writer.Write(Buoyancy);
writer.Write(Counter6);
writer.Write(Counter7);
writer.Write(Counter8);
@@ -392,9 +377,9 @@ namespace Results.Entities
WatermetersStr = reader.ReadString();
ProtocolTitle = reader.ReadString();
Remark = reader.ReadString();
DensityCorr = reader.ReadInt32();
Custom2 = reader.ReadInt32();
Custom3 = reader.ReadInt32();
RealDensity = reader.ReadDouble();
AtTemperature = reader.ReadDouble();
Buoyancy = reader.ReadDouble();
Counter6 = reader.ReadInt32();
Counter7 = reader.ReadInt32();
Counter8 = reader.ReadInt32();
+6
View File
@@ -371,6 +371,12 @@ namespace Results.Entities
#endif
}
/// <summary> Wrapper </summary>
public virtual string InfoFlagsStr()
{
return Utils.ErrorFlagsStr(InfoFlags);
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
+24
View File
@@ -186,6 +186,30 @@ namespace Results.Entities
#endif
}
public virtual long InfoFlagsFromTests()
{
long infoFlags = 0;
foreach (var mtr in MeterTestRslts)
{
if (mtr.Evaluate() && mtr.TestDone) infoFlags |= mtr.TestRslt.InfoFlags;
}
return infoFlags;
}
public virtual long InfoFlagsFromTestsAndWM()
{
return InfoFlagsFromTests() | InfoFlags;
}
/// <summary>
/// Convert combined errorFlags of all tests to string
/// </summary>
/// <returns>ErrorFlags string</returns>
public virtual string InfoFlagsStr()
{
return Utils.ErrorFlagsStr(InfoFlagsFromTestsAndWM());
}
public virtual string PassedOrErrorFlagsStr()
{
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM());
+2
View File
@@ -327,6 +327,8 @@ namespace Results
Conduct_min, /// 277
Conduct_max, /// 278
InfoFlags, /// 279
Count,
}
}
+5 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -22,10 +22,10 @@ namespace Results.Mappings
Map(x => x.Remark)
.CustomType("StringClob")
.CustomSqlType("varchar(2000)");
Map(x => x.DensityCorr)
.Column("Custom1"); ;
Map(x => x.Custom2);
Map(x => x.Custom3);
Map(x => x.RealDensity).Column("Custom1");
Map(x => x.AtTemperature).Column("Custom2");
Map(x => x.Buoyancy).Column("Custom3");
Map(x => x.Counter6);
Map(x => x.Counter7);
@@ -1,19 +1,24 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.Enhanced
{
public class EnhancedPrintDocument : PrintDocument
{
/// Size of the printed area without margins, after taking into account 'pageOrientation'
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
@@ -23,12 +28,14 @@ namespace Results.Output.Printers.Enhanced
readonly int TitleX;
readonly int TitleY; /// Depends on the size of the header
readonly int SpacingOne;
readonly int SpacingOneAndHalf;
readonly int SpacingOne4Header;
readonly int SpacingOneAndHalf4Header;
readonly int spacingOne;
readonly int spacingOneAndHalf;
readonly int spacingOne4Header;
readonly int spacingOneAndHalf4Header;
readonly int spacingOne4Footer;
readonly int SpacingOne4Footer;
int spacingAboveTable;
int spacingBelowTable;
int CommonTop; /// = TitleY + 60
int BodyTop; /// = HdrTop + 160
@@ -124,11 +131,11 @@ namespace Results.Output.Printers.Enhanced
}
/// Document outline preliminary calculations
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
SpacingOneAndHalf = (3 * SpacingOne) / 2;
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
SpacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
spacingOneAndHalf = (3 * spacingOne) / 2;
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
spacingOneAndHalf4Header = (3 * spacingOne4Header) / 2;
spacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
TitleX = cfg.LeftMargin;
TitleY = cfg.TopMargin;
@@ -178,17 +185,27 @@ namespace Results.Output.Printers.Enhanced
/// Prepare document outline
///----------
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
CommonTop = TitleY + titleHeight + SpacingOne4Header;
CommonTop = TitleY + titleHeight + spacingOne4Header;
commonHeight = commonItems.Count * SpacingOne;
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
commonHeight = commonItems.Count * spacingOne;
BodyTop = CommonTop + commonHeight + spacingOne4Header;
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
SizeF tableSize = table0.Measure(e);
int wmSectionHeight = (int)tableSize.Height + SpacingOne4Header * ((tableSize.Height > 0) ? 3 : 2);
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
if (cfg.BarcodeType == BarcodeType.None)
{
spacingAboveTable = spacingOneAndHalf4Header;
}
else
{
spacingAboveTable = Math.Max(spacingOneAndHalf4Header, cfg.BarcodeHeight + spacingOne4Header / 2);
}
spacingBelowTable = (tableSize.Height > 0) ? spacingOneAndHalf4Header : (spacingOne4Header / 2);
int wmSectionHeight = (int)tableSize.Height + spacingAboveTable + spacingBelowTable;
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
@@ -221,8 +238,8 @@ namespace Results.Output.Printers.Enhanced
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
PrintAt(e, leftMargin, CommonTop + SpacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + SpacingOne * i, rightColumn[i]);
PrintAt(e, leftMargin, CommonTop + spacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + spacingOne * i, rightColumn[i]);
}
}
@@ -241,7 +258,7 @@ namespace Results.Output.Printers.Enhanced
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
{
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + spacingBelowTable;
}
}
@@ -252,11 +269,11 @@ namespace Results.Output.Printers.Enhanced
/// Footer
///----------
int footerWidth = (int)e.Graphics.MeasureString(footer, footerFont).Width;
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * spacingOne, footer);
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, pageNrText);
}
@@ -270,25 +287,48 @@ namespace Results.Output.Printers.Enhanced
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
Results.Entities.WaterMeter wm, int printedWMNr, int top)
{
int tableTop = top + spacingAboveTable;
/// Print the water meter number and the serial number
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
PrintHeaderAt(e, leftMargin, top, wmText);
if (!string.IsNullOrEmpty(wm.SerialNr))
if (string.IsNullOrEmpty(wm.SerialNr))
{
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
}
else
{
string wmText = string.Format("{0} {1} {2} = {3}", Strings.Water_Meter, printedWMNr, Strings.sn, wm.SerialNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
switch (cfg.BarcodeType)
{
case BarcodeType.Code_128_Horizontally:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.Code_128_Vertically:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.QR_Code:
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
}
}
Table table = Table.Create_TestsAreRows(wm, testItems, style);
if (table.IsEmpty())
{
return top;
}
else
{
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
}
return table.IsEmpty() ? tableTop : table.Draw(e, leftMargin, tableTop);
}
@@ -298,7 +338,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne);
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
}
@@ -309,7 +349,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Header);
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
}
@@ -320,8 +360,33 @@ namespace Results.Output.Printers.Enhanced
}
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Footer);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Footer);
e.Graphics.DrawString(text, this.footerFont, Brushes.Black, printArea);
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.Enhanced
@@ -30,5 +30,8 @@ namespace Results.Output.Printers.Enhanced
public string[] CommonItems;
public string[] TestItems;
public string Footer;
}
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeWidth;
public int BarcodeHeight;
}
}
@@ -1,12 +1,15 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.OnePerMeter
@@ -16,7 +19,9 @@ namespace Results.Output.Printers.OnePerMeter
const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10;
/// Size of the printed area without margins, after taking into account 'pageOrientation'
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
@@ -158,6 +163,30 @@ namespace Results.Output.Printers.OnePerMeter
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
}
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count && !string.IsNullOrEmpty(wm.SerialNr))
{
try
{
if (cfg.BarcodeType == BarcodeType.QR_Code)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
catch (Exception)
{
}
}
float tableTop = cfg.TopMargin;
if (pageNr == 1)
@@ -351,5 +380,30 @@ namespace Results.Output.Printers.OnePerMeter
pageNr++;
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.OnePerMeter
@@ -54,5 +54,10 @@ namespace Results.Output.Printers.OnePerMeter
public int ImgWid;
public int ImgHgh;
public string ImgFullPathName;
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
}
}
+11
View File
@@ -23,6 +23,7 @@ namespace Results.Output
Suez_EMP_DN32, /// EMP: 12 flow rates
Suez_EMP_DN40, /// EMP: 12 flow rates
Greece, /// Q3, Q2adj, Q2, Q1
S620, /// Q3, Q100, Q2, Q1
Count,
None,
}
@@ -414,6 +415,16 @@ namespace Results.Output
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
case LogType.S620:
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q3", 5, "Q3", 5, "04", 5, "Q3", Range.R90_100),
new SensusTestInfo("Q100", 4, "Q100l", 4, "03", 4,"Q100l", Range.R100_110),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.26.1458.0")]
[assembly: AssemblyFileVersion("2.26.1458.0")]
[assembly: AssemblyVersion("3.1.1464.0")]
[assembly: AssemblyFileVersion("3.1.1464.0")]
+9
View File
@@ -510,6 +510,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Info flags.
/// </summary>
internal static string Info_flags {
get {
return ResourceManager.GetString("Info_flags", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid Q2 correction factors.
/// </summary>
+442 -28
View File
@@ -130,7 +130,7 @@
<value>Ergebnisse</value>
</data>
<data name="Batch_nr" xml:space="preserve">
<value>Stapel Nr.</value>
<value>Los Nr.</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Prüfstand</value>
@@ -154,13 +154,13 @@
<value>Endzeit</value>
</data>
<data name="EndState_aux" xml:space="preserve">
<value>Eindstand Nebenz.</value>
<value>Endstand Nebenzähler</value>
</data>
<data name="EndState_main" xml:space="preserve">
<value>Eindstand Hauptz.</value>
<value>Endstand Hauptzähler</value>
</data>
<data name="End_state" xml:space="preserve">
<value>Eindstand</value>
<value>Endstand</value>
</data>
<data name="ErrLimHi" xml:space="preserve">
<value>Fehlergrenze hoch</value>
@@ -175,10 +175,10 @@
<value>Referenzfehler</value>
</data>
<data name="Err_aux" xml:space="preserve">
<value>Fehler Nebenz.</value>
<value>Fehler Nebenzähler</value>
</data>
<data name="Err_main" xml:space="preserve">
<value>Fehler Hauptz.</value>
<value>Fehler Hauptzähler</value>
</data>
<data name="Flow" xml:space="preserve">
<value>Durchfluss</value>
@@ -187,13 +187,13 @@
<value>Format</value>
</data>
<data name="H_amb" xml:space="preserve">
<value>H umgebung</value>
<value>Luftfeuchte Umgebung</value>
</data>
<data name="Item" xml:space="preserve">
<value>Posten</value>
<value>Objekt</value>
</data>
<data name="MClass" xml:space="preserve">
<value>Metr. Klasse</value>
<value>Metrologische Klasse</value>
</data>
<data name="OkBtnText" xml:space="preserve">
<value>OK</value>
@@ -220,34 +220,34 @@
<value>Impulse/l</value>
</data>
<data name="P_amb" xml:space="preserve">
<value>Dr umgebung</value>
<value>Druck amb. (Umgebungsdruck)</value>
</data>
<data name="P_dn_end" xml:space="preserve">
<value>Dr aus ende</value>
<value>Druck Eingang Prüfungsende</value>
</data>
<data name="P_dn" xml:space="preserve">
<value>Dr aus</value>
<value>Druck Eingang</value>
</data>
<data name="P_dn_start" xml:space="preserve">
<value>Dr aus start</value>
<value>Druck Eingang Prüfungsbeginn</value>
</data>
<data name="P_up_end" xml:space="preserve">
<value>Dr ein ende</value>
<value>Druck Ausgang Prüfungsende</value>
</data>
<data name="P_up" xml:space="preserve">
<value>Dr ein</value>
<value>Druck Ausgang</value>
</data>
<data name="P_up_start" xml:space="preserve">
<value>Dr ein start</value>
<value>Druck Ausgang Prüfungsanfang</value>
</data>
<data name="Q_fall" xml:space="preserve">
<value>Q fall</value>
<value>Q Fall </value>
</data>
<data name="Q_from" xml:space="preserve">
<value>Q von</value>
</data>
<data name="Q_rise" xml:space="preserve">
<value>Q steig</value>
<value>Q Steig</value>
</data>
<data name="Q_to" xml:space="preserve">
<value>Q bis</value>
@@ -292,13 +292,13 @@
<value>Prüfvolumen</value>
</data>
<data name="T_amb" xml:space="preserve">
<value>T umgebung</value>
<value>T Umgebung</value>
</data>
<data name="T_div" xml:space="preserve">
<value>T div</value>
<value>T Umschaltung</value>
</data>
<data name="T_end" xml:space="preserve">
<value>Endzeit</value>
<value>T Ende</value>
</data>
<data name="T_in" xml:space="preserve">
<value>T ein</value>
@@ -364,13 +364,13 @@
<value>Hersteller</value>
</data>
<data name="Meter_type" xml:space="preserve">
<value>Typ</value>
<value>WZ-Typ</value>
</data>
<data name="Compound" xml:space="preserve">
<value>Verbund</value>
<value>Verbundzähler</value>
</data>
<data name="Heat_meter" xml:space="preserve">
<value />
<value>Wärmezähler</value>
</data>
<data name="Single" xml:space="preserve">
<value>Einzel</value>
@@ -382,16 +382,16 @@
<value>Größe</value>
</data>
<data name="Page" xml:space="preserve">
<value>Blz.</value>
<value>Seite</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Wasserzähler</value>
</data>
<data name="aux" xml:space="preserve">
<value>Nebenz.</value>
<value>Nebenzähler</value>
</data>
<data name="main" xml:space="preserve">
<value>Hauptz.</value>
<value>Hauptzähler</value>
</data>
<data name="fall" xml:space="preserve">
<value>fall</value>
@@ -409,6 +409,420 @@
<value>Masse</value>
</data>
<data name="Density_correction" xml:space="preserve">
<value>Dichtekorektur</value>
<value>Dichtekorrektur</value>
</data>
<data name="Energy" xml:space="preserve">
<value>Energie</value>
</data>
<data name="Energy_ref" xml:space="preserve">
<value>Energie ref.</value>
</data>
<data name="P_delta" xml:space="preserve">
<value>Druckdifferenz </value>
</data>
<data name="P_delta_end" xml:space="preserve">
<value>Druckdifferenz Ende Prüfung</value>
</data>
<data name="P_delta_mean" xml:space="preserve">
<value>Druckdifferenz Delta Prüfung </value>
</data>
<data name="P_delta_start" xml:space="preserve">
<value>Druckdifferenz Beginn Prüfung</value>
</data>
<data name="End_volume" xml:space="preserve">
<value>Ende Volumen</value>
</data>
<data name="Start_volume" xml:space="preserve">
<value>Start Volumen</value>
</data>
<data name="End_volume_aux" xml:space="preserve">
<value>Ende Volumen Nebenzähler</value>
</data>
<data name="End_volume_main" xml:space="preserve">
<value>Ende Volumen Hauptzähler</value>
</data>
<data name="Start_volume_aux" xml:space="preserve">
<value>Start Volumen Nebenzähler</value>
</data>
<data name="Start_volume_main" xml:space="preserve">
<value>Start Volumen Hauptzähler</value>
</data>
<data name="Volume_aux" xml:space="preserve">
<value>Volumen Nebenzähler</value>
</data>
<data name="Volume_main" xml:space="preserve">
<value>Volumen Hauptzähler</value>
</data>
<data name="End_mass" xml:space="preserve">
<value>End Prüfung</value>
</data>
<data name="Start_mass" xml:space="preserve">
<value>Start Prüfung</value>
</data>
<data name="VName_Flow" xml:space="preserve">
<value>Q</value>
</data>
<data name="VName_Press" xml:space="preserve">
<value>Druck</value>
</data>
<data name="VName_Temp" xml:space="preserve">
<value>Temperatur</value>
</data>
<data name="VName_Dens" xml:space="preserve">
<value>Ro</value>
</data>
<data name="VName_Humi" xml:space="preserve">
<value>Hu</value>
</data>
<data name="VName_TstTime" xml:space="preserve">
<value>Tau</value>
</data>
<data name="VName_Vol" xml:space="preserve">
<value>Vol.</value>
</data>
<data name="Tooltip_P_de_ac" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber aktuell</value>
</data>
<data name="Tooltip_P_de_avg" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber Mittelwert</value>
</data>
<data name="Tooltip_P_de_en" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsende</value>
</data>
<data name="Tooltip_P_de_me" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber-Durchschnitt </value>
</data>
<data name="Tooltip_P_de_st" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsbeginn</value>
</data>
<data name="Tooltip_P_dw_ac" xml:space="preserve">
<value>Druck am Prüfstreckenausgang aktuell</value>
</data>
<data name="Tooltip_P_dw_avg" xml:space="preserve">
<value>Druck Mittelwert am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_P_dw_en" xml:space="preserve">
<value>Druck am Prüfstreckenausgang am Ende der Prüfung</value>
</data>
<data name="Tooltip_P_dw_me" xml:space="preserve">
<value>Druck Durchnschnitt am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_P_dw_st" xml:space="preserve">
<value>Hauptdruck am Ausgang bei Prüfbeginn</value>
</data>
<data name="Tooltip_P_up_ac" xml:space="preserve">
<value>Hauptdruck am Eingang aktuell</value>
</data>
<data name="Tooltip_P_up_avg" xml:space="preserve">
<value>Druck Mittelwert am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_P_up_en" xml:space="preserve">
<value>Druck am Prüfstreckeneingang am Ende der Prüfung</value>
</data>
<data name="Tooltip_P_up_me" xml:space="preserve">
<value>Druck Durchnschnitt am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_P_up_st" xml:space="preserve">
<value>Druck am Prüfstreckeneingang bei Prüfbeginn</value>
</data>
<data name="Tooltip_Q_m_r" xml:space="preserve">
<value>Durchfluss berechnet von Masse der Waage und Zeit </value>
</data>
<data name="Tooltip_Q_riac" xml:space="preserve">
<value>Durchfluss angezeigt von NHO/ aktuell</value>
</data>
<data name="Tooltip_Q_rim" xml:space="preserve">
<value>Durchfluss von aktuellem NHO/ Durchnschnitt</value>
</data>
<data name="Tooltip_Q_v_r" xml:space="preserve">
<value>Durchfluss von aktuellem Refferenzzähler</value>
</data>
<data name="Tooltip_T_di_ac" xml:space="preserve">
<value>Temperatur aktuell an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_avg" xml:space="preserve">
<value>Temperatur-Mittelwert an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_en" xml:space="preserve">
<value>Temperatur Umschaltung am Prüfungsende (4 letzten Messungen)</value>
</data>
<data name="Tooltip_T_di_me" xml:space="preserve">
<value>Temperatur-Durchschnitt an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_st" xml:space="preserve">
<value>Temperatur Umschaltung am Prüfungsanfang (4 ersten Messungen)</value>
</data>
<data name="Tooltip_T_dw_ac" xml:space="preserve">
<value>Temperatur aktuell am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_avg" xml:space="preserve">
<value>Temperatur-Mittelwert am Prüstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_en" xml:space="preserve">
<value>Temperatur Prüfstreckenausgang am Prüfungsende ( 4 letzten Messungen)</value>
</data>
<data name="Tooltip_T_dw_me" xml:space="preserve">
<value>Temperatur-Durchschnitt am Prüstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_st" xml:space="preserve">
<value>Temperatur Prüfstreckenausgang am Prüfungsanfang( 4 ersten Messungen)</value>
</data>
<data name="Tooltip_T_up_ac" xml:space="preserve">
<value>Temperatur aktuell am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_T_up_avg" xml:space="preserve">
<value>Temperatur-Mittelwert am Prüstreckeneingang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_en" xml:space="preserve">
<value>Temperatur Prüfstreckeneingang und -Ausgang am Prüfungsanfang( 4 Messungen bevor Ende)</value>
</data>
<data name="Tooltip_T_up_me" xml:space="preserve">
<value>Temperatur-Durchschnitt am Prüfstreckeneingang wärend der Prüfung</value>
</data>
<data name="Tooltip_T_up_st" xml:space="preserve">
<value>Temperatur Prüstreckeneingang am Prüfungsbeginn (4 Messungen nach Beginn)</value>
</data>
<data name="Tooltip_E_rel" xml:space="preserve">
<value>Relative Messabweichung eines WZ</value>
</data>
<data name="Tooltip_E_rel_ref" xml:space="preserve">
<value>Relative Messabweichung des NHO</value>
</data>
<data name="Tooltip_sn" xml:space="preserve">
<value>Serie Nr. des WZ</value>
</data>
<data name="Tooltip_sn_aux" xml:space="preserve">
<value>Serie Nr. des Nebenzählers (Verbundzähler)</value>
</data>
<data name="Tooltip_sn_main" xml:space="preserve">
<value>Serie Nr. des Hauptzählers (Verbundzähler)</value>
</data>
<data name="Tooltip_Vol_Mt" xml:space="preserve">
<value>Volumen gemessen vom geprüften WZ</value>
</data>
<data name="Tooltip_Vol_rm" xml:space="preserve">
<value>Refferenz-Volumen vom geprüften WZ</value>
</data>
<data name="VName_Error" xml:space="preserve">
<value>E</value>
</data>
<data name="Tooltip_Hu_Amb_M" xml:space="preserve">
<value>Umgebungs-Luftfeuchtigkeit während der Prüfung</value>
</data>
<data name="Tooltip_P_Amb_M" xml:space="preserve">
<value>Umgebungs-Druck während der Prüfung</value>
</data>
<data name="Tooltip_T_Amb_M" xml:space="preserve">
<value>Umgebungs-Temperatur während der Prüfung</value>
</data>
<data name="Test_done" xml:space="preserve">
<value>Prüfung erledigt</value>
</data>
<data name="Test_passed" xml:space="preserve">
<value>Prüfung beendet</value>
</data>
<data name="No" xml:space="preserve">
<value>Nein</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Ja</value>
</data>
<data name="Error_flags" xml:space="preserve">
<value>Fehlerflags</value>
</data>
<data name="Legalizator" xml:space="preserve">
<value>Prüfstellenleiter</value>
</data>
<data name="User_description" xml:space="preserve">
<value>Benutzerbeschreibung</value>
</data>
<data name="Failed_meters_count" xml:space="preserve">
<value>WZ-Prüfung nicht bestanden</value>
</data>
<data name="Passed_meters_count" xml:space="preserve">
<value>WZ-Prüfung bestanden</value>
</data>
<data name="sensitivity" xml:space="preserve">
<value>Empfindlichkeit</value>
</data>
<data name="Tooltip_Q_end" xml:space="preserve">
<value>Durchflusswert vom NHO-am Prüfungsende</value>
</data>
<data name="Tooltip_Q_max" xml:space="preserve">
<value>Durchflusswert vom NHO-max</value>
</data>
<data name="Tooltip_Q_min" xml:space="preserve">
<value>Durchflusswert vom NHO-min</value>
</data>
<data name="Tooltip_Q_start" xml:space="preserve">
<value>Durchflusswert vom NHO-am Prüfungsanfang</value>
</data>
<data name="Tooltip_P_dw_max" xml:space="preserve">
<value>Druck max. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_P_dw_min" xml:space="preserve">
<value>Druck min. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_P_up_max" xml:space="preserve">
<value>Druck max. am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_P_up_min" xml:space="preserve">
<value>Druck min. am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_T_di_max" xml:space="preserve">
<value>Temp. max. an der Umschaltung während der Prüfung</value>
</data>
<data name="Tooltip_T_di_min" xml:space="preserve">
<value>Temp. min. an der Umschaltung während der Prüfung</value>
</data>
<data name="Tooltip_T_dw_max" xml:space="preserve">
<value>Temp. max am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_T_dw_min" xml:space="preserve">
<value>Temp. min. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_max" xml:space="preserve">
<value>Temp. max am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_min" xml:space="preserve">
<value>Temp. min am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_P_de_max" xml:space="preserve">
<value>Druckdifferenz gemessen von Delta P /WZ max. während der Prüfung</value>
</data>
<data name="Tooltip_P_de_min" xml:space="preserve">
<value>Druckdifferenz gemessen von Delta P /WZ min. während der Prüfung</value>
</data>
<data name="Tooltip_Rho_Wa_calc" xml:space="preserve">
<value>Dichte vom Wasser aus Tabelle oder Formel</value>
</data>
<data name="Tooltip_T_rho_0" xml:space="preserve">
<value>Temperatur von der Wasserprobe bei der Dichtekalibrierung</value>
</data>
<data name="Tooltip_T_ln_ac" xml:space="preserve">
<value>Temperatur aktuell in der Prüfstrecke</value>
</data>
<data name="Tooltip_T_ln_avg" xml:space="preserve">
<value>Temperatur-Mittelwert in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_en" xml:space="preserve">
<value>Temperatur in der Prüfstrecke am Ende der Prüfung -4 letzten Messungen</value>
</data>
<data name="Tooltip_T_ln_max" xml:space="preserve">
<value>Temperatur max. in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_me" xml:space="preserve">
<value>Temperatur-Durchschnitt in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_min" xml:space="preserve">
<value>Temperatur min. in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_st" xml:space="preserve">
<value>Temperatur in der Prüfstrecke am Anfang der Prüfung -4 ersten Messungen</value>
</data>
<data name="Unit" xml:space="preserve">
<value>Einheit</value>
</data>
<data name="Procedure_description" xml:space="preserve">
<value>Prüfprozess Beschreibung</value>
</data>
<data name="Bench_ID" xml:space="preserve">
<value>Prüfstand ID</value>
</data>
<data name="Bench_name" xml:space="preserve">
<value>Prüfstamdsname</value>
</data>
<data name="Address" xml:space="preserve">
<value>Adresse</value>
</data>
<data name="Tooltip_E_rel_last" xml:space="preserve">
<value>Relativer Fehler vom WZ in vorheriger Prüfung/ in Produktion</value>
</data>
<data name="Batch" xml:space="preserve">
<value>Zälerlos</value>
</data>
<data name="repetition" xml:space="preserve">
<value>Wiederholung</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Fehlerhafter Q2 Korrektur-Faktor</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Vorgehender Schritt fehlt oder nicht OK</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Prüfungswiederholung Anzahl überschritten!</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Falsche iPERL Durchflussrichtung</value>
</data>
<data name="Failed" xml:space="preserve">
<value>Nicht OK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>OK</value>
</data>
<data name="Test_in_progress" xml:space="preserve">
<value>Prüfung läuft</value>
</data>
<data name="Counter_0" xml:space="preserve">
<value>Zähler {0}</value>
</data>
<data name="Date_and_time" xml:space="preserve">
<value>Datum und Zeit</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Step" xml:space="preserve">
<value>Schritt</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Arbeitsplatz</value>
</data>
<data name="Workflow" xml:space="preserve">
<value>Arbeitsablauf</value>
</data>
<data name="Production_tracing_results" xml:space="preserve">
<value>Produktion Ergebnisse verfolgen</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
<data name="Part" xml:space="preserve">
<value>Teil</value>
</data>
<data name="All_results" xml:space="preserve">
<value>Alle Ergebnisse</value>
</data>
<data name="Graphs" xml:space="preserve">
<value>Graphiken</value>
</data>
<data name="No_water_meter" xml:space="preserve">
<value>Kein WZ</value>
</data>
<data name="Serial_number_is_missing" xml:space="preserve">
<value>Serie Nr. fehlt.</value>
</data>
<data name="Lower_limit" xml:space="preserve">
<value>Untere Grenze</value>
</data>
<data name="Upper_limit" xml:space="preserve">
<value>Obere Grenze</value>
</data>
<data name="Water_meter_results" xml:space="preserve">
<value>WZ Ergebnisse</value>
</data>
<data name="Relative_error" xml:space="preserve">
<value>Relativer Fehler</value>
</data>
<data name="This_position_is_disabled" xml:space="preserve">
<value>Position nicht aktiviert.</value>
</data>
<data name="Available_items" xml:space="preserve">
<value>Verfügbare Positionen</value>
</data>
<data name="Selected_items" xml:space="preserve">
<value>Ausgewählte Objekte</value>
</data>
</root>
+3
View File
@@ -828,4 +828,7 @@
<data name="VName_Conduct" xml:space="preserve">
<value>Conduct.</value>
</data>
<data name="Info_flags" xml:space="preserve">
<value>Info flags</value>
</data>
</root>
+6 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -195,6 +195,10 @@
<Compile Include="WMeterRsltItemSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
+2 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -11,9 +11,7 @@ namespace Results
{
public static string GetTestName(string name, int repeats, int repetitionNr)
{
if (name == null) return null;
if (repeats == 1) return name;
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
return Common.Utils.GetTestName(name, repeats, repetitionNr);
}
+7 -13
View File
@@ -43,13 +43,6 @@ namespace Results
return item2;
}
/// This is to show RealDensity and AtTemperatire in reports.
public static double RealDensity; /// true water density [kg/m3]
public static double AtTemperature; /// measured at temperature [°C]
public static double Buoyancy;
///
/// Function to pick a MeterTestResult field and convert it into a string
///
@@ -182,9 +175,9 @@ namespace Results
/// Density
///
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).DensityLine)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.Batch.DensityCorr))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Rho_Wa_calc, string.Format("{0} of sample", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", RealDensity)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : Config.Formulas.DistilledWaterDensityFromTemp((w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.BenchData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", Config.Formulas.DensityCorrection(w.Batch.RealDensity, w.Batch.AtTemperature))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Rho_Wa_calc, string.Format("{0} of sample", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.Batch.RealDensity)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.BenchData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : Config.Formulas.DistilledWaterDensityFromTemp((w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2))));
///
/// Date and time
@@ -259,7 +252,7 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_avg, string.Format("{0} DI avg ()", Strings.VName_Temp), Strings.Tooltip_T_di_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempDivStart + w.GetTestRslt(t).TempDivEnd) / 2)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_min, string.Format("{0} DI min ()", Strings.VName_Temp), Strings.Tooltip_T_di_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMin)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_max, string.Format("{0} DI max ()", Strings.VName_Temp), Strings.Tooltip_T_di_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMax)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_rho_0, string.Format("{0} RO0", Strings.VName_Temp), Strings.Tooltip_T_rho_0, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", AtTemperature)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_rho_0, string.Format("{0} RO0", Strings.VName_Temp), Strings.Tooltip_T_rho_0, Quantity.Temperature, ItemCategory.BenchData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Batch.AtTemperature)));
#if HEAT_METERS
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_mean, string.Format("{0} hi me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom1)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_start, string.Format("{0} hi st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom2)));
@@ -316,7 +309,7 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_temp_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Temp), Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetTestRslt(t) == null) ? w.Batch.AmbTempStart() : w.GetTestRslt(t).AmbTempStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbTempEnd() : w.GetTestRslt(t).AmbTempEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_press_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Press), Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? w.Batch.AmbPressStart(): w.GetTestRslt(t).AmbPressStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbPressEnd() : w.GetTestRslt(t).AmbPressEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_humi_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Humi), Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V2", (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiStart() : w.GetTestRslt(t).AmbHumiStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiEnd() : w.GetTestRslt(t).AmbHumiEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? FormatDbl(u, f, p, "V6", w.Batch.Buoyancy()) : ((w.GetTestRslt(t) != null) ? FormatDbl(u, f, p, "V6", (w.GetTestRslt(t).Buoyancy)) : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy", Quantity.Number, ItemCategory.BenchData, (w, t, u, f, p) => FormatDbl(u, f, p, "V6", w.Batch.Buoyancy)));
///
/// Error
@@ -336,7 +329,7 @@ namespace Results
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.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
@@ -471,6 +464,7 @@ namespace Results
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.InfoFlags, Strings.Info_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).InfoFlagsStr() : w.InfoFlagsStr())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & (int)ErrorFlagMask.E1) != 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 & (int)ErrorFlagMask.E2) != 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 & (int)ErrorFlagMask.E3) != 0) ? Strings.Yes : Strings.No));
+1
View File
@@ -14,6 +14,7 @@ namespace ResultsBrowser
ListOfSerialNumbers,
WZTypeIdAndTimePeriod,
ProducedWithinTimePeriod,
BenchAndBatchNr,
Count,
}
@@ -39,6 +39,7 @@ namespace ResultsBrowser.Forms
//queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ListOfSerialNumbers, "Všetky vodomery so sériovými číslami podľa zadaného zoznamu"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.WZTypeIdAndTimePeriod, "Všetky vodomery so zadaným WZTypeID vyrobené v zadanom časovom období"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ProducedWithinTimePeriod, "Všetky vodomery vyrobené v zadanom časovom období"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.BenchAndBatchNr, "Stanica a číslo dávky"));
queryTypeComboBox.Text = "Všetky vodomery vyrobené v zadanom časovom období";
destinationFileTextBox.Text = string.Format("vysledky_hladania_{0:ddMMyyyy_HHmm}.csv", DateTime.Now);
@@ -68,7 +69,8 @@ namespace ResultsBrowser.Forms
/// Update UI elements visibility
inputListGroupBox.Enabled = (CQCriteria == CQCriteria.ListOfOrders) ||
(CQCriteria == CQCriteria.ListOfPcbNumbers) ||
(CQCriteria == CQCriteria.ListOfSerialNumbers);
(CQCriteria == CQCriteria.ListOfSerialNumbers) ||
(CQCriteria == CQCriteria.BenchAndBatchNr);
timePeriodGroupBox.Enabled = (CQCriteria == CQCriteria.WZTypeIdAndTimePeriod) ||
(CQCriteria == CQCriteria.ProducedWithinTimePeriod);
@@ -78,6 +80,11 @@ namespace ResultsBrowser.Forms
parameterGroupBox.Enabled = true;
parameterNameLabel.Text = "WZ Type ID";
}
else if (CQCriteria == CQCriteria.BenchAndBatchNr)
{
parameterGroupBox.Enabled = true;
parameterNameLabel.Text = "Test bench number (e.g. 10 for WR10)";
}
else
{
parameterGroupBox.Enabled = false;
+3 -2
View File
@@ -5,6 +5,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace ResultsBrowser.Forms
{
@@ -91,8 +92,8 @@ namespace ResultsBrowser.Forms
cfgControl.Config = printerCfg;
cfgControl.Config.ItemNr = 0;
TBF.BenchControl.ComponentParametersDlg cfgForm = new TBF.BenchControl.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Component>();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.25.1440.0")]
[assembly: AssemblyFileVersion("2.25.1440.0")]
[assembly: AssemblyVersion("3.1.1464.0")]
[assembly: AssemblyFileVersion("3.1.1464.0")]
+75 -3
View File
@@ -163,7 +163,7 @@
<value>OK</value>
</data>
<data name="Print_query_results" xml:space="preserve">
<value>Ergebnise drucken</value>
<value>Ergebnisse Abfrage Drucken</value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Prüfvorlage</value>
@@ -172,7 +172,7 @@
<value>Protokoll</value>
</data>
<data name="Query_results" xml:space="preserve">
<value>Ergebnisse</value>
<value>Abfrageergebnisse</value>
</data>
<data name="Results_Browser" xml:space="preserve">
<value>Analyse der Ergebnisse</value>
@@ -199,7 +199,7 @@
<value>Statistiken</value>
</data>
<data name="Test" xml:space="preserve">
<value>Prüfpunkt</value>
<value>Prüfung</value>
</data>
<data name="Test_bench" xml:space="preserve">
<value>Prüfstand</value>
@@ -231,4 +231,76 @@
<data name="Print" xml:space="preserve">
<value>Drucken</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="ConfigureDatabaseText" xml:space="preserve">
<value>Password für Prüfstand configurieren</value>
</data>
<data name="ExitBtnText" xml:space="preserve">
<value>Exit</value>
</data>
<data name="Component" xml:space="preserve">
<value>Komponenten</value>
</data>
<data name="Configure" xml:space="preserve">
<value>Konfigurieren</value>
</data>
<data name="Printer" xml:space="preserve">
<value>Drucker</value>
</data>
<data name="Question" xml:space="preserve">
<value>Fragen</value>
</data>
<data name="Add" xml:space="preserve">
<value>&amp;Hinzufügen</value>
</data>
<data name="Message" xml:space="preserve">
<value>Nachricht</value>
</data>
<data name="Data" xml:space="preserve">
<value>Daten</value>
</data>
<data name="All_files" xml:space="preserve">
<value>Alle Dateien</value>
</data>
<data name="Query_files" xml:space="preserve">
<value>Abfragedateien</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>Programmeinstellungen nicht gefunden</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Einstellungen Vorgaben benutzen.</value>
</data>
<data name="Selected_language_not_supported" xml:space="preserve">
<value>Ausgewählte Sprache wird nicht unterstützt.</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>Englische Sprache benutzen!</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warnung</value>
</data>
<data name="Format" xml:space="preserve">
<value>Formatieren</value>
</data>
<data name="Configure_printer" xml:space="preserve">
<value>Drucker konfigurieren.</value>
</data>
<data name="No_printer_defined" xml:space="preserve">
<value>Kein Drucker ausgewählt.</value>
</data>
<data name="Printing_failed" xml:space="preserve">
<value>Druck fehlgeschlagen</value>
</data>
<data name="Printing_completed" xml:space="preserve">
<value>Druck vollständig</value>
</data>
<data name="Error_exporting_results" xml:space="preserve">
<value>Fehler beim exportieren der Ergebnisse!</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histogramm</value>
</data>
</root>
+1 -1
View File
@@ -19,7 +19,7 @@ namespace ResultsBrowser.Resources {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -32,7 +32,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;JUZNA_AFRIKA_NEW</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+168 -105
View File
@@ -28,8 +28,8 @@ namespace ResultsBrowser
IList<WaterMeter> waterMeters;
DateTime timePeriodStart;
DateTime timePeriodEnd;
DateTime timePeriodStart;
DateTime timePeriodEnd;
static IList<IComponent> tbfComponents;
static IList<IDevice> tbfDevices;
@@ -47,9 +47,9 @@ namespace ResultsBrowser
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
tbfDevices = new List<IDevice>();
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
}
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
}
private void ResultsBrowserWnd_Load(object sender, EventArgs e)
{
@@ -102,15 +102,15 @@ namespace ResultsBrowser
checkBox6.Visible = !string.IsNullOrEmpty(checkBox6.Text);
}
string BenchName()
{
return checkBox1.Checked ? Program.LocalSettings.Bench1
: checkBox2.Checked ? Program.LocalSettings.Bench2
: checkBox3.Checked ? Program.LocalSettings.Bench3
: checkBox4.Checked ? Program.LocalSettings.Bench4
string BenchName()
{
return checkBox1.Checked ? Program.LocalSettings.Bench1
: checkBox2.Checked ? Program.LocalSettings.Bench2
: checkBox3.Checked ? Program.LocalSettings.Bench3
: checkBox4.Checked ? Program.LocalSettings.Bench4
: checkBox5.Checked ? Program.LocalSettings.Bench5
: Program.LocalSettings.Bench6;
}
}
void Localize()
{
@@ -118,19 +118,19 @@ namespace ResultsBrowser
resultsGroupBox.Text = Strings.Query_results;
settingsBtn.Text = Strings.Settings;
testBenchesGroupBox.Text = Strings.Test_benches;
clearFiltersBtn.Text = Strings.Clear_filters;
clearFiltersBtn.Text = Strings.Clear_filters;
addFilterBtn.Text = Strings.Add_filter;
formatOfResultsBtn.Text = Strings.Format_of_results;
printerConfigBtn.Text = Strings.Configure_printer;
loadConfigBtn.Text = Strings.Load_filters;
formatOfResultsBtn.Text = Strings.Format_of_results;
printerConfigBtn.Text = Strings.Configure_printer;
loadConfigBtn.Text = Strings.Load_filters;
saveConfigBtn.Text = Strings.Save_filters;
executeQueryBtn.Text = Strings.Execute_query;
executeQueryBtn.Text = Strings.Execute_query;
exportQueryResultsBtn.Text = Strings.Export_query_results;
printQueryResultsBtn.Text = Strings.Print_query_results;
statisticsBtn.Text = Strings.Statistics;
statisticsBtn.Text = Strings.Statistics;
}
private void settingsBtn_Click(object sender, EventArgs e)
@@ -176,40 +176,40 @@ namespace ResultsBrowser
}
}
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.MetersKind = Config.Entities.MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.MetersKind = Config.Entities.MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
RedrawResults();
}
}
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
RedrawResults();
}
}
private void printerConfigBtn_Click(object sender, EventArgs e)
{
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
{
PrinterClass = filtersConfig.PrinterClass,
PrinterCfg = filtersConfig.PrinterCfg
};
private void printerConfigBtn_Click(object sender, EventArgs e)
{
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
{
PrinterClass = filtersConfig.PrinterClass,
PrinterCfg = filtersConfig.PrinterCfg
};
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.PrinterClass = dlg.PrinterClass;
filtersConfig.PrinterCfg = dlg.PrinterCfg;
}
}
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.PrinterClass = dlg.PrinterClass;
filtersConfig.PrinterCfg = dlg.PrinterCfg;
}
}
private void loadConfigBtn_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
if (dlg.ShowDialog() == DialogResult.OK)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
if (dlg.ShowDialog() == DialogResult.OK)
{
LoadConfigFromFile(dlg.FileName);
}
}
@@ -269,8 +269,8 @@ namespace ResultsBrowser
private void executeQueryBtn_Click(object sender, EventArgs e)
{
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
try
{
@@ -291,11 +291,11 @@ namespace ResultsBrowser
foreach (var filter in filters)
{
if (filter is DateFilter)
{
timePeriodStart = (filter as DateFilter).From;
timePeriodEnd = (filter as DateFilter).To;
}
if (filter is DateFilter)
{
timePeriodStart = (filter as DateFilter).From;
timePeriodEnd = (filter as DateFilter).To;
}
waterMeters2 = filter.ExecuteQuery(sessions, waterMeters);
waterMeters = waterMeters2;
}
@@ -364,10 +364,10 @@ namespace ResultsBrowser
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
try
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
for (int i = 0; i < items.Count; i++)
{
writer.Write(items[i].Caption);
@@ -397,10 +397,10 @@ namespace ResultsBrowser
}
}
}
catch (Exception exc)
{
catch (Exception exc)
{
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
@@ -448,11 +448,11 @@ namespace ResultsBrowser
IComponent component = printerFactory.GetComponent(printerCfg, tbfComponents);
IResultsPrinter printer = component as IResultsPrinter;
if (printer== null)
if (printer == null)
{
MessageBox.Show(Strings.No_printer_defined);
return;
}
}
tbfComponents.Clear();
tbfDevices.Clear();
@@ -493,7 +493,7 @@ namespace ResultsBrowser
{
if (waterMeters == null || waterMeters.Count == 0) return;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Statistics options
@@ -529,24 +529,24 @@ namespace ResultsBrowser
}
/// <summary>
/// Updates component factory
/// </summary>
/// <param name="className">Component class name</param>
/// <param name="factory">Reference to a factory</param>
/// <returns>true when factory changed</returns>
IComponentFactory GetFactory(string className)
{
if (!string.IsNullOrEmpty(className))
{
foreach (var fac in TbfComponents.Factories)
{
if (fac.ClassName == className) return fac;
}
}
/// <summary>
/// Updates component factory
/// </summary>
/// <param name="className">Component class name</param>
/// <param name="factory">Reference to a factory</param>
/// <returns>true when factory changed</returns>
IComponentFactory GetFactory(string className)
{
if (!string.IsNullOrEmpty(className))
{
foreach (var fac in TbfComponents.Factories)
{
if (fac.ClassName == className) return fac;
}
}
return null;
}
return null;
}
private void customQueryButton_Click(object sender, EventArgs e)
{
@@ -639,7 +639,6 @@ namespace ResultsBrowser
return;
}
/// Add this test bench to the list of test benches if it was still missing
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
}
@@ -734,20 +733,11 @@ namespace ResultsBrowser
/// SUEZ specific
switch (testId)
{
case -2:
oraD.AdjErrA4 = error;
break;
case -1:
oraD.AdjErr = error;
break;
case 5:
oraD.Q3LrErr = error;
break;
case 10:
oraD.Q3RlErr = error;
break;
default:
break;
case -2: oraD.AdjErrA4 = error; break;
case -1: oraD.AdjErr = error; break;
case 5: oraD.Q3LrErr = error; break;
case 10: oraD.Q3RlErr = error; break;
default: break;
}
}
dr.Close();
@@ -756,6 +746,78 @@ namespace ResultsBrowser
oracleConnection.Close();
}
else if (dlg.CQCriteria == CQCriteria.BenchAndBatchNr)
{
switch (dlg.IntParameter)
{
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 11: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 15: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 14: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 18: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 19: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 20: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 21: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
default: Results.DB.ConnectionString = string.Empty; break;
}
Results.DB.DbType = Users.Entities.DBType.MySql;
string[] fields = dlg.InputList.Split(new char[] { ',' });
int[] batchNrs = new int[fields.Length];
int batchNr;
for (int i = 0; i < batchNrs.Length; i++) if (int.TryParse(fields[i], out batchNr)) batchNrs[i] = batchNr;
IList<WaterMeter> waterMeters = new List<WaterMeter>();
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{
ISession session = Results.DB.CreateSession();
for (int i = 0; i < batchNrs.Length; i++)
{
var batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNrs[i]))
.List();
if (batches.Count == 1)
{
var wms = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch == batches[0]))
.List();
foreach (var wm in wms) waterMeters.Add(wm);
}
}
}
consoleTextBox.Text += "Collecting water meters\r\n";
foreach (var waterMeter in waterMeters)
{
oracleConnection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
oracleConnection.Open();
OracleCommand cmd = new OracleCommand("select AUFTRAGSNUMMER, MAX_PRUEFINDEX, PREFIX, ZAEHLERNUMMER from VT_ZAEHLER_PD where VT_FERNUM = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = waterMeter.SerialNr });
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
int i = 0;
string queryResult = dr.GetString(i++);
int maxPruefIx = dr.GetInt32(i++);
int testBenchId = maxPruefIx / 100;
maxPruefIx = maxPruefIx % 100;
string prefix = dr.GetString(i++);
int sn = dr.GetInt32(i++);
if (sn == -1) continue;
/// Create 'OraData' object and add it to 'oraDatas' list
oraDatas.Add(new OraData() { PO = queryResult, PcbNr = waterMeter.SerialNr, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, Prefix = prefix, SN = sn });
/// Add this test bench to the list of test benches if it was still missing
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
}
}
}
else if (dlg.CQCriteria == CQCriteria.WZTypeIdAndTimePeriod)
{
}
@@ -795,18 +857,19 @@ namespace ResultsBrowser
/// Test bench databases
switch (testBenchId)
{
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 11: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 12: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 14: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
default: Results.DB.ConnectionString = string.Empty; break;
}
#endif
Results.DB.DbType = Users.Entities.DBType.MySql;
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{
@@ -854,7 +917,7 @@ namespace ResultsBrowser
consoleTextBox.Text += Environment.NewLine;
if (session != null) session.Close();
}
}
}
consoleTextBox.Text += "End reading additional data from MySQL\r\n";
+427
View File
@@ -0,0 +1,427 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchematicDrawing
{
public class DrawingShape
{
public readonly Shape Shape; /// see enum SchematicDrawing.Shape
public readonly Sz Sz; /// see enum SchematicDrawing.Sz
public readonly int SzX; /// Size X in SchematicDrawing.Const.Step pixels
public readonly int SzY; /// Size Y in SchematicDrawing.Const.Step pixels
public readonly int OffsX; /// Offset of left/top coordinate of the bitmap when rendering
public readonly int OffsY; /// Offset of left/top coordinate of the bitmap when rendering
public readonly int Wid; /// Width of the bitmap when rendering, original bitmap is resized to this size
public readonly int Hgh; /// Height of the bitmap when rendering, original bitmap is resized to this size
public readonly Node[] Nodes; /// Nodes of this shape
public readonly Edge[] Edges; /// Edges (in the open state in case there are two states: open/closed)
public readonly bool HasImg; /// True when there is an image of this item to be displayed
public readonly Image ImgRight; /// Bitmap to be drawn (in the open state in case there are two states: open/closed)
public readonly Image ImgUp;
public readonly Image ImgLeft;
public readonly Image ImgDown;
public readonly Image ImgRightFlipped;
public readonly Image ImgUpFlipped;
public readonly Image ImgLeftFlipped;
public readonly Image ImgDownFlipped;
public readonly bool HasClosed; /// true = This shape can be displayed in a closed state
public readonly Image ImgRightClosed; /// Optional bitmap in the closed state, size should be the same as the size of Bmp
public readonly Image ImgUpClosed;
public readonly Image ImgLeftClosed;
public readonly Image ImgDownClosed;
public readonly Image ImgRightFlippedClosed;
public readonly Image ImgUpFlippedClosed;
public readonly Image ImgLeftFlippedClosed;
public readonly Image ImgDownFlippedClosed;
public readonly bool HasVacuum; /// true = This shape can display vacuum
public readonly Image ImgRightVacuum; /// Optional bitmap in the closed state, size should be the same as the size of Bmp
public readonly Image ImgUpVacuum;
public readonly Image ImgLeftVacuum;
public readonly Image ImgDownVacuum;
public readonly Image ImgRightFlippedVacuum;
public readonly Image ImgUpFlippedVacuum;
public readonly Image ImgLeftFlippedVacuum;
public readonly Image ImgDownFlippedVacuum;
public readonly bool HasOpenDry; /// true = this shape can be displayed as dry in an open state
public readonly Image ImgRightOpenDry; /// Optional bitmap in the closed state, size should be the same as the size of Bmp
public readonly Image ImgUpOpenDry;
public readonly Image ImgLeftOpenDry;
public readonly Image ImgDownOpenDry;
public readonly Image ImgRightFlippedOpenDry;
public readonly Image ImgUpFlippedOpenDry;
public readonly Image ImgLeftFlippedOpenDry;
public readonly Image ImgDownFlippedOpenDry;
DrawingShape(Shape shape, Sz sz, int szX, int szY, Node[] nodes = null, Edge[] edges = null,
int offsX = -10, int offsY = -10, int wid = 20, int hgh = 20,
Bitmap bmp = null, Bitmap bmpClosed = null, Bitmap bmpVacuum = null, Bitmap bmpOpenDry = null)
{
Shape = shape;
Sz = sz;
SzX = szX;
SzY = szY;
OffsX = offsX;
OffsY = offsY;
Wid = wid;
Hgh = hgh;
Nodes = (nodes != null) ? nodes : new Node[0];
Edges = (edges != null) ? edges : new Edge[0];
HasImg = (bmp != null);
if (HasImg)
{
ImgRight = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDown = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeft = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUp = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
ImgRightFlipped = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownFlipped = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftFlipped = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpFlipped = bmp.Clone() as Image;
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
}
HasClosed = (bmpClosed != null);
if (HasClosed)
{
ImgRightClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpClosed.RotateFlip(RotateFlipType.RotateNoneFlipY);
ImgRightFlippedClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownFlippedClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftFlippedClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpFlippedClosed = bmpClosed.Clone() as Image;
bmpClosed.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpClosed.RotateFlip(RotateFlipType.RotateNoneFlipY);
}
HasVacuum = (bmpVacuum != null);
if (HasVacuum)
{
ImgRightVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpVacuum.RotateFlip(RotateFlipType.RotateNoneFlipY);
ImgRightFlippedVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownFlippedVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftFlippedVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpFlippedVacuum = bmpVacuum.Clone() as Image;
bmpVacuum.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpVacuum.RotateFlip(RotateFlipType.RotateNoneFlipY);
}
HasOpenDry = (bmpOpenDry != null);
if (HasOpenDry)
{
ImgRightOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpOpenDry.RotateFlip(RotateFlipType.RotateNoneFlipY);
ImgRightFlippedOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgDownFlippedOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgLeftFlippedOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImgUpFlippedOpenDry = bmpOpenDry.Clone() as Image;
bmpOpenDry.RotateFlip(RotateFlipType.Rotate90FlipNone);
bmpOpenDry.RotateFlip(RotateFlipType.RotateNoneFlipY);
}
}
public Rectangle GetRotatedFlippedImageRectangle(IDrawingItem item)
{
const int G = SchematicDrawing.Const.GridSize;
if (item.Flip)
{
/// Flipped (mirror) image
switch (item.Orient)
{
default:
case Orient.R: return new Rectangle(item.X + OffsX, item.Y + G * SzY - Hgh - OffsY, Wid, Hgh);
case Orient.Up: return new Rectangle(item.X + OffsY, item.Y + OffsX, Hgh, Wid);
case Orient.L: return new Rectangle(item.X + G * SzX - Wid - OffsX, item.Y + OffsY, Wid, Hgh);
case Orient.Dn: return new Rectangle(item.X + G * SzY - Hgh - OffsY, item.Y + G * SzX - Wid - OffsX, Hgh, Wid);
}
}
else
{
/// Normal image
switch (item.Orient)
{
default:
case Orient.R: return new Rectangle(item.X + OffsX, item.Y + OffsY, Wid, Hgh);
case Orient.Up: return new Rectangle(item.X + OffsY, item.Y + G * SzX - Wid - OffsX, Hgh, Wid);
case Orient.L: return new Rectangle(item.X + G * SzX - Wid - OffsX, item.Y + G * SzY - Hgh - OffsY, Wid, Hgh);
case Orient.Dn: return new Rectangle(item.X + G * SzY - Hgh - OffsY, item.Y + OffsX, Hgh, Wid);
}
}
}
/// <summary>
/// Get coordinates and orientation of the rotated/flipped node
/// </summary>
/// <param name="item">Item</param>
/// <param name="nodeId">Node id</param>
/// <returns>Rotated/flipped node</returns>
public Node GetRotatedFlippedNode(IDrawingItem item, int nodeId)
{
if (Nodes == null || nodeId < 0 || nodeId >= Nodes.Length) return new Node(0, 0, Orient.R);
Node node = Nodes[nodeId];
if (item.Flip)
{
/// Flipped
int ori = (int)node.Orient;
if (ori % 2 == 1) ori += 2;
ori += (int)item.Orient;
switch (item.Orient)
{
default:
case Orient.R: return new Node(node.X, SzY - node.Y, (Orient)(ori % 4));
case Orient.Up: return new Node(SzY - node.Y, SzX - node.X, (Orient)(ori % 4));
case Orient.L: return new Node(SzX - node.X, node.Y, (Orient)(ori % 4));
case Orient.Dn: return new Node(node.Y, node.X, (Orient)(ori % 4));
}
}
else
{
/// Normal
int ori = (int)item.Orient + (int)node.Orient;
switch (item.Orient)
{
default:
case Orient.R: return new Node(node.X, node.Y, (Orient)(ori % 4));
case Orient.Up: return new Node(node.Y, SzX - node.X, (Orient)(ori % 4));
case Orient.L: return new Node(SzX - node.X, SzY - node.Y, (Orient)(ori % 4));
case Orient.Dn: return new Node(SzY - node.Y, node.X, (Orient)(ori % 4));
}
}
}
public static DrawingShape[] Shapes;
///
public static int DrShIx(Shape shape, Sz sz) { return (int)shape * (int)Sz.Count + (int)sz; }
///
public static DrawingShape GetDrawingShape(Shape shape, Sz sz) { return Shapes[DrShIx(shape, sz)]; }
///
public static DrawingShape GetDrawingShape(IDrawingItem item) { return (item != null) ? Shapes[DrShIx(item.Shape, item.Sz)] : null; }
/// <summary>
/// Static constructor that initializes Shapes[] array
/// </summary>
static DrawingShape()
{
Shapes = new DrawingShape[(int)Shape.Count * (int)Sz.Count];
/// Temperature meter
Shapes[DrShIx(Shape.TempM, Sz.S)] = new DrawingShape(Shape.TempM, Sz.S, 0, 0);
Shapes[DrShIx(Shape.TempM, Sz.M)] = new DrawingShape(Shape.TempM, Sz.M, 0, 0);
Shapes[DrShIx(Shape.TempM, Sz.L)] = new DrawingShape(Shape.TempM, Sz.L, 0, 0);
Shapes[DrShIx(Shape.TempM, Sz.XL)] = new DrawingShape(Shape.TempM, Sz.XL, 0, 0);
/// Pressure meter
Shapes[DrShIx(Shape.PressM, Sz.S)] = new DrawingShape(Shape.PressM, Sz.S, 0, 0);
Shapes[DrShIx(Shape.PressM, Sz.M)] = new DrawingShape(Shape.PressM, Sz.M, 0, 0);
Shapes[DrShIx(Shape.PressM, Sz.L)] = new DrawingShape(Shape.PressM, Sz.L, 0, 0);
Shapes[DrShIx(Shape.PressM, Sz.XL)] = new DrawingShape(Shape.PressM, Sz.XL, 0, 0);
/// Valve
Shapes[DrShIx(Shape.Valve, Sz.S)] = new DrawingShape(Shape.Valve, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) },
new Edge[] { new Edge(0, 1, 20, RouteCouple.OpenWhen1), new Edge(1, 0, 20, RouteCouple.OpenWhen1) },
0, 0, 20, 20,
Properties.Resources.Valve_S_open, Properties.Resources.Valve_S_closed,
Properties.Resources.Valve_S_vacuum, Properties.Resources.Valve_S_open_dry);
Shapes[DrShIx(Shape.Valve, Sz.M)] = new DrawingShape(Shape.Valve, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 30, RouteCouple.OpenWhen1), new Edge(1, 0, 30, RouteCouple.OpenWhen1) },
0, 5, 30, 30,
Properties.Resources.Valve_M_open, Properties.Resources.Valve_M_closed,
Properties.Resources.Valve_M_vacuum, Properties.Resources.Valve_M_open_dry);
Shapes[DrShIx(Shape.Valve, Sz.L)] = new DrawingShape(Shape.Valve, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40, RouteCouple.OpenWhen1), new Edge(1, 0, 40, RouteCouple.OpenWhen1) },
0, 0, 40, 40,
Properties.Resources.Valve_L_open, Properties.Resources.Valve_L_closed,
Properties.Resources.Valve_L_vacuum, Properties.Resources.Valve_L_open_dry);
Shapes[DrShIx(Shape.Valve, Sz.XL)] = new DrawingShape(Shape.Valve, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) },
new Edge[] { new Edge(0, 1, 50, RouteCouple.OpenWhen1), new Edge(1, 0, 50, RouteCouple.OpenWhen1) },
0, 5, 50, 50,
Properties.Resources.Valve_XL_open, Properties.Resources.Valve_XL_closed,
Properties.Resources.Valve_XL_vacuum, Properties.Resources.Valve_XL_open_dry);
/// Regulation valve
Shapes[DrShIx(Shape.RegV, Sz.S)] = new DrawingShape(Shape.RegV, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) },
new Edge[] { new Edge(0, 1, 20), new Edge(1, 0, 20) },
0, 0, 20, 20, Properties.Resources.RegV_S);
Shapes[DrShIx(Shape.RegV, Sz.M)] = new DrawingShape(Shape.RegV, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 30), new Edge(1, 0, 30) },
0, 5, 30, 30, Properties.Resources.RegV_M);
Shapes[DrShIx(Shape.RegV, Sz.L)] = new DrawingShape(Shape.RegV, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40), new Edge(1, 0, 40) },
0, 0, 40, 40, Properties.Resources.RegV_L);
Shapes[DrShIx(Shape.RegV, Sz.XL)] = new DrawingShape(Shape.RegV, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) },
new Edge[] { new Edge(0, 1, 50), new Edge(1, 0, 50) },
0, 5, 50, 50, Properties.Resources.RegV_XL);
/// Pump
Shapes[DrShIx(Shape.Pump, Sz.S)] = new DrawingShape(Shape.Pump, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) },
new Edge[] { new Edge(0, 1, 20, RouteCouple.OpenWhen1) },
0, 0, 20, 20, Properties.Resources.Pump_S_open, Properties.Resources.Pump_S_closed);
Shapes[DrShIx(Shape.Pump, Sz.M)] = new DrawingShape(Shape.Pump, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 30, RouteCouple.OpenWhen1) },
0, 5, 30, 30, Properties.Resources.Pump_M_open, Properties.Resources.Pump_M_closed);
Shapes[DrShIx(Shape.Pump, Sz.L)] = new DrawingShape(Shape.Pump, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40, RouteCouple.OpenWhen1) },
0, 0, 40, 40, Properties.Resources.Pump_L_open, Properties.Resources.Pump_L_closed);
Shapes[DrShIx(Shape.Pump, Sz.XL)] = new DrawingShape(Shape.Pump, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) },
new Edge[] { new Edge(0, 1, 50, RouteCouple.OpenWhen1) },
0, 5, 50, 50, Properties.Resources.Pump_XL_open, Properties.Resources.Pump_XL_closed);
/// Pump with frequency inverter
Shapes[DrShIx(Shape.PumpFM, Sz.S)] = new DrawingShape(Shape.PumpFM, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) },
new Edge[] { new Edge(0, 1, 20, RouteCouple.OpenWhen1) },
0, 0, 20, 20, Properties.Resources.Pump_S_open, Properties.Resources.Pump_S_closed);
Shapes[DrShIx(Shape.PumpFM, Sz.M)] = new DrawingShape(Shape.PumpFM, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 30, RouteCouple.OpenWhen1) },
0, 5, 30, 30, Properties.Resources.Pump_M_open, Properties.Resources.Pump_M_closed);
Shapes[DrShIx(Shape.PumpFM, Sz.L)] = new DrawingShape(Shape.PumpFM, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40, RouteCouple.OpenWhen1) },
0, 0, 40, 40, Properties.Resources.Pump_L_open, Properties.Resources.Pump_L_closed);
Shapes[DrShIx(Shape.PumpFM, Sz.XL)] = new DrawingShape(Shape.PumpFM, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) },
new Edge[] { new Edge(0, 1, 50, RouteCouple.OpenWhen1) },
0, 5, 50, 50, Properties.Resources.Pump_XL_open, Properties.Resources.Pump_XL_closed);
/// Flow meter
Shapes[DrShIx(Shape.FlowM, Sz.S)] = new DrawingShape(Shape.FlowM, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) }, new Edge[] { new Edge(0, 1, 20) },
0, 0, 20, 20, Properties.Resources.FlowM_S);
Shapes[DrShIx(Shape.FlowM, Sz.M)] = new DrawingShape(Shape.FlowM, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) }, new Edge[] { new Edge(0, 1, 30) },
0, 5, 30, 30, Properties.Resources.FlowM_M);
Shapes[DrShIx(Shape.FlowM, Sz.L)] = new DrawingShape(Shape.FlowM, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) }, new Edge[] { new Edge(0, 1, 40) },
0, 0, 40, 40, Properties.Resources.FlowM_L);
Shapes[DrShIx(Shape.FlowM, Sz.XL)] = new DrawingShape(Shape.FlowM, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) }, new Edge[] { new Edge(0, 1, 50) },
0, 5, 50, 50, Properties.Resources.FlowM_XL);
/// Water meter
Shapes[DrShIx(Shape.WaterM, Sz.L)] = new DrawingShape(Shape.WaterM, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40), new Edge(1, 0, 40) },
0, 0, 40, 40, Properties.Resources.WaterM_L);
Shapes[DrShIx(Shape.WaterM, Sz.S)] = Shapes[DrShIx(Shape.WaterM, Sz.L)];
Shapes[DrShIx(Shape.WaterM, Sz.M)] = Shapes[DrShIx(Shape.WaterM, Sz.L)];
Shapes[DrShIx(Shape.WaterM, Sz.XL)] = Shapes[DrShIx(Shape.WaterM, Sz.L)];
/// Scale
Shapes[DrShIx(Shape.Scale, Sz.S)] = new DrawingShape(Shape.Scale, Sz.S, 6, 8, new Node[] { new Node(3, 8, Orient.Dn) }, null, 0, 0, 60, 80, Properties.Resources.Scale_S);
Shapes[DrShIx(Shape.Scale, Sz.M)] = new DrawingShape(Shape.Scale, Sz.M, 8, 9, new Node[] { new Node(4, 9, Orient.Dn) }, null, 0, 0, 80, 90, Properties.Resources.Scale_M);
Shapes[DrShIx(Shape.Scale, Sz.L)] = new DrawingShape(Shape.Scale, Sz.L, 12, 11, new Node[] { new Node(6, 11, Orient.Dn) }, null, 0, 0, 120, 110, Properties.Resources.Scale_L);
Shapes[DrShIx(Shape.Scale, Sz.XL)] = new DrawingShape(Shape.Scale, Sz.XL, 16, 13, new Node[] { new Node(8, 13, Orient.Dn) }, null, 0, 0, 160, 130, Properties.Resources.Scale_XL);
/// Tank
Shapes[DrShIx(Shape.Tank, Sz.S)] = new DrawingShape(Shape.Tank, Sz.S, 10, 8, new Node[] { new Node(0, 6, Orient.L) }, null, 0, 0, 100, 80, Properties.Resources.Tank_S);
Shapes[DrShIx(Shape.Tank, Sz.M)] = new DrawingShape(Shape.Tank, Sz.M, 12, 9, new Node[] { new Node(0, 7, Orient.L) }, null, 0, 0, 120, 90, Properties.Resources.Tank_M);
Shapes[DrShIx(Shape.Tank, Sz.L)] = new DrawingShape(Shape.Tank, Sz.L, 15, 11, new Node[] { new Node(0, 9, Orient.L) }, null, 0, 0, 150, 110, Properties.Resources.Tank_L);
Shapes[DrShIx(Shape.Tank, Sz.XL)] = new DrawingShape(Shape.Tank, Sz.XL, 20, 13, new Node[] { new Node(0, 11, Orient.L) }, null, 0, 0, 200, 130, Properties.Resources.Tank_XL);
/// Junction
Shapes[DrShIx(Shape.Junction, Sz.None)] = new DrawingShape(Shape.Junction, Sz.None, 0, 0, new Node[] { new Node(0, 0, Orient.R) });
Shapes[DrShIx(Shape.Junction, Sz.S)] = new DrawingShape(Shape.Junction, Sz.S, 2, 2, new Node[] { new Node(1, 1, Orient.R) }, null, 0, 0, 20, 20,
Properties.Resources.Junction_S, null, Properties.Resources.Junction_S_vacuum, Properties.Resources.Junction_S_closed);
Shapes[DrShIx(Shape.Junction, Sz.M)] = new DrawingShape(Shape.Junction, Sz.M, 2, 2, new Node[] { new Node(1, 1, Orient.R) }, null, 0, 0, 20, 20,
Properties.Resources.Junction_M, null, Properties.Resources.Junction_M_vacuum, Properties.Resources.Junction_M_closed);
Shapes[DrShIx(Shape.Junction, Sz.L)] = new DrawingShape(Shape.Junction, Sz.L, 2, 2, new Node[] { new Node(1, 1, Orient.R) }, null, 0, 0, 20, 20,
Properties.Resources.Junction_L, null, Properties.Resources.Junction_L_vacuum, Properties.Resources.Junction_L_closed);
Shapes[DrShIx(Shape.Junction, Sz.XL)] = new DrawingShape(Shape.Junction, Sz.XL, 2, 2, new Node[] { new Node(1, 1, Orient.R) }, null, 0, 0, 20, 20,
Properties.Resources.Junction_XL, null, Properties.Resources.Junction_XL_vacuum, Properties.Resources.Junction_XL_closed);
/// Knee
Shapes[DrShIx(Shape.Knee, Sz.S)] = new DrawingShape(Shape.Knee, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(1, 0, Orient.Up) },
new Edge[] { new Edge(0, 1, 18), new Edge(1, 0, 18) },
0, 0, 20, 20, Properties.Resources.Knee_S_open, null, Properties.Resources.Knee_S_vacuum, Properties.Resources.Knee_S_closed);
Shapes[DrShIx(Shape.Knee, Sz.M)] = new DrawingShape(Shape.Knee, Sz.M, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(1, 0, Orient.Up) },
new Edge[] { new Edge(0, 1, 18), new Edge(1, 0, 18) },
0, 0, 20, 20, Properties.Resources.Knee_M_open, null, Properties.Resources.Knee_M_vacuum, Properties.Resources.Knee_M_closed);
Shapes[DrShIx(Shape.Knee, Sz.L)] = new DrawingShape(Shape.Knee, Sz.L, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(1, 0, Orient.Up) },
new Edge[] { new Edge(0, 1, 17), new Edge(1, 0, 17) },
0, 0, 20, 20, Properties.Resources.Knee_L_open, null, Properties.Resources.Knee_L_vacuum, Properties.Resources.Knee_L_closed);
Shapes[DrShIx(Shape.Knee, Sz.XL)] = new DrawingShape(Shape.Knee, Sz.XL, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(2, 0, Orient.Up) },
new Edge[] { new Edge(0, 1, 36), new Edge(1, 0, 36) },
0, 0, 40, 40, Properties.Resources.Knee_XL_open, null, Properties.Resources.Knee_XL_vacuum, Properties.Resources.Knee_XL_closed);
/// Vacuum
Shapes[DrShIx(Shape.Vacuum, Sz.L)] = new DrawingShape(Shape.Vacuum, Sz.L, 6, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(6, 1, Orient.R), new Node(4, 0, Orient.Up) },
new Edge[] { new Edge(0, 1, 60), new Edge(1, 0, 60), new Edge(0, 2, Const.Vacuum) },
0, 0, 60, 20, Properties.Resources.Vacuum_L_wet, null, null, Properties.Resources.Vacuum_L_dry);
Shapes[DrShIx(Shape.Vacuum, Sz.S)] = Shapes[DrShIx(Shape.Vacuum, Sz.L)];
Shapes[DrShIx(Shape.Vacuum, Sz.M)] = Shapes[DrShIx(Shape.Vacuum, Sz.L)];
Shapes[DrShIx(Shape.Vacuum, Sz.XL)] = Shapes[DrShIx(Shape.Vacuum, Sz.L)];
}
}
}
+23
View File
@@ -0,0 +1,23 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
namespace SchematicDrawing
{
public class Edge
{
public readonly int NodeId1;
public readonly int NodeId2;
public readonly int DefaultDist;
public readonly RouteCouple RouteCouple;
public Edge(int nodeId1, int nodeId2, int defaultDist = 20, RouteCouple routeCouple = RouteCouple.None)
{
NodeId1 = nodeId1;
NodeId2 = nodeId2;
DefaultDist = defaultDist;
RouteCouple = routeCouple;
}
}
}
+135
View File
@@ -0,0 +1,135 @@
using Dirichlet.Numerics;
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace SchematicDrawing
{
public static class Const
{
public const int GridSize = 10;
public const int SecondaryStart = 10000;
public const int Vacuum = 1000000;
}
public enum Element
{
None = 0,
Body = 1, /// Item body (component image)
Label = 2, /// Item label
MeasuredVal = 4, /// Item measured value
Setpoint = 8, /// Item setpoint
Node = 16, /// A node of an item
Pipe = 32, /// Pipe between two nodes
}
public enum Shape
{
Ambient,
Cross,
Div,
FlowM,
Junction,
Knee,
PressM,
Pump,
PumpFM,
RegV,
Scale,
Sink,
Tank,
Tee,
TempM,
Vacuum,
Valve,
WaterM,
Count
}
public enum Sz
{
None,
S,
M,
L,
XL,
Count,
}
public enum Orient
{
R,
Dn,
L,
Up,
Count,
}
public enum RouteCouple
{
None,
OpenWhen1,
ClosedWhen1,
}
public static class Utils
{
/// <summary>
/// Return coordinates of the vector in direction Orient
/// </summary>
/// <param name="orient">Orient</param>
/// <returns>Vector</returns>
public static Point GetVect(Orient orient)
{
switch (orient)
{
default:
case Orient.R: return new Point(1, 0);
case Orient.Up: return new Point(0, -1);
case Orient.L: return new Point(-1, 0);
case Orient.Dn: return new Point(0, 1);
}
}
/// <summary>
/// Return coordinates of the vector perpendicular to Orient
/// </summary>
/// <param name="orient">Orient</param>
/// <returns>Perpendicular vector</returns>
public static Point GetNormalVect(Orient orient)
{
switch (orient)
{
default:
case Orient.R: return new Point(0, 1);
case Orient.Up: return new Point(1, 0);
case Orient.L: return new Point(0, -1);
case Orient.Dn: return new Point(-1, 0);
}
}
/// <summary>
/// Returns true when item is hidden (both X and Y coordinates are 0)
/// </summary>
/// <param name="item">Drawing item</param>
/// <returns>true when hidden</returns>
public static bool IsHidden(IDrawingItem item)
{
return (item.X == 0) && (item.Y == 0);
}
/// <summary>
/// Updates distances of graph edges of IRouteBasedDrewingItem (valve, pump, ...) after route chanage.
/// </summary>
/// <param name="route">Route</param>
/// <param name="item">Item</param>
public static void UpdateGraphEdges(UInt128 route, IRouteBasedDrawingItem item)
{
bool routeBit = (route & (((UInt128)1) << item.BitNr)) != 0;
foreach (var gedge in item.EdgesToSet) gedge.UpdateFromRoute(item.Inverted ? (!routeBit) : routeBit);
}
}
}
+43
View File
@@ -0,0 +1,43 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
namespace SchematicDrawing
{
public class GEdge
{
public readonly GNode StartNode;
public readonly GNode EndNode;
public readonly int DefaultDist;
public readonly RouteCouple RouteCouple;
public int Dist;
public GEdge(GNode startNode, GNode endNode, int defaultDist, RouteCouple routeCouple)
{
StartNode = startNode;
EndNode = endNode;
DefaultDist = defaultDist;
RouteCouple = routeCouple;
Dist = (routeCouple == RouteCouple.None || routeCouple == RouteCouple.ClosedWhen1) ? DefaultDist : int.MaxValue;
}
public void UpdateFromRoute(bool routeBit)
{
switch (RouteCouple)
{
case RouteCouple.OpenWhen1:
Dist = routeBit ? DefaultDist : int.MaxValue; break;
case RouteCouple.ClosedWhen1:
Dist = routeBit ? int.MaxValue : DefaultDist; break;
}
}
public override string ToString()
{
return string.Format("{0}/{1}-{2}/{3} dist={4}", StartNode.Item.Name, StartNode.NodeId, EndNode.Item.Name, EndNode.NodeId, Dist);
}
}
}
+52
View File
@@ -0,0 +1,52 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
namespace SchematicDrawing
{
public class GNode
{
/// Graph node properties
public IDrawingItem Item;
public int NodeId;
public readonly IList<GEdge> Edges;
/// Distance from a start node
public int Dist;
/// Minimal heap index
public int HeapIx;
/// <summary>
/// Constructor
/// </summary>
/// <param name="item">Item</param>
/// <param name="nodeId"Node ID></param>
public GNode(IDrawingItem item, int nodeId)
{
Item = item;
NodeId = nodeId;
Edges = new List<GEdge>();
Dist = int.MaxValue;
}
public void AddEdge(GEdge edge)
{
Edges.Add(edge);
}
public GNode Reset(int heapIx, int dist = int.MaxValue)
{
HeapIx = heapIx;
Dist = dist;
return this;
}
public override string ToString()
{
return string.Format("{0}/{1} dist={2}", Item.Name, NodeId, Dist);
}
}
}
+106
View File
@@ -0,0 +1,106 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Diagnostics;
using System.Collections.Generic;
namespace SchematicDrawing
{
public class Graph
{
public bool Completed;
IList<GNode> nodes;
GNode startNode;
int secondaryStartNodesCount;
MinHeap minHeap;
GNode currentNode;
public Graph()
{
nodes = new List<GNode>();
startNode = null;
secondaryStartNodesCount = 0;
minHeap = new MinHeap();
Completed = false;
}
public void Clear()
{
nodes.Clear();
startNode = null;
secondaryStartNodesCount = 0;
Completed = false;
}
/// <summary>
/// Add a node to the list of graph nodes
/// </summary>
/// <param name="node">Graph node</param>
public void AddNode(GNode node, bool isStartNode = false, bool isSecondaryStartNode = false)
{
if (isStartNode && startNode == null)
{
startNode = node;
nodes.Insert(0, node);
}
else if (isStartNode || isSecondaryStartNode)
{
secondaryStartNodesCount++;
nodes.Insert(startNode != null ? 1 : 0, node);
}
else
{
nodes.Add(node);
}
}
/// <summary>
/// Add an edge to the list of edges of node1.
/// </summary>
/// <param name="node1">Node 1 (start)</param>
/// <param name="node2">NOde 2 (end)</param>
/// <param name="defaultDist">Default distance (when closed)</param>
/// <param name="routeCouple">Way the route affects this edge</param>
/// <returns>Added graph edge</returns>
public GEdge AddEdge(GNode node1, GNode node2, int defaultDist, RouteCouple routeCouple = RouteCouple.None)
{
GEdge gedge = new GEdge(node1, node2, defaultDist, routeCouple);
node1.AddEdge(gedge);
return gedge;
}
/// <summary>
/// Run Dijkstra shortest path algorithm to determine schematic drawing coloring
/// </summary>
/// <param name="startNode">Start node</param>
/// <param name="secondaryStartNodes">List of secondary start nodes</param>
public void RunDijkstraAlgo()
{
if (nodes == null || startNode == null) return;
/// Reset all nodes
minHeap.ResetAndBuild(nodes, secondaryStartNodesCount);
currentNode = minHeap.ExtractMinNode();
do
{
/// Consider all unvisited neighbors of the current node
foreach (var e in currentNode.Edges)
{
int distViaCurrNode = (e.Dist == int.MaxValue) ? int.MaxValue : currentNode.Dist + e.Dist;
if (distViaCurrNode < e.EndNode.Dist)
{
e.EndNode.Dist = distViaCurrNode;
minHeap.SiftUp(e.EndNode.HeapIx);
}
}
currentNode = minHeap.ExtractMinNode();
}
while (currentNode.Dist < int.MaxValue && currentNode != null);
}
}
}
+10
View File
@@ -0,0 +1,10 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace SchematicDrawing
{
public interface IDrawingItCmpnt
{
IDrawingItem DrawingItem { get; }
}
}
@@ -0,0 +1,12 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace SchematicDrawing
{
public interface IDrawingItCmpntWithMeasuredVal : IDrawingItCmpnt
{
bool MsrmntAvailable { get; }
double MeasuredVal { get; }
string AltString { get; }
}
}
@@ -0,0 +1,12 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace SchematicDrawing
{
public interface IDrawingItCmpntWithSetpoint : IDrawingItCmpnt
{
double SetpointVal { get; set; }
void IncreaseSetpoint();
void DecreaseSetpoint();
}
}
+30
View File
@@ -0,0 +1,30 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using Config;
using System.Collections.Generic;
namespace SchematicDrawing
{
public interface IDrawingItem
{
///
/// Schematic drawing parameters
///
string Name { get; } /// Unique name
string ClassName { get; }
Shape Shape { get; set; } /// Image
int X { get; set; }
int Y { get; set; }
Sz Sz { get; set; }
Orient Orient { get; set; }
bool Flip { get; set; }
int LblX { get; set; } /// Label
int LblY { get; set; }
Orient LblOrient { get; set; }
IList<GNode> GNodes { get; set; }
}
}
@@ -0,0 +1,16 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace SchematicDrawing
{
public interface IDrawingItemWithMeasuredVal : IDrawingItem
{
int MsrdX { get; set; }
int MsrdY { get; set; }
Orient MsrdOrient { get; set; }
string MsrdFormat { get; set; }
Config.Unit MsrdUnits { get; set; }
double MsrdValLimLo { get; set; }
double MsrdValLimHi { get; set; }
}
}
@@ -0,0 +1,14 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace SchematicDrawing
{
public interface IDrawingItemWithSetpoint : IDrawingItem
{
int SetpX { get; set; }
int SetpY { get; set; }
Orient SetpOrient { get; set; }
string SetpFormat { get; set; }
Config.Unit SetpUnits { get; set; }
}
}
@@ -0,0 +1,14 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System.Collections.Generic;
namespace SchematicDrawing
{
public interface IRouteBasedDrawingItem : IDrawingItem
{
int BitNr { get; }
bool Inverted { get; }
IList<GEdge> EdgesToSet { get; set; }
}
}
+21
View File
@@ -0,0 +1,21 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System.Drawing;
namespace SchematicDrawing
{
public class ItemElementRect
{
public IDrawingItem Item;
public Element Element;
public Rectangle Rect;
public ItemElementRect(IDrawingItem item, Element element, Rectangle rect)
{
Item = item;
Element = element;
Rect = rect;
}
}
}
+134
View File
@@ -0,0 +1,134 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
namespace SchematicDrawing
{
public class MinHeap
{
GNode[] heap; /// Minimum heap, a binary tree in form of an array
int heapSize; /// Heap size (not necessarily a size of the array heap[])
/// <summary>
/// Constructor
/// </summary>
public MinHeap()
{
heap = null;
heapSize = 0;
}
/// <summary>
/// Reset nodes and build the initial minimum heap tree.
///
/// First node on the list is the start node (mostly the main water tank),
/// followed by 'secondaryStartNodesCount' secondary start nodes (typically
/// tanks above scales), followed by all remaining nodes of the drawing.
/// In this way the heap is heapified from the beginning.
/// </summary>
/// <param name="nodes">Graph nodes</param>
/// <param name="secondaryStartNodesCount">Number of secondary start nodes</param>
public void ResetAndBuild(IList<GNode> nodes, int secondaryStartNodesCount)
{
if (nodes == null || nodes.Count == 0) return;
if (heapSize != nodes.Count)
{
heapSize = nodes.Count;
heap = new GNode[nodes.Count];
}
heap[0] = nodes[0].Reset(0, 0);
for (int i = 1; i <= secondaryStartNodesCount; i++)
{
heap[i] = nodes[i].Reset(i, Const.SecondaryStart);
}
for (int i = secondaryStartNodesCount + 1; i < nodes.Count; i++)
{
heap[i] = nodes[i].Reset(i, int.MaxValue);
}
}
/// <summary>
/// Returns the node with minimal distance at the top of the heap binary tree.
/// This node is removed from the heap, replaced by the last node and the heap is 'Heapified'.
/// </summary>
/// <returns>Node with minimal distance</returns>
public GNode ExtractMinNode()
{
GNode minNode = heap[0];
if (--heapSize > 0)
{
heap[0] = heap[heapSize]; /// Swap with the last one
heap[0].HeapIx = 0;
heap[heapSize] = minNode;
SiftDown(0); /// Heapify the heap, sift down the swapped (formerly the last) item
}
return minNode;
}
/// <summary>
/// Sift up the node in the minimum heap binary tree.
/// Function is called when distance of a node in the graph is updated.
/// As the distance is always decreased, the node sifts up in the tree.
/// </summary>
/// <param name="heapIx">Index of the node to sift up</param>
public void SiftUp(int heapIx)
{
if (heapIx == 0) return;
int parentIx = (heapIx - 1) / 2;
if (heap[heapIx].Dist < heap[parentIx].Dist)
{
SwapNodes(heapIx, parentIx);
SiftUp(parentIx);
}
}
/// <summary>
/// Sift down the node in the minimum heap binary tree.
/// Function is called when node at the top of the tree is extracted and replaced
/// by the last node. This last node is then sift down according to its distance.
/// </summary>
/// <param name="heapIx">Index of the node to sift down</param>
void SiftDown(int heapIx)
{
int leftIx = 2 * heapIx + 1;
if (leftIx < heapSize)
{
int minIx = heapIx;
if (heap[leftIx].Dist < heap[minIx].Dist)
{
minIx = leftIx;
}
int rightIx = 2 * heapIx + 2;
if (rightIx < heapSize && heap[rightIx].Dist < heap[minIx].Dist)
{
minIx = rightIx;
}
if (minIx != heapIx)
{
SwapNodes(heapIx, minIx);
SiftDown(minIx);
}
}
}
/// <summary>
/// Swap two nodes in the minimum heap binary tree.
/// </summary>
/// <param name="ix1">Index of the 1st node</param>
/// <param name="ix2">Index of the 2nd node</param>
void SwapNodes(int ix1, int ix2)
{
GNode swap = heap[ix1];
heap[ix1] = heap[ix2];
heap[ix1].HeapIx = ix1;
heap[ix2] = swap;
heap[ix2].HeapIx = ix2;
}
}
}
+21
View File
@@ -0,0 +1,21 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
namespace SchematicDrawing
{
public class Node
{
public int X;
public int Y;
public Orient Orient;
public Node(int x, int y, Orient orient)
{
X = x;
Y = y;
Orient = orient;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

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