InitParam.cs 5.56 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
using System;
using System.Collections.Generic;
using System.Text;
using Misc;
using System.Net;
using System.IO;
using System.ComponentModel;
using System.Xml.Linq;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;

namespace FLY.Thick.Base.Server
{
    //硬件配置参数
    public class InitParam: IInitParamService,  INotifyPropertyChanged, Misc.ISaveToXml
    {
        #region 属性,成员变量的代理
        /// <summary>
        /// 扫描架长
        /// </summary>
21 22
        public int PosLength { get; set; } = 8900;

潘栩锋's avatar
潘栩锋 committed
23 24 25
        /// <summary>
        /// 从 flyad7 获取的
        /// </summary>
26
        public int PosOfGrid { get; set; } = 10;
潘栩锋's avatar
潘栩锋 committed
27 28 29 30 31 32

        /// <summary>
        /// timeGridAdv 使能
        /// </summary>
        public bool IsTimeGridAdvEnabled { get; set; }

潘栩锋's avatar
潘栩锋 committed
33
        /// <summary>
潘栩锋's avatar
潘栩锋 committed
34
        /// ad 滞后量  1.28ms
潘栩锋's avatar
潘栩锋 committed
35
        /// </summary>
36
        public int ADLag { get; set; }
潘栩锋's avatar
潘栩锋 committed
37 38 39 40

        /// <summary>
        /// 自动归原点间距
        /// </summary>
41 42 43
        public int AutoOrgInterval { get; set; } = 10;
       

潘栩锋's avatar
潘栩锋 committed
44 45 46 47

        /// <summary>
        /// 线速度来源
        /// </summary>
48 49
        public FilmVSRC FilmVSrc { get; set; } = FilmVSRC.ROUND;
        
潘栩锋's avatar
潘栩锋 committed
50 51 52
        /// <summary>
        /// 最小线速度 m/min
        /// </summary>
53 54
        public int FilmVThreshold { get; set; } = 5;

潘栩锋's avatar
潘栩锋 committed
55 56 57 58 59 60



        /// <summary>
        /// 编码器2 mm/pulse
        /// </summary>
61
        public double Encoder2_mmpp { get; set; } = 0.1;
潘栩锋's avatar
潘栩锋 committed
62

63
        
潘栩锋's avatar
潘栩锋 committed
64 65 66
        /// <summary>
        /// 编码器2 放大
        /// </summary>
67 68
        public float Encoder2_comp { get; set; } = 1;
        
潘栩锋's avatar
潘栩锋 committed
69 70 71
        /// <summary>
        /// //1圈多少mm
        /// </summary>
72
        public double MmOfR { get; set; } = 376.8;
潘栩锋's avatar
潘栩锋 committed
73 74 75 76

        /// <summary>
        /// 编码器1 mm/pulse
        /// </summary>
77
        public double Encoder1_mmpp { get; set; } = 0.1;
潘栩锋's avatar
潘栩锋 committed
78 79 80 81 82 83 84




        /// <summary>
        /// 设置的速度,与 实际速度比例
        /// </summary>
85
        public double Speed1Scale { get; set; } = 1;
潘栩锋's avatar
潘栩锋 committed
86 87 88 89 90


        /// <summary>
        /// 扫描时速度
        /// </summary>
91 92 93
        public UInt32 VScan { get; set; } = 8000;


潘栩锋's avatar
潘栩锋 committed
94 95 96 97

        /// <summary>
        /// 调试时速度,向前走,向后走
        /// </summary>
98
        public UInt32 VJOG { get; set; } = 5000;
潘栩锋's avatar
潘栩锋 committed
99 100 101 102

        /// <summary>
        /// 精确速度 Velocity Of Accuracy  如: 机架修正, 样品取样, 机架信息获取
        /// </summary>
103
        public UInt32 VAccuracy { get; set; } = 3000;
潘栩锋's avatar
潘栩锋 committed
104

105
        
潘栩锋's avatar
潘栩锋 committed
106 107 108
        /// <summary>
        /// 开始速度 Start Velocity
        /// </summary>
109 110
        public UInt32 SVelocity { get; set; } = 500;
        
潘栩锋's avatar
潘栩锋 committed
111 112 113
        /// <summary>
        /// 加速时间
        /// </summary>
114 115
        public UInt32 ATime { get; set; } = 200;
        
潘栩锋's avatar
潘栩锋 committed
116 117 118
        /// <summary>
        /// 减速时间
        /// </summary>
119 120
        public UInt32 DTime { get; set; } = 200;
        
潘栩锋's avatar
潘栩锋 committed
121 122 123
        /// <summary>
        /// 归0速度1
        /// </summary>
124 125
        public UInt32 HVelocity1 { get; set; } = 5000;
        
潘栩锋's avatar
潘栩锋 committed
126 127 128
        /// <summary>
        /// 归0速度2
        /// </summary>
129
        public UInt32 HVelocity2 { get; set; } = 1000;
潘栩锋's avatar
潘栩锋 committed
130 131 132 133 134 135 136




        /// <summary>
        /// 数据有效源
        /// </summary>
137
        public DATAVALIDSRC DataValidSrc { get; set; } = DATAVALIDSRC.VALID;
潘栩锋's avatar
潘栩锋 committed
138 139 140 141

        /// <summary>
        /// 当数据有效状态改变,自动按F1,F3
        /// </summary>
142 143
        public bool AutoF1F3 { get; set; }

潘栩锋's avatar
潘栩锋 committed
144 145 146 147

        /// <summary>
        /// 当数据有效状态  无效->有效 ,等待多久重新扫描 ,单位s
        /// </summary>
148 149 150
        public int ReStartDelay { get; set; } = 5;


潘栩锋's avatar
潘栩锋 committed
151 152 153 154

        /// <summary>
        /// 有按样标定硬件
        /// </summary>
155 156
        public bool HasProfileSample { get; set; }

潘栩锋's avatar
潘栩锋 committed
157 158 159 160

        /// <summary>
        /// 有小托辊
        /// </summary>
161 162 163 164 165
        public bool HasHold { get; set; } = true;

        /// <summary>
        /// 数据库保存的月数
        /// </summary>
166
        public int DBKeepMonth { get; set; } = 6;
167

潘栩锋's avatar
潘栩锋 committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
        #endregion

        private string param_path = "initparam.xml";
        public InitParam()
        {

        }
        
        public InitParam(string param_path)
        {
            if (!string.IsNullOrEmpty(param_path))
                this.param_path = param_path;

            Load();
        }
        public bool Load() 
        {
            return Misc.SaveToXmlHepler.Load(param_path, this);
        }
        public bool Save() 
        {
            return Misc.SaveToXmlHepler.Save(param_path, this);
        }


        #region INotifyPropertyChanged 成员
194

潘栩锋's avatar
潘栩锋 committed
195 196 197 198 199 200 201 202 203 204
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region ISaveToXml 成员

        public string[] GetSavePropertyNames()
        {
            return new string[]{
                "PosLength",
潘栩锋's avatar
潘栩锋 committed
205 206
                "ADLag",
                "IsTimeGridAdvEnabled",
潘栩锋's avatar
潘栩锋 committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
                "AutoOrgInterval",
                
                "VScan",
                "VJOG",
                "VAccuracy",
                "SVelocity","ATime","DTime","HVelocity1","HVelocity2",
        
                "Encoder1_mmpp",

                "FilmVSrc",
                "FilmVThreshold",
                "Encoder2_mmpp",
                "Encoder2_comp",
                "MmOfR",
                "DataValidSrc",

                "AutoF1F3",
                "ReStartDelay",

                "HasProfileSample",
227 228
                "HasHold",
                "DBKeepMonth"
潘栩锋's avatar
潘栩锋 committed
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
            };
            
        }

        #endregion


        public void Apply()
        {
            Save();
        }
    }
    
    
}