public PlantPower ProcessLine(string line, string fileName, ApiPlant apiPlant)
 {
     var plant = apiPlant;
     var utcDateTime = extractUtcDateFromFileLine(line, plant.TimeZone);
     var utcUpdatedDateTime = string.Format("{0:yyyyMMddHHmmss}", utcDateTime);
     var utcInsertionDateTime = string.Format("{0:yyyyMMddHH0000}", DateTime.UtcNow);
     var power = extractValueFromFileLine(line);
     return new PlantPower(plant.Id, utcInsertionDateTime, utcUpdatedDateTime, power);
 }
示例#2
0
        //public Measure ProcessLine(string line, string fileName, ApiPlant plant)
        public Measure ProcessLine(DateTime ProdDate, double measure, ApiPlant plant)
        {
            var source = _confProvider.GetMeasureSourceFor1HResolution();
            var datavariable = _confProvider.GetDataVariable();
            var resolution = _confProvider.GetResolution();
            var utcDateTime = extractUtcDateFromFileLine(ProdDate, plant.TimeZone);
            var utcDate = string.Format("{0:yyyyMMdd}", utcDateTime.Date);
            var utcHour = utcDateTime.Hour;
            var utcMinute = utcDateTime.Minute;
            var utcSecond = utcDateTime.Second;
            // convert from MW to KW
            var multiplier = _confProvider.GetMeasureValueMultiplier();
            var value = measure * multiplier;
            var percentage = 1;
            var reliability = 0;

            return new Measure(plant.Id, source, datavariable, utcDate, utcHour, utcMinute, utcSecond, value, percentage, reliability, resolution);
        }
示例#3
0
        private ApiPlant GetPlantfromColumnName(string plantName)
        {
            string[] keys = new string[] { "ARROYAL", "PERUL", "LASTRA", "LODOSO", "P.E. LORA I Cont. Principal", "P.E. LORA II Cont. Principal", "MARMELLAR", "SARGENTES" };

            string sKeyResult = keys.FirstOrDefault<string>(s => plantName.Contains(s));
            string plantId = GetPlantId(sKeyResult);
            ApiPlant plant = new ApiPlant();
            if (plantId == "")
            {
                _logger.ErrorFormat("It was not identified plant´s name extracted from Columnname ");
            } else
            {
                plant = _plantService.GetPlant(plantId);
            }

            return plant;
        }