public List<ISOEnumeratedMeter> CreateMeters(IEnumerable<ISOSpatialRow> spatialRows)
{
var spatialRowWithDdi = spatialRows.FirstOrDefault(x => x.SpatialValues.Any(y => Convert.ToInt32(y.Dlv.A, 16) == DDI));
int numberOfSections = 16;
if (spatialRowWithDdi != null)
{
var spatialValue = spatialRowWithDdi.SpatialValues.First(x => Convert.ToInt32(x.Dlv.A, 16) == DDI);
numberOfSections = GetNumberOfInstalledSections(spatialValue);
}
var meters = new List<ISOEnumeratedMeter>();
for (int i = StartingSection; i < StartingSection + numberOfSections; i++)
{
meters.Add(new ISOEnumeratedMeter
{
DeviceElementUseId = i,
Representation = Representation,
GetEnumeratedValue = GetValueForMeter
});
}
return meters;
}