private ISectionProperty GetTaperedSectionProperty(ISectionProperty startSectionProperty, ISectionProperty endSectionProperty) { if (startSectionProperty.Material.Name != endSectionProperty.Material.Name) { Engine.Base.Compute.RecordWarning("Tapered section mixes materials. Only material from start of section is used"); } oM.Spatial.ShapeProfiles.IProfile taperProfile = null; if (startSectionProperty.Material.GetType() == typeof(Steel)) { SteelSection startSection = startSectionProperty as SteelSection; SteelSection endSection = endSectionProperty as SteelSection; taperProfile = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile); taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name; } if (startSectionProperty.Material.GetType() == typeof(Concrete)) { ConcreteSection startSection = startSectionProperty as ConcreteSection; ConcreteSection endSection = endSectionProperty as ConcreteSection; taperProfile = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile); taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name; } if (startSectionProperty.Material.GetType() == typeof(Timber)) { TimberSection startSection = startSectionProperty as TimberSection; TimberSection endSection = endSectionProperty as TimberSection; taperProfile = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile); taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name; } return(BH.Engine.Structure.Create.SectionPropertyFromProfile(taperProfile, startSectionProperty.Material)); }
private static double WarpingConstant(this SectionProperty property) { if (property is SectionProperty) { SteelSection steelSection = property as SteelSection; double b1 = steelSection.B1; double b2 = steelSection.B2; double tf1 = steelSection.Tf1; double tf2 = steelSection.Tf2; double tw = steelSection.Tw; switch (steelSection.Shape) { case ShapeType.ISection: if (tf1 == tf2 && b1 == b2) { return(tf1 * System.Math.Pow(steelSection.TotalDepth - tf1, 2) * System.Math.Pow(steelSection.TotalWidth, 3) / 24); } else { return(tf1 * System.Math.Pow(steelSection.TotalDepth - (tf1 + tf2) / 2, 2) / 12 * (System.Math.Pow(b1, 3) * System.Math.Pow(b2, 3) / (System.Math.Pow(b1, 3) + System.Math.Pow(b2, 3)))); } case ShapeType.Channel: return(tf1 * System.Math.Pow(steelSection.TotalDepth, 2) / 12 * (3 * b1 * tf1 + 2 * steelSection.TotalDepth * tw / (6 * b1 * tf1 + steelSection.TotalDepth * tw))); default: return(0); } } return(0); }
/***************************************************/ public static SteelSection SteelSectionFromProfile(IProfile profile, Material material = null, string name = "") { Output <IProfile, Dictionary <string, object> > result = Compute.Integrate(profile, Tolerance.MicroDistance); profile = result.Item1; Dictionary <string, object> constants = result.Item2; constants["J"] = profile.ITorsionalConstant(); constants["Iw"] = profile.IWarpingConstant(); SteelSection section = new SteelSection(profile, (double)constants["Area"], (double)constants["Rgy"], (double)constants["Rgz"], (double)constants["J"], (double)constants["Iy"], (double)constants["Iz"], (double)constants["Iw"], (double)constants["Wely"], (double)constants["Welz"], (double)constants["Wply"], (double)constants["Wplz"], (double)constants["CentreZ"], (double)constants["CentreY"], (double)constants["Vz"], (double)constants["Vpz"], (double)constants["Vy"], (double)constants["Vpy"], (double)constants["Asy"], (double)constants["Asz"]); //section.CustomData["VerticalSlices"] = new ReadOnlyCollection<IntegrationSlice>((List<IntegrationSlice>)constants["VerticalSlices"]); //section.CustomData["HorizontalSlices"] = new ReadOnlyCollection<IntegrationSlice>((List<IntegrationSlice>)constants["HorizontalSlices"]); section.Material = material == null?Query.Default(MaterialType.Steel) : material; if (!string.IsNullOrWhiteSpace(name)) { section.Name = name; } else if (!string.IsNullOrWhiteSpace(profile.Name)) { section.Name = profile.Name; } return(section); }
public static string Description(this SteelSection section) { if (section == null) { return("null section"); } return("Steel " + section.SectionProfile.IDescription() + " - " + CheckGetMaterialName(section.Material)); }
private static void SetSectionData(this SteelSection section, double height, double width, double tw, double tf1, double r1, double r2, double mass = 0, double b1 = 0, double b2 = 0, double tf2 = 0, double b3 = 0, double spacing = 0) { section.Mass = mass; section.TotalWidth = width; section.TotalDepth = height; section.Tw = tw; section.Tf1 = tf1; section.Tf2 = tf2 == 0 ? tf1 : tf2; section.r1 = r1; section.r2 = r2; section.B1 = b1 == 0 ? width : b1; section.B2 = b2 == 0 ? b1 : b2; section.B3 = b3; section.Spacing = spacing; }
/*****************************************************/ /*********** Static section constructors *******/ /*****************************************************/ public static string GenerateStandardName(this SteelSection property) { string name = null; switch (property.Shape) { case ShapeType.ISection: name = "UB " + (property.TotalDepth * 1000).ToString() + "x" + (property.TotalWidth * 1000).ToString() + "x" + (property.Tw * 1000).ToString(); break; case ShapeType.Tee: name = "TUB " + (property.TotalWidth * 1000).ToString() + "x" + (property.TotalDepth * 1000).ToString() + "x" + (property.Tw * 1000).ToString(); break; case ShapeType.Box: name = "RHS " + (property.TotalDepth * 1000).ToString() + "x" + (property.TotalWidth * 1000).ToString() + "x" + (property.Tw * 1000).ToString(); if (property.Tw != property.Tf1) { name += "x" + (property.Tf1 * 1000).ToString(); } break; case ShapeType.Angle: name = "L " + (property.TotalDepth * 1000).ToString() + "x" + (property.TotalWidth * 1000).ToString() + "x" + (property.Tw * 1000).ToString(); if (property.Tw != property.Tf1) { name += "x" + (property.Tf1 * 1000).ToString(); } break; case ShapeType.Circle: name = "C " + (property.TotalWidth * 1000).ToString(); break; case ShapeType.Rectangle: name = "R " + (property.TotalDepth * 1000).ToString() + "x" + (property.TotalWidth * 1000).ToString(); break; case ShapeType.Tube: name = "CHS " + (property.TotalWidth * 1000).ToString() + "x" + (property.Tw * 1000).ToString(); break; default: name = property.Shape.ToString(); break; } return(name); }
public static IGeometry Geometry(this SteelSection section) { if (section?.SectionProfile?.Edges == null) { return(new CompositeGeometry()); } else { return new CompositeGeometry { Elements = section.SectionProfile.Edges.ToList <IGeometry>() } }; } /***************************************************/ }
public static SteelSection SteelSectionFromProfile(IProfile profile, Steel material = null, string name = "") { //Run pre-process for section create. Calculates all section constants and checks name of profile var preProcessValues = PreProcessSectionCreate(name, profile); name = preProcessValues.Item1; profile = preProcessValues.Item2; Dictionary <string, double> constants = preProcessValues.Item3; SteelSection section = new SteelSection(profile, constants["Area"], constants["Rgy"], constants["Rgz"], constants["J"], constants["Iy"], constants["Iz"], constants["Iw"], constants["Wely"], constants["Welz"], constants["Wply"], constants["Wplz"], constants["CentreZ"], constants["CentreY"], constants["Vz"], constants["Vpz"], constants["Vy"], constants["Vpy"], constants["Asy"], constants["Asz"]); //Postprocess section. Sets default name if null, and grabs default material for section if noting is provided return(PostProcessSectionCreate(section, name, material, MaterialType.Steel)); }
public static SectionProperty CreateSection(MaterialType matType) { SectionProperty property = null; switch (matType) { case BH.oM.Materials.MaterialType.Steel: return(new SteelSection()); case BH.oM.Materials.MaterialType.Concrete: return(new ConcreteSection()); default: property = new SteelSection(); property.Material = Materials.Create.Default(matType); return(property); } }
public static SectionProperty NewSection(Group <Curve> edges, ShapeType type, MaterialType matType) { SectionProperty property = null; switch (matType) { case BH.oM.Materials.MaterialType.Steel: return(new SteelSection(edges, type)); case BH.oM.Materials.MaterialType.Concrete: return(new ConcreteSection(edges, type)); default: property = new SteelSection(edges, type); property.Material = Materials.Create.Default(matType); return(property); } }
/***************************************************/ private IFAttribute CreateSection(SteelSection sectionProperty) { IFGeometricLine lusasGeometricLine = null; if (sectionProperty.SectionProfile != null) { lusasGeometricLine = d_LusasData.createGeometricLine(sectionProperty.DescriptionOrName()); lusasGeometricLine.setValue("elementType", "3D Thick Beam"); if (CreateProfile(sectionProperty.DescriptionOrName(), sectionProperty.SectionProfile as dynamic)) { if (!(sectionProperty.SectionProfile is TaperedProfile)) { lusasGeometricLine.setFromLibrary("User Sections", "Local", sectionProperty.DescriptionOrName(), 0, 0); } } } return(lusasGeometricLine); }
/***************************************************/ public static SteelSection SteelSectionFromProfile(IProfile profile, Steel material = null, string name = "") { //Check name if (string.IsNullOrWhiteSpace(name) && profile.Name != null) { name = profile.Name; } //Check profile and raise warnings if (profile.Edges.Count == 0) { Engine.Reflection.Compute.RecordWarning("Profile with name " + profile.Name + " does not contain any edges. Section named " + name + " made with this profile will have 0 value sections constants"); } Output <IProfile, Dictionary <string, object> > result = Compute.Integrate(profile, Tolerance.MicroDistance); profile = result.Item1; Dictionary <string, object> constants = result.Item2; constants["J"] = profile.ITorsionalConstant(); constants["Iw"] = profile.IWarpingConstant(); SteelSection section = new SteelSection(profile, (double)constants["Area"], (double)constants["Rgy"], (double)constants["Rgz"], (double)constants["J"], (double)constants["Iy"], (double)constants["Iz"], (double)constants["Iw"], (double)constants["Wely"], (double)constants["Welz"], (double)constants["Wply"], (double)constants["Wplz"], (double)constants["CentreZ"], (double)constants["CentreY"], (double)constants["Vz"], (double)constants["Vpz"], (double)constants["Vy"], (double)constants["Vpy"], (double)constants["Asy"], (double)constants["Asz"]); //section.CustomData["VerticalSlices"] = new ReadOnlyCollection<IntegrationSlice>((List<IntegrationSlice>)constants["VerticalSlices"]); //section.CustomData["HorizontalSlices"] = new ReadOnlyCollection<IntegrationSlice>((List<IntegrationSlice>)constants["HorizontalSlices"]); if (material == null) { material = Query.Default(oM.Structure.MaterialFragments.MaterialType.Steel) as Steel; } section.Material = material; section.Name = name; return(section); }
public double GetFlexuralStrength(double SumQ_n) { this.SumQ_n = SumQ_n; double A_s = SteelSection.A; double MaximumTForce = A_s * F_y; //Equations (C-I3-7) and (C-I3-8) this.C_Slab = GetCForce(); double SteelSectionHeight = (SteelSection.YMax - SteelSection.YMin); double d_3 = SteelSectionHeight - SteelSection.y_pBar; // distance from Py to the top of the steel section double d_1 = Get_d_1(); //distance from the centroid of the compression force, C, in the concrete to the top of the steel section double d_2; //distance from the centroid of the compression force in the steel section to the top of the steel section double C; if (C_Slab >= MaximumTForce) { //Section is fully composite C = MaximumTForce; d_2 = 0; DistanceFromTopOfSteelToPNY = 0; } else { //Section is partially composite double C_steel = (MaximumTForce - C_Slab) / 2.0; double A_sPrime = C_steel / F_y; IMoveableSection compressedSteelSection = SteelSection.GetTopSliceOfArea(A_sPrime); DistanceFromTopOfSteelToPNY = compressedSteelSection.YMax - compressedSteelSection.YMin; var C_steelCoordinate = compressedSteelSection.GetElasticCentroidCoordinate(); d_2 = SteelSectionHeight - C_steelCoordinate.Y; C = C_Slab + C_steel; } double P_y = MaximumTForce; double phiM_n = 0.9 * (C * (d_1 + d_2) + P_y * (d_3 - d_2)); // (C-I3-10) PNYCalculated = true; return(phiM_n); }
private static double TorsionContant(this SectionProperty property) { if (property is SteelSection) { SteelSection ss = property as SteelSection; double b1 = ss.B1; double b2 = ss.B2; double tf1 = ss.Tf1; double tf2 = ss.Tf2; double tw = ss.Tw; switch (ss.Shape) { case ShapeType.ISection: case ShapeType.Channel: case ShapeType.Zed: return((b1 * System.Math.Pow(tf1, 3) + b2 * System.Math.Pow(tf2, 3) + (ss.TotalDepth - tf1) * System.Math.Pow(tw, 3)) / 3); case ShapeType.Tee: case ShapeType.Angle: return(ss.TotalWidth * System.Math.Pow(tf1, 3) + ss.TotalDepth * System.Math.Pow(tw, 3)); case ShapeType.Circle: return(System.Math.PI * System.Math.Pow(ss.TotalDepth, 4) / 2); case ShapeType.Box: return(2 * tf1 * tw * System.Math.Pow(ss.TotalWidth - tw, 2) * System.Math.Pow(ss.TotalDepth - tf1, 2) / (ss.TotalWidth * tw + ss.TotalDepth * tf1 - System.Math.Pow(tw, 2) - System.Math.Pow(tf1, 2))); case ShapeType.Tube: return(System.Math.PI * (System.Math.Pow(ss.TotalDepth, 4) - System.Math.Pow(ss.TotalDepth - tw, 4)) / 2); default: return(0); } } return(0); }
/***************************************************/ public static IGeometry Geometry(this SteelSection section) { return(new CompositeGeometry { Elements = section.SectionProfile.Edges.ToList <IGeometry>() }); }
private static void SetSectionData(this SteelSection section) { if (section.Edges != null) { section.Calculate(); BoundingBox box = section.Edges.Bounds(); double area = section.Area; double width = section.TotalWidth; double depth = section.TotalDepth; double b1 = Numerics.Integration.GetSliceAt(section.Edges, box.Max.Y - 0.001, 1, Plane.XZ()).Length; double b2 = Numerics.Integration.GetSliceAt(section.Edges, box.Min.Y + 0.001, 1, Plane.XZ()).Length; double d1 = Numerics.Integration.GetSliceAt(section.Edges, box.Min.X + 0.001, 1, Plane.YZ()).Length; double d2 = Numerics.Integration.GetSliceAt(section.Edges, box.Max.X - 0.001, 1, Plane.YZ()).Length; double tw = Numerics.Integration.GetSliceAt(section.Edges, box.Centre.Y, 1, Plane.XZ()).Length; Slice midHeight = Numerics.Integration.GetSliceAt(section.Edges, box.Centre.X, 1, Plane.YZ()); double tf1 = 0; double tf2 = 0; if (area > width * depth * 0.95) { //Rectangle section.Shape = ShapeType.Rectangle; } else if (ArrayUtils.NearEqual(area, width * depth * System.Math.PI / 4, 0.001)) { section.Shape = ShapeType.Circle; } else if (ArrayUtils.NearEqual(midHeight.Length, depth, 0.001)) { //ISection, TSection, ZSection Slice right = Numerics.Integration.GetSliceAt(section.Edges, (box.Max.X + box.Centre.X) / 2, 1, Plane.YZ()); Slice left = Numerics.Integration.GetSliceAt(section.Edges, (box.Min.X + box.Centre.X) / 2, 1, Plane.YZ()); if (right.Placement.Length == 4 && left.Placement.Length == 4) { tf2 = right.Placement[1] - right.Placement[0]; tf1 = right.Placement[3] - right.Placement[2]; section.Shape = ShapeType.ISection; } else if (b1 > tw && b2 > tw) //not a tee { //if symetrical could be a tee //else tf1 = left.Placement[0] > right.Placement[0] ? right.Length : left.Length; tf2 = left.Placement[0] > right.Placement[0] ? left.Length : right.Length; section.Shape = ShapeType.Zed; } else { tf1 = left.Length; section.Shape = ShapeType.Tee; } } else if (midHeight.Placement.Length == 4 && b1 > width * 0.8 && b2 > width * 0.8 && d1 > depth * 0.8 && d2 > depth * 0.8) { tw = tw / 2; tf1 = midHeight.Placement[3] - midHeight.Placement[2]; tf2 = midHeight.Placement[1] - midHeight.Placement[0]; section.Shape = ShapeType.Box; } else if ((ArrayUtils.NearEqual(b1, width, 0.001) || ArrayUtils.NearEqual(b2, width, 0.001)) && (ArrayUtils.NearEqual(d1, width, 0.001) || ArrayUtils.NearEqual(d2, width, 0.001))) { section.Shape = ShapeType.Angle; tf1 = midHeight.Length; } else if (ArrayUtils.NearEqual(tw, midHeight.Length, 0.001)) { section.Shape = ShapeType.Tube; tf1 = tw / 2; tw = tf1; } else { section.Shape = ShapeType.Polygon; } double mass = section.Area * section.Material.Density / 9.8; section.SetSectionData(depth, width, tw, tf1, 0, 0, mass, b1, b2, tf2); } }
private (double[], int, string) GetDimensionsFromSection(SteelSection section) { return(GetProfileDimensions(section.SectionProfile as dynamic)); }
private static void SetSpecificSection(SteelSection section, cSapModel model) { SetSectionDimensions(section.SectionProfile, section.Name, section.Material, model); }
/***************************************************/ private static void TestSerialization() { // Trigger the initialisation (need a better way) BH.Engine.Serialiser.Convert.FromJson("{}"); object input = new CustomObject() { CustomData = new Dictionary <string, object> { { "X", 1 }, { "Y", 2 }, { "Z", new CustomObject { CustomData = new Dictionary <string, object> { { "A", 3 } } } }, { "ListStrings", new List <string> { "1", "2", "3" } }, { "ListPoints", new List <Point> { new Point(), new Point { X = 1 } } }, { "DictString", new Dictionary <string, string> { { "A", "1" }, { "B", "2" } } }, { "ListEnums", new List <Frequency> { Frequency.Hz125, Frequency.Hz250 } }, //{ "DictEnum", new Dictionary<Frequency, string> { { Frequency.Hz250, "1" }, { Frequency.Hz125, "2" } } } }, Tags = new HashSet <string> { "A", "B" } }; var jsonWriterSettings = new JsonWriterSettings { OutputMode = JsonOutputMode.Strict }; BsonDocument doc = input.ToBsonDocument(); string json = doc.ToJson <BsonDocument>(jsonWriterSettings); object obj = BsonSerializer.Deserialize(doc, typeof(object)); Node node = (Node) new Point { X = 1, Y = 2, Z = 3 }; node.Name = "testNode"; BsonDocument doc2 = node.ToBsonDocument(); doc2["NewData"] = "ExtraStuff"; string json2 = doc2.ToJson <BsonDocument>(jsonWriterSettings); object obj2 = BsonSerializer.Deserialize(doc2, typeof(object)); CircleProfile circleDim = BH.Engine.Geometry.Create.CircleProfile(43.2); circleDim.Name = "Dim"; BsonDocument doc3 = circleDim.ToBsonDocument(); string json3 = doc3.ToJson <BsonDocument>(jsonWriterSettings); object obj3 = BsonSerializer.Deserialize(doc3, typeof(object)); SteelSection section = new SteelSection( BH.Engine.Geometry.Create.CircleProfile(4.2), 2.1, 1.3, .5, 2, 3, 4, 5, 6, 7, 88, 9, 0, 4, 5, 6, 7, 7, 8, 9 ); BsonDocument doc4 = section.ToBsonDocument(); string json4 = doc4.ToJson <BsonDocument>(jsonWriterSettings); object obj4 = BsonSerializer.Deserialize(doc4, typeof(object)); }