Esempio n. 1
0
        public void Measure()
        {
            var boxSize = Variable(PageVariables.BoxSize);

            // In order to add the measurements in the correct order
            // we save them temporarily in an array
            Measurement[] measurements = new Measurement[Elements.Count];

            Parallel.ForEach(Elements, (e, _, i) =>
            {
                e.Document      = this;
                measurements[i] = e.Measure(boxSize);
            });

            Measurements.AddRange(measurements);

            foreach (var element in PageItems)
            {
                element.Document = this;
            }
        }
Esempio n. 2
0
 protected Terminal(Terminal terminal) : base(terminal)
 {
     ConductingEquipment = terminal.ConductingEquipment;
     ConnectivityNode    = terminal.ConnectivityNode;
     Measurements.AddRange(terminal.Measurements);
 }
Esempio n. 3
0
        public async Task<Measurements> GetMeasurementsAsync(string databaseName, ShowMeasurements command = null)
        {
            ThrowIfDisposed();

            Ensure.That(databaseName, nameof(databaseName)).IsNotNullOrWhiteSpace();

            var result = new Measurements();

            var json = await GetMeasurementsJsonAsync(databaseName, command).ForAwait();
            var data = Requester.JsonSerializer.Deserialize<InfluxDbResponse>(json);
            if (data?.Results == null || !data.Results.Any())
                return result;

            foreach (var serie in data.Results.SelectMany(r => r.Series))
                result.AddRange(serie.Values.Select(value => value.First.ToObject<string>()).ToArray());

            return result;
        }