using System;
using System.Collections.Generic;
using CRVM.Entity;

namespace CRVM.CIDExcuter
{

    public class Machine
    {
        private Stand[] stands;

        public Stand[] Stand
        {
            get { return stands; }
            set { stands = value; }
        }
        //当前卷开始时间
        public DateTime startTime { set; get; }
        //起始位置
        public UInt32 lenCountStart { get; set; }
        //当前剪切计数器计数值
        public UInt32 lenCountNow { get; set; }
        //剪切状态
        public bool cutted { get; set; }
        //轧制总长度
        public int cutLength { get; set; }
        //当前轧制长度
        public double stripLength { get; set; }
        //出口线速度
        public double lengthSpeed { get; set; }

        public RollingArray<double> distance_Running { get; set; }//持续更新的各点轧制距离信息

        public double[] distance_Pause { get; set; }//暂存各点轧制距离信息

        //能量曲线时间轴上的数据点
        public RollingArray<double> xAxisEnergy { get; set; }

        public double[] xAxisTime { set; get; }


        public List<double> list_CutTime { set; get; }

        //public int index { get; set; }


        public Machine(int stdCount, int vibLength, int tvibLength, int energyLength)
        {
            xAxisEnergy = new RollingArray<double>(energyLength + 1);
            distance_Running = new RollingArray<double>(energyLength + 1);
            xAxisTime = new double[tvibLength];
            list_CutTime = new List<double>();
            for (int i = energyLength; i >= 0; i--)
            {
                xAxisEnergy.Add(DateTime.Now.AddSeconds(-i * Convert.ToDouble(SysParam.Instance.samplePoint) / SysParam.Instance.sampleFre).ToOADate());
                distance_Running.Add(0.0);
            }
            for (int i = 0; i < tvibLength; i++)
            {
                xAxisTime[i] = Convert.ToDouble(i) / SysParam.Instance.sampleFre;
            }
            stands = new Stand[stdCount];
            lengthSpeed = 0;
            for (int i = 0; i < stdCount; i++)
            {
                Stand std = new Stand();
                std.Initial(vibLength, tvibLength, energyLength);
                stands[i] = std;
            }
        }

        //数据回放用
        public string review_coldcoilno { get; set; }
        public string review_entThick { get; set; }
        public string review_extThick { get; set; }
        public string review_width { get; set; }
        public string review_steelGrade { get; set; }
        public string review_alloyCode { get; set; }

    }
}
