public void AnalyzeRadiativeHeatFlux( double ambTemp, double ambPressure, double h2Temp, double h2Pressure, double orificeDiam, double leakHeight, double releaseAngle, NozzleModel notionalNozzleModel, double[] radHeatFluxX, double[] radHeatFluxY, double[] radHeatFluxZ, double relativeHumidity, RadiativeSourceModels radiativeSourceModel, double[] contourLevels, out double[] fluxData, out string fluxPlotFilepath, out string tempPlotFilepath) { bool isDebug = QraStateContainer.GetValue <bool>("debug"); string dataDirLoc = QraStateContainer.UserDataDir; string plotFilepath = ""; Trace.TraceInformation("Acquiring python lock and importing module"); using (Py.GIL()) { dynamic pyGC = Py.Import("gc"); dynamic pyHyramLib = Py.Import("hyram"); try { Trace.TraceInformation("Executing python radiative heat flux analysis..."); dynamic resultPyObj = pyHyramLib.phys.capi.analyze_radiative_heat_flux( ambTemp, ambPressure, h2Temp, h2Pressure, orificeDiam, leakHeight, releaseAngle, notionalNozzleModel.GetKey(), radHeatFluxX, radHeatFluxY, radHeatFluxZ, relativeHumidity, radiativeSourceModel.ToString().ToLower(), contourLevels, dataDirLoc, isDebug ); Trace.TraceInformation("Python call complete. Processing results..."); fluxData = (double[])resultPyObj["flux_data"]; fluxPlotFilepath = (string)resultPyObj["flux_plot_filepath"]; tempPlotFilepath = (string)resultPyObj["temp_plot_filepath"]; Debug.WriteLine(" Flux results: " + plotFilepath); Debug.WriteLine(" Flux plots: " + fluxPlotFilepath + ", " + tempPlotFilepath); } catch (Exception ex) { Trace.TraceError(ex.ToString()); throw new InvalidOperationException( "Error during rad heat flux analysis. Check log for details."); } finally { pyGC.InvokeMethod("collect"); pyGC.Dispose(); pyHyramLib.Dispose(); } } }
public void SetValue(NozzleModel value) { if (DesignMode) { return; } _mNozzleModelSelected = value; var nozzleName = _mNozzleModelSelected.ToString(); for (var nmsIndex = 0; nmsIndex < cbNotionalNozzleModel.Items.Count - 1; nmsIndex++) { if ((string)cbNotionalNozzleModel.Items[nmsIndex] == nozzleName) { cbNotionalNozzleModel.SelectedIndex = nmsIndex; break; } } }
private void cbNotionalNozzleModel_SelectedIndexChanged(object sender, EventArgs e) { if (DesignMode) { return; } var newModel = NozzleModel.ParseNozzleModelName(cbNotionalNozzleModel.SelectedItem.ToString()); QraStateContainer.SetValue("NozzleModel", newModel); //QraStateContainer.Instance.SetNozzleModel((string)cbNotionalNozzleModel.SelectedItem); var oldValue = _mNozzleModelSelected; //string NozzleName = QraStateContainer.Instance.GetObject("NotionalNozzleModel").ToString(); //mNozzleModelSelected = QraStateContainer.Instance.GetNozzleModel(); var oldModel = QraStateContainer.GetValue <NozzleModel>("NozzleModel"); if (_mNozzleModelSelected != oldValue) { SpawnNotionalNozzleModelChangedEvent(); } }