Example #1
0
    public float GetCumulativeFuelMassRequired(Navigation.Transfer transfer)
    {
        Craft craft = RefuelPage.Craft;

        List <Navigation.Transfer> transfers;

        if (craft.Navigation.UpcomingTransfers.Contains(transfer))
        {
            transfers = craft.Navigation.UpcomingTransfers
                        .GetRange(0, craft.Navigation.UpcomingTransfers.IndexOf(transfer) + 1);
        }
        else
        {
            transfers = craft.Navigation.UpcomingTransfers.ToList();
            transfers.Append(transfer);
        }

        float reaction_mass = 0;

        foreach (Navigation.Transfer transfer_ in transfers)
        {
            foreach (Navigation.Transfer.Maneuver maneuver in transfer_.Maneuvers)
            {
                float dV = craft.Engine.GetVelocityChangeRequired(maneuver, craft.Motion);

                reaction_mass = dV * (craft.EmptyTankMass + reaction_mass) /
                                craft.Engine.ExhaustVelocity;
            }
        }

        return(reaction_mass);
    }
Example #2
0
    public float GetPropellentMassRequired(Navigation.Transfer transfer,
                                           float craft_mass)
    {
        float total_propellent_mass = 0;

        List <Navigation.Transfer.Maneuver> maneuvers = transfer.Maneuvers;

        foreach (Navigation.Transfer.Maneuver maneuver in maneuvers.Reversed())
        {
            int maneuver_index = maneuvers.IndexOf(maneuver);

            SatelliteMotion craft_motion;
            if (maneuver_index > 0)
            {
                craft_motion = maneuvers[maneuver_index - 1].ResultingMotion;
            }
            else
            {
                craft_motion = transfer.OriginalMotion;
            }

            total_propellent_mass +=
                GetPropellentMassRequired(maneuver,
                                          craft_motion,
                                          craft_mass + total_propellent_mass);
        }

        return(total_propellent_mass);
    }
Example #3
0
    private void Update()
    {
        Navigation navigation = this.TransportCraftPanel().Craft.Navigation;

        if (transfers_used.SequenceEqual(navigation.Transfers) &&
            first_transfer_used == navigation.NextTransfer &&
            Stops.Count() > 0)
        {
            return;
        }

        Clear();

        float y_offset = 0;

        for (int i = 0; i <= navigation.Transfers.Count; i++)
        {
            Navigation.Transfer transfer = null;
            if (i < navigation.Transfers.Count)
            {
                transfer = navigation.Transfers[i];
            }

            if (transfer != null && transfer.ArrivalDate < The.Clock.Now)
            {
                continue;
            }

            ScheduleElement element = GameObject.Instantiate(ScheduleElementPrefab);
            element.transform.SetParent(ElementsContainer, false);
            element.RectTransform.anchoredPosition = new Vector3(0, y_offset, 0);

            element.DepartureTransfer = transfer;

            y_offset -= element.RectTransform.rect.height + Margin;
        }

        transfers_used      = new List <Navigation.Transfer>(navigation.Transfers);
        first_transfer_used = navigation.NextTransfer;

        AddTransferButton.RectTransform.anchoredPosition =
            new Vector3(0, y_offset + 8, 0);
    }