Example #1
0
        public SurfaceUC(AVL_File.Surface surf)
            : this()
        {
            m_surf = surf;
            ribbonTab1.Text = "SURFACE: " + surf.Name;
            ydupTextBox.TextBoxText = surf.YDUPLICATE.ToString();
            componentTextBox.TextBoxText = surf.COMPONENT.ToString();
            scaleTextBox.TextBoxText = surf.SCALE[0].ToString() + "," + surf.SCALE[1].ToString() + "," + surf.SCALE[2].ToString();
            translateTextBox.TextBoxText = surf.TRANSLATE[0].ToString() + "," + surf.TRANSLATE[1].ToString() + "," + surf.TRANSLATE[2].ToString();
            angleTextBox.TextBoxText = surf.ANGLE.ToString();

            nowakeCheck.Checked = surf.NOWAKE;
            noableCheck.Checked = surf.NOALBE;
            noloadCheck.Checked = surf.NOLOAD;

            chordwiseUpDown.TextBoxText = surf.Nchordwise.ToString();
            spanwiseUpDown.TextBoxText = surf.Nspanwise.ToString();

            string[] ControlNames = ControlSurfNames();
            for (int i = 0; i < ControlNames.Length; i++)
            {
                var lab = new RibbonLabel();
                lab.Text = ControlNames[i];
                controlSurfDropDown.DropDownItems.Add(lab);
                if (i == 0)
                    controlSurfDropDown.SelectedItem = lab;
            }

            ChangeSection(0);
            RecalculateStats();
            OnChangedSelection(this, new SectionSelectEventArgs(-1));
        }
Example #2
0
        private void SaveBackup(AVL_File afile)
        {
            FileInfo finfo = new FileInfo(Initial_File_Path);

            if (finfo.Exists)
            {
                string fileName = finfo.Name;
                m_backup_location = finfo.DirectoryName + "\\" + fileName + ".bak";
                afile.WriteFile(m_backup_location);
            }
        }
Example #3
0
        private static List<Line3D> DrawSurface(AVL_File.Surface surf, int SecHighlight)
        {
            List<Line3D> lines = new List<Line3D>();
            for (int i = 0; i < surf.Sections.Count - 1; i++)
                lines.AddRange(DrawSection(surf.Sections[i], surf.Sections[i + 1], surf.Nchordwise, surf.Cspace, surf.Nspanwise, surf.Sspace, surf.YDUPLICATE, i == SecHighlight));

            lines.Add(DrawBorder(surf));
            return lines;
        }
Example #4
0
 private static List<Line3D> DrawSurface(AVL_File.Surface surf)
 {
     return DrawSurface(surf, -1);
 }
Example #5
0
        private static List<Line3D> DrawSection(AVL_File.Surface.Section sec1, AVL_File.Surface.Section sec2, int Nchord, int Cspace, int Nspan, int Sspace, double ydup, bool highlight)
        {
            //these could be defined for the entire surface, or by the section, so check
            if (Nspan == 0)
                Nspan = sec1.Nspanwise;
            if (Sspace == 0)
                Sspace = sec1.Sspace;

            Point3D LE_Sec1 = new Point3D(sec1.X_LeadingEdge, sec1.Y_LeadingEdge, sec1.Z_LeadingEdge);
            Point3D LE_Sec2 = new Point3D(sec2.X_LeadingEdge, sec2.Y_LeadingEdge, sec2.Z_LeadingEdge);

            Point3D TE_Sec1 = new Point3D(sec1.X_LeadingEdge + sec1.Chord, sec1.Y_LeadingEdge, sec1.Z_LeadingEdge);
            Point3D TE_Sec2 = new Point3D(sec2.X_LeadingEdge + sec2.Chord, sec2.Y_LeadingEdge, sec2.Z_LeadingEdge);

            List<Line3D> lines = new List<Line3D>();

            //chord-length lines stepping along the span, has to be Nspan-1 since for loop starts at 0, otherwise there will be one extra line
            Point3D d_le = (LE_Sec2 - LE_Sec1) / Nspan;
            Point3D d_te = (TE_Sec2 - TE_Sec1) / Nspan;
            for (int i = 0; i < Nspan; i++)
            {
                double space_mod = i;
                if (Sspace == 1 || Sspace == -1)//cosine distribution of lines
                    space_mod = (double)Nspan / 2 * (1 - Math.Cos(Math.PI * i / (Nspan-1)));
                else if (Sspace == -2)//negative sine distribution of lines
                    space_mod = (double)Nspan * Math.Sin((Math.PI / 2) * i / (Nspan-1));
                else if (Sspace == 2)//positive sine distribution of lines
                    space_mod = (double)Nspan + ((double)Nspan * Math.Sin((-Math.PI / 2) * i / (Nspan-1)));

                Point3D le_point = LE_Sec1 + (d_le * space_mod);
                Point3D te_point = TE_Sec1 + (d_te * space_mod);

                lines.Add(new Line3D(new Point3D[] { le_point, te_point }, highlight ? SelectedColor : LatticeColor));
                if (!double.IsNaN(ydup))
                    lines.Add(new Line3D(new Point3D[] { le_point.InvertY(ydup), te_point.InvertY(ydup) }, highlight ? SelectedColor : LatticeColor));
            }

            //span-length lines stepping down the chord
            double dx_root = sec1.Chord / (Nchord - 1);
            double dx_tip = sec2.Chord / (Nchord - 1);
            for (int i = 0; i < Nchord; i++)
            {
                double space_mod = i;
                if (Cspace == 1 || Cspace == -1)//cosine distribution of lines
                    space_mod = Nchord / 2 * (1 - Math.Cos(Math.PI * i / Nchord));
                else if (Cspace == -2)//negative sine distribution of lines
                    space_mod = Nchord * Math.Sin((Math.PI / 2) * i / Nchord);
                else if (Cspace == 2)//positive sine distribution of lines
                    space_mod = Nchord + (Nchord * Math.Sin((-Math.PI / 2) * i / Nchord));
                Point3D root_point = new Point3D(LE_Sec1.X + dx_root * i, LE_Sec1.Y, LE_Sec1.Z);
                Point3D tip_point = new Point3D(LE_Sec2.X + dx_tip * i, LE_Sec2.Y, LE_Sec2.Z);

                double controlFractionRoot = 1;
                double controlFractionTip = 1;
                foreach (AVL_File.Surface.Section.Control csurfroot in sec1.control_surfaces)
                {
                    foreach (AVL_File.Surface.Section.Control csurftip in sec2.control_surfaces)
                    {
                        if (csurfroot.Name == csurftip.Name)
                        {
                            if (csurfroot.Xhinge < controlFractionRoot)
                                controlFractionRoot = csurfroot.Xhinge;
                            if (csurftip.Xhinge < controlFractionTip)
                                controlFractionTip = csurftip.Xhinge;
                        }
                    }
                }

                Color c = LatticeColor;
                if (controlFractionTip < 1 && (root_point.X - sec1.X_LeadingEdge) / sec1.Chord > controlFractionRoot)
                    c = ControlSurfColor;
                if (controlFractionRoot < 1 && (tip_point.X - sec2.X_LeadingEdge) / sec2.Chord > controlFractionTip)
                    c = ControlSurfColor;
                if (highlight)
                    c = SelectedColor;

                lines.Add(new Line3D(new Point3D[] { root_point, tip_point }, c));//highlight ? SelectedColor : LatticeColor));
                if (!double.IsNaN(ydup))
                    lines.Add(new Line3D(new Point3D[] { root_point.InvertY(ydup), tip_point.InvertY(ydup) }, c));//highlight ? SelectedColor : LatticeColor));
            }

            return lines;
        }
Example #6
0
        /// <summary>
        /// Draws the border around the surface
        /// Still not quite right, if you duplicate off the y-axis then it doesnt quite outline each surface on its own
        /// Maybe code for the edges, skipping the last return point if ydup = 0, then mirror all points
        /// </summary>
        /// <param name="surf">Surface to draw border around</param>
        /// <returns>Points representing the border</returns>
        private static Line3D DrawBorder(AVL_File.Surface surf)
        {
            Point3D[] pts;
            if (!double.IsNaN(surf.YDUPLICATE))
                pts = new Point3D[surf.Sections.Count * 4];
            else
                pts = new Point3D[surf.Sections.Count * 2 + 1];

            int i = 0;
            foreach (AVL_File.Surface.Section sec in surf.Sections)
            {
                pts[i] = new Point3D(sec.X_LeadingEdge, sec.Y_LeadingEdge, sec.Z_LeadingEdge);

                if (double.IsNaN(surf.YDUPLICATE))
                    pts[(pts.Length - 2) - i] = new Point3D(sec.X_LeadingEdge + sec.Chord, sec.Y_LeadingEdge, sec.Z_LeadingEdge);
                else
                {
                    pts[(pts.Length-1) - i] = pts[i].InvertY(surf.YDUPLICATE);//mirrored leading edge

                    pts[((pts.Length)/2) -1 - i] = new Point3D(sec.X_LeadingEdge + sec.Chord, sec.Y_LeadingEdge, sec.Z_LeadingEdge);//trailing edge
                    pts[((pts.Length) / 2) + i] = Point3D.Translate(pts[(pts.Length-1) - i], sec.Chord, 0, 0);
                }
                i++;
            }

            if (double.IsNaN(surf.YDUPLICATE))
                pts[pts.Length - 1] = pts[0];

            return new Line3D(pts, BorderColor);
        }
Example #7
0
 public Surface(string name, AVL_File parent)
 {
     Name = name;
     Parent = parent;
 }
Example #8
0
 public Surface(string name, AVL_File parent)
 {
     Name   = name;
     Parent = parent;
 }
Example #9
0
 public Aircraft()
 {
     Analyze_Cases = new List <Run_Case>();
     m_work_File   = new AVL_File();
     AVL_Instance.OnUpdateMessages += new MessageEventHandler(AVL_Instance_OnUpdateMessages);
 }
Example #10
0
 public Aircraft()
 {
     Analyze_Cases = new List<Run_Case>();
     m_work_File = new AVL_File();
     AVL_Instance.OnUpdateMessages += new MessageEventHandler(AVL_Instance_OnUpdateMessages);
 }