Water meter test results graph fixed, ver. 2.27.1851

This commit is contained in:
Milan Hanajik 2022-01-12 12:42:08 +01:00
parent 5623f27959
commit 5854a6e620
2 changed files with 15 additions and 18 deletions

View File

@ -1,4 +1,7 @@
using System; ///
/// Copyright (c) 2019-2022 Sensus Metering Systems
///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
@ -18,29 +21,23 @@ namespace Results.Output
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit) public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit)
{ {
double maxFlow_m3h = 0; double maxFlow = 0;
IList<PointF> unsortedPoints = new List<PointF>(); IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.RegularMeterTestRslts()) foreach (var mtr in wm.RegularMeterTestRslts())
{ {
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0)) double flow = mtr.TestRslt.FlowVolume;
var td = mtr.TestRslt.TestData;
if (mtr.IsPilotRslt() && flow > 0 && td.Evaluate &&
(td.Publish == (sbyte)Publish.Always || (!isPrinter && td.Publish == (sbyte)Publish.OnScreen)))
{ {
double flow_m3h = (mtr.TestTime != 0) if (flow > maxFlow) maxFlow = flow;
? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestTime * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster) unsortedPoints.Add(new PointF((float)Config.Units.ConvertTo(flowUnit, flow), (float)mtr.Error));
: (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow_m3h > maxFlow_m3h) maxFlow_m3h = flow_m3h;
double flow = Config.Units.ConvertTo(flowUnit, flow_m3h); /// Convert to specified units
if (flow > 0)
{
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
}
} }
} }
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X); IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
bool isQ4 = (maxFlow_m3h > 1.1 * wm.WaterMeterData.Q3_Qn); bool isQ4 = (maxFlow > 1.1 * wm.WaterMeterData.Q3_Qn);
Chart chart = new Chart Chart chart = new Chart
{ {

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.27.1844.0")] [assembly: AssemblyVersion("2.27.1851.0")]
[assembly: AssemblyFileVersion("2.27.1844.0")] [assembly: AssemblyFileVersion("2.27.1851.0")]