Exemplo n.º 1
0
        public void PlotClick(object sender, RoutedEventArgs e)
        {
            // declare/instantiate variables
            E80Analysis analysis = new E80Analysis();
            int         plotPoints;

            // get user inputs
            try
            {
                plotPoints               = int.Parse(PlotPoints.Text);
                analysis.Span            = double.Parse(SpanLength.Text);
                analysis.IncrementInches = double.Parse(Increment.Text);
                analysis.ImpactFactor    = double.Parse(ImpactFactor.Text);
                analysis.DistFactor      = double.Parse(DistributionFactor.Text);
                analysis.GetTrainType(LoadType.SelectedIndex);
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid input!");
                return;
            }

            analysis.GetTrain();
            Tuple <double[], double[]> vals = analysis.CalculateEnvelope(plotPoints);

            double[] maxMs = vals.Item1;
            double[] maxVs = vals.Item2;

            MPlot = MakePlot("Moments", maxMs, analysis.Span);
            VPlot = MakePlot("Shears", maxVs, analysis.Span);

            PlotWindow plots = new PlotWindow();

            plots.Show();
        }
Exemplo n.º 2
0
        public void ValClick(object sender, RoutedEventArgs e)
        {
            // declare/instantiate variables
            E80Analysis analysis = new E80Analysis();
            int         plotPoints;

            // get user inputs
            try
            {
                plotPoints               = int.Parse(PlotPoints.Text);
                analysis.Span            = double.Parse(SpanLength.Text);
                analysis.IncrementInches = double.Parse(Increment.Text);
                analysis.ImpactFactor    = double.Parse(ImpactFactor.Text);
                analysis.DistFactor      = double.Parse(DistributionFactor.Text);
                analysis.GetTrainType(LoadType.SelectedIndex);
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid input!");
                return;
            }

            analysis.GetTrain();
            Tuple <double[], double[]> vals = analysis.CalculateEnvelope(plotPoints);

            double[] maxMs = vals.Item1;
            double[] maxVs = vals.Item2;

            TextResultsWindow results = new TextResultsWindow();

            double[] locations = new double[plotPoints + 1];

            for (int i = 0; i < plotPoints + 1; ++i)
            {
                locations[i] = analysis.Span / (plotPoints) * i;
            }

            results.Locations.Text = MakeList(locations);
            results.Moments.Text   = MakeList(maxMs);
            results.Shears.Text    = MakeList(maxVs);
            results.Show();
        }
Exemplo n.º 3
0
        public void CalculateClick(object sender, RoutedEventArgs e)
        {
            // declare/instantiate variables
            E80Analysis analysis = new E80Analysis();
            double      xLocation;
            bool?       pct;

            // get user inputs
            try
            {
                xLocation                = double.Parse(xLoc.Text);
                pct                      = RadioPct.IsChecked;
                analysis.Span            = double.Parse(SpanLength.Text);
                analysis.IncrementInches = double.Parse(Increment.Text);
                analysis.ImpactFactor    = double.Parse(ImpactFactor.Text);
                analysis.DistFactor      = double.Parse(DistributionFactor.Text);
                analysis.GetTrainType(LoadType.SelectedIndex);
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid input!");
                return;
            }

            // if the percent radio button is checked, set the xLocation value to its value times the span length
            if ((bool)pct)
            {
                xLocation = analysis.Span * xLocation;
            }

            analysis.GetTrain();
            Dictionary <string, double> vals = analysis.CalculateSingleLocation(xLocation);
            double mMax    = vals["m"];
            double vMax    = vals["v"];
            double mMaxLoc = vals["mloc"];
            double vMaxLoc = vals["vloc"];

            MomentResult.Text = $"The maximum moment {mMax:0.00} k-ft occurs while the front of the train is at {mMaxLoc:0.00} ft.";
            ShearResult.Text  = $"The maximum shear {vMax:0.00} k occurs while the front of the train is at {vMaxLoc:0.00} ft.";
        }