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 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); }