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

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

Merge pull request #289 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:master to develop

* commit '1f57dd54':
  cyclegearbox: report cycle-closed correctly.
  adapt shift polygon drawer to draw intersected full-load curve (gear's max torque)
  shift polygon computation: use correct boundary for fld margin (0.95 * rpm_p3)
  updated wheels values for declaration mode
  remove segment vor vehicle weigh 0-7.5t
  bugfix: measured speed when halting and gear=0 but vehicle still has a remaining velocity.
  bugfix: measured speed distance wrong
parents 0a730483 1f57dd54
No related branches found
No related tags found
No related merge requests found
Showing
with 134 additions and 103 deletions
......@@ -294,7 +294,7 @@ namespace TUGraz.VectoCore.Models.Declaration
var p6 = new Point(p2.X, VectoMath.Interpolate(p1, p3, p2.X));
var p7 = new Point(p4.X, VectoMath.Interpolate(p2, p5, p4.X));
var fldMargin = ShiftPolygonFldMargin(fullLoadCurve.FullLoadEntries, nVHigh * 0.95);
var fldMargin = ShiftPolygonFldMargin(fullLoadCurve.FullLoadEntries, (p3.X * 0.95).SI<PerSecond>());
var downshiftCorr = MoveDownshiftBelowFld(Edge.Create(p6, p3), fldMargin, 1.1 * fullLoadCurve.MaxTorque);
var downShift = new List<ShiftPolygon.ShiftPolygonEntry>();
......
......@@ -67,7 +67,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public static VehicleClass Parse(string text)
{
return text.Replace(Prefix, "").ParseEnum<VehicleClass>();
return (Prefix + text).ParseEnum<VehicleClass>();
}
public static string GetClassNumber(this VehicleClass hdvClass)
......
......@@ -281,7 +281,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
/// <summary>
/// Handles Requests when no gear is engaged
/// Handles Requests when no gear is disengaged
/// </summary>
/// <param name="absTime"></param>
/// <param name="dt"></param>
......@@ -303,8 +303,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
if ((outTorque * avgOutAngularVelocity).IsGreater(0.SI<Watt>(),
Constants.SimulationSettings.LineSearchTolerance)) {
if ((outTorque * avgOutAngularVelocity).IsGreater(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance) &&
!outAngularVelocity.IsEqual(0)) {
return new ResponseOverload {
Source = this,
Delta = outTorque * avgOutAngularVelocity,
......@@ -312,8 +312,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
if ((outTorque * avgOutAngularVelocity).IsSmaller(0.SI<Watt>(),
Constants.SimulationSettings.LineSearchTolerance)) {
if ((outTorque * avgOutAngularVelocity).IsSmaller(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance)) {
return new ResponseUnderload {
Source = this,
Delta = outTorque * avgOutAngularVelocity,
......@@ -321,13 +320,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
CurrentState.SetState(0.SI<NewtonMeter>(), 0.RPMtoRad(), outTorque, outAngularVelocity);
CurrentState.SetState(0.SI<NewtonMeter>(), 0.SI<PerSecond>(), outTorque, outAngularVelocity);
CurrentState.Gear = Gear;
var disengagedResponse = NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), DataBus.EngineIdleSpeed);
disengagedResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity;
return disengagedResponse;
//todo mk-2016-08-17: minus inTorqueLoss?? Why not plus?
}
private TorqueConverterOperatingPoint FindOperatingPoint(NewtonMeter outTorque,
......@@ -359,7 +357,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
(x.InTorque * x.InAngularVelocity).IsGreaterOrEqual(DataBus.EngineDragPower(x.InAngularVelocity),
Constants.SimulationSettings.LineSearchTolerance.SI<Watt>())
).ToArray();
if (filtered.Count() == 1) {
if (filtered.Length == 1) {
return filtered.First();
}
return operatingPointList[0];
......@@ -482,7 +480,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public override bool ClutchClosed(Second absTime)
{
return DataBus.CycleData.LeftSample.Gear != 0;
return (DataBus.DriverBehavior == DrivingBehavior.Braking
? DataBus.CycleData.LeftSample.Gear
: DataBus.CycleData.RightSample.Gear) != 0;
}
#endregion
......
......@@ -31,17 +31,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
return new DrivingCycleState {
Distance = Distance,
VehicleSpeed = VehicleSpeed,
};
}
public Meter Distance;
public MeterPerSecond VehicleSpeed;
public Meter SimulationDistance;
public MeterPerSquareSecond Acceleration;
}
protected DrivingCycleData Data;
protected readonly DrivingCycleData Data;
private bool _isInitializing;
protected IEnumerator<DrivingCycleData.DrivingCycleEntry> RightSample { get; set; }
protected IEnumerator<DrivingCycleData.DrivingCycleEntry> LeftSample { get; set; }
......@@ -64,10 +62,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
RightSample.MoveNext();
RightSample.MoveNext();
var first = LeftSample.Current;
PreviousState = new DrivingCycleState {
Distance = 0.SI<Meter>(),
VehicleSpeed = first.VehicleTargetSpeed,
};
CurrentState = PreviousState.Clone();
}
......@@ -118,6 +114,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// calc acceleration from speed diff vehicle to cycle
var deltaV = RightSample.Current.VehicleTargetSpeed - DataBus.VehicleSpeed;
var deltaT = RightSample.Current.Time - LeftSample.Current.Time;
if (DataBus.VehicleSpeed.IsSmaller(0)) {
throw new VectoSimulationException("vehicle velocity is smaller than zero");
}
if (deltaT.IsSmaller(0)) {
throw new VectoSimulationException("deltaT is smaller than zero");
}
var acceleration = deltaV / deltaT;
var gradient = LeftSample.Current.RoadGradient;
DriverAcceleration = acceleration;
......@@ -190,9 +195,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response.Acceleration = acceleration;
debug.Add(response);
CurrentState.SimulationDistance = acceleration / 2 * dt * dt + PreviousState.VehicleSpeed * dt;
CurrentState.SimulationDistance = acceleration / 2 * dt * dt + DataBus.VehicleSpeed * dt;
if (CurrentState.SimulationDistance.IsSmaller(0))
throw new VectoSimulationException(
"MeasuredSpeed: Simulation Distance must not be negative. Driving Backward is not allowed.");
CurrentState.Distance = CurrentState.SimulationDistance + PreviousState.Distance;
CurrentState.VehicleSpeed = acceleration * dt + PreviousState.VehicleSpeed;
CurrentState.Acceleration = acceleration;
return response;
......
Valid,Vehicle Category,Axle Conf.,GVW_Min,GVW_Max,HDV class,Body,Trailer,Semitrailer,.vacc file,Cross Wind Correction - Long haul,Cross Wind Correction - Other,Truck Axles - Long haul,Truck Axles - Other,Trailer Axles - Long haul,Trailer Axles - Other,Long haul,Regional delivery,Urban delivery,Municipal utility,Construction,Heavy Urban,Urban,Suburban,Interurban,Coach
0 ,RigidTruck ,4x2 ,0 ,7.5 ,0 , , , ,Truck.vacc, ,RigidSolo , , , , ,- ,pc(R) ,pc(R) ,- ,- ,- ,- ,- ,- ,-
# @@@quam below 7.5t is not considered by VECTO atm. @@@ 0 ,RigidTruck ,4x2 ,0 ,7.5 ,0 , , , ,Truck.vacc, ,RigidSolo , , , , ,- ,pc(R) ,pc(R) ,- ,- ,- ,- ,- ,- ,-
1 ,RigidTruck ,4x2 ,7.5 ,10 ,1 ,B1 , , ,Truck.vacc, ,RigidSolo , ,45/55 , , ,- ,pc(R) ,pc(R) ,- ,- ,- ,- ,- ,- ,-
1 ,Tractor ,4x2 ,7.5 ,10 ,1 ,B1 , , ,Truck.vacc, ,RigidSolo , ,45/55 , , ,- ,pc(R) ,pc(R) ,- ,- ,- ,- ,- ,- ,-
1 ,RigidTruck ,4x2 ,10 ,12 ,2 ,B2 ,T1 , ,Truck.vacc,RigidTrailer ,RigidSolo ,22.5/32.5 ,45/55 ,45/1 , ,pc(R) ,pc(R) ,pc(R) ,- ,- ,- ,- ,- ,- ,-
......
Wheel ,cross-sectional width [mm],tire aspect ratio [%],rim diameter [inch],d [mm],Inertia,F [-]
9.5 R17.5 ,241.3 ,0.95 ,17.5 ,842.0 ,4.9 ,3.05
9.00 R20 ,228.6 ,0.95 ,20 ,1018.0,10.5 ,3.05
9 R22.5 ,228.6 ,0.95 ,22.5 ,970.0 ,8.9 ,3.05
10 R17.5 ,254 ,0.95 ,17.5 ,858.0 ,5 ,3.05
10 R22.5 ,254 ,0.95 ,22.5 ,1020.0,11 ,3.05
10.00 R20 ,254 ,0.95 ,20 ,1052.0,13.1 ,3.05
11 R22.5 ,279.4 ,0.95 ,22.5 ,1050.0,14.4 ,3.05
11.00 R20 ,279.4 ,0.95 ,20 ,1082.0,14.6 ,3.05
11.00 R22 ,279.4 ,0.95 ,22 ,1050.0,16 ,3.05
12 R22.5 ,304.8 ,0.95 ,22.5 ,1084.0,16.85 ,3.05
12.00 R20 ,304.8 ,0.95 ,20 ,1122.0,19.5 ,3.05
12.00 R24 ,304.8 ,0.95 ,24 ,1226.0,27.7 ,3.05
12.5 R20 ,317.5 ,0.95 ,20 ,1120 ,12.7 ,3.05
13 R22.5 ,330.2 ,0.95 ,22.5 ,1124.0,20 ,3.05
14.00 R20 ,355.6 ,0.95 ,20 ,1238.0,30.8 ,3.05
14.5 R20 ,368.3 ,0.95 ,20 ,1092 ,14.8 ,3.05
16.00 R20 ,406.4 ,0.95 ,20 ,1343 ,47.5 ,3.05
205/75 R17.5,205 ,0.75 ,17.5 ,753.0 ,3.5 ,3.05
215/75 R17.5,215 ,0.75 ,17.5 ,767.0 ,3.9 ,3.05
225/70 R17.5,225 ,0.7 ,17.5 ,759.5 ,4 ,3.05
225/75 R17.5,225 ,0.75 ,17.5 ,782 ,4 ,3.05
235/75 R17.5,235 ,0.75 ,17.5 ,797.0 ,4.5 ,3.05
245/70 R17.5,245 ,0.7 ,17.5 ,789.0 ,5.2 ,3.05
245/70 R19.5,245 ,0.7 ,19.5 ,839.0 ,6 ,3.05
255/70 R22.5,255 ,0.7 ,22.5 ,930.0 ,9.5 ,3.05
265/70 R17.5,265 ,0.7 ,17.5 ,817 ,5.6 ,3.05
265/70 R19.5,265 ,0.7 ,19.5 ,867.0 ,6.5 ,3.05
275/70 R22.5,275 ,0.7 ,22.5 ,958.0 ,11.9 ,3.05
275/80 R22.5,275 ,0.8 ,22.5 ,1012.0,12.8 ,3.05
285/60 R22.5,285 ,0.6 ,22.5 ,914.0 ,10.6 ,3.03
285/70 R19.5,285 ,0.7 ,19.5 ,895.0 ,7.9 ,3.05
295/55 R22.5,295 ,0.55 ,22.5 ,896.0 ,10.2 ,3.03
295/60 R22.5,295 ,0.6 ,22.5 ,926.0 ,10.8 ,3.03
295/80 R22.5,295 ,0.8 ,22.5 ,1044.0,15.5 ,3.05
305/60 R22.5,305 ,0.6 ,22.5 ,938.0 ,11.4 ,3.03
305/70 R19.5,305 ,0.7 ,19.5 ,923.0 ,9.2 ,3.05
305/70 R22.5,305 ,0.7 ,22.5 ,1000.0,13.9 ,3.05
305/75 R24.5,305 ,0.75 ,24.5 ,1079.8,21.2 ,3.05
315/45 R22.5,315 ,0.45 ,22.5 ,856.0 ,9.9 ,3.03
315/60 R22.5,315 ,0.6 ,22.5 ,950.0 ,12.8 ,3.03
315/70 R22.5,315 ,0.7 ,22.5 ,1014.0,14.9 ,3.05
315/80 R22.5,315 ,0.8 ,22.5 ,1076.0,17.6 ,3.05
325/95 R24 ,325 ,0.95 ,24 ,1228.0,27.6 ,3.05
335/80 R20 ,335 ,0.8 ,20 ,1044.0,13.5 ,3.05
355/50 R22.5,355 ,0.5 ,22.5 ,928.0 ,12.2 ,3.03
365/70 R22.5,365 ,0.7 ,22.5 ,1084.0,18.6 ,3.05
365/80 R20 ,365 ,0.8 ,20 ,1092.0,17.2 ,3.05
365/85 R20 ,365 ,0.85 ,20 ,1128.0,22.5 ,3.05
375/45 R22.5,375 ,0.45 ,22.5 ,910.0 ,11.2 ,3.03
375/50 R22.5,375 ,0.5 ,22.5 ,948.0 ,13 ,3.03
375/90 R22.5,375 ,0.9 ,22.5 ,1246.5,33.8 ,3.05
385/55 R22.5,385 ,0.55 ,22.5 ,996.0 ,15.9 ,3.03
385/65 R22.5,385 ,0.65 ,22.5 ,1072.0,19.2 ,3.03
395/85 R20 ,395 ,0.85 ,20 ,1180.0,27.9 ,3.05
425/65 R22.5,425 ,0.65 ,22.5 ,1124.0,22.5 ,3.03
495/45 R22.5,495 ,0.45 ,22.5 ,1018.0,20.7 ,3.03
525/65 R20.5,525 ,0.65 ,20.5 ,1203.2,35 ,3.03
\ No newline at end of file
9.00 R20 ,258.00 ,0.95 ,20 ,1018.0,10.5 ,3.05
9 R22.5 ,230.00 ,0.95 ,22.5 ,970.0 ,8.9 ,3.05
9.5 R17.5 ,240.00 ,0.95 ,17.5 ,842.0 ,4.9 ,3.05
10 R17.5 ,254.00 ,0.95 ,17.5 ,858.0 ,5 ,3.05
10 R22.5 ,254.00 ,0.95 ,22.5 ,1020.0,11 ,3.05
10.00 R20 ,275.00 ,0.95 ,20 ,1052.0,13.1 ,3.05
11 R22.5 ,279.00 ,0.95 ,22.5 ,1050.0,14.4 ,3.05
11.00 R20 ,286.00 ,0.95 ,20 ,1082.0,14.6 ,3.05
11.00 R22.5 ,279.00 ,0.95 ,22.5 ,1050.0,16 ,3.05
12 R22.5 ,300.00 ,0.95 ,22.5 ,1084.0,16.85 ,3.05
12.00 R20 ,313.00 ,0.95 ,20 ,1122.0,19.5 ,3.05
12.00 R24 ,313.00 ,0.95 ,24 ,1226.0,27.7 ,3.05
12.5 R20 ,317.50 ,0.95 ,20 ,1120 ,12.7 ,3.05
13 R22.5 ,320.00 ,0.95 ,22.5 ,1124.0,20 ,3.05
14.00 R20 ,370.00 ,0.95 ,20 ,1238.0,30.8 ,3.05
14.5 R20 ,368.30 ,0.95 ,20 ,1092 ,14.8 ,3.05
16.00 R20 ,406.40 ,0.95 ,20 ,1343 ,47.5 ,3.05
205/75 R17.5,205.00 ,0.75 ,17.5 ,753.0 ,3.5 ,3.05
215/75 R17.5,212.00 ,0.75 ,17.5 ,767.0 ,3.9 ,3.05
225/70 R17.5,226.00 ,0.7 ,17.5 ,761.0 ,4 ,3.05
225/75 R17.5,226.00 ,0.75 ,17.5 ,783.0 ,4 ,3.05
235/75 R17.5,233.00 ,0.75 ,17.5 ,797.0 ,4.5 ,3.05
245/70 R17.5,248.00 ,0.7 ,17.5 ,789.0 ,5.2 ,3.05
245/70 R19.5,248.00 ,0.7 ,19.5 ,839.0 ,6 ,3.05
255/70 R22.5,255.00 ,0.7 ,22.5 ,930.0 ,9.5 ,3.05
265/70 R17.5,262.00 ,0.7 ,17.5 ,817.0 ,5.6 ,3.05
265/70 R19.5,262.00 ,0.7 ,19.5 ,867.0 ,6.5 ,3.05
275/70 R22.5,276.00 ,0.7 ,22.5 ,958.0 ,11.9 ,3.05
275/80 R22.5,276.00 ,0.8 ,22.5 ,1012.0,12.8 ,3.05
285/60 R22.5,285.00 ,0.6 ,22.5 ,914.0 ,10.6 ,3.03
285/70 R19.5,283.00 ,0.7 ,19.5 ,895.0 ,7.9 ,3.05
295/55 R22.5,292.00 ,0.55 ,22.5 ,896.0 ,10.2 ,3.03
295/60 R22.5,292.00 ,0.6 ,22.5 ,926.0 ,10.8 ,3.03
295/80 R22.5,298.00 ,0.8 ,22.5 ,1044.0,15.5 ,3.05
305/60 R22.5,306.00 ,0.6 ,22.5 ,938.0 ,11.4 ,3.03
305/70 R19.5,305.00 ,0.7 ,19.5 ,923.0 ,9.2 ,3.05
305/70 R22.5,305.00 ,0.7 ,22.5 ,1000.0,13.9 ,3.05
305/75 R24.5,305.00 ,0.75 ,24.5 ,1080.0,21.2 ,3.05
315/45 R22.5,307.00 ,0.45 ,22.5 ,856.0 ,9.9 ,3.03
315/60 R22.5,313.00 ,0.6 ,22.5 ,950.0 ,12.8 ,3.03
315/70 R22.5,312.00 ,0.7 ,22.5 ,1014.0,14.9 ,3.05
315/80 R22.5,312.00 ,0.8 ,22.5 ,1076.0,17.6 ,3.05
325/95 R24 ,325.00 ,0.95 ,24 ,1228.0,27.6 ,3.05
335/80 R20 ,340.00 ,0.8 ,20 ,1044.0,13.5 ,3.05
355/50 R22.5,361.00 ,0.5 ,22.5 ,928.0 ,12.2 ,3.03
365/70 R22.5,375.00 ,0.7 ,22.5 ,1084.0,18.6 ,3.05
365/80 R20 ,360.00 ,0.8 ,20 ,1092.0,17.2 ,3.05
365/85 R20 ,364.00 ,0.85 ,20 ,1128.0,22.5 ,3.05
375/45 R22.5,372.00 ,0.45 ,22.5 ,910.0 ,11.2 ,3.03
375/50 R22.5,374.00 ,0.5 ,22.5 ,948.0 ,13 ,3.03
375/90 R22.5,369.00 ,0.9 ,22.5 ,1248.0,33.8 ,3.05
385/55 R22.5,386.00 ,0.55 ,22.5 ,996.0 ,15.9 ,3.03
385/65 R22.5,389.00 ,0.65 ,22.5 ,1072.0,19.2 ,3.03
395/85 R20 ,386.00 ,0.85 ,20 ,1180.0,27.9 ,3.05
425/65 R22.5,430.00 ,0.65 ,22.5 ,1124.0,22.5 ,3.03
495/45 R22.5,500.00 ,0.45 ,22.5 ,1018.0,20.7 ,3.03
525/65 R20.5,530.00 ,0.65 ,20.5 ,1203.0,35 ,3.03
\ No newline at end of file
......@@ -104,7 +104,7 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle
}
modData.Finish(VectoRun.Status.Success);
ResultFileHelper.TestModFile(modalResultFile, modFile + Constants.FileExtensions.ModDataFile, testVelocity: false);
ResultFileHelper.TestModFile(modalResultFile, modFile + Constants.FileExtensions.ModDataFile);
}
[TestCase]
......
......@@ -389,25 +389,30 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration
};
engineData.FullLoadCurve.EngineData = engineData;
var gearboxData = new JSONGearboxDataV5(JSONInputDataFactory.ReadFile(gearboxFile), gearboxFile);
var gearboxData = new JSONGearboxDataV6(JSONInputDataFactory.ReadFile(gearboxFile), gearboxFile);
var shiftPolygons = new List<ShiftPolygon>();
var downshiftTransformed = new List<List<Point>>();
var downshiftOrig = new List<List<Point>>();
var upshiftOrig = new List<List<Point>>();
var fullLoadCurves = new List<EngineFullLoadCurve>();
for (var i = 0; i < gearboxData.Gears.Count; i++) {
shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(i, engineData.FullLoadCurve, gearboxData.Gears,
var fullLoadCurve = AbstractSimulationDataAdapter.IntersectFullLoadCurves(engineData.FullLoadCurve,
gearboxData.Gears[i].MaxTorque);
shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(i, fullLoadCurve, gearboxData.Gears,
engineData, axlegearRatio, rdyn));
List<Point> tmp1, tmp2, tmp3;
ShiftPolygonComparison.ComputShiftPolygonPoints(i, engineData.FullLoadCurve, gearboxData.Gears,
ShiftPolygonComparison.ComputShiftPolygonPoints(i, fullLoadCurve, gearboxData.Gears,
engineData, axlegearRatio, rdyn, out tmp1, out tmp2, out tmp3);
upshiftOrig.Add(tmp1);
downshiftTransformed.Add(tmp2);
downshiftOrig.Add(tmp3);
fullLoadCurves.Add(fullLoadCurve);
}
ShiftPolygonDrawer.DrawShiftPolygons(Path.GetDirectoryName(gearboxFile), engineData.FullLoadCurve, shiftPolygons,
"scania_fullload_shiftpolygon-test.png",
ShiftPolygonDrawer.DrawShiftPolygons(Path.GetDirectoryName(gearboxFile), fullLoadCurves, shiftPolygons,
"daimler_fullload_shiftpolygon-test_3.png",
DeclarationData.Gearbox.TruckMaxAllowedSpeed / rdyn * axlegearRatio * gearboxData.Gears.Last().Ratio, upshiftOrig,
downshiftTransformed, downshiftOrig);
}
......@@ -458,22 +463,26 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration
var shiftPolygons = new List<ShiftPolygon>();
var downshiftTransformed = new List<List<Point>>();
var upshiftOrig = new List<List<Point>>();
var fullLoadCurves = new List<EngineFullLoadCurve>();
for (var i = 0; i < gearboxData.Gears.Count; i++) {
var fullLoadCurve = AbstractSimulationDataAdapter.IntersectFullLoadCurves(engineData.FullLoadCurve,
gearboxData.Gears[i].MaxTorque);
shiftPolygons.Add(
DeclarationData.Gearbox.ComputeShiftPolygon(i, engineData.FullLoadCurve, gearboxData.Gears,
DeclarationData.Gearbox.ComputeShiftPolygon(i, fullLoadCurve, gearboxData.Gears,
engineData, axlegearRatio, rdyn.SI<Meter>())
);
List<Point> tmp1, tmp2, tmp3;
ComputShiftPolygonPoints(i, engineData.FullLoadCurve, gearboxData.Gears,
ComputShiftPolygonPoints(i, fullLoadCurve, gearboxData.Gears,
engineData, axlegearRatio, rdyn.SI<Meter>(), out tmp1, out tmp2, out tmp3);
upshiftOrig.Add(tmp1);
downshiftTransformed.Add(tmp2);
fullLoadCurves.Add(fullLoadCurve);
}
var imageFile = Path.GetDirectoryName(gearboxFile) + "_" + Path.GetFileNameWithoutExtension(gearboxFile) + "_" +
Path.GetFileNameWithoutExtension(engineFldFile) +
".png";
ShiftPolygonDrawer.DrawShiftPolygons(Path.GetDirectoryName(gearboxFile), engineData.FullLoadCurve, shiftPolygons,
ShiftPolygonDrawer.DrawShiftPolygons(Path.GetDirectoryName(gearboxFile), fullLoadCurves, shiftPolygons,
imageFile,
DeclarationData.Gearbox.TruckMaxAllowedSpeed / rdyn.SI<Meter>() * axlegearRatio * gearboxData.Gears.Last().Ratio,
upshiftOrig, downshiftTransformed);
......
......@@ -109,7 +109,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
var testColumns = new[] { "P_aux_FAN", "P_aux_STP", "P_aux_AC", "P_aux_ES", "P_aux_PS", "P_aux" };
ResultFileHelper.TestModFile(@"TestData\Results\EngineOnlyCycles\AuxWriteModFileSumFile.vmod",
@"AuxWriteModFileSumFile.vmod", testColumns, testVelocity: false);
@"AuxWriteModFileSumFile.vmod", testColumns);
ResultFileHelper.TestSumFile(@"TestData\Results\EngineOnlyCycles\AuxWriteModFileSumFile.vsum",
@"AuxWriteModFileSumFile.vsum");
}
......
......@@ -166,7 +166,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
ResultFileHelper.TestSumFile(@"TestData\Pwheel\Results\Pwheel.vsum", @"TestData\Pwheel\Pwheel.vsum");
ResultFileHelper.TestModFile(@"TestData\Pwheel\Results\Pwheel_Gear2_pt1_rep1_actual.vmod",
@"TestData\Pwheel\Pwheel_Gear2_pt1_rep1_actual.vmod", testVelocity: false);
@"TestData\Pwheel\Pwheel_Gear2_pt1_rep1_actual.vmod");
}
/// <summary>
......@@ -194,7 +194,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
ResultFileHelper.TestSumFile(@"TestData\Pwheel\Results\Pwheel_ultimate.vsum", @"TestData\Pwheel\Pwheel_ultimate.vsum");
ResultFileHelper.TestModFile(@"TestData\Pwheel\Results\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod",
@"TestData\Pwheel\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod", testVelocity: false);
@"TestData\Pwheel\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod");
}
}
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
Assert.IsTrue(job.FinishedWithoutErrors);
ResultFileHelper.TestModFile(expected, actual, testVelocity: false);
ResultFileHelper.TestModFile(expected, actual);
}
[TestMethod]
......@@ -89,7 +89,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
Assert.IsTrue(r.Run.FinishedWithoutErrors, string.Format("{0}", r.ExecException));
}
ResultFileHelper.TestModFile(expected, actual, testVelocity: false);
ResultFileHelper.TestModFile(expected, actual);
}
public IVectoRun CreateRun(string resultFileName)
......@@ -136,7 +136,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
@"TestData\Jobs\24t Coach EngineOnly_Engine Only1.vmod",
@"TestData\Jobs\24t Coach EngineOnly_Engine Only2.vmod",
@"TestData\Jobs\24t Coach EngineOnly_Engine Only3.vmod"
}, testVelocity: false)
})
;
}
}
......
......@@ -43,13 +43,13 @@ namespace TUGraz.VectoCore.Tests.Utils
public static class ResultFileHelper
{
public static void TestModFile(string expectedFile, string actualFile, string[] testColumns = null,
bool testRowCount = true, bool testVelocity = true)
bool testRowCount = true)
{
TestModFiles(new[] { expectedFile }, new[] { actualFile }, testColumns, testRowCount, testVelocity);
TestModFiles(new[] { expectedFile }, new[] { actualFile }, testColumns, testRowCount);
}
public static void TestModFiles(IEnumerable<string> expectedFiles, IEnumerable<string> actualFiles,
string[] testColumns = null, bool testRowcount = true, bool testVelocity = true)
string[] testColumns = null, bool testRowcount = true)
{
var resultFiles = expectedFiles.ZipAll(actualFiles, (expectedFile, actualFile) => new { expectedFile, actualFile });
foreach (var result in resultFiles) {
......@@ -59,17 +59,31 @@ namespace TUGraz.VectoCore.Tests.Utils
var expected = VectoCSVFile.Read(result.expectedFile);
var actual = VectoCSVFile.Read(result.actualFile);
if (testVelocity) {
Assert.IsTrue(
actual.Rows.Cast<DataRow>()
if (actual.Columns.Contains(ModalResultField.v_act.GetShortCaption()) &&
!double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.v_act.GetShortCaption()).ToDouble(double.NaN))) {
// test v_act >= 0
Assert.IsTrue(actual.Rows.Cast<DataRow>()
.All(r => r.ParseDouble(ModalResultField.v_act.GetShortCaption()).IsGreaterOrEqual(0)),
"v_act must not be negative.");
Assert.IsTrue(
actual.Rows.Cast<DataRow>()
// test v_targ >= 0
Assert.IsTrue(actual.Rows.Cast<DataRow>()
.All(r => r.ParseDouble(ModalResultField.v_targ.GetShortCaption()).IsGreaterOrEqual(0)),
"v_targ must not be negative.");
}
if (actual.Columns.Contains(ModalResultField.dist.GetShortCaption()) &&
!double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.dist.GetShortCaption()).ToDouble(double.NaN))) {
// test distance monotonous increasing
var distPrev = actual.Rows[0].ParseDouble(ModalResultField.dist.GetShortCaption());
for (var i = 1; i < actual.Rows.Count; i++) {
var dist = actual.Rows[i].ParseDouble(ModalResultField.dist.GetShortCaption());
Assert.IsTrue(distPrev.IsSmallerOrEqual(dist), "distance must not decrease.");
distPrev = dist;
}
}
if (testRowcount) {
Assert.AreEqual(expected.Rows.Count, actual.Rows.Count,
string.Format("Moddata: Row count differs.\nExpected {0} Rows in {1}\nGot {2} Rows in {3}", expected.Rows.Count,
......
......@@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.Tests.Utils
private static Size _diagramSize = new Size(1000, 800);
public static void DrawShiftPolygons(string title, EngineFullLoadCurve engineFld, List<ShiftPolygon> polygons,
public static void DrawShiftPolygons(string title, List<EngineFullLoadCurve> engineFld, List<ShiftPolygon> polygons,
string imageFileName, PerSecond speed85kmh, List<List<Point>> upshiftOrig = null,
List<List<Point>> downshiftTransformed = null, List<List<Point>> downshiftOrig = null)
{
......@@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.Tests.Utils
var chart = new Chart() {
Size = new Size((int)(_diagramSize.Width * numCols), (int)(_diagramSize.Height * numRows))
};
var maxX = engineFld.FullLoadEntries.Last().EngineSpeed.Value() / Constants.RPMToRad * 1.1;
var maxX = engineFld.First().FullLoadEntries.Last().EngineSpeed.Value() / Constants.RPMToRad * 1.1;
AddLegend(chart);
......@@ -70,8 +70,8 @@ namespace TUGraz.VectoCore.Tests.Utils
foreach (var shiftPolygon in polygons) {
var chartArea = AddChartArea(chart, "Gear " + (i + 1), "Engine Speed", "Torque", 0, maxX);
PlotPower(engineFld, chartArea, chart, "engine power " + i);
PlotFLD(engineFld, speed85kmh, chartArea, chart, "Engine Full Load " + i);
PlotPower(engineFld[i], chartArea, chart, "engine power " + i);
PlotFLD(engineFld[i], speed85kmh, chartArea, chart, "Engine Full Load " + i);
if (upshiftOrig != null && i < upshiftOrig.Count) {
PlotShiftLine("UpshiftOrig " + i, chartArea, chart, Color.Gray,
......
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