Ejemplo n.º 1
0
        /// <summary>
        /// 在结构计算的参数的保存文件读取参数,并保存在GlobalInfo中
        /// 只用于杆塔序列中的塔
        /// </summary>
        /// <param name="name"></param>
        public void ReadStruCalsTowerParas(string name, string sequence)
        {
            string struCalsDirPath    = StruCalsDirForTower(name, sequence) + "\\";
            string fullStessDirPath   = FullStressDirForTower(name, sequence) + "\\";
            string parasSavedFilePath = struCalsDirPath + ConstVar.StruCalsParasFileName;

            StruCalsParasCompose temp = XmlUtils.Deserializer <StruCalsParasCompose>(parasSavedFilePath);

            if (temp == null || temp == default(StruCalsParasCompose))
            {
                return;
            }

            string templatePath = struCalsDirPath + temp.TemplateName;

            List <string> fullStressTemplatePaths = new List <string>();

            foreach (var tempName in temp.FullStressTemplateNames)
            {
                fullStressTemplatePaths.Add(fullStessDirPath + tempName);
            }

            StruCalsParasCompose paras = new StruCalsParasCompose(templatePath, fullStressTemplatePaths, temp);

            GlobalInfo.GetInstance().StruCalsParas.Add(paras);
        }
Ejemplo n.º 2
0
        public List <StrDataCollection> ReadLocalStrDatas()
        {
            var filePath = GlobalInfo.GetInstance().ProjectPath + "\\" + ConstVar.DataBaseStr + "\\" + ConstVar.StrDataFileName;
            var strDatas = StrDataReader.Read(filePath);;

            if (strDatas == null)
            {
                strDatas = new List <StrDataCollection>();
            }
            return(strDatas);
        }
Ejemplo n.º 3
0
        public List <FitDataCollection> ReadLocalFitDatas()
        {
            var filePath = GlobalInfo.GetInstance().ProjectPath + "\\" + ConstVar.DataBaseStr + "\\" + ConstVar.FitDataFileName;
            var fits     = FitDataReader.Read(filePath);;

            if (fits == null)
            {
                fits = new List <FitDataCollection>();
            }
            return(fits);
        }
Ejemplo n.º 4
0
        public List <WireType> ReadLocalWires()
        {
            var filePath = GlobalInfo.GetInstance().ProjectPath + "\\" + ConstVar.DataBaseStr + "\\" + ConstVar.WireFileName;
            var wires    = WireReader.Read(filePath);

            if (wires == null)
            {
                wires = new List <WireType>();
            }
            return(wires);
        }
Ejemplo n.º 5
0
        public List <Weather> ReadLocalWeathers()
        {
            WeatherXmlReader _weatherXmlReader = new WeatherXmlReader();
            var filePath = GlobalInfo.GetInstance().ProjectPath + "\\" + ConstVar.DataBaseStr + "\\" + ConstVar.WeatherConditioFileName;
            var weas     = _weatherXmlReader.ReadLocal(filePath);

            if (weas == null)
            {
                weas = new List <Weather>();
            }
            return(weas);
        }
Ejemplo n.º 6
0
 public static GlobalInfo GetInstance()
 {
     if (singleton == null)
     {
         lock (locker)
         {
             if (singleton == null)
             {
                 singleton = new GlobalInfo();
             }
         }
     }
     return(singleton);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 将新增的塔位参数添加的GlobalInfo中 只用单个增加的塔,不用于塔库序列中的塔
        /// </summary>
        /// <param name="towerName"></param>
        /// <param name="towerType"></param>
        /// <param name="templatePath"></param>
        /// <param name="electricalLoadFilePath"></param>
        /// <returns></returns>
        public static bool NewStruCalsTower(string towerName, string towerType, float voltage, string templatePath, string electricalLoadFilePath, List <string> fullStressTemplatePaths)
        {
            var struCalsParas = GlobalInfo.GetInstance().StruCalsParas;

            if (struCalsParas.Where(item => item.TowerName == towerName && item.TemplateName == "").Count() > 0)
            {
                System.Windows.Forms.MessageBox.Show(towerName + "已经存在!");
                return(false);
            }

            StruCalsParasCompose paras = new StruCalsParasCompose(towerName, towerType, voltage, templatePath, electricalLoadFilePath, fullStressTemplatePaths, out string decodeTemplateStr);

            if (decodeTemplateStr != "")
            {
                System.Windows.Forms.MessageBox.Show(towerName + decodeTemplateStr);
                return(false);
            }

            struCalsParas.Add(paras);

            return(true);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 将新增的塔位参数添加的GlobalInfo中 只用于塔库序列中的塔
        /// </summary>
        /// <returns></returns>
        public bool NewStruCalsTower(string towerName, string sequence, string excelPath, string towerType, float voltage, string templatePath, List <string> fullStressTemplatePaths, List <HangingPointSettingParas> hpSettingsParas)
        {
            var struCalsParas = GlobalInfo.GetInstance().StruCalsParas;

            if (struCalsParas.Where(item => item.TowerName == towerName && item.TemplateName == "").Count() > 0)
            {
                System.Windows.Forms.MessageBox.Show(towerName + "已经存在!");
                return(false);
            }

            StruCalsParasCompose paras = new StruCalsParasCompose(towerName, sequence, towerType, excelPath, voltage, templatePath, fullStressTemplatePaths, hpSettingsParas, out string decodeTemplateStr);

            if (decodeTemplateStr != "")
            {
                System.Windows.Forms.MessageBox.Show(towerName + decodeTemplateStr);
                return(false);
            }

            struCalsParas.Add(paras);
            SaveStruCalsTowerParaInSequence(paras);

            return(true);
        }
        /// <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;
        }
Ejemplo n.º 10
0
        public void GenerateLoadFile(string path, List <StruCalsPointLoad> pointLoads)
        {
            List <string> processString = new List <string>();

            StruCalsLib libParas = GlobalInfo.GetInstance().GetStruCalsLibParas();

            if (libParas == null)
            {
                return;
            }

            if (libParas.IceCoverParas == null || libParas.IceCoverParas.Count == 0)
            {
                return;
            }

            #region 保存工况
            int wccNumTemp = 0;
            for (int i = 0; i < Template.WorkConditionCombos.Count; i++)
            {
                //gongjian 200728 没有选择的工况在load文件也不用计算
                if (!Template.WorkConditionCombos[i].IsCalculate)
                {
                    continue;
                }

                wccNumTemp++;

                WorkConditionCombo wcCombo = Template.WorkConditionCombos[i];

                float wcWind = WorkConditionWind[wcCombo.WorkCode - 1];

                float wdIceThickness = WorkConditionIceThickness[wcCombo.WorkCode - 1];

                float windLoad = 1, gravityLoad = 1;

                //对于冰厚,首先寻找和工况中指定冰厚一样,没有的情况下向下取最大的值
                if (libParas.IceCoverParas.Where(item => item.IceThickness == wdIceThickness).Count() > 0)
                {
                    windLoad    = libParas.IceCoverParas.Where(item => item.IceThickness == wdIceThickness).First().TowerWindLoadAmplifyCoef;
                    gravityLoad = libParas.IceCoverParas.Where(item => item.IceThickness == wdIceThickness).First().TowerGravityLoadAmplifyCoef;
                }
                else
                {
                    for (int j = libParas.IceCoverParas.Count - 1; j >= 0; j--)
                    {
                        if (wdIceThickness - libParas.IceCoverParas[j].IceThickness > 0)
                        {
                            windLoad    = libParas.IceCoverParas[j].TowerWindLoadAmplifyCoef;
                            gravityLoad = libParas.IceCoverParas[j].TowerGravityLoadAmplifyCoef;
                            break;
                        }
                    }
                }

                float installCoef = 1, otherCoef = 1.1f;
                if (libParas.WireExtraLoadParas.Where(item => item.Voltage == Paras.Voltage).Count() > 0)
                {
                    installCoef = libParas.WireExtraLoadParas.Where(item => item.Voltage == Paras.Voltage).First().InstallImportanceCoef;
                    otherCoef   = libParas.WireExtraLoadParas.Where(item => item.Voltage == Paras.Voltage).First().OtherImportanceCoef;
                }

                float comboCoef, importanceCoef;
                if (wcCombo.WorkConditionCode.StartsWith("N"))
                {
                    comboCoef      = Paras.VcFNormal * windLoad;
                    importanceCoef = otherCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("D"))
                {
                    comboCoef      = Paras.VcFCold * windLoad;
                    importanceCoef = otherCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("I"))
                {
                    comboCoef      = (Paras.SelectedStandard == "GB50545-2010" ? Paras.VcFNormal : Paras.VcFIce) * windLoad;
                    importanceCoef = otherCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("L") || wcCombo.WorkConditionCode.StartsWith("G") || wcCombo.WorkConditionCode.StartsWith("M") ||
                         wcCombo.WorkConditionCode.StartsWith("C") || wcCombo.WorkConditionCode.StartsWith("J"))
                {
                    comboCoef      = Paras.VcFInstall * windLoad;
                    importanceCoef = installCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("B"))
                {
                    comboCoef      = Paras.VcFBroken * windLoad;
                    importanceCoef = otherCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("U"))
                {
                    comboCoef      = Paras.VcFUnevenIce * windLoad;
                    importanceCoef = otherCoef;
                }
                else if (wcCombo.WorkConditionCode.StartsWith("T") || wcCombo.WorkConditionCode.StartsWith("Y"))
                {
                    comboCoef      = Paras.VcFCheck * windLoad;
                    importanceCoef = installCoef;
                }
                else
                {
                    //不应该走到此分支
                    comboCoef      = 1 * windLoad;
                    importanceCoef = 1;
                    throw new Exception("生成Load文件出错:1;工况代号" + wcCombo.WorkConditionCode);
                }

                float windAngle = wcCombo.WindDirectionCode;
                //gongjian 200728  修改风向角小于0,将负号挪到组合系统
                if (windAngle < 0)
                {
                    windAngle = Math.Abs(windAngle);
                    comboCoef = -1 * comboCoef;
                }

                float temperature = WorkConditionTemperate[wcCombo.WorkCode - 1];

                string str = wcWind.ToString("0.000").PadLeft(8) + comboCoef.ToString("0.000").PadLeft(8) + windAngle.ToString("0.000").PadLeft(8)
                             + importanceCoef.ToString("0.000").PadLeft(8) + gravityLoad.ToString("0.000").PadLeft(8) + temperature.ToString("0.00").PadLeft(8)
                             + "   " + wccNumTemp.ToString() + "-" + wcCombo.WorkComment;

                processString.Add(str);
            }

            #endregion

            #region 保存挂点荷载
            List <int> points = pointLoads.Select(p => p.Name).Distinct().ToList();

            points.Sort();

            foreach (var point in points)
            {
                int wdNumTmep = 0;
                for (int j = 0; j < Template.WorkConditionCombos.Count; j++)
                {
                    //gongjian 200728  没有选择的工况在load文件也不用计算
                    if (!Template.WorkConditionCombos[j].IsCalculate)
                    {
                        continue;
                    }

                    wdNumTmep++;

                    string str   = (wdNumTmep == 1) ? point.ToString().PadLeft(9) : (" ").PadLeft(9);
                    float  xLoad = pointLoads.Where(p => p.Name == point && p.WorkConditionId == j && p.Orientation == "X").Sum(p => p.Load);
                    float  yLoad = pointLoads.Where(p => p.Name == point && p.WorkConditionId == j && p.Orientation == "Y").Sum(p => p.Load);
                    float  zLoad = pointLoads.Where(p => p.Name == point && p.WorkConditionId == j && p.Orientation == "Z").Sum(p => p.Load);

                    str += xLoad.ToString("0.00").PadLeft(14) + yLoad.ToString("0.00").PadLeft(9) + zLoad.ToString("0.00").PadLeft(9);
                    processString.Add(str);
                }
            }
            #endregion

            FileUtils.TextSaveByLine(path, processString);
        }