diff --git a/Tools/DeclarationCycleZip/Program.cs b/Tools/DeclarationCycleZip/Program.cs index f9f3216132ddbb38b7e596cf7309e92c69b30a20..4ffa9847a296f27ef6e648ea45b763aec404f83c 100644 --- a/Tools/DeclarationCycleZip/Program.cs +++ b/Tools/DeclarationCycleZip/Program.cs @@ -65,7 +65,7 @@ namespace DeclarationCycleZip var row = table.NewRow(); row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture); row["<v>"] = x.VehicleTargetSpeed.ConvertTo().Kilo.Meter.Per.Hour.Value().ToString(CultureInfo.InvariantCulture); - row["<grad>"] = x.RoadGradientPercent.ToString(CultureInfo.InvariantCulture); + row["<grad>"] = x.RoadGradientPercent.Value().ToString(CultureInfo.InvariantCulture); row["<stop>"] = x.StoppingTime.Value().ToString(CultureInfo.InvariantCulture); table.Rows.Add(row); lastDistance = x.Distance; diff --git a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs index 7ddcaab7d648dacea8dbbd9960179f7e16b9ac94..59005eaa9003b851f50d55a03bf7cd9fe1ff9a60 100644 --- a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs @@ -205,7 +205,6 @@ namespace TUGraz.VectoCore.InputData.Reader var tmp = new DrivingCycleData.DrivingCycleEntry(entry) { StoppingTime = 0.SI<Second>(), RoadGradient = entry.RoadGradient, - RoadGradientPercent = entry.RoadGradientPercent, VehicleTargetSpeed = i < entries.Count - 1 ? entries[i + 1].VehicleTargetSpeed : 0.SI<MeterPerSecond>() }; filtered.Add(tmp); @@ -362,7 +361,6 @@ namespace TUGraz.VectoCore.InputData.Reader return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { Distance = row.ParseDouble(Fields.Distance).SI<Meter>(), VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), - RoadGradientPercent = row.ParseDoubleOrGetDefault(Fields.RoadGradient), RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(), AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs index 49f72e7e5d05fa95d492ba3b997d3510e730be4a..28f75402351f764408f95b7c66eab2070941736f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using System.Diagnostics; using TUGraz.VectoCommon.Utils; @@ -101,7 +102,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data /// <summary> /// [%] Optional. /// </summary> - public double RoadGradientPercent { get; set; } + public Scalar RoadGradientPercent + { + get { return (Math.Tan(RoadGradient.Value()) * 100).SI<Scalar>(); } + } /// <summary> /// relative altitude of the driving cycle over distance diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index b475517770c06485e8f8abf83dc4ca211f94aff2..959aaf2822a36c9adbbba2341c826b69da017256 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using System.Linq; using TUGraz.VectoCommon.Exceptions; @@ -519,7 +520,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container[ModalResultField.dist] = CurrentState.Distance; container[ModalResultField.simulationDistance] = CurrentState.SimulationDistance; container[ModalResultField.v_targ] = CurrentState.VehicleSpeed; - container[ModalResultField.grad] = LeftSample.Current.RoadGradientPercent.SI(); + container[ModalResultField.grad] = LeftSample.Current.RoadGradientPercent; container[ModalResultField.altitude] = LeftSample.Current.Altitude; container[ModalResultField.acc] = CurrentState.Acceleration; }