public override string GetInfo()
        {
            List <ElectricEnginePropellant> props = ElectricEnginePropellant.GetPropellantsEngineForType(type);
            string return_str    = "Max Power Consumption: " + MaxPower.ToString("") + " MW\n";
            var    thrust_per_mw = (2e6 * powerThrustMultiplier) / _g0 / (baseISP * PluginHelper.ElectricEngineIspMult) / 1000.0;

            props.ForEach(prop =>
            {
                var ispPropellantModifier = (PluginHelper.IspElectroPropellantModifierBase + (this.type == (int)ElectricEngineType.VASIMR ? prop.DecomposedIspMult : prop.IspMultiplier)) / (1 + PluginHelper.IspNtrPropellantModifierBase);
                var ispProp = _modifiedEngineBaseISP * ispPropellantModifier;

                double efficiency;
                if (type == (int)ElectricEngineType.ARCJET)
                {
                    efficiency = 0.87 * prop.Efficiency;
                }
                else if (type == (int)ElectricEngineType.VASIMR)
                {
                    efficiency = baseEfficency + 0.5 * variableEfficency;
                }
                else
                {
                    efficiency = prop.Efficiency;
                }

                var thrustProp = thrust_per_mw / ispPropellantModifier * efficiency * (type == (int)ElectricEngineType.ARCJET ? prop.ThrustMultiplier : 1);
                return_str     = return_str + "---" + prop.PropellantGUIName + "---\nThrust: " + thrustProp.ToString("0.000") + " kN per MW\nEfficiency: " + (efficiency * 100.0).ToString("0.00") + "%\nISP: " + ispProp.ToString("0.00") + "s\n";
            });
            return(return_str);
        }
示例#2
0
 private void clear_butt_Click(object sender, EventArgs e)
 {
     R1.Clear();
     Vin.Clear();
     Vout.Clear();
     MaxPower.Clear();
     R1Val.Clear();
     R2Val.Clear();
 }
示例#3
0
        public override string GetInfo()
        {
            var props       = ElectricEnginePropellant.GetPropellantsEngineForType(type);
            var returnStr   = Localizer.Format("#LOC_KSPIE_ElectricEngine_maxPowerConsumption") + " : " + MaxPower.ToString("F3") + " MW\n";
            var thrustPerMw = (2e6 * powerThrustMultiplier) / _g0 / (baseISP * PluginHelper.ElectricEngineIspMult) / 1000.0;

            props.ForEach(prop =>
            {
                var ispPropellantModifier = (PluginHelper.IspElectroPropellantModifierBase + (this.type == (int)ElectricEngineType.VASIMR ? prop.DecomposedIspMult : prop.IspMultiplier)) / (1 + PluginHelper.IspNtrPropellantModifierBase);
                var ispProp = _modifiedEngineBaseIsp * ispPropellantModifier;

                double efficiency;

                switch (type)
                {
                case (int)ElectricEngineType.ARCJET:
                    efficiency = 0.87 * prop.Efficiency;
                    break;

                case (int)ElectricEngineType.VASIMR:
                    efficiency = baseEfficency + 0.5 * variableEfficency;
                    break;

                default:
                    efficiency = prop.Efficiency;
                    break;
                }

                var thrustProp = thrustPerMw / ispPropellantModifier * efficiency * (type == (int)ElectricEngineType.ARCJET ? prop.ThrustMultiplier : 1);
                returnStr      = returnStr + "---" + prop.PropellantGUIName + "---\n" + Localizer.Format("#LOC_KSPIE_ElectricEngine_thrust")
                                 + ": " + thrustProp.ToString("0.000") + " " + Localizer.Format("#LOC_KSPIE_ElectricEngine_kiloNewtonPerMegaWatt") + "\n" + Localizer.Format("#LOC_KSPIE_ElectricEngine_efficiency")
                                 + " : " + (efficiency * 100.0).ToString("0.00") + "%\n" + Localizer.Format("#LOC_KSPIE_ElectricEngine_specificImpulse") + ": " + ispProp.ToString("0.00") + "s\n";
            });
            return(returnStr);
        }
 public decimal ComputePower(IEnumerable <Item> items)
 {
     return(MaxPower.ComputePower(items));
 }
示例#5
0
        // Column specific sort
        public int CompareTo(Record a2, RecordComparer.ComparisonType comparisonMethod, RecordComparer.Order sortOrder)
        {
            int result = 0;

            switch (comparisonMethod)
            {
            // Define all different sort methods
            case RecordComparer.ComparisonType.AvgPower:
                if (AvgPower != a2.AvgPower)
                {
                    result = AvgPower.CompareTo(a2.AvgPower);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxPower:
                if (MaxPower != a2.MaxPower)
                {
                    result = MaxPower.CompareTo(a2.MaxPower);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Category:
                if (CategoryName != a2.CategoryName)
                {
                    result = CategoryName.CompareTo(a2.CategoryName);
                }
                else
                {
                    // TODO: WTF is this?
                    switch (Category.Type)
                    {
                    case RecordCategory.RecordType.DistancePace:
                        result = AvgPace.CompareTo(a2.AvgPace);
                        break;

                    case RecordCategory.RecordType.MaxTemperature:
                        result = Temp.CompareTo(a2.Temp);
                        break;
                    }
                }

                break;

            case RecordComparer.ComparisonType.Distance:
                if (ActualDistance != a2.ActualDistance)
                {
                    result = ActualDistance.CompareTo(a2.ActualDistance);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.StartDistance:
                if (StartDistance != a2.StartDistance)
                {
                    result = StartDistance.CompareTo(a2.StartDistance);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.EndDistance:
                if (EndDistance != a2.EndDistance)
                {
                    result = EndDistance.CompareTo(a2.EndDistance);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Location:
                if (Location != a2.Location)
                {
                    result = Location.CompareTo(a2.Location);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.ActivityCategory:
                if (ActivityCategory != a2.ActivityCategory)
                {
                    result = ActivityCategory.CompareTo(a2.ActivityCategory);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Name:
                if (Name != a2.Name)
                {
                    result = Name.CompareTo(a2.Name);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.TotalTime:
                if (TotalTime != a2.TotalTime)
                {
                    result = TotalTime.CompareTo(a2.TotalTime);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.ElevationChange:
                if (ElevationChange != a2.ElevationChange)
                {
                    result = ElevationChange.CompareTo(a2.ElevationChange);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.TotalAscend:
                if (TotalAscend != a2.TotalAscend)
                {
                    result = TotalAscend.CompareTo(a2.TotalAscend);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.TotalDescend:
                if (TotalDescend != a2.TotalDescend)
                {
                    result = TotalDescend.CompareTo(a2.TotalDescend);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Temp:
                if (Temp != a2.Temp)
                {
                    result = Temp.CompareTo(a2.Temp);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Rank:
                if (Rank != a2.Rank)
                {
                    result = Rank.CompareTo(a2.Rank);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.AvgPace:
                if (AvgPace != a2.AvgPace)
                {
                    result = AvgPace.CompareTo(a2.AvgPace);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.Speed:
                if (Speed != a2.Speed)
                {
                    result = Speed.CompareTo(a2.Speed);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.AvgHR:
                if (AvgHR != a2.AvgHR)
                {
                    result = AvgHR.CompareTo(a2.AvgHR);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.TotalCalories:
                if (TotalCalories != a2.TotalCalories)
                {
                    result = TotalCalories.CompareTo(a2.TotalCalories);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.AvgCadence:
                if (AvgCadence != a2.AvgCadence)
                {
                    result = AvgCadence.CompareTo(a2.AvgCadence);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxSpeed:
                if (MaxSpeed != a2.MaxSpeed)
                {
                    result = MaxSpeed.CompareTo(a2.MaxSpeed);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxHR:
                if (MaxHR != a2.MaxHR)
                {
                    result = MaxHR.CompareTo(a2.MaxHR);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxElevation:
                if (MaxElevation != a2.MaxElevation)
                {
                    result = MaxElevation.CompareTo(a2.MaxElevation);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MinElevation:
                if (MinElevation != a2.MinElevation)
                {
                    result = MinElevation.CompareTo(a2.MinElevation);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxCadence:
                if (MaxCadence != a2.MaxCadence)
                {
                    result = MaxCadence.CompareTo(a2.MaxCadence);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MaxGrade:
                if (MaxGrade != a2.MaxGrade)
                {
                    result = MaxGrade.CompareTo(a2.MaxGrade);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.MinGrade:
                if (MinGrade != a2.MinGrade)
                {
                    result = MinGrade.CompareTo(a2.MinGrade);
                }
                else
                {
                    result = StartDateTime.CompareTo(a2.StartDateTime);
                }

                break;

            case RecordComparer.ComparisonType.StartDateTime:
            default:
                result = StartDateTime.CompareTo(a2.StartDateTime);
                break;
            }

            if (sortOrder == RecordComparer.Order.Descending)
            {
                return(result * -1);
            }
            else
            {
                return(result);
            }
        }
示例#6
0
 private ICollection FindMax(ILookup <ItemSlot.SlotHashes, Item> items)
 {
     return(MaxPower.FindMax(items[ItemSlot.SlotHashes.Kinetic],
                             items[ItemSlot.SlotHashes.Energy],
                             items[ItemSlot.SlotHashes.Power]) as ICollection);
 }
示例#7
0
 set => _omega = (float)Math.Max(Math.Min(MaxPower, value), 0);