Example #1
0
        private void cboTestParameter_Changed(object sender, EventArgs e)
        {
            string testParameter = this.cboTestParameter.Text;

            float[] testParameterBoundaries = ServiceVolumeArterialInputs.GetTestParameterValues(testParameter);
            this.lblLowerBound.Text = "Lower Bound: " + testParameterBoundaries[0].ToString();
            this.lblUpperBound.Text = "Upper Bound: " + testParameterBoundaries[1].ToString();
            this.lblStep.Text       = "Step: " + testParameterBoundaries[2].ToString();
        }
Example #2
0
        /*private void bgwRunServiceVolsCalcs_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
         * {
         *  Project = new ProjectData(AnalysisMode.Planning);
         *
         *  string testParameter = this.cboTestParameter.Text;
         *  float[] testParameterBoundaries = ServiceVolumeArterialInputs.GetTestParameterValues(testParameter);
         *  List<ServiceVolumes> serviceVolResults = new List<ServiceVolumes>();
         *
         *  for (float iterateBoundary = testParameterBoundaries[0]; iterateBoundary <= testParameterBoundaries[1]; iterateBoundary += testParameterBoundaries[2])
         *  {
         *      ServiceVolumes SerVols = new ServiceVolumes(iterateBoundary, testParameter);
         *      ServiceVolumeArterialInputs InputsOneLane = new ServiceVolumeArterialInputs(false, testParameter, iterateBoundary);
         *      ServiceVolumeArterialInputs InputsMultiLane = new ServiceVolumeArterialInputs(true, testParameter, iterateBoundary);
         *      this.lblIteration.Text = "Iteration: " + Math.Round(iterateBoundary,2).ToString();
         *      CalcsServiceVolumes.ServiceVolsAuto(Project, SerVols, InputsOneLane, InputsMultiLane);
         *      serviceVolResults.Add(SerVols);
         *  }
         *  //e.Cancel = true;
         *  ServiceVolResultsOutput.WriteServiceVolResultsData("Service Volume Outputs.csv", serviceVolResults);
         *
         *  //ServiceVolumeArterialInputs InputsOneLane = new ServiceVolumeArterialInputs(false, TestParameter, 0);
         *  //ServiceVolumeArterialInputs InputsMultiLane = new ServiceVolumeArterialInputs(true, TestParameter, 0);
         *  //CalcsServiceVolumes.ServiceVolsAuto(Project, SerVols, InputsOneLane, InputsMultiLane);
         * }*/

        private void bgwRunServiceVolsCalcs_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            if (SerVolTables.Count == 0)
            {
                MessageBox.Show("Please read in a Service Volumes Input File first.");
            }
            else
            {
                Project = new ProjectData(AnalysisMode.Planning);

                string  testParameter                   = this.cboTestParameter.Text;
                float[] testParameterBoundaries         = ServiceVolumeArterialInputs.GetTestParameterValues(testParameter);
                int     numberOfTestParmsPerTable       = (int)(((testParameterBoundaries[1] - testParameterBoundaries[0]) / testParameterBoundaries[2]) + 1);
                List <ServiceVolumes> serviceVolResults = new List <ServiceVolumes>();

                foreach (SerVolTablesByClass SerVolTablesForClasses in SerVolTables)
                {
                    foreach (SerVolTablesByMultiLane SerVolTablesForNumLanes in SerVolTablesForClasses.SerVolTablesMultiLane)
                    {
                        for (float iterateBoundary = testParameterBoundaries[0]; iterateBoundary <= testParameterBoundaries[1]; iterateBoundary += testParameterBoundaries[2])
                        {
                            ServiceVolumes SerVols = new ServiceVolumes(iterateBoundary, testParameter, SerVolTablesForClasses.ArtAreaType, SerVolTablesForNumLanes.ArtClass);

                            SerVolTablesForNumLanes.SerVolTables[0] = ServiceVolumeTableFDOT.ChangeTestParameterValue(SerVolTablesForNumLanes.SerVolTables[0], testParameter, iterateBoundary);
                            SerVolTablesForNumLanes.SerVolTables[1] = ServiceVolumeTableFDOT.ChangeTestParameterValue(SerVolTablesForNumLanes.SerVolTables[1], testParameter, iterateBoundary);
                            this.lblIteration.Text = "Iteration: " + Math.Round(iterateBoundary, 2).ToString();
                            CalcsServiceVolumes.ServiceVolsAutoNew(Project, SerVols, SerVolTablesForNumLanes.SerVolTables[0], SerVolTablesForNumLanes.SerVolTables[1]);
                            serviceVolResults.Add(SerVols);
                        }
                    }
                }

                ServiceVolResultsOutput.WriteServiceVolResultsDataNew("Service Volume Outputs.csv", serviceVolResults, numberOfTestParmsPerTable);
                MessageBox.Show("Calculations Finished! Please check out the \"Service Volume Outputs.csv\" file.");
            }
        }