Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 5058a7a0 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #199 in VECTO/vecto-sim from...

Merge pull request #199 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:hotfix/VECTO-292-vecto-3.x-road-gradient-always to master

* commit '60c4eebf':
  remove redundant property RoadGradientPercent, add getter that derives this value from RoadGradient if needed
parents 1d74464c 60c4eebf
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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>(),
......
......@@ -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
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment