public SelfWeight GetSelfWeight()
        {
            SelfWeight selfWeight = new SelfWeight();

            selfWeight.BasicWeight       = this.BasicWeight;
            selfWeight.DryOperationIndex = this.DOI;
            selfWeight.Correction        = this.Correction;
            selfWeight.Crew1             = this.Crew1;
            selfWeight.Crew2             = this.Crew2;
            selfWeight.Crew3             = this.Crew3;
            selfWeight.Calc();
            return(selfWeight);
        }
        public AirbusA320 GetAdvancedData()
        {
            SelfWeight selfWeight = this.GetSelfWeight();

            Fuel takeoffFuel = this.GetTakeoffFuel();

            Fuel landingFuel = this.GetLandingFuel();

            Cargo cargo1 = this.GetCargo1();

            Cargo cargo3 = this.GetCargo3();

            Cargo cargo4 = this.GetCargo4();

            Cargo cargo5 = this.GetCargo5();

            PSGComp psgOA = this.GetPsgOA();

            PSGComp psgOB = this.GetPsgOB();

            PSGComp psgOC = this.GetPsgOC();

            AirbusA320 a320 = new AirbusA320
            {
                SelfWeight  = selfWeight,
                TakeoffFuel = takeoffFuel,
                LandingFuel = landingFuel,
                Cargo1      = cargo1,
                Cargo3      = cargo3,
                Cargo4      = cargo4,
                Cargo5      = cargo5,
                PsgOA       = psgOA,
                PsgOB       = psgOB,
                PsgOC       = psgOC
            };

            a320.Calc();

            return(a320);
        }
Exemple #3
0
        public bool Write(string FilePath)
        {
            #region Write to file
            SetFact();
            string strc = "";

            //To Do: write to file
            this.FileName = FilePath;
            FileStream   fs = new FileStream(FilePath, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);
            //sw.WriteLine(ProjectTitle);
            sw.WriteLine("ASTRA " + BasicInfo.Type.ToString() + "\t" + BasicInfo.UsersTitle);

            strc = "STRUCTURE\t" + (int)BasicInfo.Type + "\t" + BasicInfo.RunningOption.ToString();

            //strc = "STRUCTURE\t" + (StructureType == StructureType.Space ? 1 : StructureType == StructureType.Floor ? 2 : 3);
            //strc = strc + '\t' + Modex.ToString();

            sw.WriteLine(strc);
            sw.WriteLine("N000 " + BasicInfo.MassUnit.ToString() + " " + BasicInfo.LengthUnit.ToString());
            if (this.NodeData.Count > 0)
            {
                sw.WriteLine("N001 UNIT {0:f3} {1:f3} {2} {3} {4} {5} NODE, x[NODE]*lfact, y[NODE]*lfact, z[NODE]*lfact, TX, TY, TZ, RX, RY, RZ",
                             NodeData.MassFactor, NodeData.LengthFactor, BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             BasicInfo.MassUnit.ToString(), NodeData.LengthUnit.ToString());
                //sw.WriteLine("N001 UNIT {0:f3} {1:f3} {2} {3} {4} {5} NODE, x[NODE]*lfact, y[NODE]*lfact, z[NODE]*lfact, TX, TY, TZ, RX, RY, RZ",
                //                   NodeData.MassFactor, NodeData.LenthFactor, this.MUnit, this.LUnit,
                //                   CAstraUnits.GetMassUnit(NodeData.MassFactor), CAstraUnits.GetLengthUnit(NodeData.LenthFactor));


                this.NodeData.Sort();
                for (i = 0; i < NodeDataArr.Count; i++)
                {
                    string st = NodeDataArr[i].ToString();
                    sw.WriteLine(st);
                }
            }
            if (this.BeamConnectivity.Count > 0)
            {
                sw.WriteLine("N002 UNIT {0:f3} {1:f3} {2} {3} {4} {5} ELTYPE=2, MEMBER#, NODE1#, x[NODE1]*lfact, y[NODE1]*lfact, z[NODE1]*lfact, NODE2#, x[NODE2]*lfact, y[NODE2]*lfact, z[NODE2]*lfact",
                             BeamConnectivity.MassFactor, BeamConnectivity.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString());

                for (i = 0; i < BeamConnectivity.Count; i++)
                {
                    sw.WriteLine(BeamConnectivity[i].ToString());
                }
            }
            if (this.SectionProperty.Count > 0)
            {
                sw.WriteLine("N003 UNIT {0:f3} {1:f3} {2} {3} {4} {5} member#, section_ID#,B, D, Do, Di, area*lfact*lfact, ix*lfact*lfact*lfact*lfact, iy*lfact*lfact*lfact*lfact, iy*lfact*lfact*lfact*lfact",
                             SectionProperty.MassFactor, SectionProperty.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             SectionProperty.MassUnit.ToString(), SectionProperty.LengthUnit.ToString());
                for (i = 0; i < SecPropArr.Count; i++)
                {
                    sw.WriteLine(SecPropArr[i].ToString());
                }
            }
            if (MatPropArr.Count > 0)
            {
                sw.WriteLine("N004 UNIT {0:f3} {1:f3} {2} {3} {4} {5} member#, mat_ID#, emod*wfact/(lfact*lfact), pr, mden*wfact/(lfact*lfact*lfact), wden*wfact/(lfact*lfact*lfact), alpha, beta",
                             MaterialProperty.MassFactor, MaterialProperty.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             MaterialProperty.MassUnit.ToString(), MaterialProperty.LengthUnit.ToString());

                for (i = 0; i < MatPropArr.Count; i++)
                {
                    sw.WriteLine(MatPropArr[i].ToString());
                }
            }
            if (this.MemberTruss.Count > 0)
            {
                sw.WriteLine("N008 ELTYPE=1, TRUSS_MEMB #");
                for (i = 0; i < MemberTruss.Count; i++)
                {
                    sw.WriteLine(MemberTruss[i].ToString());
                }
            }
            if (this.BeamConnectivityRelease.Count > 0)
            {
                sw.WriteLine("N009 member#, N1# FX FY FZ MX MY MZ N2# FX FY FZ MX MY MZ");
                for (i = 0; i < BeamConnectivityRelease.Count; i++)
                {
                    sw.WriteLine(BeamConnectivityRelease[i].ToString());
                }
            }
            if (this.Support.Count > 0)
            {
                sw.WriteLine("N005 member#, dof[0], dof[1], dof[2], dof[3], dof[4], dof[5]");
                for (i = 0; i < Support.Count; i++)
                {
                    sw.WriteLine(Support[i].ToString());
                }
            }

            if (!(SelfWeight.SELFWEIGHTX == -1 && SelfWeight.SELFWEIGHTY == -1 && SelfWeight.SELFWEIGHTZ == -1))
            {
                sw.WriteLine("N010 loadcase#, SELFWEIGHTX, SELFWEIGHTY, SELFWEIGHTZ");
                sw.WriteLine(SelfWeight.ToString());
            }
            if (JointNodalLoad.Count > 0)
            {
                sw.WriteLine("N006 UNIT {0:f3} {1:f3} {2} {3} {4} {5} Member#, loadcase#, udlx*wfact/lfact,udly*wfact/lfact,udlz*wfact/lfact, px*wfact, d1*lfact, py*wfact, d2*lfact, pz*wfact, d3*lfact",
                             JointNodalLoad.MassFactor, JointNodalLoad.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             JointNodalLoad.MassUnit.ToString(), JointNodalLoad.LengthUnit.ToString());

                int xx = JointNodalLoad[0].loadcase;

                for (i = 0; i < JointNodalLoad.Count; i++)
                {
                    if (xx != JointNodalLoad[i].loadcase)
                    {
                        sw.WriteLine("N006 UNIT {0:f3} {1:f3} {2} {3} {4} {5} Member#, loadcase#, udlx*wfact/lfact,udly*wfact/lfact,udlz*wfact/lfact, px*wfact, d1*lfact, py*wfact, d2*lfact, pz*wfact, d3*lfact",
                                     JointNodalLoad.MassFactor, JointNodalLoad.LengthFactor,
                                     BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                                     JointNodalLoad.MassUnit.ToString(), JointNodalLoad.LengthUnit.ToString());


                        xx = JointNodalLoad[i].loadcase;
                    }
                    sw.WriteLine(JointNodalLoad[i].ToString());
                }
            }
            if (this.MemberBeamLoad.Count > 0)
            {
                sw.WriteLine("N007 UNIT {0:f3} {1:f3} {2} {3} {4} {5} NODE#, loadcase#, fx*wfact, fy*wfact, fz*wfact, mx*wfact*lfact, my*wfact*lfact, mz*wfact*lfact",
                             MemberBeamLoad.MassFactor, MemberBeamLoad.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             MemberBeamLoad.MassUnit.ToString(), MemberBeamLoad.LengthUnit.ToString());

                for (i = 0; i < MemberBeamLoad.Count; i++)
                {
                    sw.WriteLine(MemberBeamLoad[i].ToString());
                }
            }


            if (MovingLoad.Count > 0)
            {
                sw.WriteLine("N011\tDEFINE MOVING LOAD");
                sw.WriteLine("N011\tDEFINE MOVING LOAD FILE " + MovingLoad.FileName);
                for (i = 0; i < MovingLoad.Count; i++)
                {
                    sw.WriteLine(MovingLoad[i].ToString());
                }
            }

            if (LoadGeneration.Count > 0)
            {
                sw.WriteLine("N012\tLOAD GENERATION");
                sw.WriteLine("N012\tLOAD GENERATION " + LoadGeneration.repeatTime);
                for (i = 0; i < LoadGeneration.Count; i++)
                {
                    sw.WriteLine(LoadGeneration[i].ToString());
                }
            }
            if (LoadCombination.Count > 0)
            {
                sw.WriteLine("N013\tLOAD CASE (COMBINATION), Load, Factor");
                for (i = 0; i < LoadCombination.Count; i++)
                {
                    sw.WriteLine(LoadCombination[i].ToString());
                }
            }
            if (AreaLoad.Count > 0)
            {
                sw.WriteLine("N014 UNIT {0:f3} {1:f3} {2} {3} {4} {5} MEMB#, loadcase#, fy*wfact",
                             AreaLoad.MassFactor, AreaLoad.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             AreaLoad.MassUnit.ToString(), AreaLoad.LengthUnit.ToString());

                for (i = 0; i < AreaLoad.Count; i++)
                {
                    sw.WriteLine(AreaLoad[i].ToString());
                }
            }

            if (this.ElementData.Count > 0)
            {
                sw.WriteLine("N016 UNIT {0:f3} {1:f3} {2} {3} {4} {5} ELTYPE=6, Element#, THICKNESS",
                             this.ElementData.MassFactor, this.ElementData.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             ElementData.MassUnit.ToString(), ElementData.LengthUnit.ToString());

                for (i = 0; i < this.ElementData.Count; i++)
                {
                    sw.WriteLine(this.ElementData[i].ElementThickNess());
                }
                sw.WriteLine("N017      ELEMENT     LOADCASE     NORMAL Pressure");
                for (i = 0; i < this.ElementData.Count; i++)
                {
                    sw.WriteLine(this.ElementData[i].ElementPressure());
                }

                sw.WriteLine("N018  ELEMENT NUMBER    NODE-I     NODE-J   NODE-K      NODE-L      NODE-0      MATERIAL NUMBER     AVERAGE THICKNESS   NORMAL Pressure      TEMPARATURE DIFFERENCE      THERMAL GRADIENT");
                for (i = 0; i < this.ElementData.Count; i++)
                {
                    sw.WriteLine(this.ElementData[i].ToString());
                }
            }
            if (MatPropertyInfo.Count > 0)
            {
                sw.WriteLine("N019 UNIT {0:f3} {1:f3} {2} {3} {4} {5} MATERIAL NUMBER   MASS DENSITY    THERMAL ALPHA(X)    EXPENSION ALPHA(Y) COEFFICIENTS ALPHA(Z)    C(XX)   C(XY)   C(XG) C(YY) C(YG) G(XY)",
                             this.MatPropertyInfo.MassFactor, this.MatPropertyInfo.LengthFactor,
                             BasicInfo.MassUnit.ToString(), BasicInfo.LengthUnit.ToString(),
                             MatPropertyInfo.MassUnit.ToString(), MatPropertyInfo.LengthUnit.ToString());

                for (i = 0; i < this.MatPropertyInfo.Count; i++)
                {
                    sw.WriteLine(this.MatPropertyInfo[i].ToString());
                }
            }
            if (ElementMultiplier.Count > 0)
            {
                sw.WriteLine("N020  ELEMENT LOAD CASE NUMBER    Pressure     THERMAL EFFECTS     X-ACCELERATION      Y-ACCELERATION      Z-ACCELERATION");
                for (i = 0; i < this.ElementMultiplier.Count; i++)
                {
                    sw.WriteLine(this.ElementMultiplier[i].ToString());
                }
            }

            #endregion

            if (Analysis.NF != -1)
            {
                sw.WriteLine("N099 NDYN NF");
                //sw.WriteLine("N099\tNDYN    <NDYN_ID#>    NF    <NF_value>");
                sw.WriteLine(Analysis.ToString());
            }

            if (Analysis.NDYN == 2)
            {
                if (TimeHistory.IsDefault == false)
                {
                    sw.WriteLine("N101    1");
                    sw.WriteLine(TimeHistory.THist_1.ToString());
                    sw.WriteLine("N101");

                    sw.WriteLine(TimeHistory.THist_2.ToString());
                    sw.WriteLine("N102");

                    sw.WriteLine(TimeHistory.THist_3.ToString());
                    sw.WriteLine(TimeHistory.THist_4.ToString());

                    if (TimeHistory.THist_5.Count > 0)
                    {
                        sw.WriteLine("N105    1");
                        for (int i = 0; i < TimeHistory.THist_5.Count; i++)
                        {
                            sw.WriteLine(TimeHistory.THist_5[i].ToString());
                        }
                        sw.WriteLine("N105");
                    }
                    if (TimeHistory.THist_6.Count > 0)
                    {
                        sw.WriteLine("N106    1");
                        for (int i = 0; i < TimeHistory.THist_6.Count; i++)
                        {
                            sw.WriteLine(TimeHistory.THist_6[i].ToString());
                        }
                        sw.WriteLine("N106    0");
                        sw.WriteLine("N106");
                    }
                }
            }
            else if (Analysis.NDYN == 3)
            {
                response.WriteToStream(sw);
            }
            sw.Flush();
            sw.Close();
            run();
            return(true);
        }