/// <summary> /// Получили данные от devMan /// </summary> /// <param name="sender">Источник события</param> /// <param name="e">Параметры события</param> protected void DevManClient_onReceive(object sender, ReceivedEventArgs e) { try { DateTime now = DateTime.Now; if (now > lastTime) { TimeSpan interval = now - lastTime; if (interval.Ticks > tInterval.Ticks) { lastTime = now; foreach (Parameter parameter in parameters) { PDescription channel = parameter.Channel; if (channel != null) { if (channel.Number >= 0 && channel.Number < e.Slice.Length) { CommutatorParameter.setCurrent(parameter, e.Slice[channel.Number]); } } } UpdateTechnologyParameters(); if (onUpdated != null) { onUpdated(this, new CommutatorEventArgs(e.Slice)); } } } else lastTime = now; } catch (Exception ex) { ErrorHandler.WriteToLog(sender, new ErrorArgs(ex.Message, ErrorType.NotFatal)); } }
/// <summary> /// Получили данные от devMan /// </summary> /// <param name="sender">Источник события</param> /// <param name="e">Параметры события</param> protected void DevManClient_onReceive(object sender, ReceivedEventArgs e) { try { DateTime now = DateTime.Now; TimeDatAacquisition = now; if (now > lastTime) { TimeSpan interval = now - lastTime; if (interval.Ticks > tInterval.Ticks) { lastTime = now; foreach (Parameter parameter in parameters) { PDescription channel = parameter.Channel; if (channel != null) { if (channel.Number >= 0 && channel.Number < e.Slice.Length) { CommutatorParameter.setCurrent(parameter, e.Slice[channel.Number]); e.Slice[channel.Number] = parameter.CalculatedValue; } } } SgtApplication app = SgtApplication.CreateInstance(); if (app != null) { app.Technology.Calculate(this, new CommutatorEventArgs(e.Slice)); if (tech_saver != null) tech_saver(e.Slice); } buffer.Append(new Slice(DateTime.Now, e.Slice)); UpdateTechnologyParameters(); if (onUpdated != null) { onUpdated(this, new CommutatorEventArgs(e.Slice)); } } } else lastTime = now; } catch (Exception ex) { ErrorHandler.WriteToLog(sender, new ErrorArgs(ex.Message, ErrorType.NotFatal)); } }
/// <summary> /// Получили данные от devMan /// </summary> /// <param name="sender">Источник события</param> /// <param name="e">Параметры события</param> protected void DevManClient_onReceive(object sender, ReceivedEventArgs e) { try { DateTime now = DateTime.Now; if (now > lastTime) { TimeSpan interval = now - lastTime; if (interval.Ticks > tInterval.Ticks) { lastTime = now; //buffer.Append(new Slice(DateTime.Now, e.Slice)); foreach (Parameter parameter in parameters) { PDescription channel = parameter.Channel; if (channel != null) { if (channel.Number >= 0 && channel.Number < e.Slice.Length) { parameter.setCurrent(e.Slice[channel.Number]); e.Slice[channel.Number] = parameter.CurrentValue; } } } buffer.Append(new Slice(DateTime.Now, e.Slice)); tech.Updated(parameters); if (onParameterUpdated != null) { onParameterUpdated(this, EventArgs.Empty); } } } else lastTime = now; } catch (Exception ex) { ErrorHandler.WriteToLog(sender, new ErrorArgs(ex.Message, ErrorType.NotFatal)); } }