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 ReservoirCAPumpSpeedHelper
- {
- #region 内部变量
- /// <summary>
- /// 时间
- /// </summary>
- private DateTime _updateTime = DateTime.Now;
- /// <summary>
- /// 模块名称
- /// </summary>
- private string _moduleName;
- /// <summary>
- /// CA流量总和
- /// </summary>
- private double _caTotalFlow = 0;
- /// <summary>
- /// 设备对象
- /// </summary>
- ReservoirDevice _device;
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="moduleName"></param>
- public ReservoirCAPumpSpeedHelper(string moduleName, ReservoirDevice 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;
- AdjustCAPumpSpeed(resRecipe);
- }
- }
- /// <summary>
- /// 调节阳极泵速
- /// </summary>
- private void AdjustCAPumpSpeed(ResRecipe resRecipe)
- {
- if (_device.ReservoirData.CaPumpEnable)
- {
- double caPumpSpeed = _device.ReservoirData.CaPumpSpeed;
- double averageCAFlow = _device.ReservoirData.CaFlow;
- if (averageCAFlow == 0)
- {
- return;
- }
- double caPumpMaxSpeed = SC.GetValue<double>("Reservoir.CAMaxPumpSpeed");
- double caFlowDelta = resRecipe.CAFlowSetPoint - averageCAFlow;
- double newCAPumpSpeed = 330 * caFlowDelta + caPumpSpeed;
- if (newCAPumpSpeed <= 0 || newCAPumpSpeed > caPumpMaxSpeed)
- {
- return;
- }
- if (Math.Abs(newCAPumpSpeed - caPumpSpeed) >= 10)
- {
- _device.CAPumpSpeed(newCAPumpSpeed);
- }
- }
- }
- }
- }
|