diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ControlNameValue.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ControlNameValue.cs index 621d6f7..c6d191c 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ControlNameValue.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ControlNameValue.cs @@ -1,24 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; +using System.Xml.Serialization; namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow { - /// - /// 真值表单元格对应的配置内容信息 - /// - public class ControlNameValue + [XmlType(typeName: "ControlNameValue")] + public partial class ControlNameValue { - [XmlAttribute(AttributeName = "Name")] + + [XmlAttribute()] public string Name { get; set; } - [XmlAttribute(AttributeName = "Value")] - public double Value { get; set; } + [XmlAttribute()] + public byte Value { get; set; } - [XmlAttribute(AttributeName = "ControlName")] + [XmlAttribute()] public string ControlName { get; set; } } } diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowManager.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowManager.cs index e2fe850..6f39f70 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowManager.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowManager.cs @@ -2,12 +2,14 @@ using Aitex.Core.RT.OperationCenter; using Aitex.Core.Util; using MECF.Framework.Common.Device.Bases; +using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; using System.Xml.Serialization; using static System.Net.Mime.MediaTypeNames; @@ -15,7 +17,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow { public class GasFlowManager : Singleton { - ModuleGsaFlow123 PM1GsaFlow { get; set; } + ModuleGsaFlow PM1GsaFlow { get; set; } public GasFlowManager() { @@ -23,48 +25,21 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow } public void Initialize() { - - //PM1GsaFlow = new ModuleGsaFlow123(); + PM1GsaFlow = CustomXmlSerializer.Deserialize(new FileInfo($"Config\\PM\\PM1\\RealtimeGasFlow.xml")); + + DATA.Subscribe($"\"PM1\".GasFlowManagerTest", () => PM1GsaFlow.GasFlowUnitLise); - //ControlNameValue controlNameValue = new ControlNameValue(); - //controlNameValue.Name = "1"; - //controlNameValue.Value = 2; - //controlNameValue.ControlName = "123"; - - //RealtimeGasFlowTrueTableRow realtimeGasFlowTrueTableRow = new RealtimeGasFlowTrueTableRow(); - //realtimeGasFlowTrueTableRow.InputList.Add(controlNameValue); - //realtimeGasFlowTrueTableRow.InputList.Add(controlNameValue); - //realtimeGasFlowTrueTableRow.OutputList.Add(controlNameValue); - - //GasFlowUnit gasFlowUnit = new GasFlowUnit(); - //gasFlowUnit.GasName = "SiH4"; - //gasFlowUnit.GasFlowRatioName = "Test"; - //gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow); - //gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow); - //gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow); - - - //PM1GsaFlow.GasFlowUnitList = new List - //{ - // gasFlowUnit, - // gasFlowUnit - //}; - - - //XmlSerializer xml = new XmlSerializer(typeof(ModuleGsaFlow123)); - //System.IO.Stream stream = new System.IO.FileStream(" sutudents.xml", System.IO.FileMode.OpenOrCreate); - //xml.Serialize(stream, PM1GsaFlow); - - ModuleGsaFlow m= DeserializeFromXml($"Config\\PM\\RealtimeGasFlow\\Test.xml"); - - PM1GsaFlow = CustomXmlSerializer.Deserialize(new FileInfo($"Config\\PM\\RealtimeGasFlow\\Test.xml")); - PM1GsaFlow.SetModuleName("PM1"); - - DATA.Subscribe("GasFlowManagerTest", () => GasFlowManagerTest()); OP.Subscribe("GasFlowManager.QueryUpdate", (string cmd, object[] args) => QueryUpdate()); } + private void IniPM(string pmName) + { + ModuleGsaFlow moduleGsaFlow = CustomXmlSerializer.Deserialize(new FileInfo($"Config\\PM\\{pmName}\\RealtimeGasFlow.xml")); + + DATA.Subscribe($"{pmName}.GasFlowManagerTest", () => moduleGsaFlow.GasFlowUnitLise); + } + public T DeserializeFromXml(string filePath) { try diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs index 3b99d22..a069353 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs @@ -1,4 +1,5 @@ -using System; +using Aitex.Core.RT.SCCore; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -11,29 +12,19 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow /// /// 单个气体对象的真值表数据,所有配置行数据集合,气体需要的属性数据 /// + [XmlType(typeName: "GasFlowUnit")] public class GasFlowUnit { + [XmlElement("GasTrueTableRows")] + public List GasTrueTableRowList { get; set; } - /// - /// 气体名称 - /// - [XmlAttribute(AttributeName = "GasName")] + [XmlAttribute()] public string GasName { get; set; } - /// - /// 系统配置文件中气体系数名称,根据此名称来获取对应的配置数据 - /// - [XmlAttribute(AttributeName = "GasFlowRatioName")] + [XmlAttribute()] public string GasFlowRatioName { get; set; } - /// - /// 一种气体对应的所有行数据集合 - /// - [XmlArrayItem("GasTrueTableRowList")] - public List GasTrueTableRowList { get; set; } = new List(); - - /// /// 系统中配置的气体流量系数 /// diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowTrueTableRow.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasTrueTableRows.cs similarity index 92% rename from MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowTrueTableRow.cs rename to MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasTrueTableRows.cs index 206d8cb..c55472f 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowTrueTableRow.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasTrueTableRows.cs @@ -13,15 +13,17 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow /// /// 单行真值表对应的逻辑对象,主要执行逻辑就在这里 /// - public class RealtimeGasFlowTrueTableRow + [XmlType(typeName: "GasTrueTableRows")] + public partial class GasTrueTableRows { - [XmlArray("InputList")] - [XmlArrayItem("ControlNameValue")] - public List InputList { get; set; } = new List(); - [XmlArray("OutputList")] - [XmlArrayItem("ControlNameValue")] - public List OutputList { get; set; } = new List(); + [XmlArray("Inputs")] + public List InputList { get; set; } + + [XmlArray("Outputs")] + public List OutputList { get; set; } + + private bool IsCanOut(string module) { //有一个集合为空,不用循环 diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasUnitData.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasUnitData.cs deleted file mode 100644 index e7f04d0..0000000 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasUnitData.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; - -namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow -{ - public class GasUnitData - { - /// - /// 气体名称 - /// - [XmlAttribute(AttributeName = "GasName")] - public string GasName { get; set; } - - /// - /// 系统配置文件中气体系数名称,根据此名称来获取对应的配置数据 - /// - [XmlAttribute(AttributeName = "GasFlowRatioName")] - public string GasFlowRatioName { get; set; } - - /// - /// 一种气体对应的所有行数据集合 - /// - [XmlArray("GasTrueTableRowList")] - [XmlArrayItem("RealtimeGasFlowTrueTableRow")] - public List RealtimeGasFlowTrueTableRows { get; set; } = new List(); - } -} diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow.cs index e872c77..07664d1 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow.cs @@ -1,231 +1,39 @@ -using System; +using Aitex.Core.Util; +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow { - - // 注意: 生成的代码可能至少需要 .NET Framework 4.5 或 .NET Core/Standard 2.0。 - /// - public partial class ModuleGsaFlow + public class ModuleGsaFlow { + [XmlAttribute()] + public string ModuleName { get; set; } + + [XmlElement("GasFlowUnit")] + public List GasFlowUnitLise { get; set; } + + private PeriodicJob _thread; + + private void IniPMGas() + { + _thread = new PeriodicJob(1000, OnTimer, $"{ModuleName}.ModuleGsaFlow", true); + } + + + private bool OnTimer() + { + foreach (var Unit in GasFlowUnitLise) + { + Unit.GetGasFlowFeedBack(ModuleName); + } + return true; + } - [System.Xml.Serialization.XmlElement("GasFlowUnit")] - public List GasFlowUnit { get; set; } } - - [System.Xml.Serialization.XmlTypeAttribute(typeName: "GasFlowUnit")] - public partial class FGasFlowUnit - { - - private ModuleGsaFlowGasFlowUnitGasTrueTableRows[] gasTrueTableRowsField; - - private string gasNameField; - - private string gasFlowRatioNameField; - - /// - [System.Xml.Serialization.XmlElementAttribute("GasTrueTableRows")] - public ModuleGsaFlowGasFlowUnitGasTrueTableRows[] GasTrueTableRows - { - get - { - return this.gasTrueTableRowsField; - } - set - { - this.gasTrueTableRowsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string GasName - { - get - { - return this.gasNameField; - } - set - { - this.gasNameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string GasFlowRatioName - { - get - { - return this.gasFlowRatioNameField; - } - set - { - this.gasFlowRatioNameField = value; - } - } - } - - public partial class ModuleGsaFlowGasFlowUnitGasTrueTableRows - { - - private ModuleGsaFlowGasFlowUnitGasTrueTableRowsControlNameValue[] inputsField; - - private ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputs outputsField; - - /// - [System.Xml.Serialization.XmlArrayItemAttribute("ControlNameValue", IsNullable = false)] - public ModuleGsaFlowGasFlowUnitGasTrueTableRowsControlNameValue[] Inputs - { - get - { - return this.inputsField; - } - set - { - this.inputsField = value; - } - } - - /// - public ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputs Outputs - { - get - { - return this.outputsField; - } - set - { - this.outputsField = value; - } - } - } - - public partial class ModuleGsaFlowGasFlowUnitGasTrueTableRowsControlNameValue - { - - private string nameField; - - private byte valueField; - - private string controlNameField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Name - { - get - { - return this.nameField; - } - set - { - this.nameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public byte Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ControlName - { - get - { - return this.controlNameField; - } - set - { - this.controlNameField = value; - } - } - } - - public partial class ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputs - { - - private ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputsControlNameValue controlNameValueField; - - /// - public ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputsControlNameValue ControlNameValue - { - get - { - return this.controlNameValueField; - } - set - { - this.controlNameValueField = value; - } - } - } - - public partial class ModuleGsaFlowGasFlowUnitGasTrueTableRowsOutputsControlNameValue - { - - private string nameField; - - private byte valueField; - - private string controlNameField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Name - { - get - { - return this.nameField; - } - set - { - this.nameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public byte Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ControlName - { - get - { - return this.controlNameField; - } - set - { - this.controlNameField = value; - } - } - } - - } diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow123.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow123.cs deleted file mode 100644 index bd388c0..0000000 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/ModuleGsaFlow123.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Aitex.Core.Util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; - -namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow -{ - public class ModuleGsaFlow123 - { - - /// - /// PM模块所有气体对象的集合 - /// - /// - [XmlArray("ModuleGsaFlow123")] - [XmlArrayItem("GasFlowUnit")] - public List GasFlowUnitList { get; set; } - - public string MoudleName { get; set; } - - private PeriodicJob _thread; - - public ModuleGsaFlow123() - { - IniPMGas(); - } - - - - public void SetModuleName(string module) - { - MoudleName = module; - } - private void IniPMGas() - { - _thread = new PeriodicJob(1000, OnTimer, $"{MoudleName}.ModuleGsaFlow123", true); - } - - private void IniGasFlowUnitList(string path) - { - - } - - private bool OnTimer() - { - foreach (var Unit in GasFlowUnitList) - { - Unit.GetGasFlowFeedBack(MoudleName); - } - return true; - } - - } -} diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowCalculator.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowCalculator.cs deleted file mode 100644 index e7fa753..0000000 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/RealtimeGasFlowCalculator.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow -{ - /// - /// 真值表逻辑计算器,对应每个大的模块所有气体 - /// - public class RealtimeGasFlowCalculator - { - - - } -} diff --git a/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj b/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj index 31b27ee..42a3c41 100644 --- a/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj +++ b/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj @@ -178,15 +178,12 @@ - - - - - + +