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

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

remove redundant property RoadGradientPercent, add getter that derives this...

remove redundant property RoadGradientPercent, add getter that derives this value from RoadGradient if needed
parent 1d74464c
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,7 @@ namespace DeclarationCycleZip ...@@ -65,7 +65,7 @@ namespace DeclarationCycleZip
var row = table.NewRow(); var row = table.NewRow();
row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture); row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture);
row["<v>"] = x.VehicleTargetSpeed.ConvertTo().Kilo.Meter.Per.Hour.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); row["<stop>"] = x.StoppingTime.Value().ToString(CultureInfo.InvariantCulture);
table.Rows.Add(row); table.Rows.Add(row);
lastDistance = x.Distance; lastDistance = x.Distance;
......
...@@ -205,7 +205,6 @@ namespace TUGraz.VectoCore.InputData.Reader ...@@ -205,7 +205,6 @@ namespace TUGraz.VectoCore.InputData.Reader
var tmp = new DrivingCycleData.DrivingCycleEntry(entry) { var tmp = new DrivingCycleData.DrivingCycleEntry(entry) {
StoppingTime = 0.SI<Second>(), StoppingTime = 0.SI<Second>(),
RoadGradient = entry.RoadGradient, RoadGradient = entry.RoadGradient,
RoadGradientPercent = entry.RoadGradientPercent,
VehicleTargetSpeed = i < entries.Count - 1 ? entries[i + 1].VehicleTargetSpeed : 0.SI<MeterPerSecond>() VehicleTargetSpeed = i < entries.Count - 1 ? entries[i + 1].VehicleTargetSpeed : 0.SI<MeterPerSecond>()
}; };
filtered.Add(tmp); filtered.Add(tmp);
...@@ -362,7 +361,6 @@ namespace TUGraz.VectoCore.InputData.Reader ...@@ -362,7 +361,6 @@ namespace TUGraz.VectoCore.InputData.Reader
return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry {
Distance = row.ParseDouble(Fields.Distance).SI<Meter>(), Distance = row.ParseDouble(Fields.Distance).SI<Meter>(),
VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(),
RoadGradientPercent = row.ParseDoubleOrGetDefault(Fields.RoadGradient),
RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0),
StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(), StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(),
AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(),
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
...@@ -101,7 +102,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data ...@@ -101,7 +102,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
/// <summary> /// <summary>
/// [%] Optional. /// [%] Optional.
/// </summary> /// </summary>
public double RoadGradientPercent { get; set; } public Scalar RoadGradientPercent
{
get { return (Math.Tan(RoadGradient.Value()) * 100).SI<Scalar>(); }
}
/// <summary> /// <summary>
/// relative altitude of the driving cycle over distance /// relative altitude of the driving cycle over distance
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
...@@ -519,7 +520,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -519,7 +520,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
container[ModalResultField.dist] = CurrentState.Distance; container[ModalResultField.dist] = CurrentState.Distance;
container[ModalResultField.simulationDistance] = CurrentState.SimulationDistance; container[ModalResultField.simulationDistance] = CurrentState.SimulationDistance;
container[ModalResultField.v_targ] = CurrentState.VehicleSpeed; 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.altitude] = LeftSample.Current.Altitude;
container[ModalResultField.acc] = CurrentState.Acceleration; 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