private void CalculationForOneStepInOneCompartment(ref int compartmentNo, ref double timeStep, ref Result.PPraeasureForCompartment ppc) { double ceiling = 0; if (result.Count() == 0) { ppc.setN2(compartmentNo, PartialPreasure(ppc.PreasureN2, 0.79 * calcDiving.AtmosphericPressure, 0, compartments.compartment[compartmentNo].HalfTimeForN2(false))); if (bTmx) { ppc.setN2(compartmentNo, PartialPreasure(ppc.PreasureHe, 0.0, 0, compartments.compartment[compartmentNo].HalfTimeForHe(false))); } } else { ppc.setN2(compartmentNo, PartialPreasure(ppc.PreasureN2, result.Last().getN2(compartmentNo), timeStep, compartments.compartment[compartmentNo].HalfTimeForN2(ppc.PreasureN2 < result.Last().getN2(compartmentNo)))); if (bTmx) { ppc.setN2(compartmentNo, PartialPreasure(ppc.PreasureHe, result.Last().getHe(compartmentNo), timeStep, compartments.compartment[compartmentNo].HalfTimeForHe(ppc.PreasureHe < result.Last().getHe(compartmentNo)))); } } if (bTmx) { ceiling = ceiling = Ceiling(ppc.getN2(compartmentNo), compartments.compartment[compartmentNo].M0N2, compartments.compartment[compartmentNo].dMN2, ppc.getHe(compartmentNo), compartments.compartment[compartmentNo].M0He, compartments.compartment[compartmentNo].dMHe); } else { ceiling = Ceiling(ppc.getN2(compartmentNo), compartments.compartment[compartmentNo].M0N2, compartments.compartment[compartmentNo].dMN2); } ppc.setCeiling(compartmentNo, ceiling); }
public Result.PPraeasureForCompartment GetMaxValues(bool tmx) { int compNo = compartments.compartment.Count(); Result.PPraeasureForCompartment res = new Result.PPraeasureForCompartment(compNo, tmx); foreach (Result.PPraeasureForCompartment ppfc in result) { res.AmbientPreasure = Math.Max(res.AmbientPreasure, ppfc.AmbientPreasure); res.Depth = Math.Max(res.Depth, ppfc.Depth); res.PreasureN2 = Math.Max(res.PreasureN2, ppfc.PreasureN2); if (tmx) { res.PreasureHe = Math.Max(res.PreasureHe, ppfc.PreasureHe); } res.Time = Math.Max(res.Time, ppfc.Time); int count = ppfc.Count(); for (int i = 0; i < count; i++) { res.setN2(i, Math.Max(res.getN2(i), ppfc.getN2(i))); if (tmx) { res.setHe(i, Math.Max(res.getHe(i), ppfc.getHe(i))); } } } return(res); }
private void compartmentChart() { double czas = (double)numericUpDownCzas.Value; Result.PPraeasureForCompartment ppfc = calculation.GetMaxValues(false); if (czas > ppfc.Time) { numericUpDownCzas.Value = (decimal)Math.Floor(ppfc.Time); czas = (double)numericUpDownCzas.Value; } double max = 0; int count = ppfc.Count(); for (int i = 0; i < count; i++) { max = Math.Max(max, ppfc.getN2(i)); } System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea = CompartmrntAtTime.ChartAreas.First(); chartArea.AxisY.Maximum = max; chartArea.AxisY.Crossing = 0; ppfc = calculation.GetValusAtTime(czas, false); textBoxCisnienie.Text = ppfc.AmbientPreasure.ToString("0.0"); textBoxGlebokosc.Text = ppfc.Depth.ToString("0.0"); textBoxPPN2.Text = ppfc.PreasureN2.ToString("0.0"); int compartmentNo = ppfc.Count(); CompartmrntAtTime.Series.Clear(); CompartmrntAtTime.Series.Add("Cisnienia w tkankach. " + calculation.compartments.Description); System.Windows.Forms.DataVisualization.Charting.Series series = CompartmrntAtTime.Series.First(); series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; for (int i = 0; i < compartmentNo; i++) { series.Points.AddY(ppfc.getN2(i)); series.Points[i].AxisLabel = calculation.compartments.compartment[i].HalfTimeN2.ToString("0.0"); } }