private void dgSystemParameters_Vehicles_CellEndEdit(object sender, DataGridViewCellEventArgs e) { GridValueChanged(sender, e); // Update annual demands var row = e.RowIndex; Debug.WriteLine("Changed row:" + row + ", col: " + e.ColumnIndex); if (row != 3) { var numVehicles = QraStateContainer.GetNdValue("nVehicles"); var numDays = QraStateContainer.GetNdValue("nVehicleOperatingDays"); var numFuelings = QraStateContainer.GetNdValue("nFuelingsPerVehicleDay"); var demands = numVehicles * numDays * numFuelings; QraStateContainer.SetNdValue("nDemands", UnitlessUnit.Unitless, demands); dgSystemParameters_Vehicles.Rows[3].Cells[1].Value = demands; // TODO: binding } }
private void Execute() { // Blanket try block to help catch deployed issue Brian encountered Trace.TraceInformation("Gathering parameters for radiative flux analysis..."); try { var ambTemp = QraStateContainer.GetNdValue("SysParam.ExternalTempC", TempUnit.Kelvin); var ambPressure = QraStateContainer.GetNdValue("SysParam.ExternalPresMPA", PressureUnit.Pa); var h2Temp = QraStateContainer.GetNdValue("FlameWrapper.T_H2", TempUnit.Kelvin); var h2Pressure = QraStateContainer.GetNdValue("FlameWrapper.P_H2", PressureUnit.Pa); var orificeDiam = QraStateContainer.GetNdValue("FlameWrapper.d_orifice", DistanceUnit.Meter); var leakHeight = QraStateContainer.GetNdValue("FlameWrapper.ReleaseHeight", DistanceUnit.Meter); _radHeatFluxX = QraStateContainer.GetNdValueList("FlameWrapper.radiative_heat_flux_point:x", DistanceUnit.Meter); _radHeatFluxY = QraStateContainer.GetNdValueList("FlameWrapper.radiative_heat_flux_point:y", DistanceUnit.Meter); _radHeatFluxZ = QraStateContainer.GetNdValueList("FlameWrapper.radiative_heat_flux_point:z", DistanceUnit.Meter); var contourLevels = QraStateContainer.GetNdValueList("FlameWrapper.contour_levels", UnitlessUnit.Unitless); var relativeHumidity = QraStateContainer.GetNdValue("FlameWrapper.RH", UnitlessUnit.Unitless); var notionalNozzleModel = QraStateContainer.GetValue <NozzleModel>("NozzleModel"); var releaseAngle = QraStateContainer.GetNdValue("OpWrapper.ReleaseAngle", AngleUnit.Radians); var radiativeSourceModel = QraStateContainer.GetValue <RadiativeSourceModels>("RadiativeSourceModel"); Trace.TraceInformation("Creating PhysInterface for python call"); var physInt = new PhysInterface(); physInt.AnalyzeRadiativeHeatFlux(ambTemp, ambPressure, h2Temp, h2Pressure, orificeDiam, leakHeight, releaseAngle, notionalNozzleModel, _radHeatFluxX, _radHeatFluxY, _radHeatFluxZ, relativeHumidity, radiativeSourceModel, contourLevels, out _fluxData, out _fluxPlotFilepath, out _tempPlotFilepath); Trace.TraceInformation("PhysInterface call complete"); } catch (Exception ex) { Trace.TraceError(ex.ToString()); MessageBox.Show(@"Heat flux analysis failed, please try again. Check log for details."); } }
private void Execute() { var ambPressure = QraStateContainer.GetNdValue("SysParam.ExternalPresMPA", PressureUnit.Pa); var ambTemp = QraStateContainer.GetNdValue("SysParam.ExternalTempC", TempUnit.Kelvin); var h2Pressure = QraStateContainer.GetNdValue("FlameWrapper.P_H2", PressureUnit.Pa); var h2Temp = QraStateContainer.GetNdValue("FlameWrapper.T_H2", TempUnit.Kelvin); var orificeDiam = QraStateContainer.GetNdValue("FlameWrapper.d_orifice", DistanceUnit.Meter); var dischargeCoeff = QraStateContainer.GetNdValue("OpWrapper.Cd0", UnitlessUnit.Unitless); var xMin = QraStateContainer.GetNdValue("PlumeWrapper.XMin", DistanceUnit.Meter); var xMax = QraStateContainer.GetNdValue("PlumeWrapper.XMax", DistanceUnit.Meter); var yMin = QraStateContainer.GetNdValue("PlumeWrapper.YMin", DistanceUnit.Meter); var yMax = QraStateContainer.GetNdValue("PlumeWrapper.YMax", DistanceUnit.Meter); var contours = QraStateContainer.GetNdValue("PlumeWrapper.Contours", UnitlessUnit.Unitless); var jetAngle = QraStateContainer.GetNdValue("PlumeWrapper.jet_angle", AngleUnit.Radians); var plotTitle = QraStateContainer.GetValue <string>("PlumeWrapper.PlotTitle"); var physInt = new PhysInterface(); _plotFilename = physInt.CreatePlumePlot( ambPressure, ambTemp, h2Pressure, h2Temp, orificeDiam, dischargeCoeff, xMin, xMax, yMin, yMax, contours, jetAngle, plotTitle); }
private void Execute() { var ambPressure = QraStateContainer.GetNdValue("SysParam.ExternalPresMPA", PressureUnit.Pa); var ambTemp = QraStateContainer.GetNdValue("SysParam.ExternalTempC", TempUnit.Kelvin); var h2Pressure = QraStateContainer.GetNdValue("FlameWrapper.P_H2", PressureUnit.Pa); var h2Temp = QraStateContainer.GetNdValue("FlameWrapper.T_H2", TempUnit.Kelvin); var orificeDiam = QraStateContainer.GetNdValue("FlameWrapper.d_orifice", DistanceUnit.Meter); var orificeDischargeCoeff = QraStateContainer.GetNdValue("OpWrapper.Cd0", UnitlessUnit.Unitless); var tankVolume = QraStateContainer.GetNdValue("OpWrapper.TankVolume", VolumeUnit.CubicMeter); var releaseDischargeCoeff = QraStateContainer.GetNdValue("OpWrapper.CdR", UnitlessUnit.Unitless); var releaseArea = QraStateContainer.GetNdValue("OpWrapper.SecondaryArea", AreaUnit.SqMeters); var releaseHeight = QraStateContainer.GetNdValue("OpWrapper.S0", DistanceUnit.Meter); var enclosureHeight = QraStateContainer.GetNdValue("OpWrapper.H", DistanceUnit.Meter); var floorCeilingArea = QraStateContainer.GetNdValue("OpWrapper.FCA", AreaUnit.SqMeters); var distReleaseToWall = QraStateContainer.GetNdValue("OpWrapper.Xwall", DistanceUnit.Meter); var ceilVentXArea = QraStateContainer.GetNdValue("OpWrapper.Av_ceil", AreaUnit.SqMeters); var ceilVentHeight = QraStateContainer.GetNdValue("OpWrapper.CVHF", DistanceUnit.Meter); var floorVentXArea = QraStateContainer.GetNdValue("OpWrapper.Av_floor", AreaUnit.SqMeters); var floorVentHeight = QraStateContainer.GetNdValue("OpWrapper.FVHF", DistanceUnit.Meter); var flowRate = QraStateContainer.GetNdValue("OpWrapper.VolumeFlowRate", VolumetricFlowUnit.CubicMetersPerSecond); var releaseAngle = QraStateContainer.GetNdValue("OpWrapper.ReleaseAngle", AngleUnit.Radians); // Blanket try block to catch odd Win8 VM issue try { Trace.TraceInformation("Primitive overpressure parameters gathered. Extracting advanced..."); _timesToPlot = QraStateContainer.GetNdValueList("OpWrapper.SecondsToPlot", ElapsingTimeConversionUnit.Second); // Whether to mark pressures on chart. Gets custom time-pressure objects NdPressureAtTime[] pressuresAtTimes = { }; if (cbMarkChartWithPTDots.Checked) { pressuresAtTimes = QraStateContainer.GetValue <NdPressureAtTime[]>("OpWrapper.PlotDotsPressureAtTimes"); var numPressures = pressuresAtTimes.Length; _dotMarkPressures = new double[numPressures]; _dotMarkTimes = new double[numPressures]; for (var i = 0; i < numPressures; i++) { _dotMarkPressures[i] = pressuresAtTimes[i].Pressure; _dotMarkTimes[i] = pressuresAtTimes[i].Time; } } else { _dotMarkPressures = new double[0]; _dotMarkTimes = new double[0]; } // WHether to plot line pressures var llp = QraStateContainer.GetNdValueList("OPWRAPPER.LIMITLINEPRESSURES", PressureUnit.KPa); double[] limitLinePressures = { }; if (cbHorizontalLines.Checked) { limitLinePressures = llp; } var maxSimTime = QraStateContainer.GetNdValue("OpWrapper.MaxSimTime", ElapsingTimeConversionUnit.Second); // prep vars to hold results var numTimes = pressuresAtTimes.Length; _pressuresPerTime = new double[numTimes]; _depths = new double[numTimes]; _concentrations = new double[numTimes]; Trace.TraceInformation("Initializing PhysInterface..."); var physInt = new PhysInterface(); var status = physInt.ExecuteOverpressureAnalysis( ambPressure, ambTemp, h2Pressure, h2Temp, orificeDiam, orificeDischargeCoeff, tankVolume, releaseDischargeCoeff, releaseArea, releaseHeight, enclosureHeight, floorCeilingArea, distReleaseToWall, ceilVentXArea, ceilVentHeight, floorVentXArea, floorVentHeight, flowRate, releaseAngle, _timesToPlot, _dotMarkPressures, _dotMarkTimes, limitLinePressures, maxSimTime, out _pressuresPerTime, out _depths, out _concentrations, out _overpressure, out _timeOfOverpressure, out _pressurePlotFilepath, out _massPlotFilepath, out _layerPlotFilepath, out _trajectoryPlotFilepath ); Trace.TraceInformation("PhysInterface call complete. Displaying results.."); } catch (Exception ex) { Trace.TraceError(ex.Message); } }
public void Execute() { var inst = QraStateContainer.Instance; var resultsAreStale = QraStateContainer.GetValue <bool>("ResultsAreStale"); // Just return stored result if no inputs have changed if (!resultsAreStale) { return; } // Gather inputs var pipeLength = QraStateContainer.GetNdValue("Components.PipeLength", DistanceUnit.Meter); var numCompressors = (int)QraStateContainer.GetNdValue("Components.NrCompressors"); var numCylinders = (int)QraStateContainer.GetNdValue("Components.NrCylinders"); var numValves = (int)QraStateContainer.GetNdValue("Components.NrValves"); var numInstruments = (int)QraStateContainer.GetNdValue("Components.NrInstruments"); var numJoints = (int)QraStateContainer.GetNdValue("Components.NrJoints"); var numHoses = (int)QraStateContainer.GetNdValue("Components.NrHoses"); var numFilters = (int)QraStateContainer.GetNdValue("Components.NrFilters"); var numFlanges = (int)QraStateContainer.GetNdValue("Components.NrFlanges"); var numExtraComp1 = (int)QraStateContainer.GetNdValue("Components.NrExtraComp1"); var numExtraComp2 = (int)QraStateContainer.GetNdValue("Components.NrExtraComp2"); var facilLength = QraStateContainer.GetNdValue("Facility.Length", DistanceUnit.Meter); var facilWidth = QraStateContainer.GetNdValue("Facility.Width", DistanceUnit.Meter); var facilHeight = QraStateContainer.GetNdValue("Facility.Height", DistanceUnit.Meter); var pipeOuterD = QraStateContainer.GetNdValue("SysParam.PipeOD", DistanceUnit.Meter); var pipeThickness = QraStateContainer.GetNdValue("SysParam.PipeWallThick", DistanceUnit.Meter); var h2Temp = QraStateContainer.GetNdValue("SysParam.InternalTempC", TempUnit.Kelvin); var h2Pres = QraStateContainer.GetNdValue("SysParam.InternalPresMPA", PressureUnit.Pa); var ambTemp = QraStateContainer.GetNdValue("SysParam.ExternalTempC", TempUnit.Kelvin); var ambPres = QraStateContainer.GetNdValue("SysParam.ExternalPresMPa", PressureUnit.Pa); var dischargeCoeff = QraStateContainer.GetNdValue("DischargeCoefficient"); var numVehicles = QraStateContainer.GetNdValue("nVehicles"); var numFuelingPerDay = QraStateContainer.GetNdValue("nFuelingsPerVehicleDay"); var numVehicleOpDays = QraStateContainer.GetNdValue("nVehicleOperatingDays"); var immediateIgnitionProbs = (double[])inst.Parameters["ImmedIgnitionProbs"]; var delayedIgnitionProbs = (double[])inst.Parameters["DelayIgnitionProbs"]; var ignitionThresholds = (double[])inst.Parameters["IgnitionThresholds"]; var h2Release000d01 = QraStateContainer.GetNdValue("H2Release.000d01"); var h2Release000d10 = QraStateContainer.GetNdValue("H2Release.000d10"); var h2Release001d00 = QraStateContainer.GetNdValue("H2Release.001d00"); var h2Release010d00 = QraStateContainer.GetNdValue("H2Release.010d00"); var h2Release100d00 = QraStateContainer.GetNdValue("H2Release.100d00"); var failureManualOverride = QraStateContainer.GetNdValue("Failure.ManualOverride"); //double? FailureManualOverride = QraStateContainer.GetValue<double?>("Failure.ManualOverride"); // Note (Cianan): this is currently always true var detectGasAndFlame = inst.GasAndFlameDetectionOn; var gasDetectCredit = QraStateContainer.GetNdValue("PdetectIsolate"); var probitThermalModelId = QraStateContainer.GetValue <ThermalProbitModel>("ThermalProbit").GetKey(); var thermalExposureTime = QraStateContainer.GetNdValue("t_expose_thermal", ElapsingTimeConversionUnit.Second); var probitOverpModelId = QraStateContainer.GetValue <OverpressureProbitModel>("OverpressureProbit").GetKey(); var peakOverpressures = QraStateContainer.GetNdValueList("P_s", PressureUnit.Pa); var overpImpulses = QraStateContainer.GetNdValueList("impulse", PressureUnit.Pa); // NOTE (Cianan): These aren't used yet double overpFragMass = 0; double overpVelocity = 0; double overpTotalMass = 0; var radSourceModel = QraStateContainer.GetValue <RadiativeSourceModels>("RadiativeSourceModel").ToString(); var notionalNozzleModel = QraStateContainer.GetValue <NozzleModel>("NozzleModel").GetKey(); var leakHeight = QraStateContainer.GetNdValue("LeakHeight", DistanceUnit.Meter); var releaseAngle = QraStateContainer.GetNdValue("ReleaseAngle", AngleUnit.Degrees); var exclusionRadius = QraStateContainer.GetNdValue("QRAD:EXCLUSIONRADIUS"); var randomSeed = (int)QraStateContainer.GetNdValue("RANDOMSEED"); var relativeHumid = QraStateContainer.GetNdValue("FlameWrapper.RH"); var occupantDistributions = (OccupantDistributionInfoCollection)inst.Parameters["OccupantDistributions"]; var occupantJson = JsonConvert.SerializeObject(occupantDistributions); // Massage component probabilities into double[][] var compList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Compressor"); var cylList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Cylinder"); var filterList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Filter"); var flangeList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Flange"); var hoseList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Hose"); var jointList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Joint"); var pipeList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Pipe"); var valveList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Valve"); var instrList = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Instrument"); var ex1List = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Extra1"); var ex2List = QraStateContainer.GetValue <List <ComponentProbability> >("Prob.Extra2"); // TODO (Cianan): Clean this up // NOTE (Cianan): Python.NET can't convert nullable list (e.g. double?) into numpy arr so mu/sigma or mean/variance are set to -1000D if null double[][] compressorProbs = { compList[0].GetDataForPython(), compList[1].GetDataForPython(), compList[2].GetDataForPython(), compList[3].GetDataForPython(), compList[4].GetDataForPython() }; double[][] cylinderProbs = { cylList[0].GetDataForPython(), cylList[1].GetDataForPython(), cylList[2].GetDataForPython(), cylList[3].GetDataForPython(), cylList[4].GetDataForPython() }; double[][] filterProbs = { filterList[0].GetDataForPython(), filterList[1].GetDataForPython(), filterList[2].GetDataForPython(), filterList[3].GetDataForPython(), filterList[4].GetDataForPython() }; double[][] flangeProbs = { flangeList[0].GetDataForPython(), flangeList[1].GetDataForPython(), flangeList[2].GetDataForPython(), flangeList[3].GetDataForPython(), flangeList[4].GetDataForPython() }; double[][] hoseProbs = { hoseList[0].GetDataForPython(), hoseList[1].GetDataForPython(), hoseList[2].GetDataForPython(), hoseList[3].GetDataForPython(), hoseList[4].GetDataForPython() }; double[][] jointProbs = { jointList[0].GetDataForPython(), jointList[1].GetDataForPython(), jointList[2].GetDataForPython(), jointList[3].GetDataForPython(), jointList[4].GetDataForPython() }; double[][] pipeProbs = { pipeList[0].GetDataForPython(), pipeList[1].GetDataForPython(), pipeList[2].GetDataForPython(), pipeList[3].GetDataForPython(), pipeList[4].GetDataForPython() }; double[][] valveProbs = { valveList[0].GetDataForPython(), valveList[1].GetDataForPython(), valveList[2].GetDataForPython(), valveList[3].GetDataForPython(), valveList[4].GetDataForPython() }; double[][] instrumentProbs = { instrList[0].GetDataForPython(), instrList[1].GetDataForPython(), instrList[2].GetDataForPython(), instrList[3].GetDataForPython(), instrList[4].GetDataForPython() }; double[][] extraComp1Probs = { ex1List[0].GetDataForPython(), ex1List[1].GetDataForPython(), ex1List[2].GetDataForPython(), ex1List[3].GetDataForPython(), ex1List[4].GetDataForPython() }; double[][] extraComp2Probs = { ex2List[0].GetDataForPython(), ex2List[1].GetDataForPython(), ex2List[2].GetDataForPython(), ex2List[3].GetDataForPython(), ex2List[4].GetDataForPython() }; var nozPo = QraStateContainer.GetValue <FailureMode>("Failure.NozPO"); var nozFtc = QraStateContainer.GetValue <FailureMode>("Failure.NozFTC"); var mValveFtc = QraStateContainer.GetValue <FailureMode>("Failure.MValveFTC"); var sValveFtc = QraStateContainer.GetValue <FailureMode>("Failure.SValveFTC"); var sValveCcf = QraStateContainer.GetValue <FailureMode>("Failure.SValveCCF"); var overpFail = QraStateContainer.GetValue <FailureMode>("Failure.Overp"); var pValveFto = QraStateContainer.GetValue <FailureMode>("Failure.PValveFTO"); var driveoffFail = QraStateContainer.GetValue <FailureMode>("Failure.Driveoff"); var couplingFtc = QraStateContainer.GetValue <FailureMode>("Failure.CouplingFTC"); var nozPoDist = nozPo.Dist.ToString(); var nozPoParamA = nozPo.ParamA; var nozPoParamB = nozPo.ParamB; var nozFtcDist = nozFtc.Dist.ToString(); var nozFtcParamA = nozFtc.ParamA; var nozFtcParamB = nozFtc.ParamB; var mValveFtcDist = mValveFtc.Dist.ToString(); var mValveFtcParamA = mValveFtc.ParamA; var mValveFtcParamB = mValveFtc.ParamB; var sValveFtcDist = sValveFtc.Dist.ToString(); var sValveFtcParamA = sValveFtc.ParamA; var sValveFtcParamB = sValveFtc.ParamB; var sValveCcfDist = sValveCcf.Dist.ToString(); var sValveCcfParamA = sValveCcf.ParamA; var sValveCcfParamB = sValveCcf.ParamB; var overpDist = overpFail.Dist.ToString(); var overpParamA = overpFail.ParamA; var overpParamB = overpFail.ParamB; var pValveFtoDist = pValveFto.Dist.ToString(); var pValveFtoParamA = pValveFto.ParamA; var pValveFtoParamB = pValveFto.ParamB; var driveoffDist = driveoffFail.Dist.ToString(); var driveoffParamA = driveoffFail.ParamA; var driveoffParamB = driveoffFail.ParamB; var couplingFtcDist = couplingFtc.Dist.ToString(); var couplingFtcParamA = couplingFtc.ParamA; var couplingFtcParamB = couplingFtc.ParamB; // Derive path to data dir for temp and data files, e.g. pickling var dataDirLoc = QraStateContainer.UserDataDir; QraResult result; using (Py.GIL()) { //var lck = PythonEngine.AcquireLock(); dynamic pyQraLib = Py.Import("hyram"); try { // Execute python analysis. Will return PyObject which is parsed in QRAResult. var resultPyObj = pyQraLib.qra.capi.conduct_analysis( pipeLength, numCompressors, numCylinders, numValves, numInstruments, numJoints, numHoses, numFilters, numFlanges, numExtraComp1, numExtraComp2, facilLength, facilWidth, facilHeight, pipeOuterD, pipeThickness, h2Temp, h2Pres, ambTemp, ambPres, dischargeCoeff, numVehicles, numFuelingPerDay, numVehicleOpDays, immediateIgnitionProbs, delayedIgnitionProbs, ignitionThresholds, detectGasAndFlame, gasDetectCredit, probitThermalModelId, thermalExposureTime, probitOverpModelId, peakOverpressures, overpImpulses, overpFragMass, overpVelocity, overpTotalMass, radSourceModel, notionalNozzleModel, leakHeight, releaseAngle, exclusionRadius, randomSeed, relativeHumid, occupantJson, compressorProbs, cylinderProbs, valveProbs, instrumentProbs, pipeProbs, jointProbs, hoseProbs, filterProbs, flangeProbs, extraComp1Probs, extraComp2Probs, nozPoDist, nozPoParamA, nozPoParamB, nozFtcDist, nozFtcParamA, nozFtcParamB, mValveFtcDist, mValveFtcParamA, mValveFtcParamB, sValveFtcDist, sValveFtcParamA, sValveFtcParamB, sValveCcfDist, sValveCcfParamA, sValveCcfParamB, overpDist, overpParamA, overpParamB, pValveFtoDist, pValveFtoParamA, pValveFtoParamB, driveoffDist, driveoffParamA, driveoffParamB, couplingFtcDist, couplingFtcParamA, couplingFtcParamB, h2Release000d01, h2Release000d10, h2Release001d00, h2Release010d00, h2Release100d00, failureManualOverride, dataDirLoc ); result = new QraResult(resultPyObj); QraStateContainer.SetValue("ResultsAreStale", false); QraStateContainer.SetValue("Result", result); } catch (PythonException ex) { QraStateContainer.SetValue("ResultsAreStale", true); Trace.TraceError(ex.Message); Debug.WriteLine(ex.Message); throw new InvalidOperationException( "Something went wrong during PyQRA execution. Check log for details."); } catch (Exception ex) { Trace.TraceError(ex.Message); QraStateContainer.SetValue("ResultsAreStale", true); throw ex; } finally { // Force display of stderr, stdout. This includes print statements from python Console.Out.Flush(); Console.Error.Flush(); // Unload imports pyQraLib.Dispose(); //PythonEngine.ReleaseLock(lck); } } }
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); }