예제 #1
0
        private void tsbShare_Click(object sender, EventArgs e)
        {
            if (SelectConductorTipXCode != Guid.Empty)
            {
                if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.ConductorTip), SelectConductorTipXCode))
                {
                    Atend.Base.Equipment.EConductorTip Conductor = Atend.Base.Equipment.EConductorTip.SelectByXCode(SelectConductorTipXCode);
                    Code = Conductor.Code;
                    MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
                }
                else
                {
                    MessageBox.Show("خطا در به اشتراک گذاری .");
                }
            }
            else
            {
                MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
            }

            //if (SelectConductorTipXCode != Guid.Empty)
            //{
            //    if (Atend.Base.Equipment.EConductorTip.ShareOnServer(SelectConductorTipXCode))
            //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
            //    else
            //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
            //}
            //else
            //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
        }
예제 #2
0
 private bool Validation()
 {
     if (string.IsNullOrEmpty(txtName.Text))
     {
         MessageBox.Show("لطفاً نام تيپ را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
         txtName.Focus();
         return(false);
     }
     if (Atend.Base.Equipment.EConductorTip.SearchByName(txtName.Text) == true && SelectConductorTipXCode == Guid.Empty)
     {
         MessageBox.Show("نام قبلا استفاده شده است", "خطا");
         txtName.Focus();
         return(false);
     }
     Atend.Base.Equipment.EConductorTip conductortip = Atend.Base.Equipment.EConductorTip.CheckForExist(Convert.ToInt32(cboPhaseCount.SelectedItem.ToString()), new Guid(cboPhaseProductCode.SelectedValue.ToString()),
                                                                                                        Convert.ToInt32(cboNeutralCount.SelectedItem.ToString()), new Guid(cboNeutralProductCode.SelectedValue.ToString()),
                                                                                                        Convert.ToInt32(cboNightCount.SelectedItem.ToString()), new Guid(cboNightProductCode.SelectedValue.ToString()));
     if (conductortip.Code != -1 && SelectConductorTipXCode == Guid.Empty)
     {
         if (MessageBox.Show("تیپ بندی سیم با مشخصات داده شده موجود میباشد\n\n تیپ بندی سیم با مشخصات فوق  : " + conductortip.Name + "\n\n" + "آیا مایل به ادامه  ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             cboPhaseProductCode.Focus();
             return(false);
         }
     }
     return(CheckStatuseOfAccessChangeDefault());
     //return true;
 }
예제 #3
0
 public void BindDataToGridCell(Guid XCode)
 {
     ed.WriteMessage("Xcode={0}\n", XCode.ToString());
     Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode(XCode);
     ed.WriteMessage("**Name={0}\n", CondTip.Name);
     gvConductor.Rows[RowIndex].Cells["NameCommentTip"].Value  = CondTip.Name;
     gvConductor.Rows[RowIndex].Cells["CommentTipXCode"].Value = CondTip.XCode;
 }
예제 #4
0
        private void btnOk_Click_1(object sender, EventArgs e)
        {
            Atend.Global.Acad.DrawEquips.AcDrawConductor DrawConductor = new Atend.Global.Acad.DrawEquips.AcDrawConductor();
            if (Validation())
            {
                if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[8].Value) == false)//Access
                {
                    //ed.WriteMessage("Access Update\n");
                    DrawConductor.UseAccess = true;
                    Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(
                        Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString()));
                    DrawConductor.eConductorTip = CondTip;
                }
                else
                {
                    //ed.WriteMessage("*******Local Update\n");
                    DrawConductor.UseAccess   = false;
                    DrawConductor.eConductors = new List <Atend.Base.Equipment.EConductor>();
                    Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode(
                        new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString()));
                    //ed.WriteMessage("condTip.Name={0}\n", CondTip.Name);
                    DrawConductor.eConductorTip = CondTip;
                    //ed.WriteMessage("CondTip.PhaseProductXCode={0}\n", CondTip.PhaseProductXCode);
                    Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.SelectByXCode(
                        CondTip.PhaseProductXCode);
                    //ed.WriteMessage("CondPhase.Name={0}\n", CondPhase.Name);
                    DrawConductor.eConductors.Add(CondPhase);
                    //ed.WriteMessage("***\n");
                    Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.SelectByXCode(
                        CondTip.NeutralProductXCode);
                    DrawConductor.eConductors.Add(CondNeutral);

                    Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.SelectByXCode(
                        CondTip.NightProductXCode);
                    DrawConductor.eConductors.Add(CondNight);
                }

                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                DrawConductor.Existance = status.ACode;

                if (cboProjCode.Items.Count == 0)
                {
                    DrawConductor.ProjectCode = 0;
                }
                else
                {
                    DrawConductor.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                DrawConductor.UpdateConductorData(NodeCode, obj, Convert.ToDouble(txtLenght.Text));
            }
            else
            {
                AllowClose = false;
            }
        }
예제 #5
0
        private void Delete()
        {
            string name = string.Empty;

            if (!Atend.Global.Utility.UBinding.ExistInSubEquip(SelectConductor, out name))
            {
                MessageBox.Show(string.Format("حذف بدلیل وجود در تجهیزات جانبی امکانپذیر نمی باشد\n تجهیز موردنظر زیر تجهیز '{0}' میباشد ", name), "خطا");

                return;
            }
            //Atend.Base.Equipment.EProductPackage _ProductPackage = Atend.Base.Equipment.EProductPackage.SelectByXCode(SelectConductor);
            //if (_ProductPackage.Code != -1)
            //{
            //    MessageBox.Show("حذف  بدلیل وجود در تجهیزات جانبی امکانپذیر نمی باشد ", "خطا");
            //    return;
            //}

            Atend.Base.Equipment.EConductorTip NeutralProduct = Atend.Base.Equipment.EConductorTip.SelectByNeutralProductXCode(SelectConductor);
            if (NeutralProduct.Code != -1)
            {
                MessageBox.Show("حذف سیم بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }
            Atend.Base.Equipment.EConductorTip NightProduct = Atend.Base.Equipment.EConductorTip.SelectByNightProductXCode(SelectConductor);
            if (NightProduct.Code != -1)
            {
                MessageBox.Show("حذف سیم بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }
            Atend.Base.Equipment.EConductorTip PhaseProduct = Atend.Base.Equipment.EConductorTip.SelectByPhaseProductXCode(SelectConductor);
            if (PhaseProduct.Code != -1)
            {
                MessageBox.Show("حذف سیم بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }

            if (MessageBox.Show("آیا از حذف کردن اطلاعات اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (SelectConductor != Guid.Empty)
                {
                    if (Atend.Base.Equipment.EConductor.DeleteX(SelectConductor))
                    {
                        Reset();
                    }
                    else
                    {
                        MessageBox.Show("امکان حذف کردن اطلاعات نمی باشد", "خطا");
                    }
                }
                else
                {
                    MessageBox.Show("لطفاً گزینه مورد نظر را انتخاب نمایید", "خطا");
                }
            }
        }
예제 #6
0
        public void BindDataToOwnControl(Guid XCode)
        {
            SelectConductorTipXCode = XCode;
            Atend.Base.Equipment.EConductorTip conductortip = Atend.Base.Equipment.EConductorTip.SelectByXCode(XCode);

            txtName.Text = Convert.ToString(conductortip.Name.ToString());
            cboPhaseCount.SelectedIndex         = Convert.ToInt32(conductortip.PhaseCount.ToString());
            cboNeutralCount.SelectedIndex       = Convert.ToInt32(conductortip.NeutralCount.ToString());
            cboNightCount.SelectedIndex         = Convert.ToInt32(conductortip.NightCount.ToString());
            cboPhaseProductCode.SelectedValue   = new Guid(conductortip.PhaseProductXCode.ToString());
            cboNeutralProductCode.SelectedValue = new Guid(conductortip.NeutralProductXCode.ToString());
            cboNightProductCode.SelectedValue   = new Guid(conductortip.NightProductXCode.ToString());
            tsbIsDefault.Checked = conductortip.IsDefault;
            Code = conductortip.Code;
        }
예제 #7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < ConductorList.Count; i++)
            {
                Atend.Global.Calculation.General.General.AutoCAdConductorList Cond = (Atend.Global.Calculation.General.General.AutoCAdConductorList)ConductorList[i];
                Atend.Base.Design.DBranch          Branch  = Atend.Base.Design.DBranch.AccessSelectByCode(Cond.ConductorGuid);
                Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Branch.ProductCode);
                //ed.WriteMessage("CondTip.Code= "+condTip.Code+"\n");
                Atend.Base.Acad.AT_INFO at_info = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(Cond.ConductorObjectID);
                if (gvConductor.Rows.Count > 0)
                {
                    //Branch.ProductCode = Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString());
                    //Branch.XCode = new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString());
                    //if (chkIsExist.CheckState == CheckState.Unchecked && cboIsExist.SelectedIndex == 0)
                    //    Branch.IsExist = 0;
                    //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 0)
                    //    Branch.IsExist = 1;
                    //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 1)
                    //    Branch.IsExist = 2;

                    //Branch.IsExist = chkIsExist.Checked;
                    Branch.Number = condTip.Description;
                    //if (Branch.AccessUpdate())
                    //{

                    //    //at_info.ProductCode = Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString());

                    //    //**EDIT**
                    //    ////at_info.ProductCode = Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString());
                    //    ////at_info.Insert();
                    //    //ed.WriteMessage("Branch.Number= " + Branch.Number + "\n");
                    //    //ed.WriteMessage("Branch.OBJID=  " + Cond.ConductorObjectID + "\n");
                    //    Atend.Global.Acad.UAcad.ChangeBranchText(Cond.ConductorObjectID, Branch.Number);
                    //}
                    //else
                    //{
                    //    MessageBox.Show("ويرايش امكان پذير نمي باشد");
                    //}
                }
            }

            AllowClose = true;
            Close();
        }
예제 #8
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            Atend.Global.Calculation.Electrical.CElectricalCrossSectionChane change = new Atend.Global.Calculation.Electrical.CElectricalCrossSectionChane();

            for (int i = 0; i < gvConductor.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvConductor.Rows[i].Cells["chkSelect"];
                if (chk.Value.ToString() == "True")
                {
                    if (gvConductor.Rows[i].Cells["NameCommentTip"].Value.ToString() != "")
                    {
                        Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(gvConductor.Rows[i].Cells["Code"].Value.ToString()));
                        change.DBranch.Add(branch);

                        if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor))
                        {
                            Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                            change.CondTip.Add(CondTip);
                        }

                        if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                        {
                            Atend.Base.Equipment.ESelfKeeperTip SelfTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                            change.SelfTip.Add(SelfTip);
                        }

                        //if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                        //{
                        //    Atend.Base.Equipment.EGroundCabelTip  GroundTip = Atend.Base.Equipment.EGroundCabelTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                        //    change.GroundTip.Add(GroundTip);
                        //}
                    }
                }
            }

            if (change.ChangeBranchInfo())
            {
                MessageBox.Show("اعمال تغییرات با موفقیت انجام شد");
            }
            else
            {
                MessageBox.Show("اعمال تغییرات با موفقیت انجام نشد");
            }
        }
예제 #9
0
 private bool CheckStatuseOfAccessChangeDefault()
 {
     Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     //ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault);
     if (!Atend.Control.Common.AccessChangeDefault)
     {
         if (SelectConductorTipXCode == Guid.Empty && IsDefault)
         {
             MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
             return(false);
         }
         else
         {
             Atend.Base.Equipment.EConductorTip Equip = Atend.Base.Equipment.EConductorTip.SelectByXCode(SelectConductorTipXCode);
             if (Equip.IsDefault || IsDefault)
             {
                 MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #10
0
        private void Save()
        {
            txtName.Focus();
            string cmd     = string.Empty;
            bool   sw      = false;
            bool   swPhase = false;

            if (lblPhase.Text != "0")
            {
                cmd    += string.Format("{0}*{1}", lblPhase.Text, txtPhaseCross.Text);
                sw      = true;
                swPhase = true;
            }
            if (lblNeutral.Text != "0")
            {
                if (sw)
                {
                    cmd += " + ";
                }
                cmd += string.Format("{0}*{1}", lblNeutral.Text, txtNeutralCross.Text);
                sw   = true;
            }
            if (lblNight.Text != "0")
            {
                if (sw)
                {
                    cmd += " + ";
                }
                cmd += string.Format("{0}*{1}", lblNight.Text, txtNightCross.Text);
            }
            if (swPhase)
            {
                cmd += "  " + lblMaterialCode.Text;
            }

            Atend.Base.Equipment.EConductorTip conductortip = new Atend.Base.Equipment.EConductorTip();
            conductortip.Name                = txtName.Text;
            conductortip.PhaseCount          = Convert.ToInt32(cboPhaseCount.SelectedItem.ToString());
            conductortip.NeutralCount        = Convert.ToInt32(cboNeutralCount.SelectedItem.ToString());
            conductortip.NightCount          = Convert.ToInt32(cboNightCount.SelectedItem.ToString());
            conductortip.NeutralProductXCode = new Guid(cboNeutralProductCode.SelectedValue.ToString());
            conductortip.PhaseProductXCode   = new Guid(cboPhaseProductCode.SelectedValue.ToString());
            conductortip.NightProductXCode   = new Guid(cboNightProductCode.SelectedValue.ToString());
            conductortip.Description         = cmd;
            conductortip.IsDefault           = IsDefault;
            conductortip.Code                = Code;
            if (SelectConductorTipXCode == Guid.Empty)
            {
                if (conductortip.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                conductortip.XCode = SelectConductorTipXCode;
                if (conductortip.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
예제 #11
0
        //DataColumn dcSCCurrent = new DataColumn("SCCurrent");
        //DataColumn CondMax1sCurrent = new DataColumn("CondMax1sCurrent");

        public frmElectericalResult(DataTable dtNodes, DataTable dtBranch)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }
            InitializeComponent();

            dtResultNode.Columns.Add(dcLoadPowerImage);
            dtResultNode.Columns.Add(dcLoadPowerReal);
            dtResultNode.Columns.Add(dcVoltAbs);
            dtResultNode.Columns.Add(dcVoltAng);
            dtResultNode.Columns.Add(dcVoltDropPer);
            dtResultNode.Columns.Add(dcLoadCurrentAbs);
            dtResultNode.Columns.Add(dcLoadCurrentArg);
            dtResultNode.Columns.Add(dcConsolGuid);

            dtResultBranch.Columns.Add(dcCode);
            dtResultBranch.Columns.Add(dcCondUtilization);
            dtResultBranch.Columns.Add(dcLenght);
            dtResultBranch.Columns.Add(dcCurrentAbs);
            dtResultBranch.Columns.Add(dcCurrentAng);
            dtResultBranch.Columns.Add(dcTotalLoadREal);
            dtResultBranch.Columns.Add(dcCondCode);
            dtResultBranch.Columns.Add(dcCondCurrent);
            dtResultBranch.Columns.Add(dcFrom);
            dtResultBranch.Columns.Add(dcTo);
            dtResultBranch.Columns.Add(dcPowerLoss);
            //dtResultBranch.Columns.Add(dcSCCurrent);
            //dtResultBranch.Columns.Add(CondMax1sCurrent);

            //ed.WriteMessage("Print Nodes\n");

            Atend.Base.Calculating.CDistributedLoadBranch.AccessDelete();
            Atend.Base.Calculating.CDistributedLoadNode.AccessDelete();

            foreach (DataRow dr in dtNodes.Rows)
            {
                DataRow drNew = dtResultNode.NewRow();
                Atend.Base.Calculating.CDistributedLoadNode loadNode = new Atend.Base.Calculating.CDistributedLoadNode();

                Atend.Base.Design.DPackage pack = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["ConsoleGuid"].ToString()));
                if (pack.Code != Guid.Empty)
                {
                    drNew["ConsolGuid"] = pack.Number;
                    loadNode.NodeName   = pack.Number;

                    drNew["VoltAbs"] = Math.Round(((Complex)dr["Voltage"]).abs, 3);
                    loadNode.VoltAbs = Math.Round(((Complex)dr["Voltage"]).abs, 3);
                    double voltDegree = ConvertToDegree(((Complex)dr["Voltage"]).arg);
                    //drNew["VoltArg"] = Math.Round(((Complex)dr["Voltage"]).arg, 2);
                    //loadNode.VoltArg = Math.Round(((Complex)dr["Voltage"]).arg, 2);

                    drNew["VoltArg"] = Math.Round(voltDegree, 2);
                    loadNode.VoltArg = Math.Round(voltDegree, 2);

                    double voltDropPer = 100 - Convert.ToDouble(dr["VoltageDropPer"].ToString());

                    drNew["VoltDropPer"] = Math.Round(voltDropPer, 2);
                    loadNode.DropVolt    = Convert.ToDouble(Math.Round(voltDropPer, 2));

                    drNew["LoadPowerReal"] = Math.Round(((Complex)dr["LoadPower"]).imag, 3) / 1000;
                    loadNode.LoadPower     = Math.Round(((Complex)dr["LoadPower"]).imag, 3) / 1000;


                    drNew["LoadPowerImg"]    = Math.Round(((Complex)dr["LoadPower"]).real, 3) / 1000;
                    loadNode.LoadPowerActive = Math.Round(((Complex)dr["LoadPower"]).real, 3) / 1000;

                    drNew["LoadCurrentAbs"] = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);//.ToString();
                    loadNode.LoadCurrentAbs = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);


                    double LoadCurrentArg = ConvertToDegree(((Complex)dr["LoadCurrent"]).arg);
                    //drNew["LoadCurrentArg"] = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);
                    //loadNode.LoadCurrentArg = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);


                    drNew["LoadCurrentArg"] = Math.Round(LoadCurrentArg, 3);
                    loadNode.LoadCurrentArg = Math.Round(LoadCurrentArg, 3);

                    dtResultNode.Rows.Add(drNew);

                    if (!loadNode.AccessInsert())
                    {
                        ed.WriteMessage("LoadNode Insert Failed\n");
                    }
                }
            }
            //ed.WriteMessage("Print Branch\n");
            double totalLoad = 0;

            foreach (DataRow dr in dtBranch.Rows)
            {
                DataRow drNew = dtResultBranch.NewRow();
                Atend.Base.Calculating.CDistributedLoadBranch LoadBranch = new Atend.Base.Calculating.CDistributedLoadBranch();
                Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(dr["Code"].ToString()));

                if (branch.Code != Guid.Empty)
                {
                    drNew["Code"]         = branch.Number;
                    LoadBranch.BranchName = branch.Number;

                    drNew["Lenght"]   = Math.Round(Convert.ToDouble(dr["Length"].ToString()), 2);
                    LoadBranch.Lenght = Math.Round(Convert.ToDouble(dr["Length"].ToString()), 3);

                    drNew["CondUtilization"]   = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    LoadBranch.Condutilization = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);

                    drNew["CurrentAbs"]   = Math.Round(((Complex)dr["Current"]).abs, 3);//.ToString();
                    LoadBranch.CurrentAbs = Math.Round(((Complex)dr["Current"]).abs, 3);


                    double currentArg = ConvertToDegree(((Complex)dr["Current"]).arg);
                    //drNew["CurrentArg"] = Math.Round(((Complex)dr["Current"]).arg, 3);
                    //LoadBranch.CurrentArg = Math.Round(((Complex)dr["Current"]).arg, 3);
                    drNew["CurrentArg"]   = Math.Round(currentArg, 3);
                    LoadBranch.CurrentArg = Math.Round(currentArg, 3);

                    //MessageBox.Show(dr["PowerLoss"].ToString());


                    totalLoad += Math.Round(((Complex)dr["TotalLoad"]).real / 1000 + (Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000), 3);
                    drNew["TotalLoadReal"] = totalLoad;
                    LoadBranch.TotalLoad   = totalLoad;//Math.Round(((Complex)dr["TotalLoad"]).real / 1000 + (Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000), 3);


                    ed.WriteMessage("CondCode={0}\n", dr["CondCode"].ToString());

                    if ((branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Terminal)))
                    {
                        Atend.Base.Equipment.EConductorTip econdTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EConductor    eCond    = Atend.Base.Equipment.EConductor.AccessSelectByCode(econdTip.PhaseProductCode);

                        drNew["CondName"]    = eCond.Name;
                        drNew["CondCurrent"] = eCond.MaxCurrent;

                        LoadBranch.CondName    = eCond.Name;
                        LoadBranch.CondCurrent = eCond.MaxCurrent;
                    }
                    else if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeperTip eSelTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.ESelfKeeper    eSelf   = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(eSelTip.PhaseProductCode);

                        drNew["CondName"]    = eSelf.Name;
                        drNew["CondCurrent"] = eSelf.MaxCurrent;

                        LoadBranch.CondName    = eSelf.Name;
                        LoadBranch.CondCurrent = eSelf.MaxCurrent;
                    }
                    else if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                    {
                        Atend.Base.Equipment.EGroundCabelTip egroundTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EGroundCabel    eGround    = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(egroundTip.PhaseProductCode);

                        drNew["CondName"]    = eGround.Name;
                        drNew["CondCurrent"] = eGround.MaxCurrent;

                        LoadBranch.CondName    = eGround.Name;
                        LoadBranch.CondCurrent = eGround.MaxCurrent;
                    }

                    DataRow[] drnodeFrom = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["From"]   = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                        LoadBranch.From = drNew["From"].ToString();
                    }


                    //به
                    DataRow[] drnodeTo = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        //drNew["Volt"] = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["To"]   = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                        LoadBranch.To = drNew["To"].ToString();
                    }
                    LoadBranch.PowerLoss = Math.Round(Convert.ToDouble(dr["PowerLoss"]) / 1000, 2);
                    drNew["PowerLoss"]   = Math.Round(Convert.ToDouble(dr["PowerLoss"]) / 1000, 2);



                    dtResultBranch.Rows.Add(drNew);
                    if (!LoadBranch.AccessInsert())
                    {
                        ed.WriteMessage("LoadBranch Inser Failed\n");
                    }
                }
                //drNew["SCCurrent"] = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 3);
                //drNew["CondMax1sCurrent"] = Math.Round(Convert.ToDouble(dr["CondMax1sCurrent"].ToString()), 3);
            }
            //ed.WriteMessage("BindDAtA\n");
            //string Code1 = "00000000-0000-0000-0000-000000000000";
            //DataRow[] drs = dtResultBranch.Select(" Code= '" + Code1 + "'");
            //drs[0].Delete();

            //DataRow[] drs1 = dtResultNode.Select(" ConsolGuid ='" + Code1 + "'");
            //drs1[0].Delete();

            gvBranch.AutoGenerateColumns = false;
            gvBranch.DataSource          = dtResultBranch;

            gvNode.AutoGenerateColumns = false;
            gvNode.DataSource          = dtResultNode;
        }
예제 #12
0
        private void frmDrawBranch01_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }
            //BindDataTocboProjCode();
            BindMaterialToComboBox();
            BindDataToComboBoxIsExist();
            if (cboMaterial.Items.Count > 0)
            {
                cboMaterial.SelectedIndex = 0;
            }

            dtMerge = Atend.Base.Equipment.EConductorTip.SelectAllAndMerge();
            System.Data.DataColumn dcAMP          = new System.Data.DataColumn("AMP");
            System.Data.DataColumn dcMaterialName = new System.Data.DataColumn("MaterialName");
            dtMerge.Columns.Add(dcMaterialName);
            dtMerge.Columns.Add(dcAMP);
            foreach (DataRow dr in dtMerge.Rows)
            {
                dr["AMP"] = string.Format("{0}+{1}j", dr["Resistance"].ToString(), dr["Reactance"].ToString());
                if (Convert.ToInt32(dr["TypeCode"].ToString()) == 0)
                {
                    dr["MaterialName"] = "مسی";
                }
                if (Convert.ToInt32(dr["TypeCode"].ToString()) == 1)
                {
                    dr["MaterialName"] = "آلومینیوم";
                }
                if (Convert.ToInt32(dr["TypeCode"].ToString()) == 2)
                {
                    dr["MaterialName"] = "آلومینیو مغز فولاد";
                }
                if (Convert.ToInt32(dr["TypeCode"].ToString()) == 3)
                {
                    dr["MaterialName"] = "آلیاژ آلومینیوم";
                }
            }

            Atend.Base.Design.DBranch          Branch  = Atend.Base.Design.DBranch.AccessSelectByCode(NodeCode);
            Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Branch.ProductCode);
            selectedProductCode = CondTip.Code;

            gvConductor.AutoGenerateColumns = false;
            gvConductor.DataSource          = dtMerge;

            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("CondCode", new object[1] {
                selectedProductCode
            }, dtMerge, gvConductor, this);
            ChangeColor();
            for (int i = 0; i < gvConductor.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvConductor.Rows[i].Cells[0].Value.ToString()) == CondTip.Code)
                {
                    gvConductor.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }

            txtLenght.Text            = Math.Round(Branch.Lenght, 2).ToString();
            Length                    = Convert.ToDouble(Math.Round(Branch.Lenght, 2).ToString());
            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(Branch.IsExist).Code;
            cboProjCode.SelectedValue = Branch.ProjectCode;
        }
예제 #13
0
        public frmCrossSectionResult(DataTable dtBranch, DataTable dtNode, int TypeCode)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }
            InitializeComponent();
            //_dtBranchResult = dtBranch;
            _TypeCode = TypeCode;

            _dtBranchResult.Columns.Add("NameExist");
            _dtBranchResult.Columns.Add("NameComment");
            _dtBranchResult.Columns.Add("NameCommentTip");
            _dtBranchResult.Columns.Add("CommentTipXCode");
            _dtBranchResult.Columns.Add("Volt");
            _dtBranchResult.Columns.Add("LossPower");
            _dtBranchResult.Columns.Add("CurrentAbs");
            _dtBranchResult.Columns.Add("FromComment");
            _dtBranchResult.Columns.Add("ToComment");
            _dtBranchResult.Columns.Add("PowerLoss");
            _dtBranchResult.Columns.Add("CrossSectionArea");
            _dtBranchResult.Columns.Add("Length");
            _dtBranchResult.Columns.Add("Select");
            _dtBranchResult.Columns.Add("Code");
            _dtBranchResult.Columns.Add("ProductType");


            double totalloss = 0;

            Atend.Base.Calculating.CCrossSection.AccessDelete();

            foreach (DataRow d in dtBranch.Rows)
            {
                totalloss += Convert.ToDouble(d["PowerLoss"].ToString());
            }
            foreach (DataRow dr in dtBranch.Rows)
            {
                Atend.Base.Calculating.CCrossSection crossSection = new Atend.Base.Calculating.CCrossSection();

                if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                {
                    DataRow drNew = _dtBranchResult.NewRow();

                    if (Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeper    self    = new Atend.Base.Equipment.ESelfKeeper();
                        Atend.Base.Equipment.ESelfKeeperTip SelfTip = new Atend.Base.Equipment.ESelfKeeperTip();
                        if ((new Guid(dr["Code"].ToString()) != Guid.Empty))
                        {
                            SelfTip                = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));
                            self                   = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfTip.PhaseProductCode);
                            drNew["NameExist"]     = self.Name;
                            crossSection.ExistCond = self.Name;

                            Atend.Base.Equipment.ESelfKeeper Self1 = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                            drNew["NameComment"]     = Self1.Name;
                            crossSection.CommentCond = Self1.Name;

                            DataTable dtCommentTip = Atend.Base.Equipment.ESelfKeeperTip.SearchConductorSelfKeeperTipConductorTypeX(Convert.ToDouble(dr["CrossSectionArea"].ToString()), TypeCode);
                            //ed.WriteMessage("commentTipName={0}\n", dtCommentTip.Rows[0]["Name"].ToString());
                            if (dtCommentTip.Rows.Count > 0)
                            {
                                drNew["NameCommentTip"]  = dtCommentTip.Rows[0]["Name"].ToString();
                                drNew["CommentTipXCode"] = dtCommentTip.Rows[0]["XCode"].ToString();
                            }
                            else
                            {
                                drNew["NameCommentTip"] = "";
                            }
                        }
                    }
                    else if ((Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)))
                    {
                        Atend.Base.Equipment.EConductor    cond    = new Atend.Base.Equipment.EConductor();
                        Atend.Base.Equipment.EConductorTip condTip = new Atend.Base.Equipment.EConductorTip();
                        if ((new Guid(dr["Code"].ToString()) != Guid.Empty))
                        {
                            ed.WriteMessage("ProductType={0},CondCode={1}\n", dr["condProductType"].ToString(), dr["CondCode"].ToString());
                            condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));
                            ed.WriteMessage("condTip.PhaseProductCode={0} \n", condTip.PhaseProductCode);

                            cond = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                            drNew["NameExist"]     = cond.Name;
                            crossSection.ExistCond = cond.Name;
                            ed.WriteMessage("****CondCode1={0}\n", dr["CondCode1"].ToString());
                            Atend.Base.Equipment.EConductor cond1 = Atend.Base.Equipment.EConductor.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                            drNew["NameComment"]     = cond1.Name;
                            crossSection.CommentCond = cond1.Name;

                            ed.WriteMessage("TypeCode={0}\n", TypeCode.ToString());

                            DataTable dtCommentTip = Atend.Base.Equipment.EConductorTip.SearchConductorConductorTipConductorTypeX(Convert.ToDouble(dr["CrossSectionArea"].ToString()), TypeCode);
                            ed.WriteMessage("commentTipName={0}\n", dtCommentTip.Rows[0]["Name"].ToString());
                            if (dtCommentTip.Rows.Count > 0)
                            {
                                drNew["NameCommentTip"]  = dtCommentTip.Rows[0]["Name"].ToString();
                                drNew["CommentTipXCode"] = dtCommentTip.Rows[0]["XCode"].ToString();
                            }
                            else
                            {
                                drNew["NameCommentTip"] = "";
                            }
                        }
                    }


                    //از
                    DataRow[] drnodeFrom = dtNode.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["FromComment"] = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                    }


                    //به
                    DataRow[] drnodeTo = dtNode.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        drNew["Volt"]      = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["ToComment"] = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                    }

                    //////{
                    //////    dr["LossPower"] = totalloss / ((Complex)dr["TotalLoad"]).real;

                    //////}

                    drNew["PowerLoss"]        = Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000;
                    drNew["CurrentAbs"]       = Math.Round(((Complex)(dr["Current"])).abs, 1);
                    drNew["CrossSectionArea"] = Convert.ToDouble(dr["CrossSectionArea"].ToString());
                    drNew["Length"]           = Convert.ToDouble(dr["Length"].ToString());
                    drNew["Select"]           = true;
                    drNew["Code"]             = dr["Code"].ToString();
                    drNew["ProductType"]      = Convert.ToInt32(dr["CondProductType"].ToString());


                    _dtBranchResult.Rows.Add(drNew);

                    crossSection.Current      = Math.Round(((Complex)(dr["Current"])).abs, 1);
                    crossSection.From         = drNew["FromComment"].ToString();
                    crossSection.To           = drNew["ToComment"].ToString();
                    crossSection.CrossSection = Convert.ToDouble(drNew["CrossSectionArea"].ToString());
                    crossSection.Lenght       = Convert.ToDouble(drNew["Length"].ToString());
                    crossSection.Volt         = Math.Round(Convert.ToDouble(drNew["Volt"].ToString()), 1);
                    crossSection.PowerLoss    = Convert.ToDouble(drNew["PowerLoss"].ToString());

                    if (!crossSection.AccessInsert())
                    {
                        ed.WriteMessage("CrossSection Insert Failed\n");
                    }
                }


                //Atend.Base.Equipment.EConductor cond1 = Atend.Base.Equipment.EConductor.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                //dr["NameComment"] = cond1.Name;
            }
            ed.WriteMessage("1\n");
            //DataRow[] drs = _dtBranchResult.Select(" UpNodeId= 0 ");
            //drs[0].Delete();

            gvConductor.AutoGenerateColumns = false;
            gvConductor.DataSource          = _dtBranchResult;


            //حذف ستونی که دارای کد 0 می باشد
            //int countOfRows = gvConductor.Rows.Count;
            //for (int i = countOfRows; i >0 ; i--)
            //{
            //    ed.WriteMessage("i={0}\n",i.ToString());
            //    if (gvConductor.Rows[i].Cells["UpNodeId"].Value.ToString() == "0")
            //    {
            //        ed.WriteMessage("I AM In The IF\n");
            //        gvConductor.Rows.RemoveAt(i);
            //    }
            //}
            //gvConductor.Refresh();

            //////////تغییر رنگ بیشترین درصد افت توان در جدول
            ////////ed.WriteMessage("(((");
            ////////double max = Convert.ToDouble(gvConductor.Rows[0].Cells["Column7"].Value.ToString());
            ////////ed.WriteMessage("MAx={0}\n",max);
            ////////int j=0;
            ////////for (int i = 1; i < gvConductor.Rows.Count; i++)
            ////////{
            ////////    if (Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString()) > max)
            ////////    {
            ////////        max = Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString());
            ////////        j=i;
            ////////    }
            ////////}
            ////////ed.WriteMessage("MAx={0},J={1}\n",max,j);
            ////////gvConductor.Rows[j].DefaultCellStyle.BackColor=Color.Red;


            //////////یافتن تلفات کل شبکه
            ////////double  sum = 0;
            ////////for (int i = 0; i < gvConductor.Rows.Count; i++)
            ////////{
            ////////    sum += Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString());
            ////////}
            ////////lblSum.Text = sum.ToString();
            gvConductor.MouseMove += new MouseEventHandler(gvConductor_MouseMove);
        }
예제 #14
0
        public frmShortCircuitResult1(DataTable dtNodes, DataTable dtBranch, double FalutDuration)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }

            InitializeComponent();
            _FaultDuration = FalutDuration;
            dtResultNode.Columns.Add(dcLoadPowerImage);
            dtResultNode.Columns.Add(dcLoadPowerReal);
            dtResultNode.Columns.Add(dcVoltAbs);
            dtResultNode.Columns.Add(dcVoltAng);
            dtResultNode.Columns.Add(dcVoltDropPer);
            dtResultNode.Columns.Add(dcLoadCurrentAbs);
            dtResultNode.Columns.Add(dcLoadCurrentArg);
            dtResultNode.Columns.Add(dcConsolGuid);

            dtResultBranch.Columns.Add(dcCode);
            dtResultBranch.Columns.Add(dcCondUtilization);
            dtResultBranch.Columns.Add(dcLenght);
            dtResultBranch.Columns.Add(dcCurrentAbs);
            dtResultBranch.Columns.Add(dcCurrentAng);
            dtResultBranch.Columns.Add(dcTotalLoadREal);
            dtResultBranch.Columns.Add(dcSCCurrent);
            dtResultBranch.Columns.Add(CondMax1sCurrent);

            //ed.WriteMessage("Print Nodes\n");
            foreach (DataRow dr in dtNodes.Rows)
            {
                DataRow drNew = dtResultNode.NewRow();

                drNew["ConsolGuid"] = dr["ConsoleGuid"].ToString();
                drNew["VoltAbs"]    = Math.Round(((Complex)dr["Voltage"]).abs, 3);
                drNew["VoltArg"]    = Math.Round(((Complex)dr["Voltage"]).arg, 2);

                drNew["VoltDropPer"]    = Math.Round(Convert.ToDouble(dr["VoltageDropPer"].ToString()));
                drNew["LoadPowerReal"]  = Math.Round(((Complex)dr["LoadPower"]).real, 3);
                drNew["LoadPowerImg"]   = Math.Round(((Complex)dr["LoadPower"]).imag, 3);
                drNew["LoadCurrentAbs"] = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3); //.ToString();
                drNew["LoadCurrentArg"] = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3); //.ToString();
                dtResultNode.Rows.Add(drNew);
            }
            ed.WriteMessage("Print Branch\n");
            foreach (DataRow dr in dtBranch.Rows)
            {
                DataRow drNew = dtResultBranch.NewRow();
                drNew["Code"]            = dr["Code"].ToString();
                drNew["Lenght"]          = dr["Length"].ToString();
                drNew["CondUtilization"] = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                drNew["CurrentAbs"]      = Math.Round(((Complex)dr["Current"]).abs, 3); //.ToString();
                drNew["CurrentArg"]      = Math.Round(((Complex)dr["Current"]).arg, 3); //.ToString();
                drNew["TotalLoadReal"]   = Math.Round(((Complex)dr["TotalLoad"]).arg, 3);
                drNew["SCCurrent"]       = Math.Round(Convert.ToDouble(dr["CondUtilizationSC"].ToString()), 0);
                ed.WriteMessage("CondCode={0}\n", dr["CondCode"].ToString());
                if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                {
                    Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.SelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));

                    Atend.Base.Equipment.EConductor conductor = Atend.Base.Equipment.EConductor.SelectByCode(condTip.PhaseProductCode);
                    ed.WriteMessage("conductor.MaxCurrent1Second={0},SCCurrent={1}\n", conductor.MaxCurrent1Second, dr["SCCurrent"].ToString());

                    double IbMax = Convert.ToDouble(conductor.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                    drNew["CondMax1sCurrent"] = Math.Round((Convert.ToDouble(dr["SCCurrent"]) / IbMax) * 100, 1);
                    ed.WriteMessage("#######\n");
                    //ed.WriteMessage("&&&&&&={0}\n", dr["CondMax1sCurrent"].ToString());
                }
                else
                {
                    drNew["CondMax1sCurrent"] = dr["CondUtilizationSC"].ToString();
                }
                dtResultBranch.Rows.Add(drNew);
            }
            foreach (DataRow dr in dtResultBranch.Rows)
            {
                ed.WriteMessage("dtResultBranch.CondMax1sCurrent={0}\n", dr["CondMax1sCurrent"].ToString());
            }

            string code1 = "00000000-0000-0000-0000-000000000000";

            DataRow[] drs = dtResultBranch.Select(" Code = '" + code1 + "'");
            drs[0].Delete();

            DataRow[] drs1 = dtResultNode.Select(" ConsolGuid = '" + code1 + "'");
            drs1[0].Delete();

            ed.WriteMessage("BindDAtA\n");
            gvBranch.AutoGenerateColumns = false;
            gvBranch.DataSource          = dtResultBranch;

            gvNode.AutoGenerateColumns = false;
            gvNode.DataSource          = dtResultNode;
        }
예제 #15
0
        public static void SetBranchData(Atend.Base.Design.DBranch Branch, int BranchMode)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            // ed.WriteMessage("Branch>productType={0},Mode={1},BranchGuid={2}\n",Branch.ProductType,BranchMode.ToString(),Branch.Code);
            if (Branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor))
            {
                Atend.Base.Equipment.EConductorTip MyConductorTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Branch.ProductCode);
                Atend.Base.Equipment.EConductor    MyConductor    = new Atend.Base.Equipment.EConductor();
                switch ((Atend.Control.Enum.BranchMode)BranchMode)
                {
                case Atend.Control.Enum.BranchMode.Phase:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.PhaseProductCode);
                    //ed.WriteMessage("***MyMranch.Name={0}\n",MyConductor.Name);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Night:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.NightProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Netural:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.NeutralProductCode);
                    break;
                }
                }



                Atend.Global.Calculation.Mechanical.CCommon.Code = MyConductor.Code;
                //double f=10e-6;
                //ed.WriteMessage("10^-6={0}\n", f.ToString());
                Atend.Global.Calculation.Mechanical.CCommon.Alpha            = MyConductor.Alpha * Math.Pow(10, -6);
                Atend.Global.Calculation.Mechanical.CCommon.Diagonal         = MyConductor.Diagonal;
                Atend.Global.Calculation.Mechanical.CCommon.UTS              = MyConductor.UTS;
                Atend.Global.Calculation.Mechanical.CCommon.Name             = MyConductor.Name;
                Atend.Global.Calculation.Mechanical.CCommon.Alasticity       = MyConductor.Alasticity;
                Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea = MyConductor.CrossSectionArea;
                Atend.Global.Calculation.Mechanical.CCommon.WC   = MyConductor.Wc;
                Atend.Global.Calculation.Mechanical.CCommon.Type = MyConductor.TypeCode;
                //ed.WriteMessage("**************ALPHA={0},ConductorALPHA={1}\n", Atend.Global.Calculation.Mechanical.CCommon.Alpha, MyConductor.Alpha);
            }
            else
            {
                Atend.Base.Equipment.ESelfKeeperTip MySelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Branch.ProductCode);
                Atend.Base.Equipment.ESelfKeeper    MySelfKeeper    = new Atend.Base.Equipment.ESelfKeeper();
                switch ((Atend.Control.Enum.BranchMode)BranchMode)
                {
                case Atend.Control.Enum.BranchMode.Phase:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.PhaseProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Night:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.NightProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Netural:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.NeutralProductCode);
                    break;
                }
                }
                Atend.Global.Calculation.Mechanical.CCommon.Code             = MySelfKeeper.Code;
                Atend.Global.Calculation.Mechanical.CCommon.Alpha            = MySelfKeeper.Alpha * Math.Pow(10, -6);
                Atend.Global.Calculation.Mechanical.CCommon.Diagonal         = MySelfKeeper.Diagonal;
                Atend.Global.Calculation.Mechanical.CCommon.UTS              = MySelfKeeper.UTS;
                Atend.Global.Calculation.Mechanical.CCommon.Name             = MySelfKeeper.Name;
                Atend.Global.Calculation.Mechanical.CCommon.Alasticity       = MySelfKeeper.Alastisity;
                Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea = MySelfKeeper.CrossSectionKeeper;
                Atend.Global.Calculation.Mechanical.CCommon.WC = MySelfKeeper.Weight;
            }
        }
예제 #16
0
        public frmShortCircuitResult(DataTable dtNodes, DataTable dtBranch, double FalutDuration)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }

            InitializeComponent();
            _FaultDuration = FalutDuration;
            dtResultNode.Columns.Add(dcLoadPowerImage);
            dtResultNode.Columns.Add(dcLoadPowerReal);
            dtResultNode.Columns.Add(dcVoltAbs);
            dtResultNode.Columns.Add(dcVoltAng);
            dtResultNode.Columns.Add(dcVoltDropPer);
            dtResultNode.Columns.Add(dcLoadCurrentAbs);
            dtResultNode.Columns.Add(dcLoadCurrentArg);
            dtResultNode.Columns.Add(dcConsolGuid);

            dtResultBranch.Columns.Add(dcCode);
            dtResultBranch.Columns.Add(dcCondUtilization);
            dtResultBranch.Columns.Add(dcLenght);
            dtResultBranch.Columns.Add(dcCurrentAbs);
            dtResultBranch.Columns.Add(dcCurrentAng);
            dtResultBranch.Columns.Add(dcTotalLoadREal);
            dtResultBranch.Columns.Add(dcSCCurrent);
            dtResultBranch.Columns.Add(CondMax1sCurrent);
            dtResultBranch.Columns.Add(dcFrom);
            dtResultBranch.Columns.Add(dcTo);
            dtResultBranch.Columns.Add(dcCondName);
            dtResultBranch.Columns.Add(dcVolt);

            ed.WriteMessage("Print Nodes\n");
            foreach (DataRow dr in dtNodes.Rows)
            {
                DataRow drNew = dtResultNode.NewRow();
                if (new Guid(dr["ConsoleGuid"].ToString()) != Guid.Empty)
                {
                    Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["ConsoleGuid"].ToString()));
                    drNew["ConsolGuid"] = dPack.Number;
                    drNew["VoltAbs"]    = Math.Round(((Complex)dr["Voltage"]).abs, 3);

                    double voltArg = ConvertToDegree(((Complex)dr["Voltage"]).arg);
                    //drNew["VoltArg"] = Math.Round(((Complex)dr["Voltage"]).arg, 2);
                    drNew["VoltArg"] = Math.Round(voltArg, 2);

                    drNew["VoltDropPer"]    = Math.Round(Convert.ToDouble(dr["VoltageDropPer"].ToString()));
                    drNew["LoadPowerReal"]  = Math.Round(((Complex)dr["LoadPower"]).real, 3);
                    drNew["LoadPowerImg"]   = Math.Round(((Complex)dr["LoadPower"]).imag, 3);
                    drNew["LoadCurrentAbs"] = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);//.ToString();
                    double loadcurrentArg = ConvertToDegree(((Complex)dr["LoadCurrent"]).arg);

                    //drNew["LoadCurrentArg"] = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);//.ToString();
                    drNew["LoadCurrentArg"] = loadcurrentArg;
                    dtResultNode.Rows.Add(drNew);
                }
            }
            ed.WriteMessage("Print Branch\n");

            Atend.Base.Calculating.CShortCircuit.AccessDelete();

            foreach (DataRow dr in dtBranch.Rows)
            {
                Atend.Base.Calculating.CShortCircuit shortCircuit = new Atend.Base.Calculating.CShortCircuit();
                if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                {
                    DataRow drNew = dtResultBranch.NewRow();
                    Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(dr["Code"].ToString()));
                    //drNew["Code"] = branch.Number;

                    if ((branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Terminal)))
                    {
                        Atend.Base.Equipment.EConductorTip ConductorTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EConductor    Conductor    = Atend.Base.Equipment.EConductor.AccessSelectByCode(ConductorTip.PhaseProductCode);
                        drNew["CondName"] = Conductor.Name;
                        double IbMax = Convert.ToDouble(Conductor.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"] = Math.Round(IbMax, 1);

                        shortCircuit.CondName         = Conductor.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }

                    if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.ESelfKeeper    SelfKeeper    = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfKeeperTip.PhaseProductCode);
                        drNew["CondName"] = SelfKeeper.Name;
                        double IbMax = Convert.ToDouble(SelfKeeper.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"]     = Math.Round(IbMax, 1);
                        shortCircuit.CondName         = SelfKeeper.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }

                    if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                    {
                        Atend.Base.Equipment.EGroundCabelTip GroundTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EGroundCabel    Ground    = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(GroundTip.PhaseProductCode);
                        drNew["CondName"] = Ground.Name;
                        double IbMax = Convert.ToDouble(Ground.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"]     = Math.Round(IbMax, 1);
                        shortCircuit.CondName         = Ground.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }


                    drNew["Lenght"]          = dr["Length"].ToString();
                    drNew["CondUtilization"] = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    drNew["CurrentAbs"]      = Math.Round(((Complex)dr["Current"]).abs, 3);//.ToString();
                    double currentArg = ConvertToDegree(((Complex)dr["Current"]).arg);

                    //drNew["CurrentArg"] = Math.Round(((Complex)dr["Current"]).arg, 3);//.ToString();
                    drNew["CurrentArg"] = Math.Round(currentArg, 3);

                    drNew["TotalLoadReal"] = Math.Round(((Complex)dr["TotalLoad"]).arg, 3);
                    drNew["SCCurrent"]     = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 0);
                    ed.WriteMessage("CondCode={0}\n", dr["CondCode"].ToString());


                    shortCircuit.Lenght          = Convert.ToDouble(dr["Length"].ToString());
                    shortCircuit.Condutilization = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    shortCircuit.CurrentAbs      = Math.Round(((Complex)dr["Current"]).abs, 3); //.ToString();

                    shortCircuit.CurrentArg = Math.Round(currentArg, 3);                        //.ToString();

                    shortCircuit.TotalLoad = Math.Round(((Complex)dr["TotalLoad"]).arg, 3);
                    shortCircuit.ScCurrent = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 0);
                    ed.WriteMessage("Current={0}\n", shortCircuit.ScCurrent);


                    //از
                    DataRow[] drnodeFrom = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["From"]     = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                        shortCircuit.From = drNew["From"].ToString();
                    }


                    //به
                    DataRow[] drnodeTo = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        drNew["Volt"]     = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["To"]       = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                        shortCircuit.To   = drNew["To"].ToString();
                        shortCircuit.Volt = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2);
                    }



                    //if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                    //{
                    ////Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));

                    ////Atend.Base.Equipment.EConductor conductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                    ////ed.WriteMessage("conductor.MaxCurrent1Second={0},SCCurrent={1}\n", conductor.MaxCurrent1Second, dr["SCCurrent"].ToString());


                    ////ed.WriteMessage("#######\n");

                    //ed.WriteMessage("&&&&&&={0}\n", dr["CondMax1sCurrent"].ToString());
                    //}
                    //else
                    //{

                    //    drNew["CondMax1sCurrent"] = dr["CondUtilizationSC"].ToString();
                    //}

                    dtResultBranch.Rows.Add(drNew);



                    if (!shortCircuit.AccessInsert())
                    {
                        ed.WriteMessage("Insert Failed\n");
                    }
                }
            }
            ////foreach (DataRow dr in dtResultBranch.Rows)
            ////{
            ////    ed.WriteMessage("dtResultBranch.CondMax1sCurrent={0}\n", dr["CondMax1sCurrent"].ToString());
            ////}

            //string code1 = "00000000-0000-0000-0000-000000000000";
            //DataRow[] drs = dtResultBranch.Select(" Code = '"+code1+"'");
            //drs[0].Delete();

            //DataRow[] drs1 = dtResultNode.Select(" ConsolGuid = '" + code1 + "'");
            //drs1[0].Delete();

            ed.WriteMessage("BindDAtA\n");
            gvBranch.AutoGenerateColumns = false;
            gvBranch.DataSource          = dtResultBranch;

            //gvNode.AutoGenerateColumns = false;
            //gvNode.DataSource = dtResultNode;
            CheckCurrent();
        }
예제 #17
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Clear();
                if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[8].Value) == false)//Access
                {
                    Atend.Base.Acad.AcadGlobal.TerminalData.UseAccess = true;
                    Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value));
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductorTip = CondTip;

                    Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.AccessSelectByCode(CondTip.PhaseProductCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondPhase);

                    Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.AccessSelectByCode(CondTip.NeutralProductCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondNeutral);

                    Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.AccessSelectByCode(CondTip.NightProductCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondNight);
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.TerminalData.UseAccess = false;
                    Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode(new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductorTip = CondTip;

                    Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip.PhaseProductXCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondPhase);

                    Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip.NeutralProductXCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondNeutral);

                    Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip.NightProductXCode);
                    Atend.Base.Acad.AcadGlobal.TerminalData.eConductors.Add(CondNight);
                }

                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                Atend.Base.Acad.AcadGlobal.TerminalData.Existance = status.ACode;

                if (cboProjectCode.Items.Count == 0)
                {
                    Atend.Base.Acad.AcadGlobal.TerminalData.ProjectCode = 0;
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.TerminalData.ProjectCode = Convert.ToInt32(cboProjectCode.SelectedValue);
                }

                Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString());
                if (cboProjectCode.Items.Count != 0)
                {
                    Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjectCode.SelectedValue.ToString());
                }
                else
                {
                    Atend.Control.Common.ProjectCode = -1;
                }

                AllowClose = true;
            }
            else
            {
                AllowClose = false;
            }
        }
예제 #18
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            this.Hide();

            PromptEntityOptions peo = new PromptEntityOptions("\nSelect Entity:");
            PromptEntityResult  per = ed.GetEntity(peo);

            Atend.Base.Acad.AT_INFO atInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
            //ed.WriteMessage("PoleGuid={0} ,ConsolGuid={1}\n", atInfo.ParentCode, atInfo.NodeCode);
            DataTable dtCondAndSelf = Atend.Global.Acad.UAcad.FillBranchList();


            if ((atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.Consol)) || (atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.Kalamp)) || (atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel)))
            {
                CanDoCalculate = true;
                Nodeobj        = Convert.ToInt32(per.ObjectId.ToString().Substring(1, per.ObjectId.ToString().Length - 2));
                //ed.WriteMessage("NodeCode={0}\n",atInfo.NodeCode);
                Atend.Base.Design.DPackage dPAck = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(atInfo.NodeCode));
                //ed.WriteMessage("dConsol.ProductCode={0}\n",dconsol.ProductCode);
                if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Consol))
                {
                    Atend.Base.Equipment.EConsol eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(dPAck.ProductCode);
                    //ed.WriteMessage("^^^^={0}\n",eConsol.Length);
                    txtVolt.Text    = eConsol.VoltageLevel.ToString();
                    txtVoltTev.Text = eConsol.VoltageLevel.ToString();
                    if (eConsol.VoltageLevel == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                else if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Kalamp))
                {
                    //ed.WriteMessage("This Is Kalamp\n");
                    Atend.Base.Equipment.EClamp Clamp = Atend.Base.Equipment.EClamp.AccessSelectByCode(dPAck.ProductCode);
                    txtVolt.Text    = Clamp.VoltageLevel.ToString();
                    txtVoltTev.Text = Clamp.VoltageLevel.ToString();
                    if (Clamp.VoltageLevel == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                else if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel))
                {
                    //ed.WriteMessage("This Is Kalamp\n");
                    Atend.Base.Equipment.EHeaderCabel HeaderCabel = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(dPAck.ProductCode);
                    txtVolt.Text    = HeaderCabel.Voltage.ToString();
                    txtVoltTev.Text = HeaderCabel.Voltage.ToString();
                    if (HeaderCabel.Voltage == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                //ed.WriteMessage("dtCondAndSelf.Rows.Count={0}\n",dtCondAndSelf.Rows.Count);
                DataRow[] drCond = dtCondAndSelf.Select(string.Format("Type={0}", (int)Atend.Control.Enum.ProductType.Conductor));
                //System.Data.DataTable dtConductor = Atend.Global.Acad.UAcad.GetConsolConductors(new Guid(atInfo.ParentCode), new Guid(atInfo.NodeCode));
                if (drCond.Length != 0)
                {
                    Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(drCond[0]["BranchGuid"].ToString()));// SelectByCode(new Guid(dtConductor.Rows[0]["BranchGuid"].ToString()));
                    //ed.WriteMessage("branch.productCode={0}\n",branch.ProductCode);

                    Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                    cond = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                    //ed.WriteMessage("Cond.TypeCode={0}\n",cond.TypeCode);
                    cboMaterial.SelectedIndex = cond.TypeCode;
                    //ed.WriteMessage("****\n");
                }

                DataRow[] drSelf = dtCondAndSelf.Select(string.Format("Type={0}", (int)Atend.Control.Enum.ProductType.SelfKeeper));
                if (drSelf.Length != 0)
                {
                    //ed.WriteMessage("Self\n");

                    Atend.Base.Design.DBranch           branchSelf = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(drSelf[0]["BranchGuid"].ToString()));
                    Atend.Base.Equipment.ESelfKeeperTip SelfTip    = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branchSelf.ProductCode);
                    Atend.Base.Equipment.ESelfKeeper    Self       = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfTip.PhaseProductCode);
                    CboMaterialCalamp.SelectedIndex = Self.MaterialConductorCode - 1;
                }
                txtX.Text           = "0";
                txtR.Text           = "0";
                txtLoadPercent.Text = "75";

                //ed.WriteMessage("FinishSElect\n");
            }
            else
            {
                MessageBox.Show("لطفت جهت شروع محاسبات یک گره را انتخاب کنید");
                CanDoCalculate = false;
            }
            this.Show();
        }