Exemple #1
0
        public void InitElecLoadSheet(TowerTypeEnum type, StruCalsElecLoad load)
        {
            towerType = type;
            elecLoad  = load;

            UpdateElecLoadWorkSheetFromMem();
        }
        public NewTowerTemplateReader(TowerTypeEnum type) : base()
        {
            Type = type;

            template.TowerType           = TowerTypeStringConvert.TowerTypeToString(type);
            template.Wires               = new List <string>();
            template.WorkConditongs      = new Dictionary <int, string>();
            template.WorkConditionCombos = new List <WorkConditionCombo>();
        }
        //解码没有加密的结构计算模板
        public bool DecodeEncryTemplate(TowerTypeEnum towerType, string templatesPath)
        {
            TowerTemplateReader templateReader = new TowerTemplateReader(towerType);

            Template = templateReader.Read(templatesPath);

            WorkConditions = ConvertTemplateToSpec(Template);

            return(true);
        }
        //解码加密的结构计算模板
        public bool DecodeTemplate(TowerTypeEnum towerType, string templatesPath)
        {
            string file = templatesPath.Substring(0, templatesPath.Length - 3) + "dat";

            DES.DesDecrypt(templatesPath, file, "12345678");

            TowerTemplateReader templateReader = new TowerTemplateReader(towerType);

            Template = templateReader.Read(file);

            WorkConditions = ConvertTemplateToSpec(Template);

            return(true);
        }
        //此构造函数用于不是杆塔序列中新增塔位, 线条相关的初始化信息主要来自于Template,
        public StruCalsParasCompose(string towerName, string towerType, float voltage, string templatePath, string electricalLaodFilePath, List <string> fullStressTemplatePaths, out string decodeTemolateStr)
        {
            decodeTemolateStr = "";

            TowerName    = towerName;
            SequenceName = "";

            TemplatePath = templatePath;
            TemplateName = templatePath.Substring(templatePath.LastIndexOf('\\') + 1);

            FullStressTemplatePaths = fullStressTemplatePaths;
            FullStressTemplateNames = new List <string>();
            foreach (var path in FullStressTemplatePaths)
            {
                FullStressTemplateNames.Add(path.Substring(path.LastIndexOf('\\') + 1));
            }

            TowerTypeEnum type = TowerTypeStringConvert.TowerStringToType(towerType);

            ElectricalLoadFilePath = electricalLaodFilePath;

            if (!DecodeTemplate(type, templatePath))
            {
                decodeTemolateStr = "解码模块错误!";
                return;
            }

            LineParas = new List <StruLineParas>();

            SetDefaultValue(type);
            BaseParas.Voltage = voltage;

            HPSettingsParas = new List <HangingPointSettingParas>();
            NewHangingPointSetting();

            ResultPointLoad = new List <StruCalsPointLoad>();

            ElecLoad = new StruCalsElecLoad()
            {
                CornerElecLoads     = new List <WireElecLoadCorner>(),
                LineCornerElecLoads = new List <WireElecLoadLineCorner>(),
                LineElecLoads       = new List <WireElecLoadLine>(),
                ExtraLoad           = new List <StruCalsTension>(),
                WorkCondition       = new List <ElecCalsWorkConditionBase>(),
            };
        }
        public TowerTemplateReader(TowerTypeEnum type)
        {
            if (type == TowerTypeEnum.LineTower)
            {
                WorkConditongsLine           = 15;
                WorkConditongsComboStartLine = 17;

                template.TowerType = "直线塔";
            }
            else if (type == TowerTypeEnum.LineCornerTower)
            {
                WorkConditongsLine           = 16;
                WorkConditongsComboStartLine = 18;

                template.TowerType = "直线转角塔";
            }
            else
            {
                WorkConditongsLine           = 26;
                WorkConditongsComboStartLine = 29;

                if (type == TowerTypeEnum.CornerTower)
                {
                    template.TowerType = "转角塔";
                }
                else if (type == TowerTypeEnum.TerminalTower)
                {
                    template.TowerType = "终端塔";
                }
                else
                {
                    template.TowerType = "分支塔";
                }
            }

            Type = type;

            template.Wires               = new List <string>();
            template.WorkConditongs      = new Dictionary <int, string>();
            template.WorkConditionCombos = new List <WorkConditionCombo>();
        }
 static public string TowerTypeToString(TowerTypeEnum type)
 {
     if (type == TowerTypeEnum.LineTower)
     {
         return(ConstVar.LineTowerStr);
     }
     else if (type == TowerTypeEnum.LineCornerTower)
     {
         return(ConstVar.LineCornerTowerStr);
     }
     else if (type == TowerTypeEnum.CornerTower)
     {
         return(ConstVar.CornerTowerStr);
     }
     else if (type == TowerTypeEnum.BranchTower)
     {
         return(ConstVar.BranchTowerStr);
     }
     else
     {
         return(ConstVar.TerminalTowerStr);
     }
 }
 static public string TowerTypeToString(TowerTypeEnum type)
 {
     if (type == TowerTypeEnum.LineTower)
     {
         return("直线塔");
     }
     else if (type == TowerTypeEnum.LineCornerTower)
     {
         return("直转塔");
     }
     else if (type == TowerTypeEnum.CornerTower)
     {
         return("转角塔");
     }
     else if (type == TowerTypeEnum.BranchTower)
     {
         return("分支塔");
     }
     else
     {
         return("终端塔");
     }
 }
Exemple #9
0
 public void Initizalize(TowerTypeEnum towerType)
 {
     TowerType = towerType;
 }
        /// <summary>
        /// 从配置文件中获取默认参数
        /// </summary>
        protected void SetDefaultValue(TowerTypeEnum towerType)
        {
            var libParas = GlobalInfo.GetInstance().GetStruCalsLibParas();

            //有配置文件就从配置文件中读出
            if (libParas != null)
            {
                var     config = new MapperConfiguration(x => x.CreateMap <StruCalsLibBaseParas, StruCalseBaseParas>().ForMember(des => des.Type, item => item.Ignore()));
                IMapper mapper = new Mapper(config);

                StruCalsLibBaseParas libBaseParas = (towerType == TowerTypeEnum.LineTower || towerType == TowerTypeEnum.LineCornerTower) ? libParas.OverhangingTowerBaseParas : libParas.TensionTowerBaseParas;

                BaseParas = mapper.Map <StruCalseBaseParas>(libBaseParas);

                //这种初始化有点问题,当两种标准的共同参数的值取不一样时会有错误
                //正确的做法是应该是在加入库时,就选择标准。
                //但这种做法两种标准切换时,两种标准共同参数取值不一样时,仍然无法切换到正确的值,
                //故维持现在的做法。
                BaseParas.RGBad        = libBaseParas.BaseParasGB50545.RGBad;
                BaseParas.RGGood       = libBaseParas.BaseParasGB50545.RGGood;
                BaseParas.RQ           = libBaseParas.BaseParasGB50545.RQ;
                BaseParas.VcFInstall   = libBaseParas.BaseParasGB50545.VcFInstall;
                BaseParas.VcFBroken    = libBaseParas.BaseParasGB50545.VcFBroken;
                BaseParas.VcFUnevenIce = libBaseParas.BaseParasGB50545.VcFUnevenIce;
                BaseParas.VcFNormal    = libBaseParas.BaseParasGB50545.VcFNormal;
                BaseParas.VcFCheck     = libBaseParas.BaseParasGB50545.VcFCheck;

                BaseParas.RGOverturn = libBaseParas.BaseParasDLT5551.RGOverturn;
                BaseParas.VcFIce     = libBaseParas.BaseParasDLT5551.VcFIce;
                BaseParas.VcFCold    = libBaseParas.BaseParasDLT5551.VcFCold;

                BaseParas.LoadRatio = 1;
                BaseParas.R1Install = 1;
                BaseParas.R0Normal  = 1;

                List <StruLineParas> lineParas = new List <StruLineParas>();
                for (int i = 0; i < Template.Wires.Count; i++)
                {
                    lineParas.Add(new StruLineParas()
                    {
                        Index       = i + 1,
                        WireType    = Template.Wires[i],
                        DrawingCoef = ((towerType == TowerTypeEnum.LineTower || towerType == TowerTypeEnum.LineCornerTower) ? libParas.OverhangingTowerBaseParas.DrawingCoef
                        : libParas.TensionTowerBaseParas.DrawingCoef)
                    });
                }
                LineParas = lineParas;
            }
            //没有默认文件就默认为0
            else
            {
                List <StruLineParas> lineParas = new List <StruLineParas>();
                for (int i = 0; i < Template.Wires.Count; i++)
                {
                    lineParas.Add(new StruLineParas()
                    {
                        Index    = i + 1,
                        WireType = Template.Wires[i],
                    });
                }
                LineParas = lineParas;
            }

            //BaseParas下列参数中在映射后赋值的原因在于:
            //如果先复制,在前面的映射过程中,会导致某些值会改变
            BaseParas.SelectedStandard  = "GB50545-2010";
            BaseParas.Type              = towerType;
            BaseParas.IsMethod1Selected = true;
        }