using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.Equipment;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow
{
[XmlType(typeName: "PMGsaFlow")]
public class PMAllGsa
{
///
/// PM腔体中气体
///
[XmlElement("GasFlowUnit")]
public List GasFlowUnitList { get; set; }
public string ModuleName { get; set; }
public List GasFlowSumList { get; set; }
///
/// 初始化单个气体,设置模块名称和对应气体的流量系数,注册界面要显示的数值
///
///
public void Initialize(string moduleName)
{
IniGasUnit(moduleName);
DATA.Subscribe($"{ModuleName}.PMGasFlowSumList", () => GasFlowSumList);
var _thread = new PeriodicJob(1000, OnTimer, $"{moduleName}.ModuleGsaFlow", true);
}
private void IniGasUnit(string moduleName)
{
ModuleName = moduleName;
GasFlowSumList = new();
List moduleNameList = new();
//单中气体初始化
foreach (var unit in GasFlowUnitList)
{
unit.Initialize(moduleName);
//string bbb = aaa.Replace("CD", "")
string gasName = "";
if (unit.GasName.Contains("Run"))
{
gasName = unit.GasName.Replace("_Run", "");
}
else if (unit.GasName.Contains("Vent"))
{
gasName = unit.GasName.Replace("_Vent", "");
}
if (!moduleNameList.Contains(gasName))
moduleNameList.Add(gasName);
}
foreach (var name in moduleNameList)
{
GasFlowSumList.Add(new GasFlowSum() { Name = name });
}
}
private bool OnTimer()
{
foreach (var Unit in GasFlowUnitList)
{
Unit.GetGasFlowFeedBack();
}
return true;
}
}
}