Skip to content

correct DDI usage #258

@woodieboogie

Description

@woodieboogie

Is it possible that the correct DDI scaling is not currently being used?

we have the following datas:

in ddiExport.txt:

DD Entity: 99 Crop Moisture
Definition: Moisture in crop yield
Comment: This DDE defines the actual percentage moisture of the crop.

Typically used by Device Classes: 
7 - Harvesters
8 - Root Harvester
9 - Forage harvester
Unit: ppm - Parts per million
Resolution: 1

in RepresentationSystem.xml:
<RelatedDDI ddi="99" unitOfMeasure="ppm" resolution="0.0001" offset="0" isDefaultRepresentationForDDI="true" />

ISOv4Plugin/Mappers/LoggedDataMappers/Export/NumericValueMapper.cs

private double GetResolution(NumericRepresentationValue value)
        {
            var ddi = _representationMapper.Map(value.Representation);
            var resolution = 1d;
            if (_ddis.ContainsKey(ddi.GetValueOrDefault()))
            {
                resolution = _ddis[ddi.GetValueOrDefault()].Resolution;
            }
            return resolution;
        }

now I get for DDI 99 a resolution of 1 instead of 0.0001
and the MAP methode use that wrong resolution.

public uint Map(NumericWorkingData meter, SpatialRecord spatialRecord)
        {
            var value = (NumericRepresentationValue)spatialRecord.GetMeterValue(meter);
            if (value == null)
                return 0;

            var resolution = GetResolution(value);
            return (UInt32)(value.Value.Value / resolution);
        }

for example I have value of 13 % ("prcnt"), then I have to write to the ISOXML Log: 13 * 0.0001 = 0.0013 because it have the unit ppm. Currently it writes 13, what is wrong.

Why isn't the resolution used by RepresentationSystem.xml instead of ddiExport.txt?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions