double CalcFaxrk(double pk, Fastener fastener, double t1, double tpen, double alfa, double t_thread) { double value = 0; if (fastener.type == "nail") { double fpaxk = CalcNailfaxk(tpen, fastener.d, pk, fastener.smooth); double fhaxk = CalcNailfaxk(t1, fastener.d, pk, fastener.smooth); double fheadk = CalcNailfheadk(pk); value = Math.Min(fpaxk * fastener.d * tpen, fhaxk * fastener.d * t1 + fheadk * Math.Pow(fastener.dh, 2)); } else if (fastener.type == "screw") { value = CalcScrewFaxrk(fastener.d, pk, alfa, tpen, t_thread); } else if (fastener.type == "bolt") { double fc90k = t_thread; double aread = Math.Pow(fastener.d, 2) * Math.PI / 4; double areadw = Math.Pow(fastener.dh, 2) * Math.PI / 4; value = Math.Min(3 * fc90k * (areadw - aread), fastener.fu * aread); } return(value); }
public TimberToSteelCapacity( Fastener Fastener, bool PreDrilled, double Pk, double Alfa, double Alfafast, string WoodType, double T1, double T_steel, double T_thread, double Npar, double Npep, int SD, double A1 ) { this.fastener = Fastener; this.preDrilled = PreDrilled; this.pk = Pk; this.alfa = Alfa; this.woodType = WoodType; this.t1 = T1; this.t_steel = T_steel; this.npar = Npar; this.npep = Npep; this.SDt = SD; this.a1 = A1; this.variables = new Variables(Fastener, PreDrilled, Pk, Alfa, Alfafast, woodType, T1, T_steel, T_thread); this.Faxrk_upperLimit = this.CalcFaxrkUpperLimitValue(Fastener); }
public double GetTpen(Fastener fastener, double t1, double t2) { double tpoint = fastener.l - t1; if (t2 - tpoint <= 4 * fastener.d) { this.error = "(t2 - tpoint) must be at least 4d"; } else if (tpoint < 8 * fastener.d) { this.error = "tpoint must be at least 8d"; } return(tpoint); }
public BrittleFailure(Fastener fastener, double pk, double alfa, bool preDrilled) { if (fastener.type == "nail" || (fastener.type == "screw" && fastener.d <= 6)) { this.CalculateForNails(pk, fastener.d, alfa); } else if (fastener.type == "bolt" || (fastener.type == "screw" && fastener.d > 6)) { this.CalculateForBolt(alfa, fastener.d); } else if (fastener.type == "dowel") { this.CalculateForDowel(alfa, fastener.d); } }
public Variables( //For timber to steel cases Fastener fastener, bool preDrilled, double pk, double alfa, double alfafast, string woodType, double t1, double t_steel, double t_thread ) { this.Myrk = CalcMyrk(fastener); this.fhk = CalcFhk(preDrilled, fastener, pk, alfa, woodType); this.Faxrk = CalcFaxrk(pk, fastener, t1, t_steel, alfafast, t_thread); }
public double CalcMyrk(Fastener fastener) { double value = 0; if (fastener.type == "nail" && fastener.smooth == true) { value = 0.3 * fastener.fu * Math.Pow(fastener.d, 2.6); } else if ((fastener.type == "nail" && fastener.smooth == false) || (fastener.type == "screw" && fastener.d <= 6)) { value = 0.45 * fastener.fu * Math.Pow(fastener.d, 2.6); } else if (fastener.type == "bolt" || (fastener.type == "screw" && fastener.d > 6)) { value = 0.3 * fastener.fu * Math.Pow(fastener.d, 2.6); } return(value); }
double CalcFhk(bool preDrilled, Fastener fastener, double pk, double alfa, string woodType) { double fhk = 0; if ((fastener.type == "nail" && fastener.d <= 8) || (fastener.type == "screw" && fastener.d <= 6)) { if (preDrilled == false) { fhk = 0.082 * pk * Math.Pow(fastener.d, -0.3); } else { fhk = 0.082 * (1 - 0.01 * fastener.d) * pk; } } if ((fastener.type == "nail" && fastener.d > 8) || (fastener.type == "bolt") || (fastener.type == "screw" && fastener.d > 6)) { fhk = CalculateFhAlfak(fastener.d, pk, alfa, woodType); } return(fhk); }
public Variables( //For shear timber to timber cases Fastener fastener, bool preDrilled, double pk1, double pk2, double alfa1, double alfa2, double alfafast, string woodType, double t1, double t2, double t_thread ) { this.Myrk = CalcMyrk(fastener); this.fh1k = CalcFhk(preDrilled, fastener, pk1, alfa1, woodType); this.fh2k = CalcFhk(preDrilled, fastener, pk2, alfa2, woodType); this.beta = this.fh2k / this.fh1k; this.tpen = GetTpen(fastener, t1, t2); this.Faxrk = CalcFaxrk(pk1, fastener, t1, this.tpen, alfafast, t_thread); }
//to shear connections public TimberToTimberCapacity( Fastener Fastener, double T1, double T2, double Alfa1, double Alfa2, string TimberMaterial, string ConnectorMaterial, bool PreDrilled, double Pk1, double Pk2, double T_head, string WoodType, double T_thread, double Alfafast, double Npar, double Npep, double A1 ) { this.t1 = T1; this.t2 = T2; this.alfa1 = Alfa1; this.alfa2 = Alfa2; this.fastener = Fastener; this.timberMaterial = TimberMaterial; this.connectorMaterial = ConnectorMaterial; this.preDrilled = PreDrilled; this.pk1 = Pk1; this.pk2 = Pk2; this.woodType = WoodType; this.t_head = T_head; this.t_thread = T_thread; this.alfafast = Alfafast; this.npar = Npar; this.npep = Npep; this.a1 = A1; this.variables = new Variables(Fastener, PreDrilled, Pk1, Pk2, Alfa1, Alfa2, alfafast, WoodType, T1, T2, T_thread); }
private double CalcFaxrkUpperLimitValue(Fastener fastener) { string type = fastener.type; if (type == "nail") { return(0.15); } else if (type == "screw") { return(1); } else if (type == "bolt") { return(0.25); } else if (type == "dowel") { return(0); } return(1); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Component = this; GrasshopperDocument = this.OnPingDocument(); if (Component.Params.Input[10].SourceCount == 0) { //instantiate new value list var vallist = new Grasshopper.Kernel.Special.GH_ValueList(); vallist.CreateAttributes(); //customise value list position int inputcount = this.Component.Params.Input[10].SourceCount; //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, // (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30); vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[10].Attributes.Bounds.Y + inputcount * 30); //populate value list with our own data vallist.ListItems.Clear(); var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0"); var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1"); var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2"); var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3"); var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4"); var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5"); var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6"); var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7"); vallist.ListItems.Add(item1); vallist.ListItems.Add(item2); vallist.ListItems.Add(item3); vallist.ListItems.Add(item4); vallist.ListItems.Add(item5); vallist.ListItems.Add(item6); vallist.ListItems.Add(item7); vallist.ListItems.Add(item8); //Until now, the slider is a hypothetical object. // This command makes it 'real' and adds it to the canvas. GrasshopperDocument.AddObject(vallist, false); //Connect the new slider to this component this.Component.Params.Input[10].AddSource(vallist); } //AQUI COMEÇA O PLGUIN MESMO double t1 = 0; double t2 = 0; double al1 = 0; double al2 = 0; double npar = 0; double npep = 0; double d = 0; string type = "bolt"; int wood = 0; bool pdrill = false; double pk = 0; bool sd = false; double kmod = 0; double Vrd = 0; double a1 = 0; double a4 = 0; double dw = 0; if (!DA.GetData <double>(0, ref Vrd)) { return; } if (!DA.GetData <double>(1, ref t1)) { return; } if (!DA.GetData <double>(2, ref t2)) { return; } if (!DA.GetData <double>(3, ref al1)) { return; } if (!DA.GetData <double>(4, ref al2)) { return; } if (!DA.GetData <double>(5, ref npar)) { return; } if (!DA.GetData <double>(6, ref npep)) { return; } if (!DA.GetData <double>(7, ref d)) { return; } if (!DA.GetData <bool>(8, ref sd)) { return; } if (!DA.GetData <double>(9, ref kmod)) { return; } if (!DA.GetData <int>(10, ref wood)) { return; } if (!DA.GetData <double>(11, ref a1)) { return; } if (!DA.GetData <double>(12, ref a4)) { return; } if (!DA.GetData <double>(1, ref a4)) { return; } //Pegar valores da Madeira do Excel string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins"); var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv")); int cont = -1; bool stop = false; string woodtype = ""; double fc90 = 0; while (!reader.EndOfStream || stop == false) { var line = reader.ReadLine(); var values = line.Split(','); if (cont == wood) { pk = 1000 * Double.Parse(values[7]); woodtype = values[13]; fc90 = 10 * Double.Parse(values[4]); stop = true; } cont++; } //CALCULO DAS LIGAÇÕES var fast = new Fastener(type, d, dw, -1, true, 1000); var analysis = new TimberToTimberCapacity(fast, t1, t2, al1, al2, woodtype, "steel", pdrill, pk, pk, fc90, woodtype, -1, -1, npar, npep, a1); double fvd = 0; if (sd == false) { fvd = kmod * analysis.FvkSingleShear() / 1.3; } else { fvd = kmod * analysis.FvkDoubleShear() / 1.3; } double faxd = kmod * analysis.variables.Faxrk / 1.3; double DIV = 0; DIV = 1000 * Vrd / fvd; DA.SetData(0, fvd); DA.SetData(1, DIV); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Component = this; GrasshopperDocument = this.OnPingDocument(); if (Component.Params.Input[10].SourceCount == 0) { //instantiate new value list var vallist = new Grasshopper.Kernel.Special.GH_ValueList(); vallist.CreateAttributes(); //customise value list position int inputcount = this.Component.Params.Input[12].SourceCount; //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, // (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30); vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[12].Attributes.Bounds.Y + inputcount * 30); //populate value list with our own data vallist.ListItems.Clear(); var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0"); var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1"); var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2"); var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3"); var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4"); var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5"); var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6"); var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7"); vallist.ListItems.Add(item1); vallist.ListItems.Add(item2); vallist.ListItems.Add(item3); vallist.ListItems.Add(item4); vallist.ListItems.Add(item5); vallist.ListItems.Add(item6); vallist.ListItems.Add(item7); vallist.ListItems.Add(item8); //Until now, the slider is a hypothetical object. // This command makes it 'real' and adds it to the canvas. GrasshopperDocument.AddObject(vallist, false); //Connect the new slider to this component this.Component.Params.Input[10].AddSource(vallist); } if (Component.Params.Input[11].SourceCount == 0) { //instantiate new value list var vallist = new Grasshopper.Kernel.Special.GH_ValueList(); vallist.CreateAttributes(); //customise value list position int inputcount = this.Component.Params.Input[12].SourceCount; //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, // (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30); vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[14].Attributes.Bounds.Y + inputcount * 30); //populate value list with our own data vallist.ListItems.Clear(); var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("Single Shear", "0"); var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("Double Shear Steel In", "1"); var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("Double Shear Steel Out", "2"); //Until now, the slider is a hypothetical object. // This command makes it 'real' and adds it to the canvas. GrasshopperDocument.AddObject(vallist, false); //Connect the new slider to this component this.Component.Params.Input[11].AddSource(vallist); } //AQUI COMEÇA O PLGUIN MESMO double Nrd = 0; double Vrd = 0; double t = 0; double tsteel = 0; double alfa = 0; double n_par = 0; double n_pep = 0; double d = 0; double dw = 0; int wood = 0; int shear_type = 0; double kmod = 0; double a1 = 0; double a4 = 0; string woodtype = ""; double fc90 = 0; //Constant Values string type = "bolt"; bool pre_drilled = true; double pk = 0; double l = -1; //irrelevant bool smooth = true; //irrelevant double fu = 1000; //default double alfa_fast = -1; //irrelevant if (!DA.GetData <double>(0, ref Nrd)) { return; } if (!DA.GetData <double>(1, ref Vrd)) { return; } if (!DA.GetData <double>(2, ref t)) { return; } if (!DA.GetData <double>(3, ref tsteel)) { return; } if (!DA.GetData <double>(4, ref alfa)) { return; } if (!DA.GetData <double>(6, ref n_par)) { return; } if (!DA.GetData <double>(7, ref n_pep)) { return; } if (!DA.GetData <double>(8, ref d)) { return; } if (!DA.GetData <double>(8, ref dw)) { return; } if (!DA.GetData <int>(9, ref wood)) { return; } if (!DA.GetData <int>(10, ref shear_type)) { return; } if (!DA.GetData <double>(11, ref kmod)) { return; } if (!DA.GetData <double>(12, ref a1)) { return; } if (!DA.GetData <double>(13, ref a4)) { return; } string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins"); var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv")); int cont = -1; bool stop = false; while (!reader.EndOfStream || stop == false) { var line = reader.ReadLine(); var values = line.Split(','); if (cont == wood) { pk = 1000 * Double.Parse(values[7]); fc90 = 10 * Double.Parse(values[4]); woodtype = values[13]; stop = true; } cont++; } //CALCULO DAS LIGAÇÕES var fast = new Fastener(type, d, dw, l, smooth, fu); var analysis = new TimberToSteelCapacity(fast, pre_drilled, pk, alfa, alfa_fast, woodtype, t, tsteel, fc90, n_par, n_pep, shear_type, a1); double fvd = 0; if (shear_type == 0) { fvd = kmod * analysis.FvrkSingleShear() / 1.3; } else { fvd = kmod * analysis.FvrkDoubleShear() / 1.3; } double faxd = kmod * analysis.variables.Faxrk / 1.3; double DIV = 0; DIV = 1000 * Vrd / fvd; //Steel Plate double Fsrd = Math.Min(1.2 * a4 * tsteel * 400 / 1.35, 2.4 * fast.d * tsteel * 400 / 1.35); double DIVsteel = 1000 * Vrd / Fsrd; DA.SetData(0, fvd); DA.SetData(1, faxd); DA.SetData(2, DIV); DA.SetData(3, DIVsteel); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Component = this; GrasshopperDocument = this.OnPingDocument(); if (Component.Params.Input[2].SourceCount == 0) { //instantiate new value list var vallist = new Grasshopper.Kernel.Special.GH_ValueList(); vallist.CreateAttributes(); //customise value list position int inputcount = this.Component.Params.Input[2].SourceCount; //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, // (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30); vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[2].Attributes.Bounds.Y + inputcount * 30); //populate value list with our own data vallist.ListItems.Clear(); var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0"); var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1"); var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2"); var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3"); var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4"); var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5"); var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6"); var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7"); vallist.ListItems.Add(item1); vallist.ListItems.Add(item2); vallist.ListItems.Add(item3); vallist.ListItems.Add(item4); vallist.ListItems.Add(item5); vallist.ListItems.Add(item6); vallist.ListItems.Add(item7); vallist.ListItems.Add(item8); //Until now, the slider is a hypothetical object. // This command makes it 'real' and adds it to the canvas. GrasshopperDocument.AddObject(vallist, false); //Connect the new slider to this component this.Component.Params.Input[2].AddSource(vallist); } string type = "screw"; double d = 0; double pk = 0; double alfa = 0; bool pdrill = false; int wood = 0; if (!DA.GetData <string>(0, ref type)) { return; } if (!DA.GetData <double>(1, ref d)) { return; } if (!DA.GetData <int>(2, ref wood)) { return; } if (!DA.GetData <double>(3, ref alfa)) { return; } if (!DA.GetData <bool>(4, ref pdrill)) { return; } //Pegar valores da Madeira do Excel string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins"); var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv")); int cont = -1; bool stop = false; string woodtype = ""; while (!reader.EndOfStream || stop == false) { var line = reader.ReadLine(); var values = line.Split(','); if (cont == wood) { pk = 1000 * Double.Parse(values[7]); woodtype = values[13]; stop = true; } cont++; } //CALCULOS DE BRITTLE FAILURE (minimos espaçamentos aceitáveis) Fastener fast = new Fastener(type, d, -1, -1, true, -1); BrittleFailure analysis = new BrittleFailure(fast, pk, alfa, pdrill); double a1 = analysis.a1; double a2 = analysis.a2; double a3c = analysis.a3c; double a3t = analysis.a3t; double a4c = analysis.a4c; double a4t = analysis.a4t; double a1best = analysis.a1_n; DA.SetData(0, a1); DA.SetData(1, a1best); DA.SetData(2, a2); DA.SetData(3, a3c); DA.SetData(4, a3t); DA.SetData(5, a4c); DA.SetData(6, a4t); }