/// <summary> /// Изменение значения аналогого датчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewIOSensorsTabbedDocument_ValueChanged(object sender, EventArgs e) { Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl Sender = (Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl)sender; if (_engine.EngineStatus == DebuggerEngineStatus.Started) { Kontel.Relkon.Classes.ControllerVar m_var = _solution.Vars.GetVarByName(Sender.SensorName); _engine.AddWriteItem(m_var.Address, m_var.Memory, Sender.GetData(), "Analog_W_" + m_var.Name, null, null); } }
/// <summary> /// Изменение метки аналогого датчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewIOSensorsTabbedDocument_LabelChanged(object sender, EventArgs e) { Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl Sender = (Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl)sender; if (Sender.SensorName.Contains("ADC")) { for (int i = 0; i < _engine.Parameters.ADCSensors.Count; i++) { if (_engine.Parameters.ADCSensors[i].Name == Sender.SensorName) { _engine.Parameters.ADCSensors[i].Caption = Sender.SensorLabel; return; } } //добавления метки в параметры отладчика Kontel.Relkon.DebuggerParameters.AnalogSensorDescription m_s = new DebuggerParameters.AnalogSensorDescription(); m_s.Name = Sender.SensorName; m_s.Caption = Sender.SensorLabel; m_s.DisplayOneByte = Sender.SigleByte; ControllerIOVar CurentValue = _solution.Vars.GetIOVar(Sender.SensorName); m_s.MemoryType = CurentValue.Memory; m_s.Address = CurentValue.Address; _engine.Parameters.ADCSensors.Add(m_s); } else { for (int i = 0; i < _engine.Parameters.DACSensors.Count; i++) { if (_engine.Parameters.DACSensors[i].Name == Sender.SensorName) { _engine.Parameters.DACSensors[i].Caption = Sender.SensorLabel; return; } } //добавления метки в параметры отладчика Kontel.Relkon.DebuggerParameters.AnalogSensorDescription m_s = new DebuggerParameters.AnalogSensorDescription(); m_s.Name = Sender.SensorName; m_s.Caption = Sender.SensorLabel; m_s.DisplayOneByte = Sender.SigleByte; ControllerIOVar CurentValue = _solution.Vars.GetIOVar(Sender.SensorName); m_s.MemoryType = CurentValue.Memory; m_s.Address = CurentValue.Address; _engine.Parameters.DACSensors.Add(m_s); } }
/// <summary> /// Обновление входов и выходов аналоговых /// </summary> /// <param name="Sender"></param> private void RefreshInterfaseAnalog(object Marker, byte[] Buffer, bool Error) { if (Buffer != null && !Error) { try { Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl m_sender = (Kontel.Relkon.Components.Documents.DebuggerTabbedDocuments.ViewIOSensorsTabbedDocument.AnalogSensorControl)Marker; if (!m_sender.Edited) { m_sender.InverseByteOrder = _engine.Parameters.InverseByteOrder; m_sender.SetData(Buffer); if (m_sender.SensorName.Contains("ADC")) { foreach (Kontel.Relkon.DebuggerParameters.AnalogSensorDescription dsd in _engine.Parameters.ADCSensors) { if (dsd.Name == m_sender.SensorName) { ControllerIOVar CurentValue = _solution.Vars.GetIOVar(dsd.Name); dsd.MemoryType = CurentValue.Memory; dsd.Address = CurentValue.Address; dsd.Value = Buffer; return; } } Kontel.Relkon.DebuggerParameters.AnalogSensorDescription dsd1 = new Kontel.Relkon.DebuggerParameters.AnalogSensorDescription(); ControllerIOVar CurentValue1 = _solution.Vars.GetIOVar(m_sender.SensorName); if (CurentValue1 == null) { return; } dsd1.Name = CurentValue1.Name; dsd1.MemoryType = CurentValue1.Memory; dsd1.Address = CurentValue1.Address; dsd1.Value = Buffer; _engine.Parameters.ADCSensors.Add(dsd1); return; } else if (m_sender.SensorName.Contains("DAC")) { foreach (Kontel.Relkon.DebuggerParameters.AnalogSensorDescription dsd in _engine.Parameters.DACSensors) { if (dsd.Name == m_sender.SensorName) { ControllerIOVar CurentValue = _solution.Vars.GetIOVar(m_sender.SensorName); dsd.MemoryType = CurentValue.Memory; dsd.Address = CurentValue.Address; dsd.Value = Buffer; return; } } Kontel.Relkon.DebuggerParameters.AnalogSensorDescription dsd1 = new Kontel.Relkon.DebuggerParameters.AnalogSensorDescription(); ControllerIOVar CurentValue1 = _solution.Vars.GetIOVar(m_sender.SensorName); if (CurentValue1 == null) { return; } dsd1.Name = CurentValue1.Name; dsd1.MemoryType = CurentValue1.Memory; dsd1.Address = CurentValue1.Address; dsd1.Value = Buffer; _engine.Parameters.DACSensors.Add(dsd1); return; } } } catch { } } }