public void GetAscentByIndex(int index) { List <DivePoint> myDivePoint = new List <DivePoint>(); CompartmentParams compartmentParams = new CompartmentParams(DivePoints[0].Gas.Helium); double FGas = 1 - DivePoints[0].Gas.Oxygen; PointParams truePointParams = new PointParams(); PointParamsAscent truePointParamsAscent = new PointParamsAscent(); truePointParams.pCurrent = new double[17]; for (int i = 0; i < truePointParams.pCurrent.Length; i++) { truePointParams.pCurrent[i] = pressureAmbient(FGas, 0, pressureSeaLevel); } int count = index; int j = 0; double airConsumption = 0; double vConsumption = 30; while (count > 0) { compartmentParams = new CompartmentParams(DivePoints[j].Gas.Helium); FGas = 1 - DivePoints[j].Gas.Oxygen; double vRate = (DivePoints[j + 1].Depth - DivePoints[j].Depth) / (DivePoints[j + 1].Time - DivePoints[j].Time); airConsumption += findAirConsumption(vConsumption, DivePoints[j + 1].Time - DivePoints[j].Time, DivePoints[j].Depth, DivePoints[j + 1].Depth); for (int i = 0; i < truePointParams.pCurrent.Length; i++) { truePointParams.pCurrent[i] = pressureAtoB(pressureAmbient(FGas, DivePoints[j].Depth, pressureSeaLevel), FGas, vRate, DivePoints[j + 1].Time - DivePoints[j].Time, Kf(compartmentParams.compartment.paramT[i]), truePointParams.pCurrent[i]); } j += 1; count -= 1; } compartmentParams = new CompartmentParams(DivePoints[j].Gas.Helium); FGas = 1 - DivePoints[j].Gas.Oxygen; double depthTo3 = maxDepthTo3(truePointParams.pCurrent, compartmentParams.compartment.paramM0, compartmentParams.compartment.paramdM, pressureSeaLevel); truePointParams.airConsumption = airConsumption; truePointParams.Gas = DivePoints[j].Gas; double lastDepth = DivePoints[j].Depth; double lastTime = DivePoints[j].Time; truePointParamsAscent = ascentUp(truePointParams, pressureSeaLevel, depthTo3, lastTime, lastDepth); for (int i = 0; i < truePointParamsAscent.depth.Count; i++) { DivePoint dv = new DivePoint(truePointParamsAscent.time[i], truePointParamsAscent.depth[i]); myDivePoint.Add(dv); } DivePoints.RemoveRange(index + 1, DivePoints.Count - 1 - index); DivePoints.AddRange(myDivePoint); }
public void RemovePoint(double time, double depth) { List <DivePoint> buffer = new List <DivePoint>(); foreach (DivePoint point in DivePoints) { buffer.Add(point); } DivePoints.Clear(); for (int i = 0; i < buffer.Count; i++) { if (!(buffer[i].Time == time && buffer[i].Depth == depth)) { DivePoints.Add(buffer[i]); } } }
public void RemovePoint(int listNumber) { List <DivePoint> buffer = new List <DivePoint>(); foreach (DivePoint point in DivePoints) { buffer.Add(point); } DivePoints.Clear(); for (int i = 0; i < buffer.Count; i++) { if (i != listNumber) { DivePoints.Add(buffer[i]); } } }
public void OrderDivePoints() { DivePoints.Sort(); }