void IQraBaseNotify.Notify_LoadComplete()
        {
            pbSpinner.Hide();
            var cpType = new ContentPanel().GetType();
            var cp     = (ContentPanel)QuickFunctions.GetFirstParentOfSpecifiedType(this, cpType);

            cp.SetNarrative(Narratives.GPD_GasPlumeDispersion);

            // Set up data-bind grids
            var vdColl = new ParameterWrapperCollection(new[]
            {
                new ParameterWrapper("PlumeWrapper.XMin", "X lower limit", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("PlumeWrapper.XMax", "X upper limit", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("PlumeWrapper.YMin", "Y lower limit", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("PlumeWrapper.YMax", "Y upper limit", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("PlumeWrapper.Contours", "Contours (mole fraction)", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),

                new ParameterWrapper("SysParam.ExternalPresMPA", "Ambient pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("SysParam.ExternalTempC", "Ambient temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("FlameWrapper.d_orifice", "Orifice diameter", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.Cd0", "Orifice discharge coefficient", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("FlameWrapper.P_H2", "Hydrogen pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.T_H2", "Hydrogen temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("PlumeWrapper.jet_angle", "Angle of jet", AngleUnit.Radians,
                                     StockConverters.AngleConverter)
            });

            StaticGridHelperRoutines.InitInteractiveGrid(PlumeParams, vdColl, false);

            PlumeParams.Columns[0].Width = 200;
            PlumeParams.Columns[1].Width = 200;
            PlumeParams.Columns[2].Width = 200;

            //tbPlotTitle_TextChanged(tbPlotTitle,new System.EventArgs());
        }
Beispiel #2
0
        public static void InitInteractiveGrid(DataGridView grid, ParameterWrapperCollection valueDefinitionObjects,
                                               bool canSort = true)
        {
            var initGridCalled = false;

            foreach (var thisVdo in valueDefinitionObjects.Values)
            {
                if (!initGridCalled)
                {
                    InitGrid(grid, new[] { "colVariable", "colValue", "colUnit" },
                             new[] { "Variable", "Value", "Unit" }, canSort);
                    initGridCalled = true;
                }

                AddLinkedValueRowToDataGrid(grid, null, thisVdo);
            }

            QuickFunctions.PreventGridColumnSorting(grid);
            grid.HandleCreated += RespondToEventAndResizeColumns;
        }
Beispiel #3
0
        void IQraBaseNotify.Notify_LoadComplete()
        {
            StartIgnoringGridChangeEvents();

            // TODO (Cianan): Can simplify all this setup by using one-way binding to objects
            ContentPanel.SetNarrative(this, Narratives.SD__System_Description);
            // Set up component grid
            var vdColl = new ParameterWrapperCollection(new[]
            {
                new ParameterWrapper("Components.NrCompressors", "# Compressors"),
                new ParameterWrapper("Components.NrCylinders", "# Cylinders"),
                new ParameterWrapper("Components.NrValves", "# Valves"),
                new ParameterWrapper("Components.NrInstruments", "# Instruments"),
                new ParameterWrapper("Components.NrJoints", "# Joints"),
                new ParameterWrapper("Components.NrHoses", "# Hoses"),
                new ParameterWrapper("Components.PipeLength", "Pipes (length)", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Components.NrFilters", "# Filters"),
                new ParameterWrapper("Components.NrFlanges", "# Flanges"),
                new ParameterWrapper("Components.NrExtraComp1", "# Extra Component 1"),
                new ParameterWrapper("Components.NrExtraComp2", "# Extra Component 2")
            });

            StaticGridHelperRoutines.InitInteractiveGrid(dgComponents, vdColl, false);

            // Set up system params grid
            var vdColl2 = new ParameterWrapperCollection(
                new[]
            {
                new ParameterWrapper("SysParam.PipeOD", "Pipe Outer Diameter", DistanceUnit.Inch,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("SysParam.PipeWallThick", "Pipe Wall Thickness", DistanceUnit.Inch,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("SysParam.InternalTempC", "Hydrogen Temperature", TempUnit.Celsius,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("SysParam.InternalPresMPA", "Hydrogen Pressure", PressureUnit.MPa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("SysParam.ExternalTempC", "Ambient Temperature", TempUnit.Celsius,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("SysParam.ExternalPresMPA", "Ambient Pressure", PressureUnit.MPa,
                                     StockConverters.PressureConverter)
            }
                );

            StaticGridHelperRoutines.InitInteractiveGrid(dgSystemParameters_Piping, vdColl2, false);
            dgSystemParameters_Piping.Columns[0].Width = 200;

            // Vehicle grid
            StaticGridHelperRoutines.InitInteractiveGrid(dgSystemParameters_Vehicles, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("nVehicles", "Number of Vehicles"),
                new ParameterWrapper("nFuelingsPerVehicleDay", "Number of Fuelings Per Vehicle Day"),
                new ParameterWrapper("nVehicleOperatingDays", "Number of Vehicle Operating Days per Year"),
                new ParameterWrapper("nDemands", "Annual Demands (calculated)", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter)
            }
                                                             ), false);

            dgSystemParameters_Vehicles.Columns[0].Width = 300;
            dgSystemParameters_Vehicles.Columns[1].Width = 100;

            // Set up facility grid
            StaticGridHelperRoutines.InitInteractiveGrid(dgFacilityParameters, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("Facility.Length", "Length (x-direction)", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Facility.Width", "Width (z-direction)", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Facility.Height", "Height (y-direction)", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter)
            }
                                                             ), false);

            SetOccupantInputsGrid();

            // Set up enclosure grid
            StaticGridHelperRoutines.InitInteractiveGrid(dgEnclosure, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("Enclosure.Height", "Height", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Enclosure.AreaOfFloorAndCeiling", "Area (floor and ceiling)",
                                     AreaUnit.SqMeters, StockConverters.AreaConverter),
                new ParameterWrapper("Enclosure.HeightOfRelease", "Height of release", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Enclosure.XWall", "Distance from release to wall (perpendicular)",
                                     DistanceUnit.Meter, StockConverters.DistanceConverter)
            }
                                                             ));

            // Override grid
            var overrideColl = new ParameterWrapperCollection(new[]
            {
                new ParameterWrapper("H2Release.000d01", "0.01% H2 Release"),
                new ParameterWrapper("H2Release.000d10", "0.10% H2 Release"),
                new ParameterWrapper("H2Release.001d00", "1% H2 Release"),
                new ParameterWrapper("H2Release.010d00", "10% H2 Release"),
                new ParameterWrapper("H2Release.100d00", "100% H2 Release"),
                new ParameterWrapper("Failure.ManualOverride", "100% H2 Release (accidents and shutdown failures)"),
                new ParameterWrapper("Pdetectisolate", "Gas detection credit")
            });

            StaticGridHelperRoutines.InitInteractiveGrid(dgManualOverrides, overrideColl, false);


            var ceilingVentDgv = dgCeilingVent;

            SetVentGrid(ceilingVentDgv, WhichVent.Ceiling);
            ceilingVentDgv.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);

            var floorVentDgv = dgFloorVent;

            SetVentGrid(floorVentDgv, WhichVent.Floor);

            // Set up random seed textbox
            var saveIgnoreValue = _ignoreRandomSeedChangeEvent;

            _ignoreRandomSeedChangeEvent = true;
            try
            {
                var cv = GetRandomSeedFromDatabase();
                cv.EnsureBaseValueIsTruncatedInt();
                var newValue = Math.Truncate(cv.GetValue(UnitlessUnit.Unitless)[0]);
                tbRandomSeed.Text = Parsing.DoubleToString(Math.Truncate(newValue));
            }
            finally
            {
                _ignoreRandomSeedChangeEvent = saveIgnoreValue;
            }

            // Set up exclusion textbox
            var exclusionRadius = QraStateContainer.GetNdValue("QRAD:EXCLUSIONRADIUS");

            tbExclusionRadius.Text = Parsing.DoubleToString(exclusionRadius);

            SetXLocParamAndModifyCellVisibilityInOccupantsGrid();

            StopIgnoringGridChangeEvents();
            // If check is enabled in analysis, this ensures analysis will be re-run
            QraStateContainer.SetValue("ResultsAreStale", true);

            // Remove a page that's not yet used.
            tcFacilityParameters.TabPages.Remove(tpEnclosure);
        }