public void Process(string xfileSavingPath, string condition, bool excelOnly)
        {
            inputgPath = xfileSavingPath.Replace(".xlsx", $"_{condition}Input1st.xlsx");
            outputPath = xfileSavingPath.Replace(".xlsx", $"_{condition}ResultFinal.xlsx");

            Radius    = float.Parse(p.segmentRadiusIn.ToString());
            Thick     = float.Parse(p.segmentThickness.ToString());
            UseRadius = Radius + Thick / 2;
            //Aangle = float.Parse(p.segmentAAngle.ToString());
            //Bangle = float.Parse(p.segmentBAngle.ToString());
            Kangle  = float.Parse(p.segmentKAngle.ToString());
            ADangle = float.Parse(p.segmentAdjacentPoreAngle.ToString());

            Joint_Coordinates();
            Joint_Restraint_Assignments();
            Connectivity_Frame_AND_Frame_Output_Station_Assigns();
            Link_Props_01_General_AND_Link_Props_05_Gap();
            Connectivity_Link_And_Link_Property_Assignments();
            //Frame_Props_01_Generall_AND_Frame_Props_02_Concrete_Col();
            SetFrameMaterial();
            Frame_Section_Assignments();
            //  Frame_Releases1_General();
            //MatProp_01_General_AND_MatProp_02_BasicAnd_Mech_Props_AND_MatProp_03b_Concrete_Data();
            Frame_Loads_Distributed();
            input.FileSaving(inputgPath);

            // all worksheet
            List <string> names = new List <string>();

            names.Add("Joint Coordinates");
            names.Add("Joint Restraint Assignments");
            names.Add("Connectivity - Frame");
            names.Add("Connectivity - Link");
            names.Add("Link Property Assignments");
            names.Add("Link Props 05 - Gap");
            names.Add("Frame Props 01 - General");
            names.Add("Frame Section Assignments");
            names.Add("Frame Loads - Distributed");
            names.Add("Jt Spring Assigns 1 - Uncoupled");
            names.Add("MatProp 01 - General");
            names.Add("MatProp 02 - Basic Mech Props");
            names.Add("MatProp 03b - Concrete Data");
            names.Add("Load Case Definitions");
            names.Add("Load Pattern Definitions");
            names.Add("Case - Static 1 - Load Assigns");
            names.Add("Case - Static 2 - NL Load App");
            names.Add("Combination Definitions");
            names.Add("Program Control");
            string[] wordtemp = xfileSavingPath.Split('\\');
            string   wordpath = "";

            for (int i = 0; i < wordtemp.Length - 1; i++)
            {
                wordpath += wordtemp[i]; wordpath += "\\";
            }
            wordpath += "SiteTunnel.docx";
            //string wordpath = xfileSavingPath.Replace(".xlsx", $".docx");
            word.Add(inputgPath, names, false, false);

            if (excelOnly)
            {
                return;
            }

            SAPCalculation(inputgPath, "DL+SOIL (NL)", outputPath, frameName);

            word.Add(outputPath, names, true, false);
            word.FileSaving(wordpath);
            oUploadFile.UploadToServer(sectionUID, wordpath);

            try
            {
                oExcuteSQL.DeleteDataBySectionUID("STN_SiteResult", sectionUID);
            }
            catch
            {
            }
            oExcuteSQL.InsertData("STN_SiteResult", "Section", sectionUID);
            oExcuteSQL.UpdateData("STN_SiteResult", "Section", sectionUID, "RC", RCUID);
            oExcuteSQL.UpdateData("STN_SiteResult", "Section", sectionUID, "Stirrup", stirrupUID);
        }
Exemple #2
0
        public void Process(string xfileSavingPath, string condition, bool excelOnly)
        {
            inputgPath = xfileSavingPath.Replace(".xlsx", $"_{condition}Input1st.xlsx");
            outputPath = xfileSavingPath.Replace(".xlsx", $"_{condition}ResultFinal.xlsx");
            Joint_Coordinates();
            Joint_Restraint_Assignments();
            Connectivity_FrameAND_Frame_Output_Station_Assigns();
            Connectivity_Link_And_Link_Property_Assignments();
            Link_Props_01_General();
            Link_Props_05_Gap();
            //Frame_Props_01_Generall_AND_Frame_Props_02_Concrete_Col();
            SetFrameMaterial();
            //  Frame_Section_Assignments();  //Frame_Section_Assignments
            //MatProp_01_General_AND_MatProp_02_BasicAnd_Mech_Props_AND_MatProp_03b_Concrete_Data();
            Frame_Loads_Distributed_AND_Frame_Section_Assignments();
            input.FileSaving(inputgPath);

            // all worksheet
            List <string> names = new List <string>();

            names.Add("Joint Coordinates");
            names.Add("Joint Restraint Assignments");
            names.Add("Connectivity - Frame");
            names.Add("Connectivity - Link");
            names.Add("Link Property Assignments");
            names.Add("Link Props 05 - Gap");
            names.Add("Frame Props 01 - General");
            names.Add("Frame Section Assignments");
            names.Add("Frame Loads - Distributed");
            names.Add("Jt Spring Assigns 1 - Uncoupled");
            names.Add("MatProp 01 - General");
            names.Add("MatProp 02 - Basic Mech Props");
            names.Add("MatProp 03b - Concrete Data");
            names.Add("Load Case Definitions");
            names.Add("Load Pattern Definitions");
            names.Add("Case - Static 1 - Load Assigns");
            names.Add("Case - Static 2 - NL Load App");
            names.Add("Combination Definitions");
            names.Add("Program Control");
            string[] wordtemp = xfileSavingPath.Split('\\');
            string   wordpath = "";

            for (int i = 0; i < wordtemp.Length - 1; i++)
            {
                wordpath += wordtemp[i]; wordpath += "\\";
            }
            wordpath += "ConnectTunnel.docx";
            //string wordpath = xfileSavingPath.Replace(".xlsx", $".docx");
            word.Add(inputgPath, names, false, false);

            if (excelOnly)
            {
                return;
            }

            SAPCalculation(inputgPath, "DL+SOIL (NL)", outputPath, frameName, out bool getResult, "Connector", 1);

            word.Add(outputPath, names, true, false);
            word.FileSaving(wordpath);
            oUploadFile.UploadToServer(sectionUID, wordpath);

            string TR = "TR";
            List <Tuple <string, double, double, double> > outData = new List <Tuple <string, double, double, double> >();
            List <string> rc = new List <string>();

            outData = SAPChosenData("", frameName, BHFrame, "Main");
            rc.Add(outData[0].Item1);
            outData = SAPChosenData("", frameName, BHFrame, "Shear");
            rc.Add(outData[0].Item1);
            outData = SAPChosenData(TR, frameName, TRFrame, "Main");
            rc.Add(outData[0].Item1);
            outData = SAPChosenData(TR, frameName, TRFrame, "Shear");
            rc.Add(outData[0].Item1);

            try
            {
                oExcuteSQL.DeleteDataBySectionUID("STN_ConnectorResult", sectionUID);
            }
            catch
            {
            }
            oExcuteSQL.InsertData("STN_ConnectorResult", "Section", sectionUID);
            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "BHRC", rc[0]);
            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "BHStirrup", rc[1]);
            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "TRRC", rc[2]);
            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "TRStirrup", rc[3]);

            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "BHStartMember", (BHStart + 1).ToString());
            oExcuteSQL.UpdateData("STN_ConnectorResult", "Section", sectionUID, "BHEndMember", (BHEnd - 1).ToString());
        }
        public void SAP200yFloodCal(out string error)
        {
            error = "";
            try
            {
                DataTable section      = dataSearch.GetByUID("STN_Section", sectionUID);
                string    longTermUID  = section.Rows[0]["LLI4_ChosenData"].ToString();
                string    shortTermUID = section.Rows[0]["SLI4_ChosenData"].ToString();

                DataTable longTermData  = dataSearch.GetByUID("STN_LongTermData", longTermUID);
                DataTable shortTermData = dataSearch.GetByUID("STN_ShortTermData", shortTermUID);

                double longTermWL      = p.groundEle - p.GWL;
                double WL              = p.floodEle - longTermWL;
                double increasedStress = WL * p.newton * (p.segmentRadiusOut * 2) * p.segmentWidth / 2;

                double longTermM     = double.Parse(longTermData.Rows[0]["MomentZ"].ToString());
                double longTermAxial = Math.Abs(double.Parse(longTermData.Rows[0]["Axial"].ToString())) + increasedStress;
                double longTermShear = Math.Abs(double.Parse(longTermData.Rows[0]["ShearY"].ToString()));

                double shortTermWL = p.groundEle;
                double shortWL     = p.floodEle - p.groundEle;
                double shortStress = shortWL * p.newton * (p.segmentRadiusOut * 2) * p.segmentWidth / 2;

                double shortTermM     = double.Parse(shortTermData.Rows[0]["MomentZ"].ToString());
                double shortTermAxial = Math.Abs(double.Parse(shortTermData.Rows[0]["Axial"].ToString())) + shortStress;
                double shortTermShear = Math.Abs(double.Parse(shortTermData.Rows[0]["ShearY"].ToString()));

                List <string> condition = new List <string> {
                    "LongTerm", "ShortTerm"
                };
                List <string> inputUID = new List <string>();
                List <Tuple <string, string, string> > floodProp = new List <Tuple <string, string, string> >();
                List <Tuple <double, double, double, double, double, double> > floodData = new List <Tuple <double, double, double, double, double, double> >();

                for (int i = 0; i < 2; i++)
                {
                    inputUID.Add(Guid.NewGuid().ToString("D"));
                    floodProp.Add(Tuple.Create("", condition[i], ""));
                }
                List <string> floodSection = new List <string> {
                    "FloodL", "FloodS"
                };
                for (int i = 0; i < 2; i++)
                {
                    dataSearch.UpdateData("STN_Section", "UID", sectionUID, floodSection[i], inputUID[i]);
                }
                floodData.Add(Tuple.Create(longTermAxial, longTermShear, 0.0, 0.0, 0.0, longTermM));
                floodData.Add(Tuple.Create(shortTermAxial, shortTermShear, 0.0, 0.0, 0.0, shortTermM));

                try
                {
                    dataSearch.DeleteDataBySectionUID("STN_200yFloodData", sectionUID);
                }
                catch
                {
                }
                dataSearch.InsertSAPData("STN_200yFloodData", inputUID, sectionUID, floodProp, 0, floodData);
            }
            catch
            {
                error = "請先完成長期與短期載重計算";
            }
        }