/// <summary> /// 计算验算点的压弯组合构件强度 GB 50017-2003 式(5.2.1) /// </summary> /// <param name="NL">截面内力</param> /// <param name="Sec">截面</param> /// <param name="iPt">截面中的验算点号</param> /// <param name="DPs">截面验算参数</param> /// <returns>强度应力(拉为正,压为负)</returns> public static double CalPointStrength_YW(SecForce NL, BSections Sec, int iPt, DesignParameters DPs) { double y, z, Res; if (Sec is SectionDBuser) { Sec.getCheckPoint(iPt, out y, out z); //取得截面验算点坐标 } else if (Sec is SectionGeneral) //如果为自定截面则验算所有外轮廓点 { SectionGeneral GenSec = Sec as SectionGeneral; y = GenSec.OPOLY[iPt].X; z = GenSec.OPOLY[iPt].Y; } else { y = 0; z = 0; } //如果验算点为0,0,则直接返回0应力值 if (y == 0 && z == 0) { return(0); } double Wy = Sec.Iyy / z; //抗弯截面模量 double Wz = Sec.Izz / y; //抗弯截面模量 double Wny = Wy * DPs.Ratio_Anet; //净截面模量 double Wnz = Wz * DPs.Ratio_Anet; //净截面模量 double My = -(NL.My); //弯矩,取内力的反号:参Midsa手册02 P16页梁单元内力输出方向 double Mz = -(NL.Mz); Res = NL.N / (Sec.Area * DPs.Ratio_Anet) + My / (DPs.Gamma_y * Wny) + Mz / (DPs.Gamma_z * Wnz); return(Res); }
/// <summary> /// 计算截面所有验算点的控制稳定应力 /// </summary> /// <param name="NL">截面内力</param> /// <param name="Sec">截面对像</param> /// <param name="DPs">单元设计参数</param> /// <param name="E">材料弹性模量</param> /// <returns>截面稳定应力值</returns> public static double CalSecMaxStability_YW(SecForce NL, BSections Sec, DesignParameters DPs, double E) { double Res = 0; List <double> slist = new List <double>(); Point2dCollection pts; if (Sec is SectionGeneral) { SectionGeneral secg = Sec as SectionGeneral; pts = secg.OPOLY; } else { pts = Sec.CheckPointCollection; } //添加到结果表 foreach (Point2d pt in pts) { slist.Add(CodeCheck.CalPointStability(NL, Sec, pt, DPs, E)); } //求得集合中的最大值 foreach (double ss in slist) { Res = Math.Max(Res, ss); } return(Res); }
/// <summary> /// 计算截面验算点上的强度最大值(绝对值) /// </summary> /// <param name="NL">截面内力</param> /// <param name="Sec">截面对像</param> /// <param name="DPs">单元设计参数</param> /// <returns>截面强度应力值(绝对值)</returns> public static double CalSecMaxStrength_YW(SecForce NL, BSections Sec, DesignParameters DPs) { double Res = 0; List <double> slist = new List <double>(); int count = 4; if (Sec is SectionGeneral) { SectionGeneral secg = Sec as SectionGeneral; count = secg.OPOLY.Length; } else { count = 4; } //添加到结果表 for (int i = 0; i < count; i++) { slist.Add(CodeCheck.CalPointStrength_YW(NL, Sec, i, DPs)); } //求得集合中的最大值 foreach (double ss in slist) { Res = Math.Max(Res, Math.Abs(ss)); } return(Res); }
/// <summary> /// 读取单元信息表1 /// </summary> public void ReadElem1(Worksheet Esheet0, ref Bmodel MyModel) { int iFrow = Esheet0.Cells.FirstRowIndex; int iLrow = Esheet0.Cells.LastRowIndex; //材料信息读取 for (int i = iFrow + 1; i <= iLrow; i++) { Row CurRow = Esheet0.Cells.GetRow(i); int imat = int.Parse(CurRow.GetCell(4).StringValue); //材料性质id string Cursec = CurRow.GetCell(7).StringValue; //截面名称 int iele = int.Parse(CurRow.GetCell(0).StringValue); int ieleI = int.Parse(CurRow.GetCell(1).StringValue); int ieleJ = int.Parse(CurRow.GetCell(2).StringValue); int MaxProp = MyModel.sections.Count > 0 ? MyModel.sections.Keys.Max() : 0; //记录最大截面号 int iProp = 1; //当前截面号 bool hasSec = false; //指示是否有当前截面 BMaterial mat = new BMaterial(imat, MatType.USER, "Mat_" + imat.ToString()); foreach (KeyValuePair <int, BSections> ss in MyModel.sections) { if (ss.Value.Name == Cursec) { iProp = ss.Key; hasSec = true;//有当前截面 break; } } //如果没有当前截面,则添加一个新的截面 if (hasSec == false) { iProp = MaxProp + 1; //新的截面号 SectionGeneral sec = new SectionGeneral(iProp, Cursec); MyModel.AddSection(sec); //添加入库 } MyModel.AddMat(mat);//添加料号入库 //最后添加单元入数据库 FrameElement ee = new FrameElement(iele, ElemType.BEAM, imat, iProp, ieleI, ieleJ); MyModel.AddElement(ee); } }
public static int[] WriteGeneral(BBData data, GeneralInfo ge, RoomInfo[] rooms, StringsChunkBuilder strings) { var ret = new SectionGeneral { Debug = ge.IsDebug, FilenameOffset = strings.GetOffset(ge.FileName), ConfigOffset = strings.GetOffset(ge.Configuration), NameOffset = strings.GetOffset(ge.Name), DisplayNameOffset = strings.GetOffset(ge.DisplayName), GameID = ge.GameID, WindowSize = ge.WindowSize, BytecodeVersion = (Int24)ge.BytecodeVersion, Major = ge.Version.Major, Minor = ge.Version.Minor, Release = ge.Version.Build, Build = ge.Version.Revision, Info = ge.InfoFlags, ActiveTargets = ge.ActiveTargets, AppID = ge.SteamAppID, LastObj = 0, LastTile = 0 }; var stringOffsetOffsets = new int[] { (int)Marshal.OffsetOf(typeof(SectionGeneral), "FilenameOffset") - 3, (int)Marshal.OffsetOf(typeof(SectionGeneral), "ConfigOffset") - 3, (int)Marshal.OffsetOf(typeof(SectionGeneral), "NameOffset") - 3, (int)Marshal.OffsetOf(typeof(SectionGeneral), "DisplayNameOffset") - 3 }; foreach (var room in rooms) { foreach (var obj in room.Objects) { if (obj.InstanceID > ret.LastObj) { ret.LastObj = obj.InstanceID; } } foreach (var tile in room.Tiles) { if (tile.InstanceID > ret.LastTile) { ret.LastTile = tile.InstanceID; } } } ret.LastObj++; ret.LastTile++; for (int i = 0; i < 4; i++) { unsafe { ret._unknown[i] = ge.unknown[i]; } } unsafe { Marshal.Copy(ge.LicenseMD5Hash, 0, (IntPtr)ret.MD5, 0x10); } ret.CRC32 = ge.LicenceCRC32; ret.Timestamp = (ulong)(ge.Timestamp.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; if (ge.WeirdNumbers == null) { ret.NumberCount = 0; } else { ret.NumberCount = (uint)ge.WeirdNumbers.Length; } var tmp = new BinBuffer(); tmp.Write(ret); data.Buffer.Write(tmp, 0, tmp.Size - 12, 8); for (int i = 0; i < ret.NumberCount; i++) { data.Buffer.Write(ge.WeirdNumbers[i]); } // TODO for 2.0: some lengthy checksum/hash at the end? // exits after launch if GEN8 is modified at all, // doesn't launch if the extra stuff is missing //for (int i = 0; i < 16; i++) // data.Buffer.Write(0x3F3F3F3F); return(stringOffsetOffsets); }