private static void CreateNumericMeterCell(SpatialRecord spatialRecord, WorkingData workingData, int depth, DataRow dataRow)
        {
            var numericRepresentationValue = spatialRecord.GetMeterValue(workingData) as NumericRepresentationValue;
            var value = numericRepresentationValue != null
                ? numericRepresentationValue.Value.Value.ToString(CultureInfo.InvariantCulture)
                : "";

            dataRow[GetColumnName(workingData, depth)] = value;
        }
Exemple #2
0
        public DLV Map(WorkingData meter)
        {
            var representation = _representationMapper.Map(meter.Representation);

            var dlv = new DLV();
            if (representation == null)
            {
                dlv.A = null;
            }
            else
            {
                if (meter.Representation != null && meter.Representation.Code == "dtRecordingStatus" && meter.DeviceElementUseId != 0)
                    dlv.A = "161";
                else
                    dlv.A = representation.ToString();
            }

            return dlv;
        }
        public RepresentationValue Interpolate(WorkingData meter)
        {
            if (!_meterToPreviousValue.ContainsKey(meter))
                return null;

            var previousValue = _meterToPreviousValue[meter];

            var numericRepresentationValue = previousValue as NumericRepresentationValue;
            if (numericRepresentationValue != null)
            {
                var newNumericRepresentationValue = numericRepresentationValue.Copy();

                if (numericRepresentationValue.Representation != null && _numericRepresentationTotals.Contains(numericRepresentationValue.Representation.Code))
                {
                    newNumericRepresentationValue.Value.Value = 0;
                }

                return newNumericRepresentationValue;
            }

            var enumeratedValue = previousValue as EnumeratedValue;
            if (enumeratedValue != null)
            {
                var newEnumeratedValue = new EnumeratedValue
                {
                    Code = enumeratedValue.Code,
                    Value = new EnumerationMember
                    {
                        Code = enumeratedValue.Value.Code,
                        Value = enumeratedValue.Value.Value
                    },
                    Representation = enumeratedValue.Representation

                };

                return newEnumeratedValue;
            }

            return null;
        }
        public void Setup()
        {
            _meter = new NumericWorkingData();
            _meters = new List<WorkingData>();

            _representationMapperMock = new Mock<IRepresentationMapper>();
            _dlvHeaderMapper = new DlvHeaderMapper(_representationMapperMock.Object);
        }
        private static void CreateEnumeratedMeterCell(SpatialRecord spatialRecord, WorkingData workingData, int depth, DataRow dataRow)
        {
            var enumeratedValue = spatialRecord.GetMeterValue(workingData) as EnumeratedValue;

            dataRow[GetColumnName(workingData, depth)] = enumeratedValue != null && enumeratedValue.Value != null ? enumeratedValue.Value.Value : "";
        }
 private static string GetColumnName(WorkingData workingData, int depth)
 {
     return String.Format("{0}-{1}-{2}", workingData.Representation.Code, workingData.Id.ReferenceId, depth);
 }
 public void SetMostRecentMeterValue(WorkingData meter, RepresentationValue value)
 {
     if (_meterToPreviousValue.ContainsKey(meter))
     {
         _meterToPreviousValue[meter] = value;
     }
     else
     {
         _meterToPreviousValue.Add(meter, value);
     }
 }
Exemple #8
0
 public int? GetAppliedLatency(WorkingData workingData)
 {
     if (_appliedLatencyValues.ContainsKey(workingData.Id.ReferenceId))
         return _appliedLatencyValues[workingData.Id.ReferenceId];
     return null;
 }
Exemple #9
0
 public void SetAppliedLatency(WorkingData workingData, int? latencyValue)
 {
     _appliedLatencyValues.Add(workingData.Id.ReferenceId, latencyValue);
 }
Exemple #10
0
 public RepresentationValue GetMeterValue(WorkingData workingData)
 {
     if (_meterValues.ContainsKey(workingData.Id.ReferenceId))
         return _meterValues[workingData.Id.ReferenceId];
     return null;
 }
Exemple #11
0
 public void SetMeterValue(WorkingData workingData, RepresentationValue value)
 {
     _meterValues.Add(workingData.Id.ReferenceId, value);
 }
 private void CreateHavestMoistureSpatialRecord(WorkingData workingData, double value)
 {
     var spatialRecord = new SpatialRecord();
     var meter1Value1 = CreateHarvestMoisture(value);
     spatialRecord.SetMeterValue(workingData, meter1Value1);
     _spatialRecords.Add(spatialRecord);
 }