Compare commits

..
Author SHA1 Message Date
Milan Hanajik 5c53929efe ResultsParser project added, ver. 1.0.0 2021-12-16 16:19:14 +01:00
Milan Hanajik 3812438e97 iPerlCommunication bug fix (OoR situation), Ora.Database bug fix (mech. meter update), ver. 2.27.1841 2021-12-15 17:00:51 +01:00
Milan Hanajik 3cb64b2684 TBF.Rig.Network.Comet.Ambient fixed : UpdateProcessData() was missing. 2021-12-15 17:00:44 +01:00
Milan Hanajik 7ea057dab4 S640CommForm cosmetical changes. 2021-12-07 12:05:28 +01:00
Milan Hanajik 0493f8fae5 Component for Gelsenwasser 2021-12-01 10:38:35 +01:00
Milan Hanajik ed606701c0 TestMethods.Evacuation added, ProcessData.FillState updated by SequenceBase.Transition(), ver. 2.27.1813, Statistics v. 2.27.1800 2021-11-22 15:22:01 +01:00
Milan Hanajik 1d152afd6c Output.FileWriters and Output.Printers changes, ver. 2.27.1807 2021-11-15 15:32:21 +01:00
Milan Hanajik 71517b6cdb TBF.Rig.DataEntry.Double24 2021-11-15 15:32:10 +01:00
Milan Hanajik 284feb73dc Bug fix : 6x try / catch to resolve crashes caused by GemCard, etc. 2021-11-11 06:32:47 +01:00
Milan Hanajik ce74b0a3bb Milwaukee component upgraded 2021-11-11 06:32:38 +01:00
Milan Hanajik 4de15b9a7c Clean-up / style changes. 2021-11-11 06:32:38 +01:00
Milan Hanajik 6fd7845d63 Unit selection in DataEntry.Standard24.TestStartEndForm, related changes in TestMethods, ver. 2.27.1802 2021-11-11 06:32:38 +01:00
Milan Hanajik 30c8433cb0 Results.Entities.WaterMeter bug fixes, style changes. 2021-11-11 06:32:38 +01:00
Milan Hanajik 7cf862410b Unit selection in UI.Procedures.TestWizard. 2021-11-09 12:12:52 +01:00
Milan Hanajik 766b52865a UI.Procedures.ProcedureDlg : Units selection in ProcedureDlg / Metrology1 Tab. 2021-11-09 12:12:44 +01:00
Milan Hanajik b9aebd8903 LeakTest : Delay when reading initial pressure, ver. 2.27.1800 2021-11-07 03:30:56 +01:00
Milan Hanajik 50494fccc9 Preferred units in all BenchInfo components and IBenchInfo, Units.ConvertFrom/To for float. 2021-11-04 08:53:12 +01:00
Milan Hanajik e0c2004f52 Milwaukee component update : Schematic drawing changes. 2021-11-02 18:04:49 +01:00
Milan Hanajik d86daefc81 bug fix in FlexFlow - SaveTestResult, ver. 2.27.1791 2021-11-02 12:23:51 +01:00
Milan Hanajik dd52b9d139 Bug fixes : Oracle in Chennai, ver. 2.27.1783 2021-10-26 19:38:39 +02:00
Milan Hanajik eec84351ac TBF.BenchControl... --> TBF.Rig... 2021-10-26 19:38:09 +02:00
Milan Hanajik 7b7b515154 More logging : List of component classes on program start-up, ver. 2.27.1783 2021-10-26 10:35:02 +02:00
Milan Hanajik 6c57f8c76a Output.DB.SensusOracle : New config. parameter TestBenchGroupId replaces constant 18000, ver. 2.27.1782 2021-10-25 12:44:54 +02:00
Milan Hanajik 3312dc40f8 S640 : Only 'passed' WMs are sealed at the end, counting pieces fixed, MeterTestRslt.Passed fixed. 2021-10-20 18:22:21 +02:00
Milan Hanajik 54cb6e4303 S640Communication : Skip bad meters feature added, file exchg timeouts up to 2000s, etc, ver. 2.27.1781 2021-10-20 17:37:15 +02:00
Milan Hanajik 4f2fb85372 SensusOracle.Database bug fix for mechanical meters. 2021-10-20 16:24:21 +02:00
Milan Hanajik a3f8902266 UI.ResultsMI.PreviousResultsDlg : Send again changes, interactive database and water meters selection, ver. 2.27.1781 2021-10-20 15:31:23 +02:00
Milan Hanajik 2e8b962d57 More S640 related changes. 2021-10-20 14:38:01 +02:00
Milan Hanajik ebad16b439 Bug fix in Output.FileWriters.IperlLogger.Writer, ver. 2.27.1780 2021-10-20 09:21:04 +02:00
Milan Hanajik 5b599c2ecd Various S640 related changes, ver. 2.27.1778 2021-10-19 14:43:54 +02:00
Milan Hanajik f3a889eed8 DataEntry.iPerl loads purchase order data from Oracle (if configured to do so). 2021-10-19 08:49:06 +02:00
Milan Hanajik 9aa41338ed S640Communication : Results.entities.WaterMeter.RadioAddress string -> long, optional scanning of serial numbers 2021-10-18 16:53:09 +02:00
Milan Hanajik 5797e97e0f SensusOracle.Database.ReadOrderDetails( ) reads from vt_auft_zaehlernr_pd 2021-10-18 16:53:09 +02:00
Milan Hanajik 352f2c1e28 Results.Entities.WaterMeter.RadioAddress added, ver. 2.27.1776 2021-10-14 14:02:41 +02:00
Milan Hanajik df63f4300a ver. 2.26.1775 2021-10-14 10:27:25 +02:00
Milan Hanajik 171aee4f1d SIRT component added, ver. 2.26.1774 2021-10-14 09:41:47 +02:00
Milan Hanajik e00e7556d6 Common.StatisticalMetrics, FeatureVectorCalculator: changes, SignalChart added, temporarily disabled in IperlHead, ver. 2.26.1771 2021-10-11 21:55:12 +02:00
Milan Hanajik 3f94318570 IperlHead.StartSession() starts datastream processing, IperlHead.TestIsGoingToStartSoon() saves raw-data, ISessionDataMngmnt. 2021-10-08 11:36:38 +02:00
Milan Hanajik 7356f45b93 Platform target AnyCPU whereever possible. 2021-10-07 11:26:02 +02:00
Milan Hanajik f725c2d2d8 FixedStartMassCollection fixes, ver. 2.26.1770 2021-10-05 15:56:36 +02:00
Milan Hanajik 4021ed1a7b S640CommForm supports 40 water meters, ver. 2.26.1769 2021-10-05 12:29:06 +02:00
Milan Hanajik 4a820af389 S640Comm.Start/End proc. params in More section, MainSeq invokes CommForm depending on RegReader type, ver. 2.26.1768 2021-10-05 11:03:11 +02:00
Milan Hanajik 0b8d51daba DEWA rework R-L / DEWA rework L-R, ver. 2.26.1767 2021-10-04 15:07:01 +02:00
Milan Hanajik 21408a962e RegReaders.S640Stream.*, TestMethods.S640Communication.*, IHasClearSessionData, ControlBoardDev.RefPulses added, ver. 2.26.1766 2021-10-04 11:24:20 +02:00
Milan Hanajik f854bf2277 Oracle.ManagedDataAccess package added, related changes, ver. 2.26.1765 2021-10-01 11:34:13 +02:00
Milan Hanajik e6d35e5178 FelxFlow : Changes related to Config.Entities.Enums --> Common.Enums, ver. 2.26.1764 2021-10-01 10:08:30 +02:00
Milan Hanajik a203885c16 Merge branch 'master-2-26-Flex' into master-2-26 2021-10-01 10:03:39 +02:00
Milan Hanajik 698e2dd6c4 Test.TstTime -> TestTime, Config.Ent.Enums + Events.Ent.Enums + Users.Ent.Enums -> Common.Enums, IRegulValve -> IRegValve, etc. 2021-10-01 09:58:06 +02:00
Milan Hanajik 5c55b2540a iPerlCommunicationForm: 40x libRfid.dll for each serial port, DewaRework( ) fixed, ver. 2.26.1751 2021-10-01 09:56:47 +02:00
Milan Hanajik 3d7ead8464 Output.FlexFlow : System.Net.WebRequest used, REST/SOAP support, etc, ver. 2.26.1763 2021-09-30 10:11:02 +02:00
Milan Hanajik 30845f4ca3 ver. 2.26.1742 2021-09-21 09:48:37 +02:00
Milan Hanajik f72457404b DB.SensusOracle.DatabaseCfg : database access passwords are not readable, ver. 2.26.1741 2021-09-20 17:09:57 +02:00
Milan Hanajik 7ab2930bf7 Output.DB.SensusOracle.Database : max_Pruefindex in VT_ZAEHLER_PD reverted, ver. 2.26.1738 2021-09-20 14:32:20 +02:00
Milan Hanajik 0cf2c442ec DB.SensusOracle.Database changes : DataSource / UserId / Password / AnbId can be configured now, ver. 2.26.1737 2021-09-20 14:29:02 +02:00
Milan Hanajik 756fa12456 Output.DB.SensusOracle.Database : max_Pruefindex in VT_ZAEHLER_PD 2021-09-20 14:29:02 +02:00
Milan Hanajik bb0361319d Config.Data --> TBF.Data and TBF.DB, etc. 2021-09-20 14:29:01 +02:00
Milan Hanajik 2cc92f3980 iPerlCommunicationForm : "DEWA rework" activity 2021-09-19 17:23:31 +02:00
Milan Hanajik abb2375500 IComponentCfg : GetControl( ) --> GetControl(IList<Component> cmpntEntities) 2021-09-16 14:21:18 +02:00
Milan Hanajik 64a5f7ceb8 ComponentParametersDlg moved from TBF.BenchControl to TBF.UI.Bench.Components. 2021-08-29 12:24:08 +02:00
Milan Hanajik adfb9ae8d5 iPerlCommunication cleanup. 2021-08-29 09:55:55 +02:00
Milan Hanajik 9e139279c7 Output.FlexFlow.Rest component added. 2021-08-26 13:24:03 +02:00
Milan Hanajik adf7a44a54 Bug fixes in MetrologyDlgDensityTab and MetrologyDlgBuoyancyTab. 2021-08-26 13:23:50 +02:00
Milan Hanajik c1860ab31c DEWA300 component upgraded, dated 25.8.2021 2021-08-26 12:08:50 +02:00
Milan Hanajik ba9d06ac3f ver. 2.26.1729 2021-08-20 15:42:00 +02:00
Milan Hanajik 8115ec4ac5 Effor flags do not stop a cycle in case test.Evaluate = false 2021-08-20 15:22:24 +02:00
Milan Hanajik f5e5d1fd0c iPerlCommunicationForm : wm.PassedFromTests() => q2adjResult/2/.Passed, limits for Q2 corr. from the iPerlComm test, ver. 2.26.1728 2021-08-20 15:21:55 +02:00
Milan Hanajik 9ecba98b4c Changes in iPerlCommunicationForm : CheckboxEditMode bug fixes, ver. 2.26.1725 2021-08-19 14:10:29 +02:00
Milan Hanajik 11ca2b7272 ver. 2.26.1724 2021-08-19 14:08:23 +02:00
Milan Hanajik df232cf508 SensusTestInfo : LogType.JustA0A4_Q3Q2Q1 added (ID_WZTYP=122), ver. 2.26.1723 2021-08-19 12:32:01 +02:00
Milan Hanajik 8c9643a8de SensusOracle.Database.Anbid_StaraTura --> Anbid_Producer, SensusOracle.Database.ReadOrderNumbersFromOracle( ). 2021-08-19 11:25:37 +02:00
Milan Hanajik 8a85458865 Minor DataStream.Reader and Elde.FlowMeter fixes 2021-08-18 13:06:37 +02:00
Milan Hanajik 848f9dff9d Initial values: CalibDate = Constants.MinDate, CalibValidDate = Constants.MaxDate, MaxDate = new DateTime(2039, 12, 31); 2021-08-18 10:40:51 +02:00
Milan Hanajik 5905d0850b DEWA300 Elde component upgraded - minor screen changes. 2021-08-18 09:35:41 +02:00
Milan Hanajik 5d144dfc24 FixedStart... methods use Math.Abs( ) of a difference of volumes to be able to cope with a reverse flow. 2021-08-18 09:35:40 +02:00
Milan Hanajik dcf746dc6b Color.DarkGoldenrod --> DarkGray in 59 forms (DataEntry, KPackE.DataEntryForRadio, Adjustment, ManualEntry, PulsesTest(Manual), ManualLevelMsrmnt). 2021-08-18 09:35:40 +02:00
Milan Hanajik 4e216c42de iPErlCommunicationForm bug fix : Test name is currentActivity.Substring(ConditnlUpdateQ2CorrRL/LRStr.Length).Trim() 2021-08-17 12:22:19 +02:00
Milan Hanajik 4f52093af6 SensusOracle.Database : Insert/update of VT_ZAEHLER_PD modified, ResultsMI.DeleteFromOracleForm, ver. 2.26.1719 2021-08-16 13:03:11 +02:00
Milan Hanajik c2826cbd27 iPerlCommunicationForm : Serious bug fix !!! ver. 2.26.1717 2021-08-03 18:27:10 +02:00
Milan Hanajik d3c62e353c Q2 correction uses q2AdjResult.Q2CorrRL / q2AdjResult.Q2CorrLR / q2AdjResult2.Q2CorrLR + iPerlCommunicationForm bug fixes 2021-08-03 13:07:13 +02:00
Milan Hanajik 1349c39d2d DataEntry.DataStream.EntryFormCfg clean-up 2021-08-03 12:20:17 +02:00
Milan Hanajik 7d1d9b1051 MeterTestRslt.CalibFactor / CalibFactorLNA / Q2CorrRL / Q2CorrLR / FlowDirection added and mapped to results database 2021-07-30 10:12:49 +02:00
Milan Hanajik c4ca299ce2 iPerlCommunication activity 'WriteDefaultQ2Corrections' modified. 2021-07-29 12:03:27 +02:00
Milan Hanajik 96a17b2d16 1. iPelrHead.MeterType.DN26 --> MeterType.DN25_Q3_10 2. TestMethodCfg.UseMuxBoards... removed 3. iPerlhead.ProcParams.InitQ2CorrRL/LR removed 4. Default Q2 corrections 2021-07-29 11:16:19 +02:00
Milan Hanajik 5b4ffd9327 Clean-up 2021-07-28 13:59:21 +02:00
Milan Hanajik 96abee384b IParamsProvider : IList<strig> ParamValues( ) --> ICollection<string> ParamValues( ) 2021-07-28 13:31:18 +02:00
Milan Hanajik 1e93a1e9ae iPerlCommunicationForm.cs changes (sync. .with 3.1 branch), ver. 2.26.1712 2021-07-28 12:42:03 +02:00
Milan Hanajik dfd6399d6c GraphsTabPageCtrl : 1. Unlimited history, 2. Dynamic subnodes. 2021-07-27 16:02:28 +02:00
Milan Hanajik 7bdf6efd9d ELDE komponent Badger-stredna-trat pre 4 vodomery. 2021-07-26 12:58:05 +02:00
Milan Hanajik 0e78f40cca DataStream.CycleBeginnigForm : Safer okButton_Click( ) 2021-07-26 10:06:08 +02:00
Milan Hanajik 56fc3b6380 MefImport : Wrappers for DatastreamInterface.StartMeasurement() / StopMeasurement() - connected meters only, ver. 2.26.1708 2021-07-20 09:24:41 +02:00
Milan Hanajik a1e73be9cb (1) MainSeq allows showCycleEndFormOp==null now, (2) iPerlCommunicationForm edit mode fixes, ver. 2.26.1707 2021-07-16 18:13:12 +02:00
Milan Hanajik bb4b1a1998 MefImport : IsConnected(), OpenConnection() and CloseAllConnections() wrappers, DataStream.EntryForm calls CloseAllConnections(). 2021-07-16 18:13:03 +02:00
Milan Hanajik c4afaf739a DataEntry.DataStream.CycleBeginningForm completed, ver. 2.26.1706 2021-07-16 16:54:50 +02:00
Milan Hanajik 2e8c5fa6f6 DataEntry.DataStream.CheckBoxImage added. 2021-07-16 14:26:24 +02:00
Milan Hanajik e46b64bd29 iPerlCommunicationForm changes. 2021-07-16 14:26:24 +02:00
Milan Hanajik 61ecb23294 LS.iPerlCommunicationsFormCheckBoxes -> OptoHeadsEnabled, MainWnd.optoHeadsToolStripMenuItem (+ visibility) 2021-07-15 10:31:32 +02:00
Milan Hanajik 674dde8d74 Changes for Milwaukee: DataStream.Reader bug fix, MefImport.MinSamplesCount =10. 2021-07-15 09:37:55 +02:00
Milan Hanajik 186bbdcc25 DataEntry.DataStream component added. 2021-07-15 09:36:28 +02:00
Milan Hanajik 2a82fbf2ca Component upgraded : VBB1+VBB2, etc. 2021-07-13 13:37:01 +02:00
Milan Hanajik 678fefb725 iPERL clean-up. 2021-07-13 13:37:01 +02:00
Milan Hanajik 58a57ba215 ver. 2.26.1698 2021-07-09 07:50:47 +02:00
Milan Hanajik 4d77926a9e iPERL : Q_WZ, KorrErrQ in VT_PRUEFREIHE_IST_PD, see email Joachim 12.1.2021, mtr.LastError not mapped to DB anymore, ver. 2.26.1697 2021-07-08 17:27:09 +02:00
Milan Hanajik a7e2947de7 Feature vector calculator - initial version of the offline tool. 2021-07-07 15:45:26 +02:00
Milan Hanajik 4a33339c63 OptoTelegramRaw class omved to Common.Iperl namespace, ver. 2.26.1694 2021-07-06 13:11:42 +02:00
Milan Hanajik 7b780d72a0 ver. 2.26.1693 2021-07-06 08:54:30 +02:00
Milan Hanajik 7a60055413 iPERL : X1 .. X9 added to result items, ver. 2.26.1692 2021-07-02 17:12:52 +02:00
Milan Hanajik c6f3751746 IPERL : Results.Entities.MeterTestRslt.X1..X9 added, X1 = flow st. dev., etc., ver. 2.26.1691 2021-07-02 11:26:48 +02:00
Milan Hanajik 300dabc800 TestMethods.PMaxTest bug fix : when pump reached 100% PMaxTest started regardless of the pressure. 2021-07-02 10:56:27 +02:00
Milan Hanajik d51ff414ca OptoTelegramRaw improvements 2021-07-02 10:56:14 +02:00
Milan Hanajik 6f65f0085e Milwaukee: TempCalibData = new float[16, 5], Diverters count bug fix, ver. 3.1.1688 2021-06-30 12:33:42 +02:00
Milan Hanajik 319cf0b8d4 New RR.DataStream.MefImport and RR.DataStream.Reader components. 2021-06-30 12:33:16 +02:00
Milan Hanajik c1daf13411 ver. 2.26.1682 2021-06-28 12:34:11 +02:00
Milan Hanajik 4fd107678d SensusOracle.Database bug fix: q_wz in VT_PRUEFREIHE_IST_PD 2021-06-28 12:22:18 +02:00
Milan Hanajik e1d3be7e56 (1) Stopping a cycle after ErrorFlags STOP, (2) Bug fix in R.Entities.MeterTestRslt, ver. 2.26.1681 2021-06-28 12:09:42 +02:00
Milan Hanajik 4f9b07ba20 RegulValve.SetFlowOp : RqrdFlowRangeRatio = 0.5, requiredFlowLo/HI -= Config.Formulas.GetCorrection(...), ver. 2.26.1679 2021-06-28 12:09:42 +02:00
Milan Hanajik 8e25fa6232 string Results.entities.MeterTestRslt.ExtraDataPath and related changes, supported by FlyingStart, FlStMassCollection and FlStMassCollProlonged. 2021-06-28 12:09:42 +02:00
Milan Hanajik 760ec598ca Event viewer changes in progress. 2021-06-02 13:52:18 +02:00
Milan Hanajik fd77380315 ver. 2.26.1675 2021-06-02 13:51:07 +02:00
Milan Hanajik bf91dc0aa6 ErrorFlagsMode.Stop added, can be used in UI, ver. 2.26.1674 2021-06-02 13:48:57 +02:00
Milan Hanajik 14a3d63f1f Small bug fixes in Results.FormsBatchResultsDlg.OneWMResults... 2021-06-01 07:58:05 +02:00
Milan Hanajik 0a60f9c64d ver. 2.26.1652 2021-05-21 11:24:53 +02:00
Milan Hanajik 258fd2579f IperlHead : Bug fix, case when there is no start or no end sample, ver. 2.26.1651 2021-05-21 11:20:17 +02:00
Milan Hanajik 4ec2dee3a2 ver. 2.26.1650 2021-05-19 15:01:31 +02:00
Milan Hanajik 723bf3fdeb ver. 2.26.1649 2021-05-19 14:13:08 +02:00
Milan Hanajik 315cccf74c iPerlHead : TimeFromSamples( ), VolumeFromSamples( ), StartEndFilterSamplesCount2 = 20, ver. 2.26.1648 2021-05-19 13:17:50 +02:00
Milan Hanajik 1b68ea8ab9 TBF.UI.Procedures.ProcedureDlg : 5-th file writer, ver. 2.26.1647 2021-05-17 11:54:07 +02:00
Milan Hanajik 9111bd7346 ResultsBrowser changes 2021-05-13 17:12:00 +02:00
Milan Hanajik cfdd59abce 10.42.128.16 --> 10.42.128.24 2021-04-30 12:22:12 +02:00
Milan Hanajik 4972347605 MettlerToledo.Standard scales robust against USB serial port drop-out. 2021-04-30 11:17:06 +02:00
Milan Hanajik 3459a5eac5 'Scale', 'Diverter' and 'RegValve' results items added. 2021-04-28 14:37:59 +02:00
Milan Hanajik 0553caac89 Bug fix in TBF.Utils.GetRegulVallvesPositions( ), TBF crashed when fn. was called from OutputPath from UI. 2021-04-28 10:44:59 +02:00
Milan Hanajik 4464a2025b Changes in binding between KPackE.Radio and KPackE.RegisterReader (Register(), Unregister(), ver. 2.26.1636 2021-04-28 08:45:19 +02:00
Milan Hanajik 03197dc8f3 FixedStartMassCollection cleanup. 2021-04-26 06:42:59 +02:00
Milan Hanajik e74c8692ce Paths : Selector : UI changes, Selector not mapped to the config DB yet. 2021-04-16 12:34:15 +02:00
Milan Hanajik cda8359623 ver. 2.26.1623 2021-04-16 12:32:57 +02:00
Milan Hanajik 508315a43f Output.SensusTestInfo : (1) S620_Kiwa, (2) CreateFromProcedure() fixed, ver. 2.26.1622 2021-04-16 12:12:24 +02:00
Milan Hanajik 9a8c9205d3 Izrael-50 component upgraded. 2021-04-15 12:06:19 +02:00
Milan Hanajik d7728d304a ver. 2.26.1617 2021-04-14 11:51:07 +02:00
Milan Hanajik fd0d7dcf7b A better bug fix in LeakTest, ver. 2.26.1616 2021-04-14 11:33:15 +02:00
Milan Hanajik 997e0d2a6b ver. 2.26.1609 2021-04-13 15:20:38 +02:00
Milan Hanajik 51e1e5721c Bug fix : Results.BatchResults.NewFromProcedure( ) uses GetTestInstances( ). 2021-04-13 14:40:38 +02:00
Milan Hanajik 34c3fa26c9 Trivial simulation mode for some test methods. 2021-04-13 13:57:28 +02:00
Milan Hanajik 5e3e70f43a Australia 169 MHz SensusTestInfo modified, first100 pieces with Q2ac, ver. 2.26.1608 2021-04-13 08:48:47 +02:00
1741 changed files with 48355 additions and 18354 deletions
+4
View File
@@ -20,6 +20,8 @@ EventViewer/bin/
EventViewer/obj/
Events/bin/
Events/obj/
FeatureVectorCalculator/bin/
FeatureVectorCalculator/obj/
GemCard/bin
GemCard/obj
GenCode128/bin
@@ -38,6 +40,8 @@ Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
ResultsParser/bin/
ResultsParser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
+3
View File
@@ -42,6 +42,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BackgroundBeep.cs" />
<Compile Include="Enums.cs" />
<Compile Include="StatisticalMetrics.cs" />
<Compile Include="Iperl\OptoTelegramRaw.cs" />
<Compile Include="SerializableDictionary.cs" />
<Compile Include="UIControls\CoolButtonCtrl.cs">
<SubType>UserControl</SubType>
+216 -30
View File
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Config.Entities
namespace Common
{
/// <summary>
/// Helper class to assign descriptions to enum values
@@ -38,6 +38,115 @@ namespace Config.Entities
}
}
/// <summary>
/// Identifies the type of a database
/// </summary>
public enum DBType
{
None, /// Database disabled
MySql, /// MySQL database
SQLite, /// SQLite
Count
}
/// <summary> Identifies the database based on the content </summary>
public enum DBKind
{
Config,
Results,
RemoteConfig,
Count
}
public enum ProcedureSelection
{
#if LANG_CS
[Description("Žádné")] None,
[Description("Lokální postupy")] FromLocalDB,
[Description("Postupy ze sdílené databázy")] FromSharedDB,
[Description("Zakázky z Oracle databázy")] OrderNrFromOracleDB,
[Description("Zakázky ze sledovací databázy")] OrderNrFromTracingDB,
#else
[Description("None")] None,
[Description("Local procedures")] FromLocalDB,
[Description("Shared procedures")] FromSharedDB,
[Description("Orders from Oracle DB")] OrderNrFromOracleDB,
[Description("Orders from Tracing DB")] OrderNrFromTracingDB,
#endif
Count
}
/// <summary>
/// Obsolete - replaced by enum ProcedureSelection (above) in 3.1 and newer
/// </summary>
public enum RemoteDBUse
{
[Description("Local DB only")] LocalDBOnly,
[Description("Remote DB only")] RemoteDBOnly,
[Description("Both DB-s, local 1st")] BothDBsLocalFirst,
[Description("Both DB-s, remote 1st")] BothDBsRemoteFirst,
Count
}
/// <summary>
/// Obsolete - Contains a procedure name and a database specification (local/remote).
/// </summary>
public class ProcedureInfo
{
public readonly string Name;
public readonly bool IsRemote;
public ProcedureInfo(string name, bool isRemote)
{
Name = name;
IsRemote = isRemote;
}
}
public enum LoginMethod
{
UserName, /// = alias, abbreviation
FullName, /// = description
Number,
Count
}
public enum AuthorizedAs
{
PowerUser,
LocalUser,
RemoteUser,
Count
}
/// <summary>
/// GID-s of user groups, each user is member of one or more groups.
/// </summary>
public enum GID
{
Testers,
TestingSpecialists,
HeadOfLab,
MaintenanceSpecialists,
Metrologists,
CalibrationSpecialists,
Administrators, /// application / network / database administrator
TraceabilityManagement,
MetrologicalAuthority,
WaterMeterAuthority,
NrOfGroups, /// Number of groups (this is not a GroupID)
None,
}
public enum MySortOrder
{
None,
Ascending, /// The same like SortOrder.Ascending
Descending, /// The same like SortOrder.Descending
Ascending2, /// Sorts by a surname in ascending order in case or 'Name Surname' column
Descending2, /// Sorts by a surname in descending order in case or 'Name Surname' column
}
/// <summary>
/// Flags returned by each device configuration control Verify(...) function.
/// </summary>
@@ -52,28 +161,48 @@ namespace Config.Entities
InvokeCfgChange = 0x20, /// Invoke CfgChange handler of the component
}
public enum RemoteDBUse
/// <summary>
/// Event severity
/// </summary>
public enum Severity
{
[Description("Local DB only")] LocalDBOnly,
[Description("Remote DB only")] RemoteDBOnly,
[Description("Both DB-s, local 1st")] BothDBsLocalFirst,
[Description("Both DB-s, remote 1st")] BothDBsRemoteFirst,
Undefined,
Notification,
Warning,
Error,
FatalError,
Count
}
/// <summary>
/// Contains a procedure name and a database specification (local/remote).
/// </summary>
public class ProcedureInfo
public enum EventClass
{
public readonly string Name;
public readonly bool IsRemote;
Undefined,
EquipmentHW,
Metrology,
TestingProcess,
BadResults,
ComputerResources,
Network,
Other,
Count
}
public ProcedureInfo(string name, bool isRemote)
{
Name = name;
IsRemote = isRemote;
}
public enum SubscriberGroup : long
{
None = 0,
Metrology = 1,
Maintenance = 2,
Production = 4,
Management = 8,
Finish = 16,
}
public enum EViewerOption
{
Undefined,
AllEvents,
RecentEvents,
UnreadEvents,
}
public enum ProcedureState
@@ -248,6 +377,17 @@ namespace Config.Entities
Count
}
/// <summary>
/// State of water filled in the test bench.
/// </summary>
public enum FillState
{
Unknown, /// Test bench fill state is unknown
Empty, /// Test bench is empty, no water
Full, /// Test bench is full of water
Count
}
public enum MeretProtocol
{
[Description("<undefined>")] Undefined,
@@ -424,7 +564,7 @@ namespace Config.Entities
[Description("Fehler")] FailureDuringOperation, /// Failure during operation -> disabled
[Description("Aus")] Off, /// The component is off
[Description("Aufzeichnen")] Record,
[Description("Reply")] Reply,
[Description("Abspielen")] Replay,
[Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Geerbt")] Inherit,
#elif LANG_FR
@@ -435,7 +575,7 @@ namespace Config.Entities
[Description("Erreur d'exécution")] FailureDuringOperation,
[Description("Éteindre")] Off,
[Description("Record")] Record,
[Description("Répondre")] Reply,
[Description("Répondre")] Replay,
[Description("Simuler")] Simulate,
[Description("Hériter")] Inherit,
#else
@@ -446,7 +586,7 @@ namespace Config.Entities
[Description("Run-time error")] FailureDuringOperation, /// Failure during operation -> disabled
[Description("Off")] Off, /// The component is off
[Description("Record")] Record,
[Description("Reply")] Reply,
[Description("Replay")] Replay,
[Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Inherit")] Inherit,
#endif
@@ -551,26 +691,32 @@ namespace Config.Entities
[Description("aus")] Off,
[Description("info")] Info,
[Description("ein")] On,
[Description("stopp")] Stop,
#elif LANG_FR
[Description("éteindre")] Off,
[Description("info")] Info,
[Description("allumé")] On,
[Description("arrêter")] Stop,
#elif LANG_CS
[Description("vypnuto")] Off,
[Description("info")] Info,
[Description("zapnuto")] On,
[Description("stop")] Stop,
#elif LANG_RU
[Description("выкл")] Off,
[Description("инфо")] Info,
[Description("вкл")] On,
[Description("останов")] Stop,
#elif LANG_PL
[Description("nie")] Off,
[Description("info")] Info,
[Description("tak")] On,
[Description("przestać")] Stop,
#else // LANG_EN
[Description("off")] Off,
[Description("info")] Info,
[Description("on")] On,
[Description("stop")] Stop,
#endif
Count
}
@@ -578,15 +724,15 @@ namespace Config.Entities
public enum ErrorFlagMask : long
{
E1 = (1L << 0), /// shift = 0, E1 = 1L
E2 = (1L << 1),
E3 = (1L << 2),
E4 = (1L << 3),
E5 = (1L << 4),
E6 = (1L << 5),
E7 = (1L << 6),
E8 = (1L << 7),
E9 = (1L << 8),
E1 = (1L << 0), /// shift = 0, E1 = 1L
E2 = (1L << 1),
E3 = (1L << 2),
E4 = (1L << 3),
E5 = (1L << 4),
E6 = (1L << 5),
E7 = (1L << 6),
E8 = (1L << 7),
E9 = (1L << 8),
E10 = (1L << 9),
E11 = (1L << 10),
E12 = (1L << 11),
@@ -642,4 +788,44 @@ namespace Config.Entities
E62 = (1L << 61),
E63 = (1L << 62),
}
#region iPERL enums
public enum Side
{
#if LANG_CS
[Description("Levá")] Left,
[Description("Pravá")] Right,
#else
[Description("Left")] Left,
[Description("Right")] Right,
#endif
Count
}
public enum FlowDir
{
R_L,
L_R,
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
OptoAndDirOK,
OptoNok,
DirNok,
Count
}
#endregion iPERL enums
}
@@ -1,12 +1,21 @@
///
/// Copyright (c) 2015-2017 Sensus Metering Systems
/// Copyright (c) 2015-2021 Sensus Metering Systems
///
using System;
using System.Globalization;
namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
namespace Common.Iperl
{
public class OptoTelegramRaw
public enum OptoTelegramFlags : byte
{
OK = 0,
OK_TestStart,
OK_TestEnd,
InvalidTelegram, /// Wrong telegram format of checksum error
SyncError,
}
public class OptoTelegramRaw
{
public static readonly int Length = 42;
private static CultureInfo culture;
@@ -26,7 +35,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public float RefFlow; /// [m3/h]
public int Counter;
public UInt32 EmfRaw; /// From iPerl opto data
public Int32 EmfRaw; /// Signed EMF from iPerl opto data
public Int16 MagneticFieldRaw;
public Int16 FlowRaw;
public UInt32 VolumeRaw;
@@ -41,8 +50,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
///
public double EMF()
{
Int32 signedEmf = (EmfRaw > 0x7FFFFF) ? ((int)EmfRaw - 0x1000000) : (int)EmfRaw;
return 0.000000333 * (double)signedEmf;
return 0.000000333 * (double)EmfRaw;
}
public double MagneticField() { return (double)MagneticFieldRaw; }
public double Flow(double scalingFactor) { return 0.225 * scalingFactor * (double)FlowRaw; }
@@ -96,22 +104,25 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
/// </description>
/// <param name="data">A complete byte array data</param>
/// <returns>true = telegram OK, false = telegram NOK</returns>
public bool UpdateFromString(string telegram, int counter, ref Int64 volumeRawExtLast, ref Int64 timestampExtLast)
public bool UpdateFromString(string telegram, int counter, float refFlow, ref Int64 volumeRawExtLast, ref Int64 timestampExtLast, bool isLog = false)
{
DateTime = DateTime.Now;
Counter = counter;
RefFlow = (float)Sequences.ProcessData.RefFlow.Val;
RefFlow = refFlow;
if ((telegram == null) || (telegram.Length < Length) ||
(telegram[6] != '\t') || (telegram[11] != '\t') || (telegram[16] != '\t') ||
(telegram[23] != '\t') || (telegram[28] != '\t') || (telegram[37] != '\t') ||
(telegram[40] != '\r') || (telegram[41] != '\n'))
(!isLog && (telegram[40] != '\r' || telegram[41] != '\n')))
{
Flags = OptoTelegramFlags.InvalidTelegram;
return false;
}
bool f1 = UInt32.TryParse(telegram.Substring(0, 6), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out EmfRaw);
UInt32 uEmfRaw;
bool f1 = UInt32.TryParse(telegram.Substring(0, 6), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out uEmfRaw);
EmfRaw = (uEmfRaw > 0x7FFFFF) ? ((int)uEmfRaw - 0x1000000) : (int)uEmfRaw;
bool f2 = Int16.TryParse(telegram.Substring(7, 4), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out MagneticFieldRaw);
bool f3 = Int16.TryParse(telegram.Substring(12, 4), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out FlowRaw);
bool f4 = UInt32.TryParse(telegram.Substring(17, 6), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out VolumeRaw);
@@ -119,51 +130,61 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
bool f6 = UInt32.TryParse(telegram.Substring(29, 8), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out Timestamp);
bool f7 = byte.TryParse(telegram.Substring(38, 2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out CheckSum);
bool allOk = f1 && f2 && f3 && f4 && f5 && f6 && f7;
byte calculatedCheckSum = 0;
for (int i = 0; i < Length - 4; i++)
{
calculatedCheckSum += (byte)telegram[i];
}
bool allOk = f1 && f2 && f3 && f4 && f5 && f6 && f7 && (calculatedCheckSum == CheckSum);
if (allOk)
{
///
/// Cope with 'VolumeRaw' overflow
///
Int64 uncorrected = (Int64)(((UInt64)volumeRawExtLast & 0xFFFFFFFFFF000000UL) | VolumeRaw);
if (Math.Abs(uncorrected - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected;
}
else if (Math.Abs(uncorrected + 0x1000000L - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected + 0x1000000L;
}
else if (Math.Abs(uncorrected - 0x1000000L - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected - 0x1000000L;
}
else
{
VolumeRawExt = volumeRawExtLast = uncorrected;
}
///
/// Cope with 'Timestamp' overflow
///
uncorrected = (Int64)(((UInt64)timestampExtLast & 0xFFFFFFFF00000000UL) | Timestamp);
if (Math.Abs(uncorrected - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected;
}
else if (Math.Abs(uncorrected + 0x100000000L - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected + 0x100000000L;
}
else if (Math.Abs(uncorrected - 0x100000000L - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected - 0x100000000L;
}
else
{
TimestampExt = timestampExtLast = uncorrected;
}
}
Flags = allOk ? OptoTelegramFlags.OK : OptoTelegramFlags.InvalidTelegram;
///
/// Cope with 'VolumeRaw' overflow
///
Int64 uncorrected = (Int64)(((UInt64)volumeRawExtLast & 0xFFFFFFFFFF000000UL) | VolumeRaw);
if (Math.Abs(uncorrected - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected;
}
else if (Math.Abs(uncorrected + 0x1000000L - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected + 0x1000000L;
}
else if (Math.Abs(uncorrected - 0x1000000L - volumeRawExtLast) <= 0x800000L)
{
VolumeRawExt = volumeRawExtLast = uncorrected - 0x1000000L;
}
else
{
VolumeRawExt = volumeRawExtLast = uncorrected;
}
///
/// Cope with 'Timestamp' overflow
///
uncorrected = (Int64)(((UInt64)timestampExtLast & 0xFFFFFFFF00000000UL) | Timestamp);
if (Math.Abs(uncorrected - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected;
}
else if (Math.Abs(uncorrected + 0x100000000L - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected + 0x100000000L;
}
else if (Math.Abs(uncorrected - 0x100000000L - timestampExtLast) <= 0x80000000L)
{
TimestampExt = timestampExtLast = uncorrected - 0x100000000L;
}
else
{
TimestampExt = timestampExtLast = uncorrected;
}
return allOk;
}
@@ -173,7 +194,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public bool UpdateFromStringDummy(string telegram)
{
DateTime = DateTime.Now;
RefFlow = (float)Sequences.ProcessData.RefFlow.Val;
RefFlow = 0;
if ((telegram == null) || (telegram.Length < Length) ||
(telegram[6] != '\t') || (telegram[11] != '\t') || (telegram[16] != '\t') ||
@@ -184,16 +205,19 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
return false;
}
//bool f1 = UInt32.TryParse(telegram.Substring(0, 6), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out EmfRaw);
//bool f2 = Int16.TryParse(telegram.Substring(7, 4), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out MagneticFieldRaw);
//bool f3 = Int16.TryParse(telegram.Substring(12, 4), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out FlowRaw);
//bool f4 = UInt32.TryParse(telegram.Substring(17, 6), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out VolumeRaw);
//bool f5 = Int16.TryParse(telegram.Substring(24, 4), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out Impedance);
//bool f6 = UInt32.TryParse(telegram.Substring(29, 8), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out Timestamp);
//bool f7 = byte.TryParse(telegram.Substring(38, 2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out CheckSum);
//return f1 && f2 && f3 && f4 && f5 && f6 && f7;
bool f7 = byte.TryParse(telegram.Substring(38, 2), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out CheckSum);
return true;
byte calculatedCheckSum = 0;
for (int i = 0; i < Length - 4; i++)
{
calculatedCheckSum += (byte)telegram[i];
}
bool allOk = f7 && (calculatedCheckSum == CheckSum);
Flags = allOk ? OptoTelegramFlags.OK : OptoTelegramFlags.InvalidTelegram;
return allOk;
}
@@ -221,7 +245,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
DateTime.Second.ToString("D2"),
DateTime.Millisecond.ToString("D4"),
Counter,
EmfRaw.ToString("X6"),
(EmfRaw & 0x00FFFFFF).ToString("X6"),
MagneticFieldRaw.ToString("X4"),
FlowRaw.ToString("X4"),
VolumeRaw.ToString("X6"),
@@ -241,80 +265,5 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
Label());
}
}
/// <summary>
/// Filter RefFlow data in an array of OptoTelegramRaw objects by a FIR filter:
///
/// kSize = 5, kSize2 = 2
///
/// i k
/// ---------------------------------------------------------------------------
/// 0 -5 filtered[0] = data[0]
/// 1 -4 filtered[1] = data[1]
/// 2 -3 filtered[2] = data[0]*k[0] + ... + data[4]*k[4]
/// 3 -2 filtered[3] = data[1]*k[0] + ... + data[5]*k[4]
/// 4 -1 filtered[4] = data[2]*k[0] + ... + data[6]*k[4]
/// 5 0 data[0] = filtered[0], filtered[0] = data[3]*k[0] + ... + data[7]*k[4]
/// 6 1 data[1] = filtered[1], filtered[1] = data[4]*k[0] + ... + data[8]*k[4]
/// 7 ...
/// </summary>
/// <param name="optoData">array of OptoTelegramRaw objects</param>
/// <param name="from">Index of the first optoData item to process</param>
/// <param name="to">Index of the last optoData item to process</param>
public static void FIRFilterFlow(OptoTelegramRaw[] optoData, int from, int to)
{
float[] kernel = new float[] { 0.1f, 0.2f, 0.4f, 0.2f, 0.1f };
int kSize = kernel.Length;
int kSize2 = kernel.Length / 2;
float[] filtered = new float[kSize];
for (int i = from; i <= to; i++)
{
if ((i < from + kSize2) || (i > to - kSize2))
{
/// Beginning or end of optoData buffer => Just copy data (=do not filter)
filtered[i % kSize] = optoData[BufferIdx(i)].RefFlow;
}
else
{
/// Make a convolution of optoData and the kernel
float weightedSum = 0;
for (int j = -kSize2; j <= kSize2; j++)
weightedSum += optoData[BufferIdx(i + j)].RefFlow * kernel[j + kSize2];
filtered[i % kSize] = weightedSum;
}
if (i >= from + kSize)
{
/// filtered[] buffer full => copy filtered data to optoData
optoData[BufferIdx(i - kSize)].RefFlow = filtered[i % kSize];
}
}
for (int i = to - kSize + 1; i <= to; i++)
{
if (i >= 0) optoData[BufferIdx(i)].RefFlow = filtered[i % kSize];
}
}
/// <summary>
/// Get index to optoData buffer
/// </summary>
/// <param name="index">Original unwrapped index</param>
/// <returns>Index to the buffer</returns>
public static int BufferIdx(int index)
{
if (index < IperlHead.MaxOptoDataCount)
{
return index;
}
else
{
return IperlHead.StartOptoDataCount + (index - IperlHead.MaxOptoDataCount) % IperlHead.EndOptoDataCount;
}
}
}
}
+338
View File
@@ -0,0 +1,338 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Iperl;
namespace Common
{
public static class Extensions
{
public static float[] SubArray(this float[] array, int offset, int length)
{
float[] result = new float[length];
Array.Copy(array, offset, result, 0, length);
return result;
}
}
public class StatisticalMetrics
{
const int VectorSize = 7;
const int MinLength = 100;
const float AdcBit = (float)57e-9;
const int NeighbourhoodSize = 30; /// To determine extended outliers
/// <summary>
/// Calculates a 7-dimensional vector with these components:
/// x[0] = X1 = Number of outliers
/// x[1] = X2 = Relative cal-factor shift due to outliers
/// x[2] = X3 = Standard deviation of high-pass filteres ++++ demodulation of EMF (cut-off at Nyquist frequency)
/// x[3] = X4 = Robust standard deviation of high-pass filtered ++++ demodulation
/// x[4] = X5 = Peak-to-peak of low-pass filtered ++++ demodulation of EMF (cut-off TBD)
/// x[5] = X6 = Peak-to-peak of reference flow rate
/// x[6] = X7 = Mean impedance (++-- demodulation)
/// </summary>
/// <param name="optoData"></param>
/// <param name="optoDataCount"></param>
/// <param name="startIx"></param>
/// <param name="endIx"></param>
/// <returns></returns>
public static float[] Calculate(OptoTelegramRaw[] optoData, int optoDataCount, int startIx, int endIx, bool downsample,
out float[] offsetV, out float[] kOhmsR, out float[] kOhmsC, out float[] dutFlow,
out float[] refFlow, out float[] flowRatio, out float[] magField, out float[] emfV,
out PointF[] outliers, out PointF[] extendedOutliers)
{
offsetV = kOhmsR = kOhmsC = dutFlow = refFlow = flowRatio = magField = emfV = null;
outliers = extendedOutliers = null;
if (optoData == null || optoData.Length < optoDataCount ||
startIx < 0 || endIx >= optoDataCount || endIx <= startIx + MinLength + 3) return null;
float[] modulatedData = GetModulatedEmf(optoData, optoDataCount, AdcBit);
FindShiftAndDemodulate(modulatedData, downsample,
new float[] { +1, +1, +1, +1 }, out offsetV,
new float[] { +1, +1, -1, -1 }, out kOhmsR,
new float[] { +1, -1, -1, +1 }, out kOhmsC,
new float[] { +1, -1, +1, -1 }, out dutFlow);
//offsetV = FirFilter(modulatedData, new float[] { 1, 3, 4, 4, 3, 1}, 0.0625F);
magField = GetMagField(optoData, optoDataCount, downsample, new float[] { 1, 1, 1, 1 });
refFlow = GetRefFlow(optoData, optoDataCount, downsample, new float[] { 1, 1, 1, 1 });
flowRatio = new float[Math.Min(dutFlow.Length, refFlow.Length)];
for (int i = 0; i < flowRatio.Length; i++)
{
flowRatio[i] = (refFlow[i] != 0) ? dutFlow[i] / refFlow[i] : 1;
}
float[] x = new float[VectorSize];
/// X1 = Number of outliers
int outliersCount = GetOutliers(flowRatio, out outliers, out extendedOutliers);
/// X2 = Relative cal-factor shift due to outliers
/// X3 = Standard deviation of high-pass filteres ++++ demodulation of EMF (cut-off at Nyquist frequency)
/// X4 = Robust standard deviation of high-pass filtered ++++ demodulation
/// X5 = Peak-to-peak of low-pass filtered ++++ demodulation of EMF (cut-off TBD)
/// X6 = Peak-to-peak of reference flow rate
/// X7 = Mean impedance (++-- demodulation)
double sum = 0;
foreach (var z in kOhmsR) sum += z;
x[6] = Convert.ToSingle(sum / kOhmsR.Length);
return x;
}
static float[] GetModulatedEmf(OptoTelegramRaw[] optoData, int optoDataCount, float factor)
{
if (optoData == null || optoDataCount < 0) return null;
float[] result = new float[optoDataCount];
for (int i = 0; i < optoDataCount; i++)
{
result[i] = optoData[i].EmfRaw * factor;
}
return result;
}
static float[] GetMagField(OptoTelegramRaw[] optoData, int optoDataCount, bool downsample, float[] kernel)
{
if (optoData == null || optoDataCount < 0 || (downsample && (kernel == null || kernel.Length < 4))) return null;
int resultLen = downsample ? (optoDataCount / 4) : optoDataCount;
float[] result = new float[resultLen];
if (downsample)
{
float ksum = 0;
for (int j = 0; j < kernel.Length; j++) ksum += kernel[j];
for (int j = 0; j < kernel.Length; j++) kernel[j] /= ksum;
for (int i = 0; (4 * i) + kernel.Length - 1 < optoDataCount; i++)
{
float sum = 0;
for (int j = 0; j < kernel.Length; j++) sum += Convert.ToSingle(optoData[4 * i + j].MagneticFieldRaw) * kernel[j];
result[i] = sum;
}
}
else
{
for (int i = 0; i < optoDataCount; i++) result[i] = optoData[i].MagneticFieldRaw;
}
return result;
}
static float[] GetRefFlow(OptoTelegramRaw[] optoData, int optoDataCount, bool downsample, float[] kernel)
{
if (optoData == null || optoDataCount < 0 || (downsample && (kernel == null || kernel.Length < 4))) return null;
int resultLen = downsample ? (optoDataCount / 4) : optoDataCount;
float[] result = new float[resultLen];
if (downsample)
{
float ksum = 0;
for (int j = 0; j < kernel.Length; j++) ksum += kernel[j];
for (int j = 0; j < kernel.Length; j++) kernel[j] /= ksum;
for (int i = 0; (4 * i) + kernel.Length - 1 < optoDataCount; i++)
{
float sum = 0;
for (int j = 0; j < kernel.Length; j++) sum += Convert.ToSingle(optoData[4 * i + j].RefFlow) * kernel[j];
result[i] = sum;
}
}
else
{
for (int i = 0; i < optoDataCount; i++) result[i] = optoData[i].RefFlow;
}
return result;
}
public static void FindShiftAndDemodulate(float[] modulatedData, bool downsample,
float[] kernel1, out float[] data1,
float[] kernel2, out float[] data2,
float[] kernel3, out float[] data3,
float[] kernel4, out float[] data4)
{
int shift = GetShift(modulatedData.SubArray(0, MinLength));
data1 = (kernel1 != null) ? Demodulate(modulatedData, kernel1, shift, downsample) : null;
data2 = (kernel2 != null) ? Demodulate(modulatedData, kernel2, shift, downsample) : null;
data3 = (kernel3 != null) ? Demodulate(modulatedData, kernel3, shift, downsample) : null;
data4 = (kernel4 != null) ? Demodulate(modulatedData, kernel4, shift, downsample) : null;
}
/// <summary>
/// Unlike FIR filtering, demodulation shifts the kernel in 4 phases
/// </summary>
/// <param name="data">Input data</param>
/// <param name="kernel">Demodulation kernel</param>
/// <param name="shift">shift 0..3</param>
/// <returns>Output data</returns>
static float[] Demodulate(float[] data, float[] kernel, int shift, bool downsample)
{
if (data == null || data.Length < MinLength || kernel == null || kernel.Length != 4)
{
return null;
}
float ksum = 0;
for (int i = 0; i < 4; i++) ksum += Math.Abs(kernel[i]);
for (int i = 0; i < 4; i++) kernel[i] /= ksum;
int rsltLen = downsample ? (data.Length - 3) / 4 : data.Length - 3;
float[] result = new float[rsltLen];
if (downsample)
{
for (int i = shift; i < 4 * rsltLen; i += 4)
{
float sum = 0;
for (int j = 0; j < 4; j++) sum += data[i + j] * kernel[(i + j + 4 - shift) % 4];
result[i / 4] = sum;
}
}
else
{
for (int i = 0; i < rsltLen; i++)
{
float sum = 0;
for (int j = 0; j < 4; j++) sum += data[i + j] * kernel[(i + j + 4 - shift) % 4];
result[i] = sum;
}
}
return result;
}
/// <summary>
/// Determine modulation phase by maximizing ++-- demodulation result.
/// </summary>
/// <param name="modulatedEmf">Input data</param>
/// <returns>0..3 = modulation phase or, -1 = error</returns>
static int GetShift(float[] modulatedData)
{
float[] kernel = new float[4] { 1, 1, -1, -1 };
int maximizingShift = -1;
float maximum = float.MinValue;
for (int shift = 0; shift <= 3; shift++)
{
var demodulatedCandidate = Demodulate(modulatedData, kernel, shift, false);
float sum = 0;
foreach (var d in demodulatedCandidate) sum += d;
if (sum > maximum)
{
maximum = sum;
maximizingShift = shift;
}
}
return maximizingShift;
}
/// <summary>
/// FIR filtering = convolution with a kernel
/// </summary>
/// <param name="data">Input data</param>
/// <param name="kernel">Convolution kernel</param>
/// <returns>Output data</returns>
static float[] FirFilter(float[] data, float[] kernel, float factor)
{
if (data == null || kernel == null) return null;
int kernelLen = kernel.Length;
int rsltLen = data.Length - kernelLen + 1;
if (rsltLen < 0) return null;
float[] result = new float[rsltLen];
for (int i = 0; i < rsltLen; i++)
{
float sum = 0;
for (int j = 0; j < kernelLen; j++) sum += data[i + j] * kernel[j];
result[i] = sum * factor;
}
return result;
}
static int GetOutliers(float[] flowRatio, out PointF[] outliers, out PointF[] extendedOutliers)
{
float mean = Enumerable.Average(flowRatio);
var fr = new float[flowRatio.Length];
for (int i = 0; i < fr.Length; i++) fr[i] = flowRatio[i] - mean;
Array.Sort(fr);
float qLo = fr[fr.Length / 4];
float qHi = fr[3 * fr.Length / 4];
int N = fr.Length / 2;
float sumY = 0;
float sumYY = 0;
for (int i = fr.Length / 4; i < 3 * fr.Length / 4; i++)
{
sumY += fr[i];
sumYY += fr[i] * fr[i];
}
float std = (float)Math.Sqrt(sumYY / N - (sumY / N) * (sumY / N));
float robustStd = std * 5.1812824F;
float threshold = 7 * robustStd;
/// Restore fr as it was before sorting
for (int i = 0; i < fr.Length; i++) fr[i] = flowRatio[i] - mean;
IList<PointF> listOfOutliers = new List<PointF>();
bool[] boolExtendedOutliers = new bool[fr.Length];
int outliersCount = 0;
for (int i = 0; i < fr.Length; i++)
{
if (fr[i] < -threshold || fr[i] > threshold)
{
/// This is an outlier
listOfOutliers.Add(new PointF(Convert.ToSingle(i), fr[i] + mean));
outliersCount++;
for (int j = Math.Max(0, i - NeighbourhoodSize); j <= Math.Min(i + NeighbourhoodSize, fr.Length - 1); j++)
{
boolExtendedOutliers[j] = true;
}
}
}
IList<PointF> listOfExtendedOutliers = new List<PointF>();
for (int i = 0; i < fr.Length; i++)
{
if (boolExtendedOutliers[i])
{
listOfExtendedOutliers.Add(new PointF(Convert.ToSingle(i), fr[i] + mean));
}
}
outliers = listOfOutliers.ToArray<PointF>();
extendedOutliers = listOfExtendedOutliers.ToArray<PointF>();
return outliersCount;
}
}
}
+29 -4
View File
@@ -2,10 +2,7 @@
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO.Ports;
namespace Common
{
@@ -17,5 +14,33 @@ namespace Common
if (repeats == 1) return name;
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
}
public static Parity GetParity(string str, Parity defaultParity = Parity.None)
{
if (str.Equals(Parity.None.ToString())) return Parity.None;
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
if (str.Equals(Parity.Mark.ToString())) return Parity.Mark;
if (str.Equals(Parity.Space.ToString())) return Parity.Space;
return defaultParity;
}
public static StopBits GetStopBits(string str, StopBits defaultStopBits = StopBits.One)
{
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
return defaultStopBits;
}
public static Handshake GetHandshake(string str, Handshake defaultHandshake = Handshake.None)
{
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
if (str.Equals(Handshake.RequestToSendXOnXOff.ToString())) return Handshake.RequestToSendXOnXOff;
return defaultHandshake;
}
}
}
+3 -5
View File
@@ -19,18 +19,18 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -75,7 +75,6 @@
<Compile Include="Entities\Component.cs" />
<Compile Include="Entities\ComponentProcedure.cs" />
<Compile Include="Entities\ComponentTest.cs" />
<Compile Include="Entities\Enums.cs" />
<Compile Include="Entities\FeedingPath.cs" />
<Compile Include="Entities\Group.cs" />
<Compile Include="Entities\HeatMetersPath.cs" />
@@ -83,7 +82,6 @@
<Compile Include="Entities\IHasName.cs" />
<Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\IParamsProvider.cs" />
<Compile Include="Entities\IperlEnums.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" />
+4 -9
View File
@@ -15,10 +15,10 @@ namespace Config
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif MUNICH
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif MALTA_WSD25
public const int WMsCount = 6;
@@ -88,11 +88,6 @@ namespace Config
public const int MaxPartNr = WMsCount / LineSize;
#endif
///
/// Database related: This object reference is set after a successful user login
///
public static DatabaseSettings CurrentBench;
public static double RealDensity = 0; /// true water density [kg/m3]
public static double AtTemperature = 0; /// measured at temperature [°C]
public static double Buoyancy = 0;
+4 -4
View File
@@ -25,10 +25,10 @@ namespace Config
{
BenchName = String.Empty; /// Empty string (avoid null)
IsRealBench = false;
ProceduresDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
WaterMetersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
EventsDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
UsersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
ProceduresDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
WaterMetersDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
EventsDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
UsersDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
}
public object Clone()
+3 -1
View File
@@ -14,6 +14,7 @@ namespace Config.Entities
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Selector { get; set; }
public virtual string TempMtrUp { get; set; }
public virtual string TempMtrDown { get; set; }
public virtual string PressMtrUp { get; set; }
@@ -46,7 +47,8 @@ namespace Config.Entities
result.Qfrom = Qfrom;
result.Qto = Qto;
result.TempMtrUp = TempMtrUp;
result.Selector = Selector;
result.TempMtrUp = TempMtrUp;
result.TempMtrDown = TempMtrDown;
result.PressMtrUp = PressMtrUp;
result.PressMtrDown = PressMtrDown;
+2 -1
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using Common;
namespace Config.Entities
{
@@ -86,7 +87,7 @@ namespace Config.Entities
else if (line.Equals(DebugMode.FailureDuringOperation.ToString())) result.Mode = DebugMode.FailureDuringOperation;
else if (line.Equals(DebugMode.Off.ToString())) result.Mode = DebugMode.Off;
else if (line.Equals(DebugMode.Record.ToString())) result.Mode = DebugMode.Record;
else if (line.Equals(DebugMode.Reply.ToString())) result.Mode = DebugMode.Reply;
else if (line.Equals(DebugMode.Replay.ToString())) result.Mode = DebugMode.Replay;
else if (line.Equals(DebugMode.Simulate.ToString())) result.Mode = DebugMode.Simulate;
else if (line.Equals(DebugMode.Inherit.ToString())) result.Mode = DebugMode.Inherit;
+8 -5
View File
@@ -14,6 +14,7 @@ namespace Config.Entities
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Selector { get; set; }
public virtual string Pump { get; set; }
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
@@ -40,12 +41,14 @@ namespace Config.Entities
{
FeedingPath result = new FeedingPath(name, itemNr);
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Pump = Pump;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Selector = Selector;
result.Pump = Pump;
result.RegulValvesPct = RegulValvesPct;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
+2 -2
View File
@@ -9,7 +9,7 @@ namespace Config.Entities
public class Group
{
public virtual int Id { get; protected set; }
public virtual Users.Entities.GID GID { get; set; }
public virtual Common.GID GID { get; set; }
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
@@ -18,7 +18,7 @@ namespace Config.Entities
Users = new List<User>();
}
public Group(Users.Entities.GID gid)
public Group(Common.GID gid)
: this()
{
GID = gid;
+2 -1
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
namespace Config.Entities
{
@@ -31,7 +32,7 @@ namespace Config.Entities
/// Returns a list of possible values of one parameter (ComboBox when editing) or null (Textbox when editing).
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
IList<string> ParamValues(int ix);
ICollection<string> ParamValues(int ix);
/// <summary>
/// Returns a parameter value in the string form
-44
View File
@@ -1,44 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public enum Side
{
#if LANG_CS
[Description("Levá")] Left,
[Description("Pravá")] Right,
#else
[Description("Left")] Left,
[Description("Right")] Right,
#endif
Count
}
public enum FlowDir
{
R_L,
L_R,
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
OptoAndDirOK,
OptoNok,
DirNok,
Count
}
}
+13 -11
View File
@@ -14,6 +14,7 @@ namespace Config.Entities
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Selector { get; set; }
public virtual string RegulValve { get; set; }
public virtual string FlowMeter { get; set; }
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
@@ -46,18 +47,19 @@ namespace Config.Entities
{
OutputPath result = new OutputPath(name, itemNr);
result.Name = Name;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.RegulValve = RegulValve;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Scale = Scale;
result.Name = Name;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Selector = Selector;
result.RegulValve = RegulValve;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Scale = Scale;
result.RegulValvesPct = RegulValvesPct;
result.ValvesOpen = ValvesOpen;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
+2 -1
View File
@@ -4,6 +4,7 @@
using System;
using System.Globalization;
using System.IO;
using Common;
namespace Config.Entities
{
@@ -78,7 +79,7 @@ namespace Config.Entities
TempLimHi = 25.0; /// [°C]
PressLimLo = 0; /// [bar]
PressLimHi = 16.0; /// [bar]
Publish = (sbyte)Config.Entities.Publish.Always;
Publish = (sbyte)Common.Publish.Always;
Evaluate = true;
E1 = (sbyte)ErrorFlagsMode.On;
+2 -1
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Common;
namespace Config.Entities
{
@@ -78,7 +79,7 @@ namespace Config.Entities
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
MetersKind = Entities.MetersKind.Single;
MetersKind = MetersKind.Single;
Watermeters = string.Empty;
Description = string.Empty;
LongDescription = string.Empty;
+1
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Common;
namespace Config.Entities
{
+61 -54
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Common;
namespace Config.Entities
{
@@ -25,7 +26,7 @@ namespace Config.Entities
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual float TestTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
@@ -44,7 +45,7 @@ namespace Config.Entities
public virtual int TimeFlow2Mass { get; set; } /// Delay time from the flow stable to the 1st mass measurement in [s]
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual double TolerRed { get; set; } /// = Filter
public virtual double ShortPulses { get; set; } /// = Filter
public virtual string RedType { get; set; }
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
@@ -53,12 +54,25 @@ namespace Config.Entities
#if HEAT_METERS
public virtual string HeatMetersPath { get; set; }
#endif
public virtual string RelTransBefore { get; set; }
public virtual string RelTransBetween { get; set; }
public virtual string TransitionAfter { get; set; }
public virtual string TransBefore { get; set; }
public virtual string TransBetween { get; set; }
public virtual string TransAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
public virtual bool QtgTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool QfromTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool QtoTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool VolumeTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool TempLimLoTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool TempLimHiTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit VolumeUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit FlowUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit MassUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit TempUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit PressUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual Unit LengthUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual IList<ComponentTest> MoreParams { get; set; }
@@ -75,7 +89,7 @@ namespace Config.Entities
///
Part = 0;
Profile = TestProfile.UserDefined;
Publish = (sbyte)Config.Entities.Publish.Always;
Publish = (sbyte)Common.Publish.Always;
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
@@ -94,10 +108,10 @@ namespace Config.Entities
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
RelTransBetween = string.Empty;
TransitionAfter = string.Empty;
ShortPulses = 0; /// = Filter parameter
TransBefore = string.Empty;
TransBetween = string.Empty;
TransAfter = string.Empty;
}
public Test(string name, int itemNr, Procedure procedure)
@@ -124,6 +138,16 @@ namespace Config.Entities
return autoTests.Contains(action);
}
public virtual void ResetChngdFlags()
{
QtgTextChngd = false;
QfromTextChngd = false;
QtoTextChngd = false;
VolumeTextChngd = false;
TempLimLoTextChngd = false;
TempLimHiTextChngd = false;
}
// Makes a new copy of this object (not just a reference)
public virtual Test Clone()
{
@@ -137,7 +161,7 @@ namespace Config.Entities
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Volume = Volume;
result.TstTime = TstTime;
result.TestTime = TestTime;
result.Method = Method;
result.ErrLimLo = ErrLimLo;
result.ErrLimHi = ErrLimHi;
@@ -156,7 +180,7 @@ namespace Config.Entities
result.TimeFlow2Mass = TimeFlow2Mass;
result.TimePump2StartV = TimePump2StartV;
result.TimeStop2Mass = TimeStop2Mass;
result.TolerRed = TolerRed;
result.ShortPulses = ShortPulses;
result.RedType = RedType;
result.FeedingPath = FeedingPath;
result.BenchPath = BenchPath;
@@ -165,10 +189,16 @@ namespace Config.Entities
#if HEAT_METERS
result.HeatMetersPath = HeatMetersPath;
#endif
result.RelTransBefore = RelTransBefore;
result.RelTransBetween = RelTransBetween;
result.TransitionAfter = TransitionAfter;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
result.TransBefore = TransBefore;
result.TransBetween = TransBetween;
result.TransAfter = TransAfter;
result.VolumeUnit = VolumeUnit;
result.FlowUnit = FlowUnit;
result.MassUnit = MassUnit;
result.TempUnit = TempUnit;
result.PressUnit = PressUnit;
result.LengthUnit = LengthUnit;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
return result;
}
@@ -185,7 +215,7 @@ namespace Config.Entities
output.WriteLine(Qfrom.ToString(ci));
output.WriteLine(Qto.ToString(ci));
output.WriteLine(Volume.ToString(ci));
output.WriteLine(TstTime.ToString(ci));
output.WriteLine(TestTime.ToString(ci));
output.WriteLine(Method);
output.WriteLine(ErrLimLo.ToString(ci));
output.WriteLine(ErrLimHi.ToString(ci));
@@ -208,10 +238,10 @@ namespace Config.Entities
output.WriteLine(BenchPath);
output.WriteLine(OutputPath);
output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween);
output.WriteLine(TransBefore);
output.WriteLine(TransBetween);
output.WriteLine(Profile);
output.WriteLine(TransitionAfter);
output.WriteLine(TransAfter);
foreach (var prms in MoreParams) { prms.Export(output); }
output.WriteLine();
@@ -236,7 +266,7 @@ namespace Config.Entities
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qto = float.Parse(input.ReadLine(), ci);
tst.Volume = float.Parse(input.ReadLine(), ci);
tst.TstTime = float.Parse(input.ReadLine(), ci);
tst.TestTime = float.Parse(input.ReadLine(), ci);
tst.Method = input.ReadLine();
tst.ErrLimLo = float.Parse(input.ReadLine(), ci);
tst.ErrLimHi = float.Parse(input.ReadLine(), ci);
@@ -259,13 +289,13 @@ namespace Config.Entities
tst.BenchPath = input.ReadLine();
tst.OutputPath = input.ReadLine();
tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine();
tst.TransBefore = input.ReadLine();
tst.TransBetween = input.ReadLine();
string line = input.ReadLine();
tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.TransitionAfter = input.ReadLine();
tst.TransAfter = input.ReadLine();
while (true)
{
@@ -298,7 +328,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TstTime.ToString(ci)) { diff.AppendFormat(fmt, "TstTime", TstTime.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TestTime.ToString(ci)) { diff.AppendFormat(fmt, "TstTime", TestTime.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Method) { diff.AppendFormat(fmt, "Method", Method, ln); };
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
@@ -321,10 +351,10 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != BenchPath) { diff.AppendFormat(fmt, "BenchPath", BenchPath, ln); };
ln = inp.ReadLine(); if (ln != OutputPath) { diff.AppendFormat(fmt, "OutputPath", OutputPath, ln); };
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
ln = inp.ReadLine(); if (ln != TransBefore) { diff.AppendFormat(fmt, "RelTransBefore", TransBefore, ln); };
ln = inp.ReadLine(); if (ln != TransBetween) { diff.AppendFormat(fmt, "RelTransBetween", TransBetween, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != TransAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransAfter, ln); };
return diff.ToString();
}
@@ -425,29 +455,6 @@ namespace Config.Entities
return false;
}
/// <summary>
/// Determines whether tests part number is OK.
/// Examples of correct part number are:
/// 1, 2, 12, 21 in case of max. part nr.== 2
/// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4
/// </summary>
/// <param name="partNr">Tests par tnumber</param>
/// <returns>true when Part number is OK</returns>
public static bool IsGoodPartNr(int partNr)
{
bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= Config.Data.MaxPartNr);
bool secondDigitIsOK = (((partNr/10) % 10) > 0) && (((partNr/10) % 10) <= Config.Data.MaxPartNr);
bool thirdDigitIsOK = (((partNr/100) % 10) > 0) && (((partNr/100) % 10) <= Config.Data.MaxPartNr);
bool fourthDigitIsOK = (((partNr/1000) % 10) > 0) && (((partNr/1000) % 10) <= Config.Data.MaxPartNr);
if (firstDigitIsOK && (partNr / 10 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true;
return false;
}
public override string ToString()
{
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
+19 -64
View File
@@ -14,45 +14,11 @@ namespace Config
{
public static class FluentCommon
{
/// <summary>
/// Session factories for regular sessions.
/// </summary>
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Users.Entities.DBKind.Count];
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database)
{
Users.Entities.DBType dbType;
string connectionString;
switch (database)
{
default:
case Users.Entities.DBKind.Config:
dbType = Data.CurrentBench.ProceduresDBSettings.DbType;
connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString;
break;
case Users.Entities.DBKind.Results:
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
case Users.Entities.DBKind.RemoteConfig:
dbType = Data.CurrentBench.UsersDBSettings.DbType;
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
break;
}
return CreateSessionFactory(database, dbType, connectionString, false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database, Users.Entities.DBType dbType, string connectionString, bool createDB)
public static ISessionFactory CreateSessionFactory(Common.DBKind database, Common.DBType dbType, string connectionString, bool createDB)
{
try
{
@@ -61,10 +27,10 @@ namespace Config
switch (dbType)
{
default:
case Users.Entities.DBType.SQLite:
case Common.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Users.Entities.DBType.MySql:
case Common.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
@@ -72,11 +38,11 @@ namespace Config
switch (database)
{
default:
case Users.Entities.DBKind.Config:
case Users.Entities.DBKind.RemoteConfig:
case Common.DBKind.Config:
case Common.DBKind.RemoteConfig:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Users.Entities.DBKind.Results:
case Common.DBKind.Results:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
}
@@ -116,17 +82,6 @@ namespace Config
new SchemaExport(config).Create(true, true);
}
/// Create a NHibernate session for the given database
public static ISession CreateSession(Users.Entities.DBKind database)
{
if (database < 0 || database >= Users.Entities.DBKind.Count) return null;
int ix = (int)database;
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
return SessionFactories[ix].OpenSession();
}
/// <summary>
/// Create an empty users database.
/// Database contains only the user 'admin' and the control board component 'CB'.
@@ -134,9 +89,9 @@ namespace Config
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyConfigDB(Users.Entities.DBType dbType, string connectionString)
public static bool CreateEmptyConfigDB(Common.DBType dbType, string connectionString)
{
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Config, dbType, connectionString, true);
ISessionFactory sessionFactory = CreateSessionFactory(Common.DBKind.Config, dbType, connectionString, true);
if (sessionFactory == null) return false;
/// Populate the database
@@ -158,23 +113,23 @@ namespace Config
///
/// Prepare all groups, add some of them to admin
///
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
for (Common.GID gid = 0; gid < Common.GID.NrOfGroups; gid++)
{
Config.Entities.Group group = new Config.Entities.Group(gid);
switch (gid)
{
case Users.Entities.GID.Testers:
case Users.Entities.GID.TestingSpecialists:
case Users.Entities.GID.HeadOfLab:
case Users.Entities.GID.MaintenanceSpecialists:
case Users.Entities.GID.Metrologists:
case Users.Entities.GID.CalibrationSpecialists:
case Users.Entities.GID.Administrators:
case Common.GID.Testers:
case Common.GID.TestingSpecialists:
case Common.GID.HeadOfLab:
case Common.GID.MaintenanceSpecialists:
case Common.GID.Metrologists:
case Common.GID.CalibrationSpecialists:
case Common.GID.Administrators:
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
case Users.Entities.GID.TraceabilityManagement:
case Common.GID.TraceabilityManagement:
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
case Users.Entities.GID.MetrologicalAuthority:
case Users.Entities.GID.WaterMeterAuthority:
case Common.GID.MetrologicalAuthority:
case Common.GID.WaterMeterAuthority:
#endif
admin.AddGroup(group);
session.SaveOrUpdate(group); /// Save this group
+6 -5
View File
@@ -22,7 +22,8 @@ namespace Config.Mappings
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Volume);
Map(x => x.TstTime);
Map(x => x.TestTime)
.Column("TstTime");
Map(x => x.Repeats);
Map(x => x.DoDraining)
.Column("Emptying");
@@ -45,7 +46,7 @@ namespace Config.Mappings
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.Uncertainty);
Map(x => x.TolerRed)
Map(x => x.ShortPulses)
.Column("TolerRed"); /// ???
Map(x => x.RedType);
Map(x => x.FeedingPath);
@@ -55,11 +56,11 @@ namespace Config.Mappings
#if HEAT_METERS
Map(x => x.HeatMetersPath);
#endif
Map(x => x.RelTransBefore)
Map(x => x.TransBefore)
.Column("RelTransBefore");
Map(x => x.RelTransBetween)
Map(x => x.TransBetween)
.Column("RelTransBetween");
Map(x => x.TransitionAfter)
Map(x => x.TransAfter)
.Column("TransitionAfter");
HasMany(x => x.MoreParams)
+51 -23
View File
@@ -3,6 +3,7 @@
///
using System;
using System.Reflection;
using Common;
using Config.Entities;
namespace Config
@@ -247,14 +248,14 @@ namespace Config
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static bool IsQuantity(Unit units, Quantity quantity)
public static bool IsQuantity(Unit unit, Quantity quantity)
{
return (quantity == GetQuantity(units));
return (quantity == GetQuantity(unit));
}
public static Quantity GetQuantity(Unit units)
public static Quantity GetQuantity(Unit unit)
{
switch (units)
switch (unit)
{
case Unit.pulse:
case Unit.degree:
@@ -359,26 +360,32 @@ namespace Config
}
}
public static bool IsVolume(Unit units) { return IsQuantity(units, Config.Quantity.Volume); }
public static bool IsFlow(Unit units) { return IsQuantity(units, Config.Quantity.Flow); }
public static bool IsMass(Unit units) { return IsQuantity(units, Config.Quantity.Mass); }
public static bool IsTime(Unit units) { return IsQuantity(units, Config.Quantity.Time); }
public static bool IsTemperature(Unit units) { return IsQuantity(units, Config.Quantity.Temperature); }
public static bool IsPressure(Unit units) { return IsQuantity(units, Config.Quantity.Pressure); }
public static bool IsHumidity(Unit units) { return IsQuantity(units, Config.Quantity.Humidity); }
public static bool IsError(Unit units) { return IsQuantity(units, Config.Quantity.Error); }
public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); }
public static bool IsDensity(Unit units) { return IsQuantity(units, Config.Quantity.Density); }
public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); }
public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit units) { return IsQuantity(units, Config.Quantity.Conductivity); }
public static bool IsVolume(Unit unit) { return IsQuantity(unit, Config.Quantity.Volume); }
public static bool IsFlow(Unit unit) { return IsQuantity(unit, Config.Quantity.Flow); }
public static bool IsMass(Unit unit) { return IsQuantity(unit, Config.Quantity.Mass); }
public static bool IsTime(Unit unit) { return IsQuantity(unit, Config.Quantity.Time); }
public static bool IsTemperature(Unit unit) { return IsQuantity(unit, Config.Quantity.Temperature); }
public static bool IsPressure(Unit unit) { return IsQuantity(unit, Config.Quantity.Pressure); }
public static bool IsHumidity(Unit unit) { return IsQuantity(unit, Config.Quantity.Humidity); }
public static bool IsError(Unit unit) { return IsQuantity(unit, Config.Quantity.Error); }
public static bool IsLength(Unit unit) { return IsQuantity(unit, Config.Quantity.Length); }
public static bool IsDensity(Unit unit) { return IsQuantity(unit, Config.Quantity.Density); }
public static bool IsEnergy(Unit unit) { return IsQuantity(unit, Config.Quantity.Energy); }
public static bool IsPulses(Unit unit) { return IsQuantity(unit, Config.Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Config.Quantity.Conductivity); }
public static double ConvertTo(Unit units, double v)
public static float ConvertTo(Unit unit, float v)
{
switch (units)
return (float)ConvertTo(unit, (double)v);
}
public static double ConvertTo(Unit unit, double v)
{
switch (unit)
{
/// Volume: internal representation in l
case Unit.ml: return 1000 * v; /// 1 ml = 0.001 l
@@ -456,9 +463,15 @@ namespace Config
}
}
public static double ConvertFrom(Unit units, double v)
public static float ConvertFrom(Unit unit, float v)
{
switch (units)
return (float)ConvertFrom(unit, (double)v);
}
public static double ConvertFrom(Unit unit, double v)
{
switch (unit)
{
/// Volume: internal representation in l
case Unit.ml: return 0.001 * v; /// 0.001 l
@@ -535,5 +548,20 @@ namespace Config
default: return v; /// Do not convert
}
}
/// <summary>
/// Converts a string to a unit
/// </summary>
/// <param name="description">Unit description string</param>
/// <returns>Converted unit or Unit.None if not recognized</returns>
public static Unit FromDescription(string description)
{
for (Unit unit = 0; unit < Unit.Count; unit++)
{
if (unit.ToDescription() == description) return unit;
}
return Unit.None;
}
}
}
+6 -5
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
namespace Config
{
@@ -147,7 +148,7 @@ namespace Config
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q1 or Qmin flow in m3/h</returns>
public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
public static double GetQ1Qmin(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
@@ -158,7 +159,7 @@ namespace Config
}
else
{
if (medium == Entities.Medium.HotWater)
if (medium == Medium.HotWater)
{
switch (metroClass)
{
@@ -192,7 +193,7 @@ namespace Config
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q2 or Qt flow in m3/h</returns>
public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
public static double GetQ2Qt(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
@@ -202,7 +203,7 @@ namespace Config
return 1.6 * Qn / (double)metroClassRatio;
}
if (medium == Entities.Medium.HotWater)
if (medium == Medium.HotWater)
{
switch (metroClass)
{
@@ -235,7 +236,7 @@ namespace Config
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q4 or Qmax flow in m3/h</returns>
public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
public static double GetQ4Qmax(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
+1 -1
View File
@@ -86,7 +86,7 @@ namespace DataStreamMeter
public int GetMetersCount()
{
return 1;
return 20;
}
public bool OpenConnection(int meterIx, string connectionParameters, out string meterID)
+2 -2
View File
@@ -16,7 +16,7 @@
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -27,7 +27,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
+6 -2
View File
@@ -16,7 +16,7 @@
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -27,7 +27,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@@ -90,6 +90,10 @@
</Compile>
</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>
+113 -112
View File
@@ -2,12 +2,13 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using System.Xml.Serialization;
using System.Windows.Forms;
using Common;
using TBF.Rig;
using TBF.Rig.Generic;
using TBF.UI.Bench.Components;
namespace DeviceTest
@@ -79,7 +80,7 @@ namespace DeviceTest
compClasses.Add(componentFactory.ClassName);
}
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
tbfComponents = new List<TBF.Rig.Generic.IComponent>();
tbfDevices = new List<IDevice>();
}
@@ -108,8 +109,8 @@ namespace DeviceTest
config.Name = Program.LocalSettings.ParentName;
config.ParentName = string.Empty;
config.ItemNr = 0;
config.DebugLevel = Config.Entities.DebugMode.Normal;
config.LogLevel = Config.Entities.LogLevel.Debug;
config.DebugLevel = DebugMode.Normal;
config.LogLevel = LogLevel.Debug;
config.Corrections = null;
config.Factory = parentFactory;
parentCfg = config;
@@ -141,8 +142,8 @@ namespace DeviceTest
config.Name = Program.LocalSettings.ComponentName;
config.ParentName = string.IsNullOrEmpty(Program.LocalSettings.ComponentParentName) ? string.Empty : Program.LocalSettings.ComponentParentName;
config.ItemNr = 1;
config.DebugLevel = Config.Entities.DebugMode.Normal;
config.LogLevel = Config.Entities.LogLevel.Debug;
config.DebugLevel = DebugMode.Normal;
config.LogLevel = LogLevel.Debug;
config.Corrections = null;
config.Factory = component1Factory;
component1Cfg = config;
@@ -176,8 +177,8 @@ namespace DeviceTest
config.Name = Program.LocalSettings.Component2Name;
config.ParentName = string.IsNullOrEmpty(Program.LocalSettings.Component2ParentName) ? string.Empty : Program.LocalSettings.Component2ParentName;
config.ItemNr = 2;
config.DebugLevel = Config.Entities.DebugMode.Normal;
config.LogLevel = Config.Entities.LogLevel.Debug;
config.DebugLevel = DebugMode.Normal;
config.LogLevel = LogLevel.Debug;
config.Corrections = null;
config.Factory = component2Factory;
component2Cfg = config;
@@ -211,8 +212,8 @@ namespace DeviceTest
config.Name = Program.LocalSettings.Component3Name;
config.ParentName = string.IsNullOrEmpty(Program.LocalSettings.Component3ParentName) ? string.Empty : Program.LocalSettings.Component3ParentName;
config.ItemNr = 3;
config.DebugLevel = Config.Entities.DebugMode.Normal;
config.LogLevel = Config.Entities.LogLevel.Debug;
config.DebugLevel = DebugMode.Normal;
config.LogLevel = LogLevel.Debug;
config.Corrections = null;
config.Factory = component3Factory;
component3Cfg = config;
@@ -383,7 +384,7 @@ namespace DeviceTest
/// <returns>true when factory changed</returns>
bool FactoryFromClassName(string className, ref IComponentFactory factory)
{
foreach (var fac in TbfComponents.Factories)
foreach (var fac in TbfComponents.Factories)
{
if (className == fac.ClassName)
{
@@ -421,13 +422,13 @@ namespace DeviceTest
{
parentCfg = parentFactory.DefaultConfig();
}
IComponentCfgCtrl cfgControl = parentCfg.GetControl();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Config.Entities.Component>();
IComponentCfgCtrl cfgControl = parentCfg.GetControl(cfgForm.CmpntEntities);
cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
DialogResult dr = cfgForm.ShowDialog();
@@ -450,17 +451,17 @@ namespace DeviceTest
{
component1Cfg = component1Factory.DefaultConfig();
}
IComponentCfgCtrl cfgControl = component1Cfg.GetControl();
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
var compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
cfgForm.TbfComponents = compEntities;
cfgForm.CmpntEntities = compEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
IComponentCfgCtrl cfgControl = component1Cfg.GetControl(compEntities);
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
@@ -484,18 +485,18 @@ namespace DeviceTest
{
component2Cfg = component2Factory.DefaultConfig();
}
IComponentCfgCtrl cfgControl = component2Cfg.GetControl();
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
var 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;
IComponentCfgCtrl cfgControl = component2Cfg.GetControl(compEntities);
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
@@ -519,19 +520,19 @@ namespace DeviceTest
{
component3Cfg = component3Factory.DefaultConfig();
}
IComponentCfgCtrl cfgControl = component3Cfg.GetControl();
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
var compEntities = new List<Config.Entities.Component>();
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;
IComponentCfgCtrl cfgControl = component3Cfg.GetControl(compEntities);
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
@@ -568,7 +569,7 @@ namespace DeviceTest
{
if (parentFactory != null && parentCfg != null)
{
TBF.BenchControl.Generic.IComponent component = parentFactory.GetComponent(parentCfg, tbfComponents);
TBF.Rig.Generic.IComponent component = parentFactory.GetComponent(parentCfg, tbfComponents);
tbfComponents.Add(component);
IDevice dev = component as IDevice;
if (dev != null)
@@ -580,7 +581,7 @@ namespace DeviceTest
}
if (component1Factory != null && component1Cfg != null)
{
TBF.BenchControl.Generic.IComponent component = component1Factory.GetComponent(component1Cfg, tbfComponents);
TBF.Rig.Generic.IComponent component = component1Factory.GetComponent(component1Cfg, tbfComponents);
tbfComponents.Add(component);
tbfComponent1forOp = component;
IDevice dev = component as IDevice;
@@ -593,7 +594,7 @@ namespace DeviceTest
}
if (component2Factory != null && component2Cfg != null)
{
TBF.BenchControl.Generic.IComponent component2 = component2Factory.GetComponent(component2Cfg, tbfComponents);
TBF.Rig.Generic.IComponent component2 = component2Factory.GetComponent(component2Cfg, tbfComponents);
tbfComponents.Add(component2);
tbfComponent2forOp = component2;
IDevice dev = component2 as IDevice;
@@ -606,7 +607,7 @@ namespace DeviceTest
}
if (component3Factory != null && component3Cfg != null)
{
TBF.BenchControl.Generic.IComponent component3 = component3Factory.GetComponent(component3Cfg, tbfComponents);
TBF.Rig.Generic.IComponent component3 = component3Factory.GetComponent(component3Cfg, tbfComponents);
tbfComponents.Add(component3);
tbfComponent3forOp = component3;
IDevice dev = component3 as IDevice;
@@ -663,120 +664,120 @@ namespace DeviceTest
int previousOperation = 0;
if (tbfComponent1forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent1forOp is TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent1forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
else if (tbfComponent1forOp is TBF.Rig.Network.Camera.CLP1611.Camera)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
operation1 = (tbfComponent1forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation2 = (tbfComponent1forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
}
else if (tbfComponent1forOp is TBF.BenchControl.Network.Camera.Roi.Roi)
else if (tbfComponent1forOp is TBF.Rig.Network.Camera.Roi.Roi)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
operation1 = (tbfComponent1forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
else if (tbfComponent1forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
else if (tbfComponent1forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation2 = (tbfComponent1forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent1forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
//operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation2 = (tbfComponent1forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation3 = (tbfComponent1forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
operation1 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent2forOp is TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent2forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
else if (tbfComponent2forOp is TBF.Rig.Network.Camera.CLP1611.Camera)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
operation21 = (tbfComponent2forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation22 = (tbfComponent2forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
}
else if (tbfComponent2forOp is TBF.BenchControl.Network.Camera.Roi.Roi)
else if (tbfComponent2forOp is TBF.Rig.Network.Camera.Roi.Roi)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
operation21 = (tbfComponent2forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
else if (tbfComponent2forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
else if (tbfComponent2forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation22 = (tbfComponent2forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent2forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
//operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation23 = (tbfComponent2forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
operation21 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
if (tbfComponent3forOp is TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
}
else if (tbfComponent3forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
else if (tbfComponent3forOp is TBF.Rig.Network.Camera.CLP1611.Camera)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
operation31 = (tbfComponent3forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(false);
operation33 = (tbfComponent3forOp as TBF.Rig.Network.Camera.CLP1611.Camera).LiveStreamOp(true);
}
else if (tbfComponent3forOp is TBF.BenchControl.Network.Camera.Roi.Roi)
else if (tbfComponent3forOp is TBF.Rig.Network.Camera.Roi.Roi)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
operation31 = (tbfComponent3forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
else if (tbfComponent3forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
else if (tbfComponent3forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
//operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation33 = (tbfComponent3forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.Rig.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.Rig.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.Rig.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
+2 -2
View File
@@ -16,7 +16,7 @@
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -27,7 +27,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
+1
View File
@@ -138,6 +138,7 @@
// eventsListView
//
this.eventsListView.AllowColumnReorder = true;
this.eventsListView.CheckBoxes = true;
this.eventsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.eventsListView.DoubleClickActivation = false;
this.eventsListView.FullRowSelect = true;
+5 -4
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NHibernate;
using Common;
using Common.UIControls;
using Events;
using Events.Entities;
@@ -210,8 +211,8 @@ namespace EventViewer
{
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(evnt.Severity.ToString());
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = Utils.GetSeverityColor(evnt.Severity);
lvi.SubItems[lvi.SubItems.Count - 1].ForeColor = Utils.GetSeverityColor(evnt.Severity, true);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = global::Events.Utils.GetSeverityColor(evnt.Severity);
lvi.SubItems[lvi.SubItems.Count - 1].ForeColor = global::Events.Utils.GetSeverityColor(evnt.Severity, true);
}
lvi.SubItems.Add(evnt.Message);
eventsListView.Items.Add(lvi);
@@ -275,7 +276,7 @@ namespace EventViewer
private void settingsButton_Click(object sender, EventArgs e)
{
//Users.Entities.GID[] groupsWithAccess = new Users.Entities.GID[] { Users.Entities.GID.Administrators };
//Common.GID[] groupsWithAccess = new Common.GID[] { Common.GID.Administrators };
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg(true);
if (dlg.ShowDialog() == DialogResult.OK)
{
@@ -290,7 +291,7 @@ namespace EventViewer
{
try
{
Users.GlobalData.RemoteUsersDB = new Users.DBSettings(Users.Entities.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.GlobalData.RemoteUsersDB = new Users.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
if (dlg.ShowDialog() == DialogResult.OK)
{
+2 -2
View File
@@ -59,8 +59,8 @@ namespace EventViewer
ConnectionString = "SERVER=localhost; DATABASE=test-e; UID=root; PASSWORD=kraken; CHARSET=utf8";
UsersDBConnString = "SERVER=localhost; DATABASE=test; UID=root; PASSWORD=kraken; CHARSET=utf8;";
#else
ConnectionString = "SERVER=10.42.128.16; DATABASE=st_wr_shared_events; UID=v9305784; PASSWORD=p89344390; CHARSET=utf8";
UsersDBConnString = "SERVER=10.42.128.16; DATABASE=st_wr_shared_config; UID=u9305784; PASSWORD=p89344390; CHARSET=utf8;";
ConnectionString = "SERVER=10.42.128.24; DATABASE=st_wr_shared_events; UID=v9305784; PASSWORD=p89344390; CHARSET=utf8";
UsersDBConnString = "SERVER=10.42.128.24; DATABASE=st_wr_shared_config; UID=u9305784; PASSWORD=p89344390; CHARSET=utf8;";
#endif
RecentTimeDays = 7;
Language = "sk";
+5 -4
View File
@@ -8,6 +8,7 @@ using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Common;
using Events.Entities;
namespace Events
@@ -34,9 +35,9 @@ namespace Events
}
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
private static Entities.DBType dbType;
private static DBType dbType;
///
public static Entities.DBType DbType
public static DBType DbType
{
get { return dbType; }
set { dbType = value; SessionFactory = null; }
@@ -63,10 +64,10 @@ namespace Events
switch (dbType)
{
default:
case Entities.DBType.SQLite:
case DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Entities.DBType.MySql:
case DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
-58
View File
@@ -1,58 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace Events.Entities
{
/// <summary>
/// Identifies the type of a database
/// </summary>
public enum DBType
{
None, /// Database disabled
MySql, /// MySQL database
SQLite, /// SQLite
Count
}
public enum Severity
{
Undefined,
Notification,
Warning,
Error,
FatalError,
Count
}
public enum EventClass
{
Undefined,
EquipmentHW,
Metrology,
TestingProcess,
BadResults,
ComputerResources,
Network,
Other,
Count
}
public enum SubscriberGroup : long
{
None = 0,
Metrology = 1,
Maintenance = 2,
Production = 4,
Management = 8,
Finish = 16,
}
public enum EViewerOption
{
Undefined,
AllEvents,
RecentEvents,
UnreadEvents,
}
}
+1
View File
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using Common;
namespace Events.Entities
{
+6 -1
View File
@@ -56,7 +56,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="DB.cs" />
<Compile Include="Entities\Enums.cs" />
<Compile Include="Entities\Event.cs" />
<Compile Include="Entities\Subscriber.cs" />
<Compile Include="Utils.cs" />
@@ -67,6 +66,12 @@
<ItemGroup>
<Folder Include="DeliveryServices\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</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.
+1
View File
@@ -3,6 +3,7 @@
///
using System;
using System.Drawing;
using Common;
using Events.Entities;
namespace Events
+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>
+280
View File
@@ -0,0 +1,280 @@
namespace FeatureVectorCalculator
{
partial class CalculatorWnd
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.rawFileComboBox = new System.Windows.Forms.ComboBox();
this.browseButton = new System.Windows.Forms.Button();
this.resultsTextBox = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.tabPage8 = new System.Windows.Forms.TabPage();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
this.tabControl1.SuspendLayout();
this.SuspendLayout();
//
// rawFileComboBox
//
this.rawFileComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.rawFileComboBox.FormattingEnabled = true;
this.rawFileComboBox.Location = new System.Drawing.Point(0, 0);
this.rawFileComboBox.Name = "rawFileComboBox";
this.rawFileComboBox.Size = new System.Drawing.Size(1040, 21);
this.rawFileComboBox.TabIndex = 0;
//
// browseButton
//
this.browseButton.Location = new System.Drawing.Point(7, 0);
this.browseButton.Name = "browseButton";
this.browseButton.Size = new System.Drawing.Size(66, 37);
this.browseButton.TabIndex = 1;
this.browseButton.Text = "Browse";
this.browseButton.UseVisualStyleBackColor = true;
this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
//
// resultsTextBox
//
this.resultsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.resultsTextBox.Location = new System.Drawing.Point(0, 0);
this.resultsTextBox.Multiline = true;
this.resultsTextBox.Name = "resultsTextBox";
this.resultsTextBox.Size = new System.Drawing.Size(1127, 156);
this.resultsTextBox.TabIndex = 3;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
this.splitContainer1.Size = new System.Drawing.Size(1127, 733);
this.splitContainer1.SplitterDistance = 200;
this.splitContainer1.TabIndex = 4;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.resultsTextBox);
this.splitContainer2.Size = new System.Drawing.Size(1127, 200);
this.splitContainer2.SplitterDistance = 40;
this.splitContainer2.TabIndex = 3;
//
// splitContainer3
//
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer3.Location = new System.Drawing.Point(0, 0);
this.splitContainer3.Name = "splitContainer3";
//
// splitContainer3.Panel1
//
this.splitContainer3.Panel1.Controls.Add(this.rawFileComboBox);
//
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.browseButton);
this.splitContainer3.Size = new System.Drawing.Size(1127, 40);
this.splitContainer3.SplitterDistance = 1040;
this.splitContainer3.TabIndex = 0;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage5);
this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Controls.Add(this.tabPage8);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1127, 529);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1119, 503);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "OffsetV";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1119, 503);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "KOhmsR";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1119, 503);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "KOhmsC";
this.tabPage3.UseVisualStyleBackColor = true;
//
// tabPage4
//
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(1119, 503);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "DutFlowLph";
this.tabPage4.UseVisualStyleBackColor = true;
//
// tabPage5
//
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(1119, 503);
this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "RefFlowLph";
this.tabPage5.UseVisualStyleBackColor = true;
//
// tabPage6
//
this.tabPage6.Location = new System.Drawing.Point(4, 22);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Size = new System.Drawing.Size(1119, 503);
this.tabPage6.TabIndex = 5;
this.tabPage6.Text = "FlowRatio";
this.tabPage6.UseVisualStyleBackColor = true;
//
// tabPage7
//
this.tabPage7.Location = new System.Drawing.Point(4, 22);
this.tabPage7.Name = "tabPage7";
this.tabPage7.Size = new System.Drawing.Size(1119, 503);
this.tabPage7.TabIndex = 6;
this.tabPage7.Text = "MagField";
this.tabPage7.UseVisualStyleBackColor = true;
//
// tabPage8
//
this.tabPage8.Location = new System.Drawing.Point(4, 22);
this.tabPage8.Name = "tabPage8";
this.tabPage8.Size = new System.Drawing.Size(1119, 503);
this.tabPage8.TabIndex = 7;
this.tabPage8.Text = "EmfV";
this.tabPage8.UseVisualStyleBackColor = true;
//
// CalculatorWnd
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1127, 733);
this.Controls.Add(this.splitContainer1);
this.Name = "CalculatorWnd";
this.Text = "Feature vector calculator";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox rawFileComboBox;
private System.Windows.Forms.Button browseButton;
private System.Windows.Forms.TextBox resultsTextBox;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.TabPage tabPage8;
}
}
+148
View File
@@ -0,0 +1,148 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using Common.Iperl;
using System.Globalization;
using System.Drawing;
namespace FeatureVectorCalculator
{
public partial class CalculatorWnd : Form
{
public const int MaxOptoDataCount = 40000;
public const bool Downsample = true;
public const bool Extend = true;
OptoTelegramRaw[] optoData;
Int64 volumeRawExtLast;
Int64 timestampExtLast;
public CalculatorWnd()
{
InitializeComponent();
optoData = new OptoTelegramRaw[MaxOptoDataCount];
for (int i = 0; i < MaxOptoDataCount; i++)
{
optoData[i] = new OptoTelegramRaw();
}
}
void ClearOutput()
{
resultsTextBox.Clear();
tabControl1.TabPages[0].Controls.Clear();
tabControl1.TabPages[1].Controls.Clear();
tabControl1.TabPages[2].Controls.Clear();
tabControl1.TabPages[3].Controls.Clear();
tabControl1.TabPages[4].Controls.Clear();
tabControl1.TabPages[5].Controls.Clear();
tabControl1.TabPages[6].Controls.Clear();
tabControl1.TabPages[7].Controls.Clear();
}
private void browseButton_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
rawFileComboBox.Text = ofd.FileName;
ProcessRawDataFile(ofd.FileName);
}
}
void ProcessRawDataFile(string fileName)
{
int counter = 0;
int startIx = -1;
int endIx = -1;
ClearOutput();
resultsTextBox.Text = string.Format("File name: {0}{1}", fileName, Environment.NewLine);
try
{
using (StreamReader reader = new StreamReader(fileName))
{
string line;
while ((line = reader.ReadLine()) != null && counter < MaxOptoDataCount)
{
int ix = line.IndexOf(" :\t");
string[] items = line.Split('\t');
if (items.Length > 18)
{
string telegram = string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\r\n",
items[2], items[3], items[4], items[5], items[6], items[7], items[8]);
if (optoData[counter].UpdateFromString(telegram, counter, 0, ref volumeRawExtLast, ref timestampExtLast))
{
if (line.EndsWith("#### start test ####"))
{
startIx = counter;
optoData[counter].Flags = OptoTelegramFlags.OK_TestStart;
}
else if (line.EndsWith("#### end of test ####"))
{
endIx = counter;
optoData[counter].Flags = OptoTelegramFlags.OK_TestEnd;
}
else
{
optoData[counter].Flags = OptoTelegramFlags.OK;
}
}
optoData[counter].RefFlow = float.Parse(items[15].Replace(',', '.'), CultureInfo.InvariantCulture);
}
else
{
optoData[counter].Flags = OptoTelegramFlags.InvalidTelegram;
}
counter++;
}
reader.Close();
}
}
catch (Exception exc)
{
MessageBox.Show(string.Format("Exception: {0}", exc.Message));
return;
}
int start = Extend ? 0 : startIx;
int end = Extend ? (counter - 1) : endIx;
float[] offsetV, kOhmsR, kOhmsC, dutFlow, refFlow, flowRatio, magField, emfV;
PointF[] outliers, extendedOutliers;
float[] featureVector = Common.StatisticalMetrics.Calculate(optoData, counter, start, end, Downsample,
out offsetV, out kOhmsR, out kOhmsC, out dutFlow,
out refFlow, out flowRatio, out magField, out emfV,
out outliers, out extendedOutliers);
for (int i = 0; i < Math.Min(9, featureVector.Length); i++)
{
resultsTextBox.Text += string.Format("X{0} = {1}{2}", i + 1, featureVector[i], Environment.NewLine);
}
float period = Downsample ? 0.5F : 0.125F;
if (offsetV != null) tabControl1.TabPages[0].Controls.Add(SignalChart.GetChart(offsetV, period, "OffsetV", "OffsetV [μV]"));
if (kOhmsR != null) tabControl1.TabPages[1].Controls.Add(SignalChart.GetChart(kOhmsR, period, "kOhmsR", "kΩ"));
if (kOhmsC != null) tabControl1.TabPages[2].Controls.Add(SignalChart.GetChart(kOhmsC, period, "kOhmsC", "kΩ"));
if (dutFlow != null) tabControl1.TabPages[3].Controls.Add(SignalChart.GetChart(dutFlow, period, "dutFlow", "L/h"));
if (refFlow != null) tabControl1.TabPages[4].Controls.Add(SignalChart.GetChart(refFlow, period, "refFlow", "L/h"));
if (flowRatio != null) tabControl1.TabPages[5].Controls.Add(SignalChart.GetChart(flowRatio, period, "flowRatio", "", true, extendedOutliers, outliers));
if (magField != null) tabControl1.TabPages[6].Controls.Add(SignalChart.GetChart(magField, period, "magField", "μV", false));
if (emfV != null) tabControl1.TabPages[7].Controls.Add(SignalChart.GetChart(emfV, period, "emfV", "μV"));
}
}
}
@@ -0,0 +1,100 @@
<?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>{6280F3F9-139A-48E3-8C88-25EB4124E982}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FeatureVectorCalculator</RootNamespace>
<AssemblyName>FeatureVectorCalculator</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>
<PropertyGroup>
<StartupObject>FeatureVectorCalculator.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CalculatorWnd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CalculatorWnd.Designer.cs">
<DependentUpon>CalculatorWnd.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SignalChart.cs" />
<EmbeddedResource Include="CalculatorWnd.resx">
<DependentUpon>CalculatorWnd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</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>
+25
View File
@@ -0,0 +1,25 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FeatureVectorCalculator
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CalculatorWnd());
}
}
}
@@ -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("FeatureVectorCalculator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FeatureVectorCalculator")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4d3a6fe2-3153-4581-8ec7-e5a386b50177")]
// 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")]
+63
View File
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FeatureVectorCalculator.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// 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.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FeatureVectorCalculator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FeatureVectorCalculator.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace FeatureVectorCalculator
{
public class SignalChart
{
public static Chart GetChart(float[] data, float period, string caption, string captionY, bool fromZero = true,
PointF[] extendedOutliers = null, PointF[] outliers = null)
{
Series series1 = null, series2 = null, series3 = null;
series1 = new Series { Name = caption, ChartArea = "area1", ChartType = SeriesChartType.Line, Color = Color.DeepSkyBlue };
float minY = float.MaxValue;
float maxY = float.MinValue;
for (int x = 0; x < data.Length; x++)
{
float y = data[x];
if (minY > y) minY = y;
if (maxY < y) maxY = y;
series1.Points.AddXY(x * period, y);
}
if (extendedOutliers != null)
{
series2 = new Series { Name = "extended outliers", ChartArea = "area1", ChartType = SeriesChartType.Point, Color = Color.Yellow };
for (int i = 0; i < extendedOutliers.Length; i++)
{
series2.Points.AddXY(extendedOutliers[i].X * period, extendedOutliers[i].Y);
}
}
if (outliers != null)
{
series3 = new Series { Name = "outliers", ChartArea = "area1", ChartType = SeriesChartType.Point, Color = Color.DarkRed };
for (int i = 0; i < outliers.Length; i++)
{
series3.Points.AddXY(outliers[i].X * period, outliers[i].Y);
}
}
ChartArea chArea = new ChartArea { Name = "area1" };
chArea.AxisX.Title = "Time [s]";
chArea.AxisX.IsLogarithmic = false;
chArea.AxisX.IsLabelAutoFit = true;
chArea.AxisX.Minimum = 0;
chArea.AxisX.Maximum = (data.Length - 1) * period;
// for (int j = i; j < i + 3; j++)
// {
// CustomLabel cl = new CustomLabel();
// cl.Text = string.Format("{0} {1}", xs[j], flowUnit.ToDescription());
// cl.FromPosition = Math.Log10(xs[j] * spacer);
// cl.ToPosition = Math.Log10(xs[j] / spacer);
// chArea.AxisX.CustomLabels.Add(cl);
// }
chArea.AxisY.Title = captionY;
chArea.AxisY.IsLogarithmic = false;
chArea.AxisY.IsLabelAutoFit = true;
chArea.AxisY.IsStartedFromZero = fromZero;
chArea.AxisY.Minimum = chArea.AxisY.IsStartedFromZero ? 0 : minY;
chArea.AxisY.Maximum = 1.1 * maxY;
if (chArea.AxisY.Maximum == chArea.AxisY.Minimum)
{
chArea.AxisY.Maximum = chArea.AxisY.Maximum + 1;
}
Chart chart = new Chart { Text = caption, Dock = DockStyle.Fill };
chart.ChartAreas.Add(chArea);
chart.Series.Add(series1);
if (series2 != null) chart.Series.Add(series2);
if (series3 != null) chart.Series.Add(series3);
return chart;
}
}
}
+58 -50
View File
@@ -199,7 +199,8 @@ namespace GemCard
{
Disconnect(DISCONNECT.Unpower);
ReleaseContext();
try { ReleaseContext(); }
catch { }
}
#region ICard Members
@@ -215,66 +216,73 @@ namespace GemCard
/// <returns>A string array of the readers</returns>
public override string[] ListReaders()
{
EstablishContext(SCOPE.User);
try
{
EstablishContext(SCOPE.User);
string[] sListReaders = null;
UInt32 pchReaders = 0;
IntPtr szListReaders = IntPtr.Zero;
string[] sListReaders = null;
UInt32 pchReaders = 0;
IntPtr szListReaders = IntPtr.Zero;
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
szListReaders = Marshal.AllocHGlobal((int) pchReaders);
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
char[] caReadersData = new char[pchReaders];
int nbReaders = 0;
for (int nI = 0; nI < pchReaders; nI++)
{
caReadersData[nI] = (char) Marshal.ReadByte(szListReaders, nI);
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
szListReaders = Marshal.AllocHGlobal((int)pchReaders);
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
char[] caReadersData = new char[pchReaders];
int nbReaders = 0;
for (int nI = 0; nI < pchReaders; nI++)
{
caReadersData[nI] = (char)Marshal.ReadByte(szListReaders, nI);
if (caReadersData[nI] == 0)
nbReaders++;
}
if (caReadersData[nI] == 0)
nbReaders++;
}
// Remove last 0
--nbReaders;
// Remove last 0
--nbReaders;
if (nbReaders != 0)
{
sListReaders = new string[nbReaders];
char[] caReader = new char[pchReaders];
int nIdx = 0;
int nIdy = 0;
int nIdz = 0;
// Get the nJ string from the multi-string
if (nbReaders != 0)
{
sListReaders = new string[nbReaders];
char[] caReader = new char[pchReaders];
int nIdx = 0;
int nIdy = 0;
int nIdz = 0;
// Get the nJ string from the multi-string
while(nIdx < pchReaders - 1)
{
caReader[nIdy] = caReadersData[nIdx];
if (caReader[nIdy] == 0)
{
sListReaders[nIdz] = new string(caReader, 0, nIdy);
++nIdz;
nIdy = 0;
caReader = new char[pchReaders];
}
else
++nIdy;
while (nIdx < pchReaders - 1)
{
caReader[nIdy] = caReadersData[nIdx];
if (caReader[nIdy] == 0)
{
sListReaders[nIdz] = new string(caReader, 0, nIdy);
++nIdz;
nIdy = 0;
caReader = new char[pchReaders];
}
else
++nIdy;
++nIdx;
}
}
++nIdx;
}
}
}
}
Marshal.FreeHGlobal(szListReaders);
}
Marshal.FreeHGlobal(szListReaders);
}
ReleaseContext();
ReleaseContext();
return sListReaders;
return sListReaders;
}
catch
{
return new string[0];
}
}
/// <summary>
+2 -2
View File
@@ -97,7 +97,7 @@
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
@@ -110,7 +110,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
+2 -2
View File
@@ -20,7 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -29,7 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+34 -37
View File
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Common;
using Results.Entities;
namespace Results
@@ -71,9 +72,9 @@ namespace Results
RealDensity = realDensity,
AtTemperature = atTemperature,
Buoyancy = buoyancy,
Compound = (procedure.MetersKind == Config.Entities.MetersKind.Combined),
Compound = (procedure.MetersKind == MetersKind.Combined),
#if HEAT_METERS
HeatMeter = (procedure.MetersKind == Config.Entities.MetersKind.HeatMeter),
HeatMeter = (procedure.MetersKind == MetersKind.HeatMeter),
#endif
};
@@ -101,45 +102,41 @@ namespace Results
}
}
foreach (var t in procedure.Tests)
foreach (var ti in procedure.GetTestInstances())
{
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
TestData td = TestData.UpdateList(d.TestDataList, new TestData(ti.Test));
for (int rnr = 1; rnr <= t.Repeats; rnr++)
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, ti.Test.Part, ti.Repetition);
d.Batch.TestRslts.Add(tr);
for (int i = 0; i < d.WMPositionsCount; i++)
{
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
d.Batch.TestRslts.Add(tr);
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (!d.Batch.WaterMeters[i].Disabled && t.IsPartCompatible(waterMeterParts[i]))
if (!d.Batch.WaterMeters[i].Disabled && ti.Test.IsPartCompatible(waterMeterParts[i]))
{
///
/// Create empty watermeter test results and add them to the list and to dictionaries
///
IList<MeterTestRslt> wmtrs = d.Batch.WaterMeters[i].MeterTestRslts;
if (d.Batch.Compound)
{
///
/// Create empty watermeter test results and add them to the list and to dictionaries
///
IList<MeterTestRslt> wmtrs = d.Batch.WaterMeters[i].MeterTestRslts;
if (d.Batch.Compound)
{
/// Compound water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound));
}
else if (d.Batch.HeatMeter)
{
/// Heat meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterVolume));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.HeatMeterEnergy));
}
else
{
/// Water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single));
}
/// Compound water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.CompoundMain));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.CompoundAux));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.Compound));
}
}
else if (d.Batch.HeatMeter)
{
/// Heat meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.HeatMeterVolume));
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.HeatMeterEnergy));
}
else
{
/// Water meter
wmtrs.Add(new MeterTestRslt(d.Batch.WaterMeters[i], tr, CompoundMeterId.Single));
}
}
}
}
@@ -176,7 +173,7 @@ namespace Results
return Batch.GetTestRslt(name, part);
}
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, Config.Entities.CompoundMeterId meterId)
public MeterTestRslt GetMeterTestRslt(string name, int wmNr0, CompoundMeterId meterId)
{
if (Batch.WaterMeters != null && Batch.WaterMeters.Count > wmNr0 && !Batch.WaterMeters[wmNr0].Disabled)
{
+4 -4
View File
@@ -37,9 +37,9 @@ namespace Results
}
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
private static Users.Entities.DBType dbType;
private static Common.DBType dbType;
///
public static Users.Entities.DBType DbType
public static Common.DBType DbType
{
get { return dbType; }
set { dbType = value; SessionFactory = null; }
@@ -66,10 +66,10 @@ namespace Results
switch (dbType)
{
default:
case Users.Entities.DBType.MySql:
case Common.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
case Users.Entities.DBType.SQLite:
case Common.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
}
+7 -6
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using Common;
namespace Results.Entities
{
@@ -257,7 +258,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbTempStart;
}
return 0;
@@ -266,7 +267,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbPressStart;
}
return 0;
@@ -275,7 +276,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbHumiStart;
}
return 0;
@@ -285,7 +286,7 @@ namespace Results.Entities
{
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbTempEnd;
}
return 0;
@@ -294,7 +295,7 @@ namespace Results.Entities
{
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbPressEnd;
}
return 0;
@@ -303,7 +304,7 @@ namespace Results.Entities
{
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbHumiEnd;
}
return 0;
+107 -21
View File
@@ -1,9 +1,10 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using Common;
namespace Results.Entities
{
@@ -27,10 +28,27 @@ namespace Results.Entities
public virtual double Error { get; set; } /// [%]
public virtual long ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (error flags)
public virtual long InfoIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (info flags)
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
#if IPERL
public virtual int CalibFactor { get; set; }
public virtual int CalibFactorLNA { get; set; }
public virtual int Q2CorrRL { get; set; }
public virtual int Q2CorrLR { get; set; }
public virtual int FlowDirection { get; set; } /// 0=unknown, 1=RL, 2=LR
public virtual string ExtraDataPath { get; set; } /// Relative path to a file with opto-data/raw-data
public virtual float X1 { get; set; }
public virtual float X2 { get; set; }
public virtual float X3 { get; set; }
public virtual float X4 { get; set; }
public virtual float X5 { get; set; }
public virtual float X6 { get; set; }
public virtual float X7 { get; set; }
public virtual float X8 { get; set; }
public virtual float X9 { get; set; }
#endif
#if ORACLE_DB
public virtual double ErrorBC { get; set; } /// [%] error before correction, saved to Oracle to table VT_PRUEFREIHE_IST_PD as KorrErrQ
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
#endif
@@ -40,9 +58,9 @@ namespace Results.Entities
///
/// Wrappers
///
public virtual string Name() { return TestRslt.Name(); }
public virtual string Name() { return TestRslt.Name(); }
public virtual DateTime StartTime() { return TestRslt.StartTime; }
public virtual DateTime EndTime() { return TestRslt.EndTime; }
public virtual DateTime EndTime() { return TestRslt.EndTime; }
public virtual double FlowSetTime() { return TestRslt.FlowSetTime; } /// [s]
public virtual double FlowMass() { return TestRslt.FlowMass; } /// [kg/h]
public virtual double FlowVolume() { return TestRslt.FlowVolume; } /// [m3/h]
@@ -70,23 +88,23 @@ namespace Results.Entities
public virtual double QRise() { return WaterMeter.QRise; } /// [m3/h]
public virtual double QFall() { return WaterMeter.QFall; } /// [m3/h]
public virtual bool Evaluate() { return TestData().Evaluate; }
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData().Publish; }
public virtual bool Evaluate() { return TestData().Evaluate; }
public virtual Common.Publish Publish() { return (Publish)TestData().Publish; }
public virtual WaterMeterData WaterMeterData() { return WaterMeter.WaterMeterData; }
public virtual Batch Batch() { return WaterMeter.Batch; }
public virtual bool IsPilotRslt()
{
return (CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Single) ||
(CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Compound) ||
(CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy);
return (CompoundMeterId == (byte)Common.CompoundMeterId.Single) ||
(CompoundMeterId == (byte)Common.CompoundMeterId.Compound) ||
(CompoundMeterId == (byte)Common.CompoundMeterId.HeatMeterEnergy);
}
public virtual bool IsPulses() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Pulses || RegReaderType == (int)Config.Entities.RegisterReaderType.Unknown); }
public virtual bool IsCamera() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Camera); }
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
public virtual bool IsPulses() { return (RegReaderType == (int)RegisterReaderType.Pulses || RegReaderType == (int)RegisterReaderType.Unknown); }
public virtual bool IsCamera() { return (RegReaderType == (int)RegisterReaderType.Camera); }
public virtual bool IsDataStream() { return (RegReaderType == (int)RegisterReaderType.DataStream); }
public virtual bool IsManual() { return (RegReaderType == (int)RegisterReaderType.Manual); }
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
{
@@ -107,7 +125,7 @@ namespace Results.Entities
Passed = false;
}
public MeterTestRslt(WaterMeter waterMeterRslt, TestRslt testRslt, Config.Entities.CompoundMeterId compoundMeterId)
public MeterTestRslt(WaterMeter waterMeterRslt, TestRslt testRslt, CompoundMeterId compoundMeterId)
: this()
{
WaterMeter = waterMeterRslt;
@@ -137,11 +155,28 @@ namespace Results.Entities
Error = oriMTR.Error;
ErrorIndicators = oriMTR.ErrorIndicators;
InfoIndicators = oriMTR.InfoIndicators;
KorrErrQ = oriMTR.KorrErrQ;
TestDone = oriMTR.TestDone;
Passed = oriMTR.Passed;
#if IPERL
CalibFactor = oriMTR.CalibFactor;
CalibFactorLNA = oriMTR.CalibFactorLNA;
Q2CorrRL = oriMTR.Q2CorrRL;
Q2CorrLR = oriMTR.Q2CorrLR;
FlowDirection = oriMTR.FlowDirection;
ExtraDataPath = oriMTR.ExtraDataPath;
X1 = oriMTR.X1;
X2 = oriMTR.X2;
X3 = oriMTR.X3;
X4 = oriMTR.X4;
X5 = oriMTR.X5;
X6 = oriMTR.X6;
X7 = oriMTR.X7;
X8 = oriMTR.X8;
X9 = oriMTR.X9;
#endif
#if ORACLE_DB
LastError = oriMTR.LastError;
ErrorBC = oriMTR.ErrorBC;
LastError = oriMTR.LastError;
#endif
}
@@ -164,11 +199,28 @@ namespace Results.Entities
Error = src.Error;
ErrorIndicators = src.ErrorIndicators;
InfoIndicators = src.InfoIndicators;
KorrErrQ = src.KorrErrQ;
TestDone = src.TestDone;
Passed = src.Passed;
#if IPERL
CalibFactor = src.CalibFactor;
CalibFactorLNA = src.CalibFactorLNA;
Q2CorrRL = src.Q2CorrRL;
Q2CorrLR = src.Q2CorrLR;
FlowDirection = src.FlowDirection;
ExtraDataPath = src.ExtraDataPath;
X1 = src.X1;
X2 = src.X2;
X3 = src.X3;
X4 = src.X4;
X5 = src.X5;
X6 = src.X6;
X7 = src.X7;
X8 = src.X8;
X9 = src.X9;
#endif
#if ORACLE_DB
LastError = src.LastError;
ErrorBC = src.ErrorBC;
LastError = src.LastError;
#endif
}
@@ -195,10 +247,27 @@ namespace Results.Entities
writer.Write(Error);
writer.Write(ErrorIndicators);
writer.Write(InfoIndicators);
writer.Write(KorrErrQ);
writer.Write(TestDone);
writer.Write(Passed);
#if IPERL
writer.Write(CalibFactor);
writer.Write(CalibFactorLNA);
writer.Write(Q2CorrRL);
writer.Write(Q2CorrLR);
writer.Write(FlowDirection);
writer.Write((ExtraDataPath != null) ? ExtraDataPath : string.Empty);
writer.Write(X1);
writer.Write(X2);
writer.Write(X3);
writer.Write(X4);
writer.Write(X5);
writer.Write(X6);
writer.Write(X7);
writer.Write(X8);
writer.Write(X9);
#endif
#if ORACLE_DB
writer.Write(ErrorBC);
writer.Write(LastError);
#endif
writer.Write((TestRslt != null && TestRslt.Name() != null) ? TestRslt.Name() : string.Empty);
@@ -223,10 +292,27 @@ namespace Results.Entities
Error = reader.ReadDouble();
ErrorIndicators = reader.ReadInt64();
InfoIndicators = reader.ReadInt64();
KorrErrQ = reader.ReadDouble();
TestDone = reader.ReadBoolean();
Passed = reader.ReadBoolean();
#if IPERL
CalibFactor = reader.ReadInt32();
CalibFactorLNA = reader.ReadInt32();
Q2CorrRL = reader.ReadInt32();
Q2CorrLR = reader.ReadInt32();
FlowDirection = reader.ReadInt32();
ExtraDataPath = reader.ReadString();
X1 = reader.ReadSingle();
X2 = reader.ReadSingle();
X3 = reader.ReadSingle();
X4 = reader.ReadSingle();
X5 = reader.ReadSingle();
X6 = reader.ReadSingle();
X7 = reader.ReadSingle();
X8 = reader.ReadSingle();
X9 = reader.ReadSingle();
#endif
#if ORACLE_DB
ErrorBC = reader.ReadDouble();
LastError = reader.ReadDouble();
#endif
TestRslt = null;
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Results.Entities
Qfrom = (double)test.Qfrom;
Qto = (double)test.Qto;
TargetVolume = (double)test.Volume;
TargetTime = (double)test.TstTime;
TargetTime = (double)test.TestTime;
Method = test.Method;
ErrLimLo = (double)test.ErrLimLo;
ErrLimHi = (double)test.ErrLimHi;
+6 -2
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Common;
namespace Results.Entities
{
@@ -153,7 +154,10 @@ namespace Results.Entities
public virtual double TargetVolume() { return TestData.TargetVolume; }
public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; }
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; }
public virtual string RefFlowmeter() { return (Components != null && Components.Flowmeter != null) ? Components.Flowmeter : string.Empty; }
public virtual string Scale() { return (Components != null && Components.Scale != null) ? Components.Scale : string.Empty; }
public virtual string Diverter() { return (Components != null && Components.Diverter != null) ? Components.Diverter : string.Empty; }
public virtual string RegValve() { return (Components != null && Components.RegValve != null) ? Components.RegValve : string.Empty; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest") || MethodClass.Contains("ManualEntry")) : true; }
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest") || TestData.Method.ToLower().Contains("pmax")) : true; }
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
@@ -225,7 +229,7 @@ namespace Results.Entities
public virtual float TempLimLo() { return TestData.TempLimLo; }
public virtual float TempLimHi() { return TestData.TempLimHi; }
public virtual bool Evaluate() { return TestData.Evaluate; }
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
public virtual Publish Publish() { return (Publish)TestData.Publish; }
public TestRslt()
+54 -51
View File
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Config.Entities;
using Common;
using Results.Resources;
namespace Results.Entities
@@ -43,8 +43,9 @@ namespace Results.Entities
{
public virtual int Id { get; protected set; }
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter
public virtual string PurchaseOrder { get; set; }
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ eRegister PCB Number of a 640 water meter
public virtual string RadioAddress { get; set; }
public virtual string PurchaseOrder { get; set; }
public virtual int YearOfProduction { get; set; }
public virtual int WMPosition { get; set; } /// 1-based water meter position
public virtual string EndState { get; set; } /// End state (of the main water meter)
@@ -76,7 +77,6 @@ namespace Results.Entities
/// <summary>
/// Data from a production test bench (in case of tests on iPerl special)
/// </summary>
public virtual string RadioAddress { get; set; }
public virtual int PaletteNr { get; set; }
public virtual int UmkartonNr { get; set; }
public virtual string ProdTestBench { get; set; }
@@ -93,15 +93,16 @@ namespace Results.Entities
public virtual string Prefix { get; set; }
public virtual string Suffix { get; set; }
public virtual string CompleteSerialNr { get; set; }
public virtual string OriRadioAddress { get; set; } /// Original radio address of a 640 water meter (AlbatrosID)
public virtual int WMTypeRevision { get; set; }
public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex
public virtual int HydrPruefung { get; set; }
public virtual object RawTestInfos { get; set; } /// IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
public virtual object RawTestInfos { get; set; } /// Not mapped to DB !!! IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
public virtual object CompleteTestInfos { get; set; } /// Not mapped to DB !!! SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
#endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
@@ -329,7 +330,7 @@ namespace Results.Entities
return GetMeterTestRslt(testName, CompoundMeterId.SingleOrCompound);
}
public virtual MeterTestRslt GetMeterTestRslt(string testName, Config.Entities.CompoundMeterId meterId)
public virtual MeterTestRslt GetMeterTestRslt(string testName, CompoundMeterId meterId)
{
if (string.IsNullOrEmpty(testName)) return null;
if (Disabled) return null;
@@ -343,18 +344,15 @@ namespace Results.Entities
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Single)
else if (meterId == CompoundMeterId.SingleOrCompound && mtr.CompoundMeterId == (byte)CompoundMeterId.Single)
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.Compound)
else if (meterId == CompoundMeterId.SingleOrCompound && mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
else if (meterId == CompoundMeterId.SingleOrCompound && mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
{
return mtr;
}
@@ -420,11 +418,31 @@ namespace Results.Entities
public WaterMeter()
{
MeterTestRslts = new List<MeterTestRslt>();
/// Initialize strings
SerialNr = string.Empty;
SerialNrAux = string.Empty;
RadioAddress = string.Empty;
PurchaseOrder = string.Empty;
EndState = string.Empty;
EndStateAux = string.Empty;
ErrorFlags = 0;
InfoFlags = 0;
ArchivePath = string.Empty;
Remark = string.Empty;
#if IPERL
FWVersion = string.Empty;
#endif
#if TURA_SPECIAL
ProdUserName = string.Empty;
ProdPurchaseOrder = string.Empty;
#endif
#if ORACLE_DB
AssignedSerialNr = 0;
Prefix = string.Empty;
Suffix = string.Empty;
CompleteSerialNr = string.Empty;
OriRadioAddress = string.Empty;
WMTypeRevision = 0;
Pruefindex = 1;
HydrPruefung = 0;
@@ -433,25 +451,7 @@ namespace Results.Entities
#endif
ProcessId = 0;
SessionId = 0;
ErrorFlags = 0;
LastRecordIsNok = false;
/// Initialize strings
SerialNr = string.Empty;
SerialNrAux = string.Empty;
PurchaseOrder = string.Empty;
EndState = string.Empty;
EndStateAux = string.Empty;
ArchivePath = string.Empty;
Remark = string.Empty;
#if TURA_SPECIAL
RadioAddress = string.Empty;
ProdUserName = string.Empty;
ProdPurchaseOrder = string.Empty;
#endif
#if IPERL
FWVersion = string.Empty;
#endif
}
@@ -461,6 +461,7 @@ namespace Results.Entities
SerialNr = src.SerialNr;
SerialNrAux = src.SerialNrAux;
RadioAddress = src.RadioAddress;
PurchaseOrder = src.PurchaseOrder;
YearOfProduction = src.YearOfProduction;
WMPosition = src.WMPosition;
@@ -489,23 +490,23 @@ namespace Results.Entities
FWVersion = src.FWVersion;
#endif
#if TURA_SPECIAL
RadioAddress = src.RadioAddress;
PaletteNr = src.PaletteNr;
UmkartonNr = src.UmkartonNr;
ProdTestBench = src.ProdTestBench;
ProdWMPosition = src.ProdWMPosition;
ProdUserName = src.ProdUserName;
ProdPurchaseOrder = src.ProdPurchaseOrder;
ProdPassed = src.ProdPassed;
ProdResultCode = src.ProdResultCode;
ProdQ2CorrRL = src.ProdQ2CorrRL;
ProdQ2CorrLR = src.ProdQ2CorrLR;
PaletteNr = src.PaletteNr;
UmkartonNr = src.UmkartonNr;
ProdTestBench = src.ProdTestBench;
ProdWMPosition = src.ProdWMPosition;
ProdUserName = src.ProdUserName;
ProdPurchaseOrder = src.ProdPurchaseOrder;
ProdPassed = src.ProdPassed;
ProdResultCode = src.ProdResultCode;
ProdQ2CorrRL = src.ProdQ2CorrRL;
ProdQ2CorrLR = src.ProdQ2CorrLR;
#endif
#if ORACLE_DB
AssignedSerialNr = src.AssignedSerialNr;
Prefix = src.Prefix;
Suffix = src.Suffix;
CompleteSerialNr = src.CompleteSerialNr;
OriRadioAddress = src.OriRadioAddress;
WMTypeRevision = src.WMTypeRevision;
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
@@ -518,7 +519,7 @@ namespace Results.Entities
foreach (var mtr in MeterTestRslts)
{
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (CompoundMeterId)mtr.CompoundMeterId);
if (srcMtr != null)
{
mtr.CopyContentFrom(srcMtr);
@@ -557,8 +558,8 @@ namespace Results.Entities
{
if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
&& mtr.TestDone
&& (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
&& (mtr.Publish() != Publish.Never)
&& (mtr.Publish() != Publish.Internal))
{
testNames.Add(mtr.Name());
}
@@ -642,6 +643,7 @@ namespace Results.Entities
writer.Write(Id);
writer.Write((SerialNr != null) ? SerialNr : string.Empty);
writer.Write((SerialNrAux != null) ? SerialNrAux : string.Empty);
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
writer.Write((PurchaseOrder != null) ? PurchaseOrder : string.Empty);
writer.Write(YearOfProduction);
writer.Write(WMPosition);
@@ -670,7 +672,6 @@ namespace Results.Entities
writer.Write((FWVersion != null) ? FWVersion : string.Empty);
#endif
#if TURA_SPECIAL
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
writer.Write(PaletteNr);
writer.Write(UmkartonNr);
writer.Write((ProdTestBench != null) ? ProdTestBench : string.Empty);
@@ -687,6 +688,7 @@ namespace Results.Entities
writer.Write((Prefix != null) ? Prefix : string.Empty);
writer.Write((Suffix != null) ? Suffix : string.Empty);
writer.Write((CompleteSerialNr != null) ? CompleteSerialNr : string.Empty);
writer.Write((OriRadioAddress != null) ? OriRadioAddress : string.Empty);
writer.Write(WMTypeRevision);
writer.Write(Pruefindex);
writer.Write(HydrPruefung);
@@ -737,6 +739,7 @@ namespace Results.Entities
Id = reader.ReadInt32();
SerialNr = reader.ReadString();
SerialNrAux = reader.ReadString();
RadioAddress = reader.ReadString();
PurchaseOrder = reader.ReadString();
YearOfProduction = reader.ReadInt32();
WMPosition = reader.ReadInt32();
@@ -765,7 +768,6 @@ namespace Results.Entities
FWVersion = reader.ReadString();
#endif
#if TURA_SPECIAL
RadioAddress = reader.ReadString();
PaletteNr = reader.ReadInt32();
UmkartonNr = reader.ReadInt32();
ProdTestBench = reader.ReadString();
@@ -782,6 +784,7 @@ namespace Results.Entities
Prefix = reader.ReadString();
Suffix = reader.ReadString();
CompleteSerialNr = reader.ReadString();
OriRadioAddress = reader.ReadString();
WMTypeRevision = reader.ReadInt32();
Pruefindex = reader.ReadInt32();
HydrPruefung = reader.ReadInt32();
+7 -7
View File
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Config.Entities;
using Common;
namespace Results.Entities
{
@@ -204,17 +204,17 @@ namespace Results.Entities
Producer = reader.ReadString();
DN = reader.ReadDouble();
L = reader.ReadDouble();
Mounting = (Config.Entities.Mounting)reader.ReadInt32();
Mounting = (Mounting)reader.ReadInt32();
NewQnames = reader.ReadBoolean();
Q4_Qmax = reader.ReadDouble();
Q3_Qn = reader.ReadDouble();
Q2_Qt = reader.ReadDouble();
Q1_Qmin = reader.ReadDouble();
MetrologicalClass = reader.ReadString();
TemperatureClass = (Config.Entities.TemperatureClass)reader.ReadInt32();
PressureLossClass = (Config.Entities.PressureLossClass)reader.ReadInt32();
MaxAdmissiblePressure = (Config.Entities.MaxAdmissiblePressure)reader.ReadInt32();
FlowProfileSensitivityClass = (Config.Entities.FlowProfileSensitivityClass)reader.ReadInt32();
TemperatureClass = (TemperatureClass)reader.ReadInt32();
PressureLossClass = (PressureLossClass)reader.ReadInt32();
MaxAdmissiblePressure = (MaxAdmissiblePressure)reader.ReadInt32();
FlowProfileSensitivityClass = (FlowProfileSensitivityClass)reader.ReadInt32();
ApprovalInfo = reader.ReadString();
Certificate = reader.ReadString();
PulsesPerLtr = reader.ReadDouble();
@@ -222,7 +222,7 @@ namespace Results.Entities
Q3_Qn_Aux = reader.ReadDouble();
MetrologicalClassAux = reader.ReadString();
ApprovalInfoAux = reader.ReadString();
Medium = (Config.Entities.Medium)reader.ReadInt32();
Medium = (Medium)reader.ReadInt32();
Text1 = reader.ReadString();
Text2 = reader.ReadString();
Text3 = reader.ReadString();
+2 -2
View File
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Common;
using Results.Resources;
using NHibernate;
using TracingDB.Entities;
@@ -284,7 +284,7 @@ namespace Results.Forms
private void OnTimer(object source, EventArgs e)
{
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0 && !flowLayoutPanel.IsDisposed)
{
/// The last size change was more recent then the last redraw
+2 -1
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Common;
using Config.Entities;
using Results.Resources;
@@ -78,7 +79,7 @@ namespace Results.Forms
unitsCB = new ComboBox();
ComboBox alignmentCB = new ComboBox();
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
for (Alignment a = 0; a < Alignment.Count; a++)
{
alignmentCB.Items.Add(a.ToDescription());
}
+2 -2
View File
@@ -76,8 +76,8 @@ namespace Results.Forms
// foreach (var mtr in wMtr.MeterTestRslts)
// {
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
// mtr.Publish() != Config.Entities.Publish.Internal)
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never &&
// mtr.Publish() != Publish.Internal)
// {
// string str = item.Print(wMtr, mtr.Name());
+7 -6
View File
@@ -5,6 +5,7 @@ using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Common;
namespace Results.Forms
{
@@ -80,7 +81,7 @@ namespace Results.Forms
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
@@ -90,7 +91,7 @@ namespace Results.Forms
#endif
/// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
lView.Columns.Add(wMtr.WMPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
@@ -107,8 +108,8 @@ namespace Results.Forms
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
mtr.Publish() != Config.Entities.Publish.Internal)
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never &&
mtr.Publish() != Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
@@ -139,7 +140,7 @@ namespace Results.Forms
/// Private
///
void Update(int wmPosition)
void UpdateWMPos(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
@@ -148,7 +149,7 @@ namespace Results.Forms
}
}
void Update(Color backColor)
void UpdateBkColor(Color backColor)
{
if (this.bkColor != backColor)
{
+7 -6
View File
@@ -5,6 +5,7 @@ using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Common;
namespace Results.Forms
{
@@ -92,7 +93,7 @@ namespace Results.Forms
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
@@ -101,7 +102,7 @@ namespace Results.Forms
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
Update(wMtr.WMPosition);
UpdateWMPos(wMtr.WMPosition);
/// Update test results
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
@@ -109,8 +110,8 @@ namespace Results.Forms
lView.Items.Clear();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
&& mtr.Publish() != Config.Entities.Publish.Internal)
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never
&& mtr.Publish() != Publish.Internal)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
@@ -149,7 +150,7 @@ namespace Results.Forms
/// Private
///
void Update(int wmPosition)
void UpdateWMPos(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
@@ -158,7 +159,7 @@ namespace Results.Forms
}
}
void Update(Color backColor)
void UpdateBkColor(Color backColor)
{
if (this.bkColor != backColor)
{
+3 -3
View File
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Config.Entities;
using Common;
using Results.Resources;
namespace Results.Forms
@@ -99,7 +99,7 @@ namespace Results.Forms
unitsCB = new ComboBox();
ComboBox alignmentCB = new ComboBox();
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
for (Alignment a = 0; a < Alignment.Count; a++)
{
alignmentCB.Items.Add(a.ToDescription());
}
@@ -187,7 +187,7 @@ namespace Results.Forms
}
case Column.Alignment:
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
for (Alignment a = 0; a < Alignment.Count; a++)
{
if (a.ToDescription().Equals(editors[e.SubItem].Text))
{
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Common;
using Results;
using Results.Resources;
+15
View File
@@ -328,6 +328,21 @@ namespace Results
Conduct_max, /// 278
InfoFlags, /// 279
Scale, /// 280
Diverter, /// 281
RegValve, /// 282
X1, /// 283
X2, /// 284
X3, /// 285
X4, /// 286
X5, /// 287
X6, /// 288
X7, /// 289
X8, /// 290
X9, /// 291
RadioAddress, /// 292
Count,
}
+1 -1
View File
@@ -3,8 +3,8 @@
///
using System;
using System.Collections.Generic;
using Common;
using Config;
using Config.Entities;
using Results.Entities;
using Results.Resources;
using System.Globalization;
+20 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -24,10 +24,27 @@ namespace Results.Mappings
Map(x => x.TimestampEnd);
Map(x => x.TestTime);
Map(x => x.Error);
Map(x => x.TestDone);
Map(x => x.TestDone);
Map(x => x.Passed);
#if IPERL
Map(x => x.CalibFactor);
Map(x => x.CalibFactorLNA);
Map(x => x.Q2CorrRL);
Map(x => x.Q2CorrLR);
Map(x => x.FlowDirection);
Map(x => x.ExtraDataPath);
Map(x => x.X1);
Map(x => x.X2);
Map(x => x.X3);
Map(x => x.X4);
Map(x => x.X5);
Map(x => x.X6);
Map(x => x.X7);
Map(x => x.X8);
Map(x => x.X9);
#endif
#if ORACLE_DB
Map(x => x.LastError);
Map(x => x.ErrorBC).Column("LastError");
#endif
References(x => x.WaterMeter);
References(x => x.TestRslt);
+5 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2017 Sensus Metering Systems
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -13,7 +13,8 @@ namespace Results.Mappings
Id(x => x.Id);
Map(x => x.SerialNr);
Map(x => x.SerialNrAux);
Map(x => x.PurchaseOrder);
Map(x => x.RadioAddress);
Map(x => x.PurchaseOrder);
Map(x => x.YearOfProduction);
Map(x => x.WMPosition);
Map(x => x.EndState);
@@ -43,7 +44,6 @@ namespace Results.Mappings
Map(x => x.FWVersion);
#endif
#if TURA_SPECIAL
Map(x => x.RadioAddress);
Map(x => x.PaletteNr);
Map(x => x.UmkartonNr);
Map(x => x.ProdTestBench);
@@ -60,9 +60,10 @@ namespace Results.Mappings
Map(x => x.Prefix);
Map(x => x.Suffix);
Map(x => x.CompleteSerialNr);
Map(x => x.OriRadioAddress);
Map(x => x.WMTypeRevision);
Map(x => x.Pruefindex);
Map(x => x.HydrPruefung);
Map(x => x.WMTypeRevision);
#endif
References(x => x.WaterMeterData);
References(x => x.Batch);
@@ -7,7 +7,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Common;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
@@ -1,12 +1,13 @@
///
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.Enhanced
{
public class EnhancedPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public string Template;
public int TopMargin;
public int BottomMargin;
@@ -8,7 +8,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities;
using Common;
using Results.Resources;
using GenCode128;
@@ -1,13 +1,14 @@
///
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.Label
{
public class LabelPrinterCfg
{
public string Template; /// Full path to a 'png' file
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public int PaperWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int PaperHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string[] ItemsToPrint;
@@ -8,7 +8,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities;
using Common;
using Results.Resources;
using GenCode128;
@@ -1,12 +1,13 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.MultiLabel
{
public class MultiLabelPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public int LabelColumnsCount;
public int LeftTopLabelLeft;
public int LeftTopLabelTop;
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using Config.Entities;
using Common;
using System.IO;
using Results.Resources;
@@ -120,7 +120,7 @@ namespace Results.Output.Printers.Munich
resultsCount = 0;
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always) resultsCount++;
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always) resultsCount++;
}
pageNr = 1;
@@ -381,7 +381,7 @@ namespace Results.Output.Printers.Munich
int rowCount = 0;
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
if (from <= rowCount && rowCount <= to)
{
@@ -449,7 +449,7 @@ namespace Results.Output.Printers.Munich
int rowCount = 0;
foreach (var mtr in wm.RegularMeterTestRslts())
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
if (from <= rowCount && rowCount <= to)
{
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Common;
using Results.Resources;
namespace Results.Output.Printers.OnePerBatch
@@ -1,13 +1,14 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.OnePerBatch
{
public class OnePerBatchPrinterCfg
{
public string AutoTestParam;
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public string Template;
public int TopMargin;
public int BottomMargin;
@@ -34,9 +35,9 @@ namespace Results.Output.Printers.OnePerBatch
public string[] CommonItems1;
public string[] CommonItems2;
public string[] CommonItems3;
public Config.Entities.TableForm Form;
public TableForm Form;
public string[] TestItems;
public Config.Entities.TableForm Form2;
public TableForm Form2;
public string[] TestItems2;
public int BelowW0Pct;
public int BelowW1Pct;
@@ -7,7 +7,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Common;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
@@ -1,12 +1,13 @@
///
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.OnePerMeter
{
public class OnePerMeterPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public string Template;
public int TopMargin;
public int BottomMargin;
@@ -33,9 +34,9 @@ namespace Results.Output.Printers.OnePerMeter
public string[] CommonItems1;
public string[] CommonItems2;
public string[] CommonItems3;
public Config.Entities.TableForm Form;
public TableForm Form;
public string[] TestItems;
public Config.Entities.TableForm Form2;
public TableForm Form2;
public string[] TestItems2;
public int BelowW0Pct;
public int BelowW1Pct;
+1 -1
View File
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using Config.Entities;
using Common;
namespace Results.Output.Printers
{
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Common;
using Results;
using Results.Resources;
@@ -1,12 +1,13 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
///
using Common;
namespace Results.Output.Printers.Zapiska
{
public class ZapiskaPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public PageOrientation PageOrientation;
public string Template;
public int TopMargin;
public int BottomMargin;
+45 -23
View File
@@ -9,23 +9,25 @@ namespace Results.Output
{
public enum LogType
{
Just_Q3Q2Q1, /// pNrs = -1,3,2,1
Just_Q3Q2Q1_Alt, /// pNrs = -1,5,2,1
Just_Q3Q2adjQ1, /// pNrs = -1,3,2,1
Just_Q3Q2adjQ1_Alt, /// pNrs = -1,5,2,1
JustA0A4_Q3Q2adjQ1, /// pNrs = -2,-1,3,2,1 (Australia 169 MHz)
DEWA, /// Q4, Q3, Q2adj, Q2, Q1
DEWA_wo_Q2, /// Q4, Q3, Q2adj, Q1
Suez, /// Two directions, with Q2 and Q2ac
Suez_smart, /// There is only Q2ac in both directions
Suez_Repeatability, /// 3xQ3, 3xQ2, 3xQ1
Suez_EMP_DN15, /// EMP: 12 flow rates
Suez_EMP_DN20, /// EMP: 12 flow rates
Suez_EMP_DN32, /// EMP: 12 flow rates
Suez_EMP_DN40, /// EMP: 12 flow rates
Greece, /// Q3, Q2adj, Q2, Q1
S620, /// Q3, Q100, Q2, Q1
S620_Alt, /// Q3, Q100, Q2, Q1
Just_Q3Q2Q1, /// pNrs = -1,3,2,1
Just_Q3Q2Q1_Alt, /// pNrs = -1,5,2,1
Just_Q3Q2adjQ1, /// pNrs = -1,3,2,1
Just_Q3Q2adjQ1_Alt, /// pNrs = -1,5,2,1
JustA0A4_Q3Q2adjQ1, /// pNrs = -2,-1,3,2,1 (Australia 169 MHz, raw data pNrs: -2,-1,4,3,2,1)
JustA0A4_Q3Q2Q1, /// pNrs = -2,-1,3,2,1 (Australia 169 MHz smart, raw data pNrs: -2,-1,3,2,1)
DEWA, /// Q4, Q3, Q2adj, Q2, Q1
DEWA_wo_Q2, /// Q4, Q3, Q2adj, Q1
Suez, /// Two directions, with Q2 and Q2ac
Suez_smart, /// There is only Q2ac in both directions
Suez_Repeatability, /// 3xQ3, 3xQ2, 3xQ1
Suez_EMP_DN15, /// EMP: 12 flow rates
Suez_EMP_DN20, /// EMP: 12 flow rates
Suez_EMP_DN32, /// EMP: 12 flow rates
Suez_EMP_DN40, /// EMP: 12 flow rates
Greece, /// Q3, Q2adj, Q2, Q1
S620, /// Q3, Q100, Q2, Q1
S620_Alt, /// Q3, Q100, Q2, Q1
S620_Kiwa,
Count,
None,
}
@@ -266,18 +268,29 @@ namespace Results.Output
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
case LogType.JustA0A4_Q3Q2adjQ1:
case LogType.JustA0A4_Q3Q2adjQ1: /// Australia 169 MHz
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q2adj", 0, "", 2, "02", 0, "", Range.R100_110),
new SensusTestInfo("Q2adj", 0, "", 3, "03", 3,"Q2adj", Range.R100_110),
new SensusTestInfo("Qjust_A0", -1, "Just", -1, "-1", -1, "Q-1", Range.R95_105),
new SensusTestInfo("Qjust_A4", -2, "Just", -2, "-2", -2, "Q-2", Range.R95_105),
new SensusTestInfo("Q3", 3, "Q3", 3, "03", 3, "Q3", Range.R90_100),
new SensusTestInfo("Q2", 2, "Q2", 0, "", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q3", 3, "Q3", 4, "04", 4, "Q3", Range.R90_100),
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.JustA0A4_Q3Q2Q1: /// Australia 169 MHz with default Q2 corrections and conditional update at the end of cycle
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Qjust_A0", -1, "Just", -1, "-1", -1, "Q-1", Range.R95_105),
new SensusTestInfo("Qjust_A4", -2, "Just", -2, "-2", -2, "Q-2", Range.R95_105),
new SensusTestInfo("Q3", 3, "Q3", 3, "03", 3, "Q3", Range.R90_100),
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.DEWA: /// DEWA (with Q4 and Q2 after correction)
return new SensusTestInfo[]
{
@@ -447,6 +460,15 @@ 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_Kiwa:
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q4", 5, "Q4", 5, "04", 5, "Q4", Range.R90_100),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
}
}
@@ -505,7 +527,7 @@ namespace Results.Output
///
static bool TestShouldBeIncluded(Config.Entities.Test test)
{
return test.DoEvaluate && !test.Method.ToLower().Contains("iperlcommunication");
return test.DoEvaluate && test.IsRegular() && !test.Method.ToLower().Contains("iperlcommunication");
}
///
public static SensusTestInfo CreateFromTest(Config.Entities.Test test, int repetitionNr, int luID, string fullTestNameWoPart)
@@ -534,7 +556,7 @@ namespace Results.Output
QBezeichnungLog = fullTestNameWoPart, /// Flow name in Oracle database
Range = range,
Flow = (range == Range.R100_110) ? test.Qfrom : (range == Range.R90_100) ? test.Qto : (test.Qfrom + test.Qto) / 2,
TestTime = (int)Math.Round(test.TstTime),
TestTime = (int)Math.Round(test.TestTime),
ErrLimLoFromDB = test.ErrLimLo,
ErrLimHiFromDB = test.ErrLimHi,
Uncertainty = test.Uncertainty,
+6 -6
View File
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using Config.Entities;
using Common;
namespace Results.Output
{
@@ -283,7 +283,7 @@ namespace Results.Output
WMeterRsltItemSpec.TableRowNr = 1;
foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam))
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
string[] oneTableRow = new string[table.ColumnsCount];
horizAlignment = new Alignment[table.ColumnsCount];
@@ -317,7 +317,7 @@ namespace Results.Output
int columnsCount = 1; /// Left column contains item caption
foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam))
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
columnsCount++; /// One additional column for each test to be published
}
@@ -343,7 +343,7 @@ namespace Results.Output
WMeterRsltItemSpec.TableColumnNr = 1;
foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam))
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
/// Strip color information
oneTableRow[WMeterRsltItemSpec.TableColumnNr] =
@@ -374,7 +374,7 @@ namespace Results.Output
int columnsCount = 2; /// Left two columns contain item caption and units
foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam))
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
columnsCount++; /// One additional column for each test to be published
}
@@ -410,7 +410,7 @@ namespace Results.Output
WMeterRsltItemSpec.TableColumnNr = 1;
foreach (var mtr in string.IsNullOrEmpty(autoTestParam) ? wm.RegularMeterTestRslts() : wm.AutoMeterTestRslts(autoTestParam))
{
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Publish.Always)
{
int colIx = WMeterRsltItemSpec.TableColumnNr + 1;
+1 -1
View File
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms.DataVisualization.Charting;
using Config.Entities;
using Common;
using Results.Entities;
using Results.Resources;
+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.1560.0")]
[assembly: AssemblyFileVersion("2.26.1560.0")]
[assembly: AssemblyVersion("2.27.1776.0")]
[assembly: AssemblyFileVersion("2.27.1776.0")]
+18
View File
@@ -906,6 +906,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Radio address.
/// </summary>
internal static string Radio_address {
get {
return ResourceManager.GetString("Radio_address", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ref.pulses.
/// </summary>
@@ -1581,6 +1590,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Radio address.
/// </summary>
internal static string Tooltip_RA {
get {
return ResourceManager.GetString("Tooltip_RA", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calculated density of water from table or formula at water density calibration temperature (r).
/// </summary>
+6
View File
@@ -831,4 +831,10 @@
<data name="Info_flags" xml:space="preserve">
<value>Info flags</value>
</data>
<data name="Tooltip_RA" xml:space="preserve">
<value>Radio address</value>
</data>
<data name="Radio_address" xml:space="preserve">
<value>Radio address</value>
</data>
</root>
+3 -3
View File
@@ -19,17 +19,17 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+35 -22
View File
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Config;
using Config.Entities;
using Common;
using Results.Entities;
using Results.Resources;
using System.Globalization;
@@ -24,11 +24,11 @@ namespace Results
public readonly ItemCategory Category; ///
public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
public string TestID; /// Specifies the test
public Config.Unit Units; /// Specifies units for the output
public Unit Units; /// Specifies units for the output
public string Format; /// Specifies format for the output
public string Precision; /// Specifies precision for the output
public int Width; /// Specifies the number of characters of the output, 0 = automatic
public Config.Entities.Alignment Alignment; /// Specifies alignment for the output
public Alignment Alignment; /// Specifies alignment for the output
public WMeterRsltItemSpec Clone()
{
@@ -46,7 +46,7 @@ namespace Results
///
/// Function to pick a MeterTestResult field and convert it into a string
///
public delegate string PrintDlgt(WaterMeter waterMeterResult, string testID, Config.Unit units, string format, string precision);
public delegate string PrintDlgt(WaterMeter waterMeterResult, string testID, Unit units, string format, string precision);
private readonly PrintDlgt printDlgt;
@@ -67,11 +67,11 @@ namespace Results
{
return str;
}
else if (Alignment == Config.Entities.Alignment.Left)
else if (Alignment == Alignment.Left)
{
return str + new string(' ', Width - len);
}
else if (Alignment == Config.Entities.Alignment.Right)
else if (Alignment == Alignment.Right)
{
return new string(' ', Width - len) + str;
}
@@ -331,8 +331,11 @@ namespace Results
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
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : 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
///
/// Water meter info
@@ -364,11 +367,12 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text5)));
/// Water meters results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.PurchaseOrder)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.YearOfProduction)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.WMPosition)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Formatted_WM_ID, "Formatted WM ID", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? string.Format("{0}-{1}", w.BatchNr(), w.WMPosition) : string.Format(f, w.StartTime(), w.EndTime(), w.BatchNr(), w.WMPosition, w.SerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RadioAddress, Strings.Radio_address, Strings.Tooltip_RA, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.RadioAddress)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.PurchaseOrder)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.YearOfProduction)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.WMPosition)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Formatted_WM_ID, "Formatted WM ID", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? string.Format("{0}-{1}", w.BatchNr(), w.WMPosition) : string.Format(f, w.StartTime(), w.EndTime(), w.BatchNr(), w.WMPosition, w.SerialNr)));
/// Water meters results (single)
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
@@ -420,10 +424,10 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
#if HEAT_METERS
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_start, Strings.Energy + " start ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_end, Strings.Energy + " end ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_start, Strings.Energy + " start ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_end, Strings.Energy + " end ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterEnergy).VolumeRef) : string.Empty));
#endif
#if IPERL
@@ -437,7 +441,16 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2Corr LR", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
#if ORACLE_DB
AllItems.Add(new WMeterRsltItemSpec(ItemID.X1, "X1 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X1 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X2, "X2 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X2 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X3, "X3 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X3 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X4, "X4 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X4 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X5, "X5 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X5 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X6, "X6 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X6 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X7, "X7 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X7 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X8, "X8 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X8 : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.X9, "X9 ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).X9 : 0)));
#if ORACLE_DB
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.OraWMTypeID, "OraDB WM Type ID", Quantity.Number, ItemCategory.MeterData, (w, t, u, f, p) => FormatInt(f, w.WaterMeterData.WMTypeId)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.OraWMTypeRev, "OraDB WM Type Rev.", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.WMTypeRevision)));
@@ -647,7 +660,7 @@ namespace Results
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
}
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v)
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v)
{
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture);
}
@@ -684,12 +697,12 @@ namespace Results
}
}
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2)
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2)
{
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v1, v2, CultureInfo.CurrentCulture);
}
///
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci)
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci)
{
double val1 = Config.Units.ConvertTo(units, v1);
double val2 = Config.Units.ConvertTo(units, v2);
@@ -814,7 +827,7 @@ namespace Results
item.Precision = field[5];
item.Width = int.Parse(field[6]);
item.Alignment = 0;
for (Config.Entities.Alignment a = 0; a < Config.Entities.Alignment.Count; a++)
for (Alignment a = 0; a < Alignment.Count; a++)
{
if (a.ToString().Equals(field[7])) { item.Alignment = a; break; }
}
+7 -6
View File
@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.Rig;
using TBF.Rig.Generic;
using TBF.UI.Bench.Components;
namespace ResultsBrowser.Forms
{
@@ -87,13 +88,13 @@ namespace ResultsBrowser.Forms
printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
}
IComponentCfgCtrl cfgControl = printerCfg.GetControl();
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Component>();
IComponentCfgCtrl cfgControl = printerCfg.GetControl(cfgForm.CmpntEntities);
cfgControl.Config = printerCfg;
cfgControl.Config.ItemNr = 0;
TBF.BenchControl.ComponentParametersDlg cfgForm = new TBF.BenchControl.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
DialogResult dr = cfgForm.ShowDialog();
+4 -3
View File
@@ -3,11 +3,12 @@
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using Common;
using Results.Entities;
using ResultsBrowser.Resources;
using ResultsBrowser.Output.Printers.Statistics;
using System.IO;
namespace ResultsBrowser.Forms
{
@@ -168,10 +169,10 @@ namespace ResultsBrowser.Forms
switch (MessageBox.Show(Strings.Yes_Portrait_No_Landscape, Strings.Page_orientation, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
{
case DialogResult.Yes:
new StatisticsPrintDocument(title, table, Config.Entities.PageOrientation.Portrait).Print();
new StatisticsPrintDocument(title, table, PageOrientation.Portrait).Print();
break;
case DialogResult.No:
new StatisticsPrintDocument(title, table, Config.Entities.PageOrientation.Landscape).Print();
new StatisticsPrintDocument(title, table, PageOrientation.Landscape).Print();
break;
default:
break;
-4
View File
@@ -126,8 +126,6 @@ namespace ResultsBrowser
Bench5 = "WR15";
Bench6 = "WR18";
Bench7 = "WR19";
Bench8 = "WR20";
Bench9 = "WR21";
ConnectionString1 = "SERVER=10.42.129.253; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString2 = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString3 = "SERVER=10.42.128.138; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
@@ -135,8 +133,6 @@ namespace ResultsBrowser
ConnectionString5 = "SERVER=10.42.130.97; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString6 = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString7 = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString8 = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
ConnectionString9 = "SERVER=10.42.128.150; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;";
Language = "SK";
#endif
}
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
/// Copyright (c) 2016 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using Config.Entities;
using Common;
namespace ResultsBrowser.Output.Printers.Statistics
{
+1 -1
View File
@@ -42,7 +42,7 @@ namespace ResultsBrowser
/// Local program configuration directory including the trailing backslash
ExecutableDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
#if false
#if true
/// Config directory is a sibling directory of the executable directory
ConfigDirectory = Path.Combine(ExecutableDirectory, "..", string.Format("Cfg{0}", (args.Length >= 1) ? args[0] : string.Empty));
LogDirectory = Path.Combine(ExecutableDirectory, "..\\Log\\");
+8 -4
View File
@@ -16,23 +16,23 @@
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -304,6 +304,10 @@
</Compile>
</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>
+13 -12
View File
@@ -6,14 +6,15 @@ using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using NHibernate;
using Results.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using ResultsBrowser.Filters;
using ResultsBrowser.Resources;
using Oracle;
using Oracle.DataAccess.Client;
using Common;
using Results.Entities;
using TBF.Rig;
using TBF.Rig.Generic;
using TBF.Rig.GenericDevices;
using ResultsBrowser.Filters;
using ResultsBrowser.Resources;
namespace ResultsBrowser
{
@@ -44,7 +45,7 @@ namespace ResultsBrowser
filtersConfig = new FiltersConfig();
this.args = args;
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
tbfComponents = new List<TBF.Rig.Generic.IComponent>();
tbfDevices = new List<IDevice>();
timePeriodStart = new DateTime(0);
@@ -197,7 +198,7 @@ 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.MetersKind = MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
if (dlg.ShowDialog() == DialogResult.OK)
@@ -432,7 +433,7 @@ namespace ResultsBrowser
#if MUNICH
foreach (var wm in waterMeters)
{
new Results.Output.Printers.Munich.MunichPrintDocument(string.Format("4/13 - {0}", BenchName()), wm, Config.Entities.PageOrientation.Portrait).Print();
new Results.Output.Printers.Munich.MunichPrintDocument(string.Format("4/13 - {0}", BenchName()), wm, PageOrientation.Portrait).Print();
}
#elif CEVAK_40
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
@@ -444,7 +445,7 @@ namespace ResultsBrowser
//foreach (var batch in batches)
//{
// new Results.Output.Printers.Cevak.PrintDocumentCevak(batch,
// Config.Entities.PageOrientation.Portrait,
// PageOrientation.Portrait,
// 60, 60, 60,
// "PT40 Z/E-35-A",
// "0111-OOP-C035-13").Print();
@@ -822,7 +823,7 @@ namespace ResultsBrowser
#endif
default: Results.DB.ConnectionString = string.Empty; break;
}
Results.DB.DbType = Users.Entities.DBType.MySql;
Results.DB.DbType = Common.DBType.MySql;
string[] fields = dlg.InputList.Split(new char[] { ',' });
int[] batchNrs = new int[fields.Length];
@@ -936,7 +937,7 @@ namespace ResultsBrowser
default: Results.DB.ConnectionString = string.Empty; break;
}
#endif
Results.DB.DbType = Users.Entities.DBType.MySql;
Results.DB.DbType = Common.DBType.MySql;
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{

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