CalcPower() public méthode

public CalcPower ( double speed, double acc, double gradient ) : double
speed double
acc double
gradient double
Résultat double
Exemple #1
0
        public static CEP operator *(CEP cp1, double d)
        {
            #region SingleValues
            CEP newCEP = new CEP(cp1.HeavyVehicle,
                d * cp1._massVehicle,
                d * cp1._vehicleLoading,
                d * cp1._vehicleMassRot,
                d * cp1._crossSectionalArea,
                d * cp1._cWValue,
                d * cp1._resistanceF0,
                d * cp1._resistanceF1,
                d * cp1._resistanceF2,
                d * cp1._resistanceF3,
                d * cp1._resistanceF4,
                d * cp1._axleRatio,
                d * cp1._auxPower,
                d * cp1._ratedPower,
                d * cp1._engineIdlingSpeed,
                d * cp1._engineRatedSpeed,
                d * cp1._effectiveWheelDiameter,
                d * cp1._pNormV0,
                d * cp1._pNormP0,
                d * cp1._pNormV1,
                d * cp1._pNormP1);

            newCEP._fuelType = cp1.FuelType;
            #endregion

            #region SpeedRotationalTable
            newCEP._speedPatternRotational = new List<double>(cp1._speedPatternRotational);
            newCEP._speedCurveRotational = new List<double>(cp1._speedCurveRotational.Select(p => p * d));
            newCEP._gearTransmissionCurve = new List<double>(cp1._gearTransmissionCurve.Select(p => p * d));
            #endregion

            #region NormalizingPower
            newCEP._drivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0);

            if (newCEP._heavyVehicle)
            {
                newCEP._normalizingPower = newCEP._ratedPower;
                newCEP._normalizingType = NormalizingType.RatedPower;
            }
            else
            {
                newCEP._normalizingPower = newCEP._drivingPower;
                newCEP._normalizingType = NormalizingType.DrivingPower;
            }
            #endregion

            #region FC
            newCEP._powerPatternFC = new List<double>(cp1._powerPatternFC.Select(p => p * d));
            newCEP._normalizedPowerPatternFC = new List<double>(cp1._normalizedPowerPatternFC);
            newCEP._cepCurveFC = new List<double>(cp1._cepCurveFC.Select(p => p * d));
            newCEP._normedCepCurveFC = new List<double>(cp1._normedCepCurveFC.Select(p => p * d));
            #endregion

            #region Pollutants
            newCEP._powerPatternPollutants = new List<double>(cp1._normailzedPowerPatternPollutants.Select(p => p * newCEP._normalizingPower));
            newCEP._normailzedPowerPatternPollutants = new List<double>(cp1._normailzedPowerPatternPollutants);
            newCEP._cepCurvePollutants = new Dictionary<string, List<double>>();
            newCEP._cepNormalizedCurvePollutants = new Dictionary<string, List<double>>();

            foreach (string id in cp1._cepCurvePollutants.Keys)
            {
                newCEP._cepCurvePollutants.Add(id, new List<double>(cp1._cepCurvePollutants[id].Select(p => p * d)));
                newCEP._cepNormalizedCurvePollutants.Add(id, new List<double>(cp1._cepNormalizedCurvePollutants[id].Select(p => p * d)));
            }
            #endregion

            #region IdlingValues
            newCEP._idlingValueFC = cp1._idlingValueFC * d;
            newCEP._idlingValuesPollutants = new Dictionary<string, double>();

            foreach (string id in cp1._idlingValuesPollutants.Keys)
            {
                newCEP._idlingValuesPollutants.Add(id,
                    cp1._idlingValuesPollutants[id] * d);
            }
            #endregion

            #region DragTable
            newCEP._nNormTable = new List<double>(cp1._nNormTable);
            newCEP._dragNormTable = new List<double>(cp1._dragNormTable.Select(p => p * d));
            #endregion
            return newCEP;
        }
Exemple #2
0
        //--------------------------------------------------------------------------------------------------
        // Operators for fleetmix
        //--------------------------------------------------------------------------------------------------
        
        #if FLEET
        #region AddRangeCeps
        public static CEP AddRangeCeps(CEP[] cps, Helpers Helper)
        {
            #region SingleValues
            CEP newCEP = new CEP(cps.Select(p => p.HeavyVehicle ? 1 : 0).Sum() > 0,
                cps.Select(p => p._massVehicle).Sum(),
                cps.Select(p => p._vehicleLoading).Sum(),
                cps.Select(p => p._vehicleMassRot).Sum(),
                cps.Select(p => p._crossSectionalArea).Sum(),
                cps.Select(p => p._cWValue).Sum(),
                cps.Select(p => p._resistanceF0).Sum(),
                cps.Select(p => p._resistanceF1).Sum(),
                cps.Select(p => p._resistanceF2).Sum(),
                cps.Select(p => p._resistanceF3).Sum(),
                cps.Select(p => p._resistanceF4).Sum(),
                cps.Select(p => p._axleRatio).Sum(),
                cps.Select(p => p._auxPower).Sum(),
                cps.Select(p => p._ratedPower).Sum(),
                cps.Select(p => p._engineIdlingSpeed).Sum(),
                cps.Select(p => p._engineRatedSpeed).Sum(),
                cps.Select(p => p._effectiveWheelDiameter).Sum(),
                cps.Select(p => p._pNormV0).Sum(),
                cps.Select(p => p._pNormP0).Sum(),
                cps.Select(p => p._pNormV1).Sum(),
                cps.Select(p => p._pNormP1).Sum());

            newCEP._fuelType = cps.First().FuelType;
            #endregion

            #region SpeedRotationalTable
            double minSpeedRotational = cps.Select(p => p._speedPatternRotational.First()).Min();
            double maxSpeedRotational = cps.Select(p => p._speedPatternRotational.Last()).Max();

            newCEP._speedPatternRotational
                = CreatePattern(minSpeedRotational,
                maxSpeedRotational,
                Constants.SPEED_ROTATIONAL_INCREMENT);

            newCEP._speedCurveRotational = new List<double>();
            newCEP._gearTransmissionCurve = new List<double>();

            for (int i = 0; i < newCEP._speedPatternRotational.Count; i++)
            {
                newCEP._speedCurveRotational.Add(cps.Select(p => p.GetRotationalCoeffecient(newCEP._speedPatternRotational[i])).Sum());

                newCEP._gearTransmissionCurve.Add(cps.Select(p => p.GetGearCoeffecient(newCEP._speedPatternRotational[i])).Sum());
            }
            #endregion

            #region NormalizingPower
            newCEP._drivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0);

            if (newCEP._heavyVehicle)
            {
                newCEP._normalizingPower = newCEP._ratedPower;
                newCEP._normalizingType = NormalizingType.RatedPower;
            }
            else
            {
                newCEP._normalizingPower = newCEP._drivingPower;
                newCEP._normalizingType = NormalizingType.DrivingPower;
            }
            #endregion

            #region FC
            double minNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFC.First()).Min();
            double maxNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFC.Last()).Max();

            newCEP._normalizedPowerPatternFC
                = CreatePattern(minNormPowerPatternFC,
                maxNormPowerPatternFC,
                Constants.POWER_FC_INCREMENT);

            newCEP._cepCurveFC = new List<double>();
            newCEP._normedCepCurveFC = new List<double>();
            newCEP._powerPatternFC = new List<double>();

            for (int i = 0; i < newCEP._normalizedPowerPatternFC.Count; i++)
            {
                double newCepVal = cps.Select(p => p.GetNormedEmission("FC", newCEP._normalizedPowerPatternFC[i], double.MaxValue, Helper)).Sum();
                newCEP._cepCurveFC.Add(newCepVal * newCEP._ratedPower);
                newCEP._normedCepCurveFC.Add(newCepVal);
                newCEP._powerPatternFC.Add(newCEP._normalizedPowerPatternFC[i] * newCEP._ratedPower);
            }
            #endregion

            #region Pollutants
            double minNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.First()).Min();
            double maxNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.Last()).Max();

            newCEP._normailzedPowerPatternPollutants
                 = CreatePattern(minNormPowerPattern,
                 maxNormPowerPattern,
                 Constants.POWER_POLLUTANT_INCREMENT);

            newCEP._cepCurvePollutants = new Dictionary<string, List<double>>();
            newCEP._powerPatternPollutants = new List<double>();
            newCEP._cepNormalizedCurvePollutants = new Dictionary<string, List<double>>();

            foreach (string id in cps.First()._cepCurvePollutants.Keys)
            {
                newCEP._cepCurvePollutants.Add(id, new List<double>());
                newCEP._cepNormalizedCurvePollutants.Add(id, new List<double>());
            }

            for (int i = 0; i < newCEP._normailzedPowerPatternPollutants.Count; i++)
            {
                foreach (string id in newCEP._cepCurvePollutants.Keys)
                {
                    if (newCEP.NormalizingTypeX == NormalizingType.RatedPower)
                    {
                        double newCepVal = cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum();
                        newCEP._cepCurvePollutants[id].Add(newCepVal * newCEP._ratedPower);
                        newCEP._cepNormalizedCurvePollutants[id].Add(newCepVal);
                    }
                    else
                    {
                        newCEP._cepCurvePollutants[id].Add(cps.Select(p => p.GetEmission(id, newCEP._normailzedPowerPatternPollutants[i] * p._normalizingPower, double.MaxValue, Helper)).Sum());
                        newCEP._cepNormalizedCurvePollutants[id].Add(cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum());
                    }
                }
                newCEP._powerPatternPollutants.Add(newCEP._normailzedPowerPatternPollutants[i] * newCEP.NormalizingPower);
            }
            #endregion

            #region IdlingValues
            newCEP._idlingValueFC = cps.Select(p => p._idlingValueFC).Sum();
            newCEP._idlingValuesPollutants = new Dictionary<string, double>();

            foreach (string id in cps.First()._idlingValuesPollutants.Keys)
            {
                newCEP._idlingValuesPollutants.Add(id, cps.Select(p => p._idlingValuesPollutants[id]).Sum());
            }
            #endregion

            #region TragTable
            double minTragTable = cps.Select(p => p._nNormTable.First()).Min();
            double maxTragTable = cps.Select(p => p._nNormTable.Last()).Max();

            newCEP._nNormTable
                = CreatePattern(minTragTable,
                maxTragTable,
                Constants.NNORM_INCREMENT);

            newCEP._dragNormTable = new List<double>();

            for (int i = 0; i < newCEP._nNormTable.Count; i++)
            {
                newCEP._dragNormTable.Add(cps.Select(p => p.GetDragCoeffecient(newCEP._nNormTable[i])).Sum());
            }
            #endregion
            return newCEP;
        }
Exemple #3
0
        public static CEP operator *(CEP cp1, double d)
        {
            #region SingleValues
            CEP newCEP = new CEP(cp1.HeavyVehicle,
                                 d * cp1._massVehicle,
                                 d * cp1._vehicleLoading,
                                 d * cp1._vehicleMassRot,
                                 d * cp1._crossSectionalArea,
                                 d * cp1._cWValue,
                                 d * cp1._resistanceF0,
                                 d * cp1._resistanceF1,
                                 d * cp1._resistanceF2,
                                 d * cp1._resistanceF3,
                                 d * cp1._resistanceF4,
                                 d * cp1._axleRatio,
                                 d * cp1._auxPower,
                                 d * cp1.RatedPower,
                                 d * cp1._engineIdlingSpeed,
                                 d * cp1._engineRatedSpeed,
                                 d * cp1._effectiveWheelDiameter,
                                 d * cp1._pNormV0,
                                 d * cp1._pNormP0,
                                 d * cp1._pNormV1,
                                 d * cp1._pNormP1);

            #region Fleetmix and Fueltype
            newCEP.FuelType  = cp1.FuelType;
            newCEP._FleetMix = new Dictionary <string, double>();
            foreach (string id in cp1._FleetMix.Keys)
            {
                if (newCEP.FuelType == id)
                {
                    newCEP._FleetMix.Add(newCEP.FuelType, d);
                }
                else
                {
                    newCEP._FleetMix.Add(id, 0);
                }
            }
            #endregion
            #endregion

            #region SpeedRotationalTable
            newCEP._speedPatternRotational = new List <double>(cp1._speedPatternRotational);
            newCEP._speedCurveRotational   = new List <double>(cp1._speedCurveRotational.Select(p => p * d));
            newCEP._gearTransmissionCurve  = new List <double>(cp1._gearTransmissionCurve.Select(p => p * d));
            #endregion

            #region NormalizingPower
            newCEP.DrivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0, (cp1.CalcType == "HEV" | cp1.CalcType == "BEV"));

            if (newCEP.HeavyVehicle)
            {
                newCEP.NormalizingPower = newCEP.RatedPower;
                newCEP.NormalizingType  = eNormalizingType.RatedPower;
            }
            else
            {
                newCEP.NormalizingPower = newCEP.DrivingPower;
                newCEP.NormalizingType  = eNormalizingType.DrivingPower;
            }
            #endregion

            #region FC
            newCEP._powerPatternFCvalues           = new List <double>(cp1._powerPatternFCvalues.Select(p => p * d));
            newCEP._normalizedPowerPatternFCvalues = new List <double>(cp1._normalizedPowerPatternFCvalues);
            newCEP._cepCurveFCvalues       = new Dictionary <string, List <double> >();
            newCEP._normedCepCurveFCvalues = new Dictionary <string, List <double> >();

            foreach (string id in cp1._cepCurveFCvalues.Keys)
            {
                newCEP._cepCurveFCvalues.Add(id, new List <double>(cp1._cepCurveFCvalues[id].Select(p => p * d)));
                newCEP._normedCepCurveFCvalues.Add(id, new List <double>(cp1._normedCepCurveFCvalues[id].Select(p => p * d)));
            }
            #endregion

            #region Pollutants
            newCEP._powerPatternPollutants           = new List <double>(cp1._normailzedPowerPatternPollutants.Select(p => p * newCEP.NormalizingPower));
            newCEP._normailzedPowerPatternPollutants = new List <double>(cp1._normailzedPowerPatternPollutants);
            newCEP._cepCurvePollutants           = new Dictionary <string, List <double> >();
            newCEP._cepNormalizedCurvePollutants = new Dictionary <string, List <double> >();

            foreach (string id in cp1._cepCurvePollutants.Keys)
            {
                newCEP._cepCurvePollutants.Add(id, new List <double>(cp1._cepCurvePollutants[id].Select(p => p * d)));
                newCEP._cepNormalizedCurvePollutants.Add(id, new List <double>(cp1._cepNormalizedCurvePollutants[id].Select(p => p * d)));
            }
            #endregion

            #region IdlingValues
            newCEP._idlingValueFCvalues    = new Dictionary <string, double>();
            newCEP._idlingValuesPollutants = new Dictionary <string, double>();

            foreach (string id in cp1._idlingValueFCvalues.Keys)
            {
                newCEP._idlingValueFCvalues.Add(id,
                                                cp1._idlingValueFCvalues[id] * d);
            }

            foreach (string id in cp1._idlingValuesPollutants.Keys)
            {
                newCEP._idlingValuesPollutants.Add(id,
                                                   cp1._idlingValuesPollutants[id] * d);
            }
            #endregion

            #region DragTable
            newCEP._nNormTable    = new List <double>(cp1._nNormTable);
            newCEP._dragNormTable = new List <double>(cp1._dragNormTable.Select(p => p * d));
            #endregion
            return(newCEP);
        }
Exemple #4
0
        //--------------------------------------------------------------------------------------------------
        // Operators for fleetmix
        //--------------------------------------------------------------------------------------------------

        #if FLEET
        #region AddRangeCeps
        public static CEP AddRangeCeps(CEP[] cps, Helpers Helper)
        {
            #region SingleValues
            CEP newCEP = new CEP(cps.Select(p => p.HeavyVehicle ? 1 : 0).Sum() > 0,
                                 cps.Select(p => p._massVehicle).Sum(),
                                 cps.Select(p => p._vehicleLoading).Sum(),
                                 cps.Select(p => p._vehicleMassRot).Sum(),
                                 cps.Select(p => p._crossSectionalArea).Sum(),
                                 cps.Select(p => p._cWValue).Sum(),
                                 cps.Select(p => p._resistanceF0).Sum(),
                                 cps.Select(p => p._resistanceF1).Sum(),
                                 cps.Select(p => p._resistanceF2).Sum(),
                                 cps.Select(p => p._resistanceF3).Sum(),
                                 cps.Select(p => p._resistanceF4).Sum(),
                                 cps.Select(p => p._axleRatio).Sum(),
                                 cps.Select(p => p._auxPower).Sum(),
                                 cps.Select(p => p.RatedPower).Sum(),
                                 cps.Select(p => p._engineIdlingSpeed).Sum(),
                                 cps.Select(p => p._engineRatedSpeed).Sum(),
                                 cps.Select(p => p._effectiveWheelDiameter).Sum(),
                                 cps.Select(p => p._pNormV0).Sum(),
                                 cps.Select(p => p._pNormP0).Sum(),
                                 cps.Select(p => p._pNormV1).Sum(),
                                 cps.Select(p => p._pNormP1).Sum());

            #region Fleetmix and Fueltype
            if (cps.Select(p => p.FuelType).Min() == cps.Select(p => p.FuelType).Max())
            {
                newCEP.FuelType = cps.First().FuelType;
            }
            else
            {
                newCEP.FuelType = "Mix";
            }

            newCEP._FleetMix = new Dictionary <string, double>();
            foreach (string id in cps.First()._FleetMix.Keys)
            {
                newCEP._FleetMix.Add(id, cps.Select(p => p._FleetMix[id]).Sum());
            }
            #endregion
            #endregion

            #region SpeedRotationalTable
            double minSpeedRotational = cps.Select(p => p._speedPatternRotational.First()).Min();
            double maxSpeedRotational = cps.Select(p => p._speedPatternRotational.Last()).Max();

            newCEP._speedPatternRotational
                = CreatePattern(minSpeedRotational,
                                maxSpeedRotational,
                                Constants.SPEED_ROTATIONAL_INCREMENT);

            newCEP._speedCurveRotational  = new List <double>();
            newCEP._gearTransmissionCurve = new List <double>();

            for (int i = 0; i < newCEP._speedPatternRotational.Count; i++)
            {
                newCEP._speedCurveRotational.Add(cps.Select(p => p.GetRotationalCoeffecient(newCEP._speedPatternRotational[i])).Sum());

                newCEP._gearTransmissionCurve.Add(cps.Select(p => p.GetGearCoeffecient(newCEP._speedPatternRotational[i])).Sum());
            }
            #endregion

            #region NormalizingPower
            newCEP.DrivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0, (Helper.pClass == Constants.strBEV | Helper.uClass == Constants.strHybrid));

            if (newCEP.HeavyVehicle)
            {
                newCEP.NormalizingPower = newCEP.RatedPower;
                newCEP.NormalizingType  = eNormalizingType.RatedPower;
            }
            else
            {
                newCEP.NormalizingPower = newCEP.DrivingPower;
                newCEP.NormalizingType  = eNormalizingType.DrivingPower;
            }
            #endregion

            #region FC
            double minNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFCvalues.First()).Min();
            double maxNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFCvalues.Last()).Max();

            newCEP._normalizedPowerPatternFCvalues
                = CreatePattern(minNormPowerPatternFC,
                                maxNormPowerPatternFC,
                                Constants.POWER_FC_INCREMENT);

            newCEP._cepCurveFCvalues       = new Dictionary <string, List <double> >();
            newCEP._normedCepCurveFCvalues = new Dictionary <string, List <double> >();
            newCEP._powerPatternFCvalues   = new List <double>();

            foreach (string id in cps.First()._cepCurveFCvalues.Keys)
            {
                newCEP._cepCurveFCvalues.Add(id, new List <double>());
                newCEP._normedCepCurveFCvalues.Add(id, new List <double>());
            }

            for (int i = 0; i < newCEP._normalizedPowerPatternFCvalues.Count; i++)
            {
                foreach (string id in newCEP._cepCurveFCvalues.Keys)
                {
                    double newCepVal = cps.Select(p => p.GetNormedEmission(id, newCEP._normalizedPowerPatternFCvalues[i], double.MaxValue, Helper)).Sum();
                    newCEP._cepCurveFCvalues[id].Add(newCepVal * newCEP.RatedPower);
                    newCEP._normedCepCurveFCvalues[id].Add(newCepVal);
                }
                newCEP._powerPatternFCvalues.Add(newCEP._normalizedPowerPatternFCvalues[i] * newCEP.RatedPower);
            }
            #endregion

            #region Pollutants
            double minNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.First()).Min();
            double maxNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.Last()).Max();

            newCEP._normailzedPowerPatternPollutants
                = CreatePattern(minNormPowerPattern,
                                maxNormPowerPattern,
                                Constants.POWER_POLLUTANT_INCREMENT);

            newCEP._cepCurvePollutants           = new Dictionary <string, List <double> >();
            newCEP._cepNormalizedCurvePollutants = new Dictionary <string, List <double> >();
            newCEP._powerPatternPollutants       = new List <double>();

            foreach (string id in cps.First()._cepCurvePollutants.Keys)
            {
                newCEP._cepCurvePollutants.Add(id, new List <double>());
                newCEP._cepNormalizedCurvePollutants.Add(id, new List <double>());
            }

            for (int i = 0; i < newCEP._normailzedPowerPatternPollutants.Count; i++)
            {
                foreach (string id in newCEP._cepCurvePollutants.Keys)
                {
                    if (newCEP.NormalizingType == eNormalizingType.RatedPower)
                    {
                        double newCepVal = cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum();
                        newCEP._cepCurvePollutants[id].Add(newCepVal * newCEP.RatedPower);
                        newCEP._cepNormalizedCurvePollutants[id].Add(newCepVal);
                    }
                    else
                    {
                        newCEP._cepCurvePollutants[id].Add(cps.Select(p => p.GetEmission(id, newCEP._normailzedPowerPatternPollutants[i] * p.NormalizingPower, double.MaxValue, Helper)).Sum());
                        newCEP._cepNormalizedCurvePollutants[id].Add(cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum());
                    }
                }
                newCEP._powerPatternPollutants.Add(newCEP._normailzedPowerPatternPollutants[i] * newCEP.NormalizingPower);
            }
            #endregion

            #region IdlingValues
            newCEP._idlingValueFCvalues    = new Dictionary <string, double>();
            newCEP._idlingValuesPollutants = new Dictionary <string, double>();

            foreach (string id in cps.First()._idlingValueFCvalues.Keys)
            {
                newCEP._idlingValueFCvalues.Add(id, cps.Select(p => p._idlingValueFCvalues[id]).Sum());
            }

            foreach (string id in cps.First()._idlingValuesPollutants.Keys)
            {
                newCEP._idlingValuesPollutants.Add(id, cps.Select(p => p._idlingValuesPollutants[id]).Sum());
            }
            #endregion

            #region TragTable
            double minTragTable = cps.Select(p => p._nNormTable.First()).Min();
            double maxTragTable = cps.Select(p => p._nNormTable.Last()).Max();

            newCEP._nNormTable
                = CreatePattern(minTragTable,
                                maxTragTable,
                                Constants.NNORM_INCREMENT);

            newCEP._dragNormTable = new List <double>();

            for (int i = 0; i < newCEP._nNormTable.Count; i++)
            {
                newCEP._dragNormTable.Add(cps.Select(p => p.GetDragCoeffecient(newCEP._nNormTable[i])).Sum());
            }
            #endregion
            return(newCEP);
        }
Exemple #5
0
        static public VehicleResult CreateVehicleStateData(Helpers Helper,
                                                           CEP currCep,
                                                           double time,
                                                           double inputSpeed,
                                                           double inputAcc,
                                                           double Gradient = 0)
        {
            //Declaration
            double speed = Math.Max(inputSpeed, 0);
            double acc;
            double P_pos;

            //Speed/Acceleration limitation
            if (speed == 0)
                acc = 0;
            else
                acc = inputAcc;

            //Calculate the power
            double power = currCep.CalcPower(speed, acc, Gradient);
            double P_eng = currCep.CalcEngPower(power);

            //Power limitation
            if (P_eng >= 0) 
                P_pos = power;
            else 
                P_pos = 0;

            //Calculate the result values (BEV)
            if (Helper.tClass == Constants.strBEV)
            {
                return new VehicleResult(time,
                                         speed,
                                         Gradient,
                                         power,
                                         P_pos,
                                         P_eng / currCep.RatedPower,
                                         P_eng / currCep.DrivingPower,
                                         acc,
                                         0,
                                         currCep.GetEmission("FC", power, speed, Helper),
                                         0,
                                         0,
                                         0,
                                         0,
                                         0);
            }

            //Calculate the decel costing
            double decelCoast = currCep.GetDecelCoast(speed, acc, Gradient);

            //Calculate the result values (Zero emissions by costing)
            if (acc >= decelCoast)
            {
                return new VehicleResult(time,
                                         speed,
                                         Gradient,
                                         power,
                                         P_pos,
                                         P_eng / currCep.RatedPower,
                                         P_eng / currCep.DrivingPower,
                                         acc,
                                         currCep.GetEmission("FC", power, speed, Helper),
                                         0,
                                         currCep.GetCO2Emission(currCep.GetEmission("FC", power, speed, Helper), currCep.GetEmission("CO", power, speed, Helper), currCep.GetEmission("HC", power, speed, Helper), Helper),
                                         currCep.GetEmission("NOx", power, speed, Helper),
                                         currCep.GetEmission("HC", power, speed, Helper),
                                         currCep.GetEmission("PM", power, speed, Helper),
                                         currCep.GetEmission("CO", power, speed, Helper));
            }
            else
            {
                return new VehicleResult(time,
                                         speed,
                                         Gradient,
                                         power,
                                         P_pos,
                                         power / currCep.RatedPower,
                                         power / currCep.DrivingPower,
                                         acc,
                                         0,
                                         0,
                                         0,
                                         0,
                                         0,
                                         0,
                                         0);
            }
        }