12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //using System;
- //using System.Collections.Generic;
- //using System.Diagnostics;
- //using System.Linq;
- //using System.Text;
- //using System.Threading.Tasks;
- //namespace CyberX8_Core
- //{
- // public class RecipeToleranceChecker
- // {
- // Stopwatch _stopwatch;
- // ToleranceMode _toleranceMode;
- // List<ToleranceObject> _toleranceObjects;
- // public RecipeToleranceChecker()
- // {
- // _stopwatch = new Stopwatch();
- // }
- // public void Start(ToleranceMode toleranceMode, List<ToleranceObject> toleranceObjects)
- // {
- // _stopwatch.Start();
- // _toleranceMode = toleranceMode;
- // _toleranceObjects = toleranceObjects;
- // _toleranceObjects.ForEach(_toleranceObject =>
- // {
- // if (_toleranceMode == ToleranceMode.Percent)
- // {
- // _toleranceObject.WarningScale = _toleranceObject.SetPoint * _toleranceObject.WarningScale / 100;
- // _toleranceObject.AlarmScale = _toleranceObject.SetPoint * _toleranceObject.AlarmScale / 100;
- // }
- // });
- // }
- // public void Monitor(params int[] feedBacks)
- // {
- // for (int i = 0; i < _toleranceObjects.Count; i++)
- // {
- // if (_stopwatch.ElapsedMilliseconds > _toleranceObjects[i].DelayTime)
- // {
- // if ((feedBacks[i] < _toleranceObjects[i].SetPoint - _toleranceObjects[i].WarningScale || feedBacks[i] > _toleranceObjects[i].SetPoint + _toleranceObjects[i].WarningScale) && _toleranceObjects[i].WarningFlag == false)
- // {
- // _toleranceObjects[i].WarningFlag = true;
- // }
- // }
- // }
- // for (int i = 0; i < _toleranceObjects.Count; i++)
- // {
- // if (_stopwatch.ElapsedMilliseconds > _toleranceObjects[i].DelayTime)
- // {
- // if ((feedBacks[i] < _toleranceObjects[i].SetPoint - _toleranceObjects[i].AlarmScale || feedBacks[i] > _toleranceObjects[i].SetPoint + _toleranceObjects[i].AlarmScale) && _toleranceObjects[i].AlarmFlag == false)
- // {
- // _toleranceObjects[i].AlarmFlag = true;
- // }
- // }
- // }
- // }
- // public void End()
- // {
- // _stopwatch.Stop();
- // }
- // }
- // public class ToleranceObject
- // {
- // public string Name { get; set; }
- // public int SetPoint { get; set; }
- // public int WarningScale { get; set; }
- // public int AlarmScale { get; set; }
- // public bool WarningFlag { get; set; }
- // public bool AlarmFlag { get; set; }
- // public int DelayTime { get; set; }
- // public ToleranceObject(string name, int setPoint, int warningScale, int alarmScale, int delayTime)
- // {
- // Name = name;
- // SetPoint = setPoint;
- // WarningScale = warningScale;
- // AlarmScale = alarmScale;
- // DelayTime = delayTime;
- // }
- // }
- //}
|