示例#1
0
        private void AddPipingGrid()
        {
            var newDataGrid = new DataGridView();

            StaticGridHelperRoutines.InitInteractiveGrid(newDataGrid, 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)
            }
                                                             ), false);

            newDataGrid.Columns[0].Width = 200;
            AddGridToLayout(newDataGrid, "System Parameters");
        }
示例#2
0
        //Much of this code is currently just copied from cpSystemDecription.
        //A more elegant and extensible system might be nice.

        private void AddComponentsGrid()
        {
            var newDataGrid = new DataGridView();

            StaticGridHelperRoutines.InitInteractiveGrid(newDataGrid, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("Components.NrCompressors", "# Compressors", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrCylinders", "# Cylinders", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrValves", "# Valves", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrInstruments", "# Instruments", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrJoints", "# Joints", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrHoses", "# Hoses", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.PipeLength", "Pipes (length)", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Components.NrFilters", "# Filters", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("Components.NrFlanges", "# Flanges", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter)
            }
                                                             ), false);
            AddGridToLayout(newDataGrid, "Components");
        }
示例#3
0
        private void InitializeInputGrid()
        {
            StaticGridHelperRoutines.InitInteractiveGrid(dgInput,
                                                         new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("SysParam.ExternalPresMPA", "Ambient Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("SysParam.ExternalTempC", "Ambient Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("FlameWrapper.P_H2", "H2 Tank Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.T_H2", "H2 Tank Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("OpWrapper.TankVolume", "H2 Tank Volume", VolumeUnit.CubicMeter,
                                     StockConverters.VolumeConverter),
                new ParameterWrapper("FlameWrapper.d_orifice", "Leak Diameter", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.Cd0", "Discharge Coefficient-Orifice", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("OpWrapper.CdR", "Discharge Coefficient-Release", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("OpWrapper.SecondaryArea", "Release Area", AreaUnit.SqMeters,
                                     StockConverters.AreaConverter),
                new ParameterWrapper("OpWrapper.S0", "Release Height", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.H", "Enclosure Height", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.FCA", "Floor/Ceiling Area", AreaUnit.SqMeters,
                                     StockConverters.AreaConverter),
                new ParameterWrapper("OpWrapper.Xwall", "Distance from Release to Wall", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.Av_ceil", "Vent 1 (Ceiling Vent) Cross-Sectional Area",
                                     AreaUnit.SqMeters, StockConverters.AreaConverter),
                new ParameterWrapper("OpWrapper.CVHF", "Vent 1 (Ceiling Vent) Height from Floor",
                                     DistanceUnit.Meter, StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.Av_floor", "Vent 2 (Floor Vent) Cross-Sectional Area",
                                     AreaUnit.SqMeters, StockConverters.AreaConverter),
                new ParameterWrapper("OpWrapper.FVHF", "Vent 2 (Floor Vent) Height from Floor",
                                     DistanceUnit.Meter, StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.VolumeFlowRate", "Vent Volumetric Flow Rate",
                                     VolumetricFlowUnit.CubicMetersPerSecond, StockConverters.VolumetricFlowConverter),
                new ParameterWrapper("OpWrapper.ReleaseAngle", "Angle of Release (0=Horz.)", AngleUnit.Degrees,
                                     StockConverters.AngleConverter)
            }
                                                             ));

            dgInput.Columns[0].Width = 235;
        }
示例#4
0
        void IQraBaseNotify.Notify_LoadComplete()
        {
            SetNarrative();
            pbSpinner.Hide();

            // Initialize input grid
            StaticGridHelperRoutines.InitInteractiveGrid(dgInput, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("SysParam.ExternalTempC", "Ambient Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("SysParam.ExternalPresMPA", "Ambient Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.T_H2", "Hydrogen Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("FlameWrapper.P_H2", "Hydrogen Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.d_orifice", "Leak Diameter", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("FlameWrapper.RH", "Relative Humidity", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("OpWrapper.ReleaseAngle", "Release Angle", AngleUnit.Radians,
                                     StockConverters.AngleConverter),
                new ParameterWrapper("FlameWrapper.ReleaseHeight", "Leak Height from Floor", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter)
            }
                                                             ));
            dgInput.Columns[0].Width = 180;

            // Initialize flex input
            UiParsingRoutines.PutDoubleArrayIntoTextBox(tbRadiativeHeatFluxPointsX,
                                                        QraStateContainer.Instance.GetStateDefinedValueObject("FlameWrapper.radiative_heat_flux_point:x")
                                                        .GetValue(DistanceUnit.Meter));
            UiParsingRoutines.PutDoubleArrayIntoTextBox(tbRadiativeHeatFluxPointsY,
                                                        QraStateContainer.Instance.GetStateDefinedValueObject("FlameWrapper.radiative_heat_flux_point:y")
                                                        .GetValue(DistanceUnit.Meter));
            UiParsingRoutines.PutDoubleArrayIntoTextBox(tbRadiativeHeatFluxPointsZ,
                                                        QraStateContainer.Instance.GetStateDefinedValueObject("FlameWrapper.radiative_heat_flux_point:z")
                                                        .GetValue(DistanceUnit.Meter));
            UiParsingRoutines.PutDoubleArrayIntoTextBox(tbContourLevels,
                                                        QraStateContainer.Instance.GetStateDefinedValueObject("FlameWrapper.contour_levels")
                                                        .GetValue(UnitlessUnit.Unitless));

            _mIgnoreXyzChangeEvent = false;
            SetRadiativeSourceModel();
        }
        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());
        }
示例#6
0
        private void AddFacilitiesParametersGrid()
        {
            var newDataGrid = new DataGridView();

            StaticGridHelperRoutines.InitInteractiveGrid(newDataGrid, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("Facility.Length", "Length", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Facility.Width", "Width", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("Facility.Height", "Height", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter)
            }
                                                             ), false);

            AddGridToLayout(newDataGrid, "Facility");
        }
示例#7
0
        private void SetVentGrid(DataGridView dg, WhichVent gridPurpose)
        {
            var crossSectionalAreaKey   = gridPurpose + ".CrossSectionalArea";
            var heightFromFloorKey      = gridPurpose + ".VentHeightFromFloor";
            var dischargeCoefficientKey = gridPurpose + ".DischargeCoefficient";
            var windVelocityKey         = gridPurpose + ".WindVelocity";

            StaticGridHelperRoutines.InitInteractiveGrid(dg, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper(crossSectionalAreaKey, "Cross-sectional area", AreaUnit.SqMeters,
                                     StockConverters.AreaConverter),
                new ParameterWrapper(heightFromFloorKey, "Vent height from floor", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper(dischargeCoefficientKey, "Discharge coefficient", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper(windVelocityKey, "Wind velocity", SpeedUnit.MetersPerSecond,
                                     StockConverters.SpeedConverter)
            }));
        }
示例#8
0
        private void AddVehiclesGrid()
        {
            var newDataGrid = new DataGridView();

            StaticGridHelperRoutines.InitInteractiveGrid(newDataGrid, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("nVehicles", "# Vehicles", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("nFuelingsPerVehicleDay", "nFuelingsPerVehicleDay", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("nVehicleOperatingDays", "nVehicleOperatingDays", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter),
                new ParameterWrapper("nDemands", "Annual demands (calculated)", UnitlessUnit.Unitless,
                                     StockConverters.UnitlessConverter)
            }
                                                             ), false);

            newDataGrid.Columns[0].Width = 200;
            AddGridToLayout(newDataGrid, "System Demand");
        }
示例#9
0
        private void InitializeInputGrid()
        {
            StaticGridHelperRoutines.InitInteractiveGrid(dgInput, new ParameterWrapperCollection(
                                                             new[]
            {
                new ParameterWrapper("SysParam.ExternalTempC", "Ambient Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("SysParam.ExternalPresMPA", "Ambient Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.T_H2", "Hydrogen Temperature", TempUnit.Kelvin,
                                     StockConverters.TemperatureConverter),
                new ParameterWrapper("FlameWrapper.P_H2", "Hydrogen Pressure", PressureUnit.Pa,
                                     StockConverters.PressureConverter),
                new ParameterWrapper("FlameWrapper.d_orifice", "Leak Diameter", DistanceUnit.Meter,
                                     StockConverters.DistanceConverter),
                new ParameterWrapper("FlameWrapper.ReleaseHeight", "Leak Height from Floor (y0)",
                                     DistanceUnit.Meter, StockConverters.DistanceConverter),
                new ParameterWrapper("OpWrapper.ReleaseAngle", "Release Angle", AngleUnit.Degrees,
                                     StockConverters.AngleConverter)
            }
                                                             ));

            dgInput.Columns[0].Width = 180;
        }
示例#10
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);
        }