/// <summary> /// 获取误差项目ID /// </summary> /// <param name="WcType">误差类型</param> /// <param name="GLFX">功率方向</param> /// <param name="Yj">元件</param> /// <param name="Glys">功率因素</param> /// <param name="xIb">电流倍数</param> /// <param name="XieBo">谐波 0不加,1加</param> /// <param name="Xiangxu">相序 0正相续,1逆相序</param> /// <returns></returns> public static string getWcPrjID(CLDC_Comm.Enum.Cus_WcType WcType, CLDC_Comm.Enum.Cus_PowerFangXiang GLFX, CLDC_Comm.Enum.Cus_PowerYuanJian Yj, string Glys, string xIb, int XieBo, int Xiangxu) { return(string.Format("{0}{1}{2}{3}{4}{5}{6}" , (int)WcType , (int)GLFX , (int)Yj , CLDC_DataCore.Const.GlobalUnit.g_SystemConfig.GlysZiDian.getGlysID(Glys) , CLDC_DataCore.Const.GlobalUnit.g_SystemConfig.xIbDic.getxIbID(xIb) , XieBo.ToString(), Xiangxu.ToString())); }
/// <summary> /// 拷贝方案 /// </summary> /// <returns></returns> public CLDC_DataCore.Model.Plan.Plan_ErrAccord Copy() { if (Dgv_Data.Rows.Count == 1) { return(new CLDC_DataCore.Model.Plan.Plan_ErrAccord((int)TaiType, "")); } CLDC_DataCore.Model.Plan.Plan_ErrAccord _Obj = new CLDC_DataCore.Model.Plan.Plan_ErrAccord((int)TaiType, ""); string strPara1 = ""; string strPara2 = ""; string strPara3 = ""; string strPara4 = ""; if (chk_Yzx.Checked) { CLDC_Comm.Enum.Cus_WcType _WcType = CLDC_Comm.Enum.Cus_WcType.误差一致性; for (int i = 0; i < Dgv_Data.Rows.Count; i++) { switch (i + 1) { case 1: strPara1 = Dgv_Data[1, 0].Value.ToString() + "|" + Dgv_Data[2, 0].Value.ToString(); break; case 2: strPara2 = Dgv_Data[1, 1].Value.ToString() + "|" + Dgv_Data[2, 1].Value.ToString(); break; case 3: strPara3 = Dgv_Data[1, 2].Value.ToString() + "|" + Dgv_Data[2, 2].Value.ToString(); break; case 4: strPara4 = Dgv_Data[1, 3].Value.ToString() + "|" + Dgv_Data[2, 3].Value.ToString(); break; } } _Obj.Add(_WcType, strPara1, strPara2, strPara3, strPara4, 0, 0); } if (chk_Bc.Checked) { if (!this.CheckDigOK(1)) { return(new CLDC_DataCore.Model.Plan.Plan_ErrAccord((int)TaiType, "")); } CLDC_Comm.Enum.Cus_WcType _WcType = CLDC_Comm.Enum.Cus_WcType.误差变差试验; _Obj.Add(_WcType, "1.0Ib|1.0", "1.0Ib|0.5L", "", "", float.Parse(txt_Bc.Text), 0); } if (chk_Sj.Checked) { if (!this.CheckDigOK(1)) { return(new CLDC_DataCore.Model.Plan.Plan_ErrAccord((int)TaiType, "")); } CLDC_Comm.Enum.Cus_WcType _WcType = CLDC_Comm.Enum.Cus_WcType.电流升降试验; _Obj.Add(_WcType, "", cbo_Value2.Text + "|1.0", cbo_Value3.Text + "|1.0", cbo_Value4.Text + "|1.0", 0, 0);//cbo_Value1.Text + "|1.0" } if (chk_Gz.Checked) { if (!this.CheckDigOK(3)) { return(new CLDC_DataCore.Model.Plan.Plan_ErrAccord((int)TaiType, "")); } CLDC_Comm.Enum.Cus_WcType _WcType = CLDC_Comm.Enum.Cus_WcType.电流过载试验; _Obj.Add(_WcType, "10Ib|1.0", "1.0Ib|1.0", "", "", float.Parse(txt_Gz1.Text), float.Parse(txt_Gz2.Text)); } _Obj.SetPram((int)base.TaiType, base.FaName); return(_Obj); }
/// <summary> /// 添加一个需要检定的误差点 /// </summary> /// <param name="WcType">误差类型</param> /// <param name="Time1">时间1</param> /// <param name="Time2">时间2</param> public void Add(CLDC_Comm.Enum.Cus_WcType WcType, string Para1, string Para2, string Para3, string Para4, float time1, float time2) { CLDC_DataCore.Struct.StErrAccord _Point = new CLDC_DataCore.Struct.StErrAccord(); CLDC_DataCore.Struct.StErrAccordbase _PointBase = new StErrAccordbase(); _Point.PrjName = string.Format("{0} {1} {2} {3} {4}", Para1, Para2, Para3, Para4, WcType.ToString()); _Point.lstErrPoint = new List <StErrAccordbase>(); string[] strPara = { Para1, Para2, Para3, Para4 }; //给默认参数 // 功率方向:正向有功 // 元 件:合元 // 谐 波:0不加 // 相 序:0正相续 CLDC_Comm.Enum.Cus_PowerFangXiang _Fx = CLDC_Comm.Enum.Cus_PowerFangXiang.正向有功; CLDC_Comm.Enum.Cus_PowerYuanJian _Yj = CLDC_Comm.Enum.Cus_PowerYuanJian.H; int _XieBo = 0; int _Xx = 0; string strIb = ""; string strGlys = ""; string[] strTmp = new string[2]; for (int i = 0; i < 4; i++) { if (strPara[i].Trim() != "") { strTmp = strPara[i].Split('|'); strIb = strTmp[0]; strGlys = strTmp[1]; _PointBase = new StErrAccordbase(); _PointBase.PrjID = getWcPrjID(WcType, _Fx, _Yj, strGlys, strIb, _XieBo, _Xx); string _GlfxString; switch ((int)_Fx) { case 1: { _GlfxString = "P+"; break; } case 2: { _GlfxString = "P-"; break; } case 3: { _GlfxString = "Q+"; break; } case 4: { _GlfxString = "Q-"; break; } default: { _GlfxString = "P+"; break; } } string strYj = ""; switch (_Yj.ToString().ToUpper()) { case "H": strYj = "合元"; break; case "A": strYj = "A元"; break; case "B": strYj = "B元"; break; case "C": strYj = "C元"; break; default: strYj = "合元"; break; } _PointBase.TestPointName = string.Format("{0} {1} {2} {3}", _GlfxString, strYj, strGlys, strIb); _PointBase.PowerYinSu = strGlys; _PointBase.PowerDianLiu = strIb; _Point.lstErrPoint.Add(_PointBase); } } _Point.ErrAccordType = (int)WcType - 3; _Point.Time1 = time1; _Point.Time2 = time2; _LstErrAccord.Add(_Point); return; }
/// <summary> /// 添加一个需要检定的误差点 /// </summary> /// <param name="WcType">误差类型</param> /// <param name="GLFX">功率方向 </param> /// <param name="Yj">元件</param> /// <param name="Glys">功率因素</param> /// <param name="xIb">电流倍数</param> /// <param name="XieBo">是否加谐波0-不加,1-加</param> /// <param name="Xiangxu">相序0-正相序,1-逆相序</param> public void Add(CLDC_Comm.Enum.Cus_WcType WcType, CLDC_Comm.Enum.Cus_PowerFangXiang GLFX, CLDC_Comm.Enum.Cus_PowerYuanJian Yj, string Glys, string xIb, int XieBo, int Xiangxu, string strLimit) { string _PrjID = getWcPrjID(WcType, GLFX, Yj, Glys, xIb, XieBo, Xiangxu); if (CheckedYn(_PrjID) || _PrjID.Length != 9) { return; } StPlan_WcPoint _Point = new StPlan_WcPoint(); _Point.PrjID = _PrjID; string _GlfxString; switch ((int)GLFX) { case 1: { _GlfxString = "P+"; GlfxYj[0] = true; break; } case 2: { _GlfxString = "P-"; GlfxYj[1] = true; break; } case 3: { _GlfxString = "Q+"; GlfxYj[2] = true; break; } case 4: { _GlfxString = "Q-"; GlfxYj[3] = true; break; } case 5: { _GlfxString = "Q1"; GlfxYj[4] = true; break; } case 6: { _GlfxString = "Q2"; GlfxYj[5] = true; break; } case 7: { _GlfxString = "Q3"; GlfxYj[6] = true; break; } case 8: { _GlfxString = "Q4"; GlfxYj[7] = true; break; } default: { _GlfxString = "P+"; break; } } string _Yj = ""; switch (Yj.ToString().ToUpper()) { case "H": _Yj = "合元"; break; case "A": _Yj = "A元"; break; case "B": _Yj = "B元"; break; case "C": _Yj = "C元"; break; default: _Yj = "合元"; break; } _Point.PrjName = string.Format("{0} {1} {2} {3} {4}", _GlfxString, _Yj, Glys, xIb, (int)WcType == 2 ? "标准偏差" : "基本误差"); _Point.PowerYinSu = Glys; _Point.PowerDianLiu = xIb; CLDC_DataCore.DataBase.IDAndValue _WcLimitName = _WcLimit.getWcLimitNameValue(CzWcLimit); CLDC_DataCore.DataBase.IDAndValue _GuiChengName = _WcLimit.getGuiChengValue("JJG596-2012"); CLDC_DataCore.DataBase.IDAndValue[] _DjValue = new CLDC_DataCore.DataBase.IDAndValue[2]; CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo meter = CLDC_DataCore.Const.GlobalUnit.g_CUS.DnbData.MeterGroup[CLDC_DataCore.Const.GlobalUnit.g_CUS.DnbData.GetFirstYaoJianMeterBwh()]; string[] _DJ = CLDC_DataCore.Function.Number.getDj(meter.Mb_chrBdj); _DjValue[0] = _WcLimit.getDjValue(_DJ[0]); _DjValue[1] = _WcLimit.getDjValue(_DJ[1]); CLDC_DataCore.DataBase.IDAndValue _GlysValue = new CLDC_DataCore.DataBase.IDAndValue(); //功率因素值 CLDC_DataCore.DataBase.IDAndValue _xIbValue = new CLDC_DataCore.DataBase.IDAndValue(); //电流倍数值 _GlysValue.Value = _Point.PowerYinSu; _GlysValue.id = long.Parse(CLDC_DataCore.Const.GlobalUnit.g_SystemConfig.GlysZiDian.getGlysID(_GlysValue.Value)); _xIbValue.Value = _Point.PowerDianLiu; _xIbValue.id = long.Parse(CLDC_DataCore.Const.GlobalUnit.g_SystemConfig.xIbDic.getxIbID(_xIbValue.Value)); bool _YouGong = true; if ((int)_Point.PowerFangXiang > 2) { _YouGong = false; } if (_Point.Pc == 0) //基本误差的误差限获取 { _WcLimit.SetWcx(_WcLimitName , _GuiChengName , (int)_Point.PowerFangXiang > 2 ? _DjValue[1] : _DjValue[0] , _Point.PowerYuanJian , meter.Mb_BlnHgq , _YouGong, _GlysValue, _xIbValue, strLimit); } else { string[] _Wcx = _WcLimit.getPcxValue(_WcLimitName , _GuiChengName , (int)_Point.PowerFangXiang > 2 ? _DjValue[1] : _DjValue[0]).Split('|'); _Point.SetWcx(float.Parse(_Wcx[0].Replace("+", "")), float.Parse(_Wcx[1])); //设置误差限 } LstCheckPoint.Add(_Point); return; }
/// <summary> /// 设置检定圈数(09-7-2之后不再使用) /// </summary> /// <param name="Current">电流参数1.5(6)</param> /// <param name="MeConst">当前表常数 有功(无功)</param> /// <param name="MinConst">当台表最小常数(数组 下标0=有功,1=无功)</param> //public void SetQs(string Current,string MeConst,int[] MinConst) //{ // for (int _i = 0; _i < LstCheckPoint.Count; _i++) // { // CLDC_DataCore.Struct.CheckPoint _Item = LstCheckPoint[_i]; // _Item.SetLapCount(MinConst, MeConst, Current, Qscz, Czqs); // LstCheckPoint[_i] = _Item; // } //} /// <summary> /// 设置各个测试点误差限(09-7-2之后不再使用) /// </summary> /// <param name="GuiChengName">规程名称"JJG596-1999"</param> /// <param name="DjString">等级字符串1.0,0.5S(2.0)</param> /// <param name="Hgq">是否经互感器0-不,1-要</param> //public void SetWcx(string GuiChengName,string DjString,int Hgq) //{ // CLDC_DataCore.DataBase.clsWcLimitDataControl _WcLimit= new clsWcLimitDataControl(); // bool _YouGong =true; // string[] _Dj = CLDC_DataCore.Function.Number.getDj(DjString); // if (CzWcLimit == "规程误差限") //参照规程误差限则直接通过公式计算误差限 // { // for (int _i = 0; _i < LstCheckPoint.Count; _i++) // { // if ((int)LstCheckPoint[_i].PowerFangXiang > 2) // _YouGong = false; // string _Wcx = ""; // CLDC_DataCore.Struct.CheckPoint _Item = LstCheckPoint[_i]; // if (LstCheckPoint[_i].Pc == 0) //基本误差的误差限获取 // { // _Wcx = clsWcLimitDataControl.Wcx(LstCheckPoint[_i].PowerDianLiu // , GuiChengName // , (int)LstCheckPoint[_i].PowerFangXiang > 2 ? _Dj[1] : _Dj[0] // , LstCheckPoint[_i].PowerYuanJian // , LstCheckPoint[_i].PowerYinSu // , Hgq == 0 ? false : true // , _YouGong); // _Item.SetWcx(float.Parse(_Wcx), float.Parse(string.Format("-{0}", _Wcx))); //设置误差限 // } // else // { // _Wcx = clsWcLimitDataControl.Pcx((int)LstCheckPoint[_i].PowerFangXiang > 2 ? _Dj[1] : _Dj[0]).ToString(); //如果是无功则使用无功等级 // _Item.SetWcx(float.Parse(_Wcx), 0F); //设置误差限 // } // LstCheckPoint[_i] = _Item; // } // } // else // { // CLDC_DataCore.DataBase.IDAndValue _WcLimitName = _WcLimit.getWcLimitNameValue(CzWcLimit); // CLDC_DataCore.DataBase.IDAndValue _GuiChengName = _WcLimit.getGuiChengValue(GuiChengName); // CLDC_DataCore.DataBase.IDAndValue[] _DjValue = new IDAndValue[2]; // _DjValue[0] = _WcLimit.getDjValue(_Dj[0]); // _DjValue[1] = _WcLimit.getDjValue(_Dj[1]); // CLDC_DataCore.SystemModel.Item.csGlys _GlysCol = new CLDC_DataCore.SystemModel.Item.csGlys(); // CLDC_DataCore.SystemModel.Item.csxIbDic _xIbCol = new CLDC_DataCore.SystemModel.Item.csxIbDic(); // _GlysCol.Load(); // _xIbCol.Load(); // for (int _i = 0; _i < LstCheckPoint.Count; _i++) // { // CLDC_DataCore.Struct.CheckPoint _Item = LstCheckPoint[_i]; // CLDC_DataCore.DataBase.IDAndValue _GlysValue = new IDAndValue(); //功率因素值 // CLDC_DataCore.DataBase.IDAndValue _xIbValue = new IDAndValue(); //电流倍数值 // _GlysValue.Value = LstCheckPoint[_i].PowerYinSu; // _GlysValue.id = long.Parse(_GlysCol.getGlysID(_GlysValue.Value)); // _xIbValue.Value = LstCheckPoint[_i].PowerDianLiu; // _xIbValue.id = long.Parse(_xIbCol.getxIbID(_xIbValue.Value)); // if ((int)LstCheckPoint[_i].PowerFangXiang > 2) // _YouGong = false; // if (LstCheckPoint[_i].Pc == 0) //基本误差的误差限获取 // { // string[] _Wcx = _WcLimit.GetWcx(_WcLimitName // , _GuiChengName // , (int)LstCheckPoint[_i].PowerFangXiang > 2 ? _DjValue[1] : _DjValue[0] // , LstCheckPoint[_i].PowerYuanJian // , Hgq == 0 ? false : true // , _YouGong, _GlysValue, _xIbValue).Split('|'); // _Item.SetWcx(float.Parse(_Wcx[0].Replace("+", "")), float.Parse(_Wcx[1])); //设置误差限 // } // else // { // string[] _Wcx = _WcLimit.getPcxValue(_WcLimitName // , _GuiChengName // , (int)LstCheckPoint[_i].PowerFangXiang > 2 ? _DjValue[1] : _DjValue[0]).Split('|'); // _Item.SetWcx(float.Parse(_Wcx[0].Replace("+", "")), float.Parse(_Wcx[1])); //设置误差限 // } // LstCheckPoint[_i] = _Item; // } // } //} #endregion /// <summary> /// 添加一个需要检定的误差点 /// </summary> /// <param name="WcType">误差类型</param> /// <param name="GLFX">功率方向 </param> /// <param name="Yj">元件</param> /// <param name="Glys">功率因素</param> /// <param name="xIb">电流倍数</param> /// <param name="XieBo">是否加谐波0-不加,1-加</param> /// <param name="Xiangxu">相序0-正相序,1-逆相序</param> public void Add(CLDC_Comm.Enum.Cus_WcType WcType, CLDC_Comm.Enum.Cus_PowerFangXiang GLFX, CLDC_Comm.Enum.Cus_PowerYuanJian Yj, string Glys, string xIb, int XieBo, int Xiangxu) { string _PrjID = getWcPrjID(WcType, GLFX, Yj, Glys, xIb, XieBo, Xiangxu); if (CheckedYn(_PrjID)) { return; } StPlan_WcPoint _Point = new StPlan_WcPoint(); _Point.PrjID = _PrjID; string _GlfxString; switch ((int)GLFX) { case 1: { _GlfxString = "P+"; GlfxYj[0] = true; break; } case 2: { _GlfxString = "P-"; GlfxYj[1] = true; break; } case 3: { _GlfxString = "Q+"; GlfxYj[2] = true; break; } case 4: { _GlfxString = "Q-"; GlfxYj[3] = true; break; } case 5: { _GlfxString = "Q1"; GlfxYj[4] = true; break; } case 6: { _GlfxString = "Q2"; GlfxYj[5] = true; break; } case 7: { _GlfxString = "Q3"; GlfxYj[6] = true; break; } case 8: { _GlfxString = "Q4"; GlfxYj[7] = true; break; } default: { _GlfxString = "P+"; break; } } string _Yj = ""; switch (Yj.ToString().ToUpper()) { case "H": _Yj = "合元"; break; case "A": _Yj = "A元"; break; case "B": _Yj = "B元"; break; case "C": _Yj = "C元"; break; default: _Yj = "合元"; break; } _Point.PrjName = string.Format("{0} {1} {2} {3} {4}", _GlfxString, _Yj, Glys, xIb, (int)WcType == 2 ? "标准偏差" : " "); //基本误差 _Point.PowerYinSu = Glys; _Point.PowerDianLiu = xIb; LstCheckPoint.Add(_Point); return; }