Example #1
0
        private double TotalBurnTime(double dv)
        {
            double time        = 0;
            double dvRemaining = dv;

            for (int index = stages.Length - 1; index >= 0; index -= 1)
            {
                KER.Stage stage = stages[index];

                if (dvRemaining <= double.Epsilon)
                {
                    break;
                }

                if (stage.DeltaV > 0)
                {
                    double dvToBurn     = stage.DeltaV > dvRemaining ? dvRemaining : stage.DeltaV;
                    double massFlowRate = stage.Thrust / (stage.Isp * 9.80665);

                    time        += stage.TotalMass / massFlowRate * (1.0 - Math.Exp(-dvToBurn * massFlowRate / stage.Thrust));
                    dvRemaining -= dvToBurn;
                }
            }

            if (dvRemaining > double.Epsilon)
            {
                return(double.PositiveInfinity);
            }

            return(time);
        }
 public Stage[] GetStages()
 {
     Array raw = (Array) stages.GetValue(null, null);
     Stage[] array = new Stage[raw.Length];
     for(int index = 0; index < raw.Length; index += 1)
     {
         array[index] = new Stage(raw.GetValue(index));
     }
     return array;
 }