1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.SCCore;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.ToolLayout;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PunkHPX8_RT.Devices.Reservoir
- {
- public class ReservoirANPumpSpeedHelper
- {
- #region 内部变量
- /// <summary>
- /// 时间
- /// </summary>
- private DateTime _updateTime = DateTime.Now;
- /// <summary>
- /// 模块名称
- /// </summary>
- private string _moduleName;
- /// <summary>
- /// CA流量总和
- /// </summary>
- private double _caTotalFlow = 0;
- /// <summary>
- /// 设备对象
- /// </summary>
- DMReservoirDevice _device;
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="moduleName"></param>
- public ReservoirANPumpSpeedHelper(string moduleName, DMReservoirDevice reservoirDevice)
- {
- _moduleName = moduleName;
- _device = reservoirDevice;
- }
- /// <summary>
- /// 监控
- /// </summary>
- public void Monitor(ResRecipe resRecipe)
- {
- int cellFlowUpdatePeriod = SC.GetValue<int>("Reservoir.CellFlowUpdatePeriod");
- if (DateTime.Now.Subtract(_updateTime).TotalSeconds > cellFlowUpdatePeriod)
- {
- _updateTime = DateTime.Now;
- AdjustAnPumpSpeed(resRecipe);
- }
- }
- /// <summary>
- /// 调节阳极泵速
- /// </summary>
- private void AdjustAnPumpSpeed(ResRecipe resRecipe)
- {
- if (_device.ReservoirData.AnPumpEnable)
- {
- double anPumpSpeed = _device.ReservoirData.AnPumpSpeed;
- double averageANFlow = _device.ReservoirData.AnFlow;
- if (averageANFlow == 0)
- {
- return;
- }
- double anPumpMaxSpeed = SC.GetValue<double>("Reservoir.ANMaxPumpSpeed");
- double anFlowDelta = resRecipe.ANFlowSetPoint - averageANFlow;
- double newANPumpSpeed = 1.8 * anFlowDelta + anPumpSpeed;
- if (newANPumpSpeed <= 0||newANPumpSpeed>=anPumpMaxSpeed)
- {
- return;
- }
- if (Math.Abs(newANPumpSpeed - anPumpSpeed) >= 0.01)
- {
- _device.AnPumpSpeed(newANPumpSpeed);
- }
- }
- }
- }
- }
|