99 lines
3.6 KiB
C#
99 lines
3.6 KiB
C#
using Aitex.Core.RT.Device.Devices;
|
|
using Aitex.Core.RT.Device;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.MfcCalculation
|
|
{
|
|
/// <summary>
|
|
/// 存储真值表中一行的数据对象,并提供计算气体流量的方法
|
|
/// </summary>
|
|
public class MfcInputOutRow
|
|
{
|
|
public List<NameValue> InputList { get; set; } = new List<NameValue>();
|
|
public List<NameValue> OutputList { get; set; } = new List<NameValue>();
|
|
public double Accumulation(string module,double otherValue=0)
|
|
{
|
|
double volue = 0;
|
|
//有一个集合为空,不用循环
|
|
if (InputList.Count == 0 || OutputList.Count == 0 )
|
|
return 0;
|
|
//一行内单元格的输入输出配置
|
|
foreach (var rowInputs in InputList)
|
|
{
|
|
try
|
|
{
|
|
//Input配置的单元格
|
|
var value = rowInputs.Value;
|
|
var ioValve = DEVICE.GetDevice<IoValve>($"{module}.{rowInputs.Name}");
|
|
|
|
//开、关时后的状态,和表配置对比,只要不满足就可以退出函数
|
|
if (ioValve.Status == true && value == "1")
|
|
continue;
|
|
if (ioValve.Status == false && value == "0")
|
|
continue;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
return 0;
|
|
|
|
}
|
|
foreach (var rowOutputs in OutputList)
|
|
{
|
|
try
|
|
{
|
|
if (rowOutputs.ControlName.Contains("Mfc"))
|
|
{
|
|
//Output配置的单元格
|
|
var _mfc = DEVICE.GetDevice<IoMFC>($"{module}.{rowOutputs.ControlName}");
|
|
volue += _mfc.FeedBack * double.Parse(rowOutputs.Value) + otherValue;
|
|
}
|
|
else
|
|
{
|
|
//混合气体流量
|
|
volue += Double.Parse(rowOutputs.Value);
|
|
switch (rowOutputs.ControlName)
|
|
{
|
|
case "H2":
|
|
volue+= AddOther(MfcManager.H2, rowOutputs.Value);
|
|
break;
|
|
case "ArFlow":
|
|
volue += AddOther(MfcManager.ArFlow, rowOutputs.Value);
|
|
break;
|
|
case "HCL":
|
|
volue += AddOther(MfcManager.HCL, rowOutputs.Value);
|
|
break;
|
|
case "TMA":
|
|
volue += AddOther(MfcManager.TMA, rowOutputs.Value);
|
|
break;
|
|
case "TCS":
|
|
volue += AddOther(MfcManager.TCS, rowOutputs.Value);
|
|
break;
|
|
case "PN2":
|
|
volue += AddOther(MfcManager.PN2, rowOutputs.Value);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
return volue;
|
|
}
|
|
private double AddOther(double other,string coefficient)
|
|
{
|
|
return other * double.Parse(coefficient);
|
|
}
|
|
}
|
|
}
|