예제 #1
0
        public override ManualGaugingDischargeSection Create()
        {
            var verticals = GetVerticals();
            var results   = new ManualGaugingResultSummary(verticals);

            var factory       = new ManualGaugingDischargeSectionFactory(FieldVisit.UnitSystem);
            var manualGauging = factory.CreateManualGaugingDischargeSection(_measurementPeriod,
                                                                            results.TotalDischarge);

            manualGauging.DischargeMethod           = DischargeMethodType.MeanSection;
            manualGauging.VelocityObservationMethod = FieldVisit.DischargeActivity.ObservationMethodType;
            manualGauging.StartPoint       = StartPointType.LeftEdgeOfWater;
            manualGauging.DeploymentMethod = DeploymentMethodType.Unspecified;

            foreach (var vertical in verticals)
            {
                manualGauging.Verticals.Add(vertical);
            }

            manualGauging.WidthValue           = results.TotalWidth;
            manualGauging.AreaValue            = results.TotalArea;
            manualGauging.VelocityAverageValue = results.MeanVelocity;

            Log.Info($"Creating ManualGaugingDischargeSection with {manualGauging.Verticals.Count} verticals");

            return(manualGauging);
        }
        private static ManualGaugingDischargeSection CreateDischargeSectionWithRawValuesFromSummaryItem(DateTimeInterval measurementPeriod, GaugingSummaryItem summaryItem)
        {
            if (!summaryItem.Area.HasValue)
            {
                throw new ArgumentNullException(nameof(summaryItem.Area));
            }
            if (!summaryItem.MeanVelocity.HasValue)
            {
                throw new ArgumentNullException(nameof(summaryItem.MeanVelocity));
            }

            var factory = new ManualGaugingDischargeSectionFactory(ParametersAndMethodsHelper.UnitSystem)
            {
                DefaultChannelName = ParametersAndMethodsHelper.DefaultChannelName
            };

            var dischargeSection = factory.CreateManualGaugingDischargeSection(measurementPeriod, summaryItem.Flow.AsDischargeMeasurement().Value);

            dischargeSection.Party                = summaryItem.ObserversName;
            dischargeSection.Comments             = summaryItem.Comments;
            dischargeSection.AreaValue            = summaryItem.Area.Value;
            dischargeSection.VelocityAverageValue = summaryItem.MeanVelocity.Value;

            return(dischargeSection);
        }
예제 #3
0
        private ManualGaugingDischargeSection CreateDischargeSectionWithDescription(DischargeActivity dischargeActivity,
                                                                                    DischargeMeasurementSummary summary, UnitSystem unitSystem)
        {
            var factory          = new ManualGaugingDischargeSectionFactory(unitSystem);
            var dischargeSection = factory.CreateManualGaugingDischargeSection(
                dischargeActivity.MeasurementPeriod, summary.Discharge ?? throw new ArgumentNullException(nameof(summary.Discharge)));

            //Party:
            dischargeSection.Party    = dischargeActivity.Party;
            dischargeSection.Comments = dischargeActivity.Comments;

            //Discharge method default to mid-section:
            var dischargeMethod = "MID".Equals(summary.DischargeMeasurementMethod, StringComparison.InvariantCultureIgnoreCase)
                ? DischargeMethodType.MidSection
                : DischargeMethodType.MeanSection;

            dischargeSection.DischargeMethod = dischargeMethod;
            dischargeSection.StartPoint      = "RIGHT".Equals(summary.StartEdge, StringComparison.InvariantCultureIgnoreCase)
                ? StartPointType.RightEdgeOfWater
                : StartPointType.LeftEdgeOfWater;

            dischargeSection.DeploymentMethod = DeploymentMethodType.Unspecified;

            return(dischargeSection);
        }
        private ManualGaugingDischargeSection CreateMidSectionMeasurement(DischargeActivity dischargeActivity, double discharge)
        {
            var factory = new ManualGaugingDischargeSectionFactory(Units.MetricUnitSystem)
            {
                DefaultChannelName = Config.DefaultChannelName
            };
            var dischargeSection = factory.CreateManualGaugingDischargeSection(dischargeActivity.MeasurementPeriod, discharge);

            dischargeSection.DischargeMethod = DischargeMethodType.MidSection;

            //dischargeSection.Comments = _ehsn.DisMeas.dischargeRemark;
            dischargeSection.Comments = string.Join("\n",
                                                    new[] { _ehsn.DisMeas.dischargeRemark, "+++++++++", string.Join(" - ", new[] { _ehsn.InstrumentDeployment?.GeneralInfo?.methodType, _ehsn.InstrumentDeployment?.GeneralInfo?.deployment,
                                                                                                                                   _ehsn.InstrumentDeployment?.GeneralInfo?.instrument, _ehsn.InstrumentDeployment?.GeneralInfo?.manufacturer, _ehsn.InstrumentDeployment?.GeneralInfo?.model,
                                                                                                                                   _ehsn.InstrumentDeployment?.GeneralInfo?.serialNum, _ehsn.InstrumentDeployment?.GeneralInfo?.structureType, _ehsn.InstrumentDeployment?.GeneralInfo?.monitoringMethod }.Where(s => !string.IsNullOrWhiteSpace(s))) }
                                                    .Where(s => !string.IsNullOrWhiteSpace(s)));

            dischargeSection.AreaUnitId           = Units.AreaUnitId;
            dischargeSection.AreaValue            = _ehsn.DisMeas.area.ToNullableDouble();
            dischargeSection.WidthValue           = _ehsn.DisMeas.width.ToNullableDouble();
            dischargeSection.VelocityAverageValue = _ehsn.DisMeas.meanVel.ToNullableDouble();
            dischargeSection.VelocityUnitId       = Units.VelocityUnitId;
            dischargeSection.DeploymentMethod     = GetMappedEnum(_ehsn.InstrumentDeployment?.GeneralInfo?.deployment, KnownMidSectionDeploymentTypes);
            dischargeSection.MeterCalibration     = new MeterCalibration
            {
                Configuration   = "",
                Model           = _ehsn.InstrumentDeployment?.GeneralInfo?.model.WithDefaultValue(Config.UnknownMeterPlaceholder),
                Manufacturer    = _ehsn.InstrumentDeployment?.GeneralInfo?.manufacturer.WithDefaultValue(Config.UnknownMeterPlaceholder),
                SerialNumber    = _ehsn.InstrumentDeployment?.GeneralInfo?.serialNum.WithDefaultValue(Config.UnknownMeterPlaceholder),
                FirmwareVersion = _ehsn.InstrumentDeployment?.GeneralInfo?.firmware,
                SoftwareVersion = _ehsn.InstrumentDeployment?.GeneralInfo?.software,
                MeterType       = MeterType.PriceAa
            };


            var meters = (_ehsn.MidsecMeas?.DischargeMeasurement?.MmtInitAndSummary?.MetersUsed ?? new Meter[0])
                         .Select(CreateMeterCalibration)
                         .ToList();

            if (meters.Count == 2 && meters[0].Equations.Count < 2 && meters[1].Equations.Count < 2)
            {
                AddPanelMeasurements(dischargeSection);
            }

            if (meters.Count == 1 && meters[0].Equations.Count < 2)
            {
                AddPanelMeasurements(dischargeSection);
            }

            return(dischargeSection);
        }
        private ManualGaugingDischargeSection CreateDischargeSectionWithDescription(UnitSystem unitSystem,
                                                                                    DateTimeInterval observationInterval)
        {
            var factory = new ManualGaugingDischargeSectionFactory(unitSystem);
            var manualGaugingDischarge = factory.CreateManualGaugingDischargeSection(observationInterval, _parsedData.TotalDischarge);

            //Party:
            manualGaugingDischarge.Party = _parsedData.UserId;

            //Discharge Method should always be Mid Section, i.e., points are rendered in the middle of a segment on UI.
            manualGaugingDischarge.DischargeMethod = DischargeMethodType.MidSection;

            return(manualGaugingDischarge);
        }
예제 #6
0
        private ManualGaugingDischargeSection CreateExpectedManualGaugingDischargeSection()
        {
            var factory = new ManualGaugingDischargeSectionFactory(ParametersAndMethodsHelper.UnitSystem)
            {
                DefaultChannelName = ParametersAndMethodsHelper.DefaultChannelName
            };

            var dischargeSection = factory.CreateManualGaugingDischargeSection(_dischargeActivity.MeasurementPeriod, _gaugingSummaryItem.Flow.Value);

            dischargeSection.Party                = _gaugingSummaryItem.ObserversName;
            dischargeSection.Comments             = _gaugingSummaryItem.Comments;
            dischargeSection.AreaValue            = _gaugingSummaryItem.Area.Value;
            dischargeSection.VelocityAverageValue = _gaugingSummaryItem.MeanVelocity.Value;

            return(dischargeSection);
        }
예제 #7
0
        private ManualGaugingDischargeSection CreateManualGauging(DischargeActivity dischargeActivity)
        {
            var manualGaugingDischargeSectionFactory = new ManualGaugingDischargeSectionFactory(UnitSystem);

            var manualGauging =
                manualGaugingDischargeSectionFactory.CreateManualGaugingDischargeSection(
                    dischargeActivity.MeasurementPeriod,
                    dischargeActivity.Discharge.Value);

            manualGauging.AreaValue            = UnitConverter.ConvertArea(DataFile.Calculations.Area);
            manualGauging.WidthValue           = UnitConverter.ConvertDistance(DataFile.Calculations.Width);
            manualGauging.VelocityAverageValue = UnitConverter.ConvertVelocity(DataFile.Calculations.Velocity.X);
            manualGauging.StartPoint           = DataFile.Stations.First().StationType == StationType.RightBank
                ? StartPointType.RightEdgeOfWater
                : StartPointType.LeftEdgeOfWater;
            manualGauging.VelocityObservationMethod = FindMostCommonVelocityMethod();
            manualGauging.DischargeMethod           = CreateDischargeMethodType();
            manualGauging.Party = dischargeActivity.Party;

            dischargeActivity.ChannelMeasurements.Add(manualGauging);

            return(manualGauging);
        }
        private ManualGaugingDischargeSection CreateDischargeSectionWithDescription(DischargeActivity dischargeActivity,
                                                                                    XmlRootSummaryWinRiver_II_Section_by_Section_Summary sxsSummary, UnitSystem unitSystem)
        {
            var factory = new ManualGaugingDischargeSectionFactory(unitSystem);
            var manualGaugingDischarge = factory.CreateManualGaugingDischargeSection(
                dischargeActivity.MeasurementPeriod, sxsSummary.Total_Q.AsDouble());

            //Party:
            manualGaugingDischarge.Party    = dischargeActivity.Party;
            manualGaugingDischarge.Comments = dischargeActivity.Comments;

            //Discharge method default to mid-section:
            var dischargeMethod = sxsSummary.Q_Method == "Mean-section"
                ? DischargeMethodType.MeanSection
                : DischargeMethodType.MidSection;

            manualGaugingDischarge.DischargeMethod = dischargeMethod;
            manualGaugingDischarge.StartPoint      = sxsSummary.Begin_Shore == "Left"
                ? StartPointType.LeftEdgeOfWater
                : StartPointType.RightEdgeOfWater;

            return(manualGaugingDischarge);
        }