修改气动阀仿真不能正常使用问题点

1修改IO配置
2添加报错信息打印
3修改XML配置
This commit is contained in:
hanqiangqiang
2026-07-10 14:11:13 +08:00
parent 6168f16fbe
commit fc81863141
7 changed files with 202 additions and 376 deletions
@@ -2,9 +2,11 @@
using Aitex.Core.RT.IOCore;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Xml;
namespace MECF.Framework.Simulator.Core
@@ -24,18 +26,29 @@ namespace MECF.Framework.Simulator.Core
/// <param name="node"></param>
protected virtual void InitializeIValve(XmlElement node)
{
XmlNodeList valveNodes = node.GetElementsByTagName("IoValve");
foreach (XmlElement xmlElement in valveNodes)
string valveName = "";
try
{
string diName = xmlElement.GetAttribute("diOpen");
string doName = xmlElement.GetAttribute("doOpen");
if (!DI_DOList.ContainsKey(diName) && !DI_DOList.ContainsKey(doName))
DI_DOList.Add(diName, doName);
XmlNodeList valveNodes = node.GetElementsByTagName("IoValve");
foreach (XmlElement xmlElement in valveNodes)
{
string diName = xmlElement.GetAttribute("diOpen");
string doName = xmlElement.GetAttribute("doOpen");
valveName= diName;
if (!DI_DOList.ContainsKey(diName) && !DI_DOList.ContainsKey(doName))
DI_DOList.Add(diName, doName);
var isDefaultOpen = xmlElement.GetAttribute("isDefaultOpen");
if (!String.IsNullOrWhiteSpace(isDefaultOpen))
IO.DO[$"{Module}.{doName}"].Value = Convert.ToBoolean(isDefaultOpen);
var isDefaultOpen = xmlElement.GetAttribute("isDefaultOpen");
if (!String.IsNullOrWhiteSpace(isDefaultOpen))
IO.DO[$"{Module}.{doName}"].Value = Convert.ToBoolean(isDefaultOpen);
}
}
catch (Exception ex)
{
Debug.Assert(false, $"{DI_DOList.LastOrDefault().Value}--检查气动阀仿真配置");
throw;
}
}
protected override void HandleMonitor()