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

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

Merge branch 'develop' of...

Merge branch 'develop' of https://webgate.ec.europa.eu/CITnet/stash/scm/~emquarima/vecto-sim into feature/VECTO-260-aaux-lookup-cycle

# By Michael Krisper
# Via Michael Krisper (4) and QUARITSCH Markus (3)
* 'develop' of https://webgate.ec.europa.eu/CITnet/stash/scm/~emquarima/vecto-sim:
  removed TRACE var for Release, added function for printing the search iteration data
  IterationStatistics
  renamed Enabled --> Enable, and DisableLogging --> Init for test suite
  extended debug output only with TRACE defined
  added IterationStatistics for performance measuring
parents aee413b6 e4232b51
No related branches found
No related tags found
No related merge requests found
Showing
with 289 additions and 70 deletions
Job [-],Input File [-],Cycle [-],Status,Mass [kg],Loading [kg],time [s],distance [km],speed [km/h],altitudeDelta [m],FC-Map [g/h],FC-Map [g/km],FC-AUXc [g/h],FC-AUXc [g/km],FC-WHTCc [g/h],FC-WHTCc [g/km],FC-AAUX [g/h],FC-AAUX [g/km],FC-Final [g/h],FC-Final [g/km],FC-Final [l/100km],FC-Final [l/100tkm],CO2 [g/km],CO2 [g/tkm],P_wheel_in_pos [kW],P_brake_loss [kW],P_eng_out_pos [kW],P_eng_out_neg [kW],E_aux_FAN [kWh],E_aux_STP [kWh],E_aux_AC [kWh],E_aux_PS [kWh],E_aux_ES [kWh],E_aux_sum [kWh],E_air [kWh],E_roll [kWh],E_grad [kWh],E_inertia [kWh],E_brake [kWh],E_gbx_axl_loss [kWh],E_ret_loss [kWh],E_tc_loss [kWh],E_eng_out_pos [kWh],E_eng_out_neg [kWh],a [m/s^2],a_pos [m/s^2],a_neg [m/s^2],AccelerationTimeShare [%],DecelerationTimeShare [%],CruiseTimeShare [%],StopTimeShare [%]
2-0,12t Delivery Truck,LongHaul.vdri,Success,7750.0000,0.0000,4544.7743,100.1850,79.3584,-2.5494,14928.1995,188.1112,14928.1995,188.1112,15044.6394,189.5784,15044.6394,189.5784,15044.6394,189.5784,22.7859,,599.0678,,57.9544,0.8532,75.6554,-16.3708,0.8435,0.4672,0.2525,1.4900,2.2368,5.2901,50.6334,20.0004,-0.0512,0.0000,1.0772,15.9289,0.0000,0.0000,88.4933,-0.8804,0.0000,0.4627,-0.4662,4.3794,4.3134,0.0000,1.4742
2-1,12t Delivery Truck,LongHaul.vdri,Success,7750.0000,4150.0000,4574.5666,100.1850,78.8416,-2.5494,16547.5682,209.8838,16547.5682,209.8838,16676.6392,211.5209,16676.6392,211.5209,16676.6392,211.5209,25.4232,6.1261,668.4060,161.0617,66.6100,2.4444,86.0351,-15.8558,0.8490,0.4703,0.2542,1.4998,2.2515,5.3247,50.3756,29.4211,-0.0786,0.0000,3.1061,16.1961,0.0000,0.0000,100.0772,-1.0250,0.0000,0.4200,-0.4759,4.6568,4.0446,0.0000,1.4646
2-2,12t Delivery Truck,LongHaul.vdri,Success,7750.0000,4150.0000,4574.5666,100.1850,78.8416,-2.5494,16547.5682,209.8838,16547.5682,209.8838,16676.6392,211.5209,16676.6392,211.5209,16676.6392,211.5209,25.4232,6.1261,668.4060,161.0617,66.6100,2.4444,86.0351,-15.8558,0.8490,0.4703,0.2542,1.4998,2.2515,5.3247,50.3756,29.4211,-0.0786,0.0000,3.1061,16.1961,0.0000,0.0000,100.0772,-1.0250,0.0000,0.4200,-0.4759,4.6568,4.0446,0.0000,1.4646
2-3,12t Delivery Truck,RegionalDelivery.vdri,Success,7750.0000,0.0000,1580.7711,25.8360,58.8381,0.0101,10796.3012,183.4916,10796.3012,183.4916,10802.7790,183.6017,10802.7790,183.6017,10802.7790,183.6017,22.0675,,580.1814,,40.4898,2.2577,64.7531,-8.3571,0.3167,0.1406,0.0878,0.5622,0.6620,1.7693,10.7354,5.1202,-0.0001,0.0000,0.9913,4.0827,0.0000,0.0000,21.3940,-0.4322,0.0000,0.4901,-0.5314,13.9241,12.7848,0.0000,7.2117
2-4,12t Delivery Truck,RegionalDelivery.vdri,Success,7750.0000,2983.8900,1583.3376,25.8360,58.7427,0.0101,11907.2364,202.7014,11907.2364,202.7014,11914.3807,202.8230,11914.3807,202.8230,11914.3807,202.8230,24.3778,8.1698,640.9207,214.7937,46.7806,3.7696,75.9980,-11.2300,0.3172,0.1408,0.0880,0.5631,0.6631,1.7722,10.6922,6.8643,-0.0002,0.0000,1.6579,4.1756,0.0000,0.0000,24.1477,-0.7165,0.0000,0.4665,-0.5103,14.9810,13.4640,0.0000,7.2000
2-5,12t Delivery Truck,RegionalDelivery.vdri,Success,7750.0000,4150.0000,1584.9491,25.8360,58.6830,0.0101,12325.0194,210.0270,12325.0194,210.0270,12332.4144,210.1530,12332.4144,210.1530,12332.4144,210.1530,25.2588,6.0865,664.0836,160.0201,49.1906,4.3746,80.4332,-11.8038,0.3175,0.1409,0.0881,0.5637,0.6637,1.7740,10.6534,7.5320,-0.0002,0.0000,1.9260,4.2116,0.0000,0.0000,25.1871,-0.8189,0.0000,0.4431,-0.4858,15.9722,14.2677,0.0000,7.1927
2-6,12t Delivery Truck,UrbanDelivery.vdri,Aborted,7750.0000,0.0000,906.0032,4.9742,19.7651,-7.4125,4408.4726,223.0431,4408.4726,223.0431,4367.9147,220.9911,4367.9147,220.9911,4367.9147,220.9911,26.5614,,698.3320,,13.1643,5.0283,37.3407,-6.9963,0.1551,0.0781,0.0378,0.3324,0.3504,0.9537,0.5806,0.9857,-0.1559,0.0295,1.2655,0.8116,0.0000,0.0000,3.8777,-0.2921,0.0076,0.5538,-0.6160,20.9945,17.6796,0.0000,29.8428
2-7,12t Delivery Truck,UrbanDelivery.vdri,Aborted,7750.0000,2983.8900,686.4355,4.4473,23.3240,-6.5605,5871.9648,251.7561,5871.9648,251.7561,5817.9427,249.4399,5817.9427,249.4399,5817.9427,249.4399,29.9808,10.0475,788.2302,264.1620,20.5155,9.2052,50.6685,-7.5826,0.1175,0.0592,0.0286,0.2519,0.2655,0.7227,0.5563,1.1816,-0.1911,0.0290,1.7552,0.7508,0.0000,0.0000,4.4481,-0.2784,0.0100,0.5367,-0.6031,24.2336,20.0000,0.0000,21.4150
2-8,12t Delivery Truck,UrbanDelivery.vdri,Aborted,7750.0000,4150.0000,1995.5984,12.2235,22.0509,-7.3852,5664.0624,256.8634,5664.0624,256.8634,5611.9530,254.5002,5611.9530,254.5002,5611.9530,254.5002,30.5890,7.3708,804.2207,193.7881,19.8581,8.2179,52.3756,-8.3023,0.3416,0.1719,0.0832,0.7319,0.7715,2.1000,1.4655,3.5633,-0.2384,0.0294,4.5554,2.0750,0.0000,0.0000,12.5032,-0.8591,0.0035,0.5393,-0.5926,21.1028,18.7469,0.0000,25.9163
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
*/ */
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
namespace TUGraz.VectoCommon.Models namespace TUGraz.VectoCommon.Models
{ {
...@@ -65,6 +64,6 @@ namespace TUGraz.VectoCommon.Models ...@@ -65,6 +64,6 @@ namespace TUGraz.VectoCommon.Models
Second AbsTime { get; set; } Second AbsTime { get; set; }
Driver.OperatingPoint OperatingPoint { get; set; } OperatingPoint OperatingPoint { get; set; }
} }
} }
\ No newline at end of file
using System.Diagnostics;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCommon.Models
{
[DebuggerDisplay("a: {Acceleration}, dt: {SimulationInterval}, ds: {SimulationDistance}")]
public struct OperatingPoint
{
public MeterPerSquareSecond Acceleration;
public Meter SimulationDistance;
public Second SimulationInterval;
public override string ToString()
{
return string.Format("a: {0}, dt: {1}, ds: {2}", Acceleration, SimulationInterval, SimulationDistance);
}
}
}
\ No newline at end of file
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
<Compile Include="Models\GearboxType.cs" /> <Compile Include="Models\GearboxType.cs" />
<Compile Include="Models\IResponse.cs" /> <Compile Include="Models\IResponse.cs" />
<Compile Include="Models\LoggingObject.cs" /> <Compile Include="Models\LoggingObject.cs" />
<Compile Include="Models\OperatingPoint.cs" />
<Compile Include="Models\RetarderType.cs" /> <Compile Include="Models\RetarderType.cs" />
<Compile Include="Models\VehicleCategory.cs" /> <Compile Include="Models\VehicleCategory.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
......
...@@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl ...@@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
public Second AbsTime { get; set; } public Second AbsTime { get; set; }
public Driver.OperatingPoint OperatingPoint { get; set; } public OperatingPoint OperatingPoint { get; set; }
public PerSecond EngineSpeed { get; set; } public PerSecond EngineSpeed { get; set; }
......
...@@ -44,6 +44,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -44,6 +44,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
protected override IResponse DoSimulationStep() protected override IResponse DoSimulationStep()
{ {
IterationStatistics.StartIteration();
// estimate distance to be traveled within the next TargetTimeInterval // estimate distance to be traveled within the next TargetTimeInterval
var ds = Container.VehicleSpeed.IsEqual(0) var ds = Container.VehicleSpeed.IsEqual(0)
? Constants.SimulationSettings.DriveOffDistance ? Constants.SimulationSettings.DriveOffDistance
...@@ -52,6 +54,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -52,6 +54,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
var loopCount = 0; var loopCount = 0;
IResponse response; IResponse response;
do { do {
IterationStatistics.Increment(this, "Iterations");
Container.BrakePower = 0.SI<Watt>(); Container.BrakePower = 0.SI<Watt>();
response = CyclePort.Request(AbsTime, ds); response = CyclePort.Request(AbsTime, ds);
response.Switch(). response.Switch().
...@@ -72,6 +76,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -72,6 +76,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
} }
} while (!(response is ResponseSuccess || response is ResponseCycleFinished)); } while (!(response is ResponseSuccess || response is ResponseCycleFinished));
IterationStatistics.Increment(this, "Distance", Container.Distance.Value());
IterationStatistics.Increment(this, "Time", AbsTime.Value());
IterationStatistics.FinishIteration(AbsTime);
return response; return response;
} }
......
...@@ -145,6 +145,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -145,6 +145,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
} }
Container.RunStatus = Status.Success; Container.RunStatus = Status.Success;
Container.FinishSimulation(); Container.FinishSimulation();
IterationStatistics.FinishSimulation(RunName + CycleName + RunSuffix + RunIdentifier);
Log.Info("VectoJob finished."); Log.Info("VectoJob finished.");
} }
......
...@@ -144,6 +144,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -144,6 +144,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
IResponse ITnOutPort.Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun) IResponse ITnOutPort.Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun)
{ {
IterationStatistics.Increment(this, "Requests");
Log.Debug("Engine Powertrain Power Request: torque: {0}, angularVelocity: {1}, power: {2}", torque, angularVelocity, Log.Debug("Engine Powertrain Power Request: torque: {0}, angularVelocity: {1}, power: {2}", torque, angularVelocity,
torque * angularVelocity); torque * angularVelocity);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using iTextSharp.text.pdf;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
...@@ -101,6 +102,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -101,6 +102,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient)
{ {
IterationStatistics.Increment(this, "Requests");
Log.Debug("==== DRIVER Request (distance) ===="); Log.Debug("==== DRIVER Request (distance) ====");
Log.Debug( Log.Debug(
"Request: absTime: {0}, ds: {1}, targetVelocity: {2}, gradient: {3} | distance: {4}, velocity: {5}, vehicle stopped: {6}", "Request: absTime: {0}, ds: {1}, targetVelocity: {2}, gradient: {3} | distance: {4}, velocity: {5}, vehicle stopped: {6}",
...@@ -119,7 +122,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -119,7 +122,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient) public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient)
{ {
//VehicleStopped = true; IterationStatistics.Increment(this, "Requests");
Log.Debug("==== DRIVER Request (time) ===="); Log.Debug("==== DRIVER Request (time) ====");
Log.Debug( Log.Debug(
"Request: absTime: {0}, dt: {1}, targetVelocity: {2}, gradient: {3} | distance: {4}, velocity: {5} gear: {6}: vehicle stopped: {7}", "Request: absTime: {0}, dt: {1}, targetVelocity: {2}, gradient: {3} | distance: {4}, velocity: {5} gear: {6}: vehicle stopped: {7}",
...@@ -151,6 +155,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -151,6 +155,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse DrivingActionAccelerate(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, public IResponse DrivingActionAccelerate(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
IResponse previousResponse = null) IResponse previousResponse = null)
{ {
IterationStatistics.Increment(this, "Accelerate");
Log.Debug("DrivingAction Accelerate"); Log.Debug("DrivingAction Accelerate");
var operatingPoint = ComputeAcceleration(ds, targetVelocity); var operatingPoint = ComputeAcceleration(ds, targetVelocity);
...@@ -229,6 +235,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -229,6 +235,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns> /// <returns></returns>
public IResponse DrivingActionCoast(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient) public IResponse DrivingActionCoast(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient)
{ {
IterationStatistics.Increment(this, "Coast");
Log.Debug("DrivingAction Coast"); Log.Debug("DrivingAction Coast");
return CoastOrRollAction(absTime, ds, maxVelocity, gradient, false); return CoastOrRollAction(absTime, ds, maxVelocity, gradient, false);
...@@ -244,6 +251,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -244,6 +251,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns> /// <returns></returns>
public IResponse DrivingActionRoll(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient) public IResponse DrivingActionRoll(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient)
{ {
IterationStatistics.Increment(this, "Roll");
Log.Debug("DrivingAction Roll"); Log.Debug("DrivingAction Roll");
var retVal = CoastOrRollAction(absTime, ds, maxVelocity, gradient, true); var retVal = CoastOrRollAction(absTime, ds, maxVelocity, gradient, true);
...@@ -347,6 +356,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -347,6 +356,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient,
IResponse previousResponse = null, Meter targetDistance = null) IResponse previousResponse = null, Meter targetDistance = null)
{ {
IterationStatistics.Increment(this, "Brake");
Log.Debug("DrivingAction Brake"); Log.Debug("DrivingAction Brake");
IResponse retVal = null; IResponse retVal = null;
...@@ -360,8 +371,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -360,8 +371,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var nextAcceleration = DriverData.AccelerationCurve.Lookup(v2).Deceleration; var nextAcceleration = DriverData.AccelerationCurve.Lookup(v2).Deceleration;
var tmp = ComputeTimeInterval(VectoMath.Min(operatingPoint.Acceleration, nextAcceleration), var tmp = ComputeTimeInterval(VectoMath.Min(operatingPoint.Acceleration, nextAcceleration),
operatingPoint.SimulationDistance); operatingPoint.SimulationDistance);
if (!operatingPoint.Acceleration.IsEqual(nextAcceleration) && if (!operatingPoint.Acceleration.IsEqual(nextAcceleration) && operatingPoint.SimulationDistance.IsEqual(tmp.SimulationDistance)) {
operatingPoint.SimulationDistance.IsEqual(tmp.SimulationDistance)) {
// only adjust operating point if the acceleration is different but the simulation distance is not modified // only adjust operating point if the acceleration is different but the simulation distance is not modified
// i.e., braking to the next sample point (but a little bit slower) // i.e., braking to the next sample point (but a little bit slower)
Log.Debug("adjusting acceleration from {0} to {1}", operatingPoint.Acceleration, tmp.Acceleration); Log.Debug("adjusting acceleration from {0} to {1}", operatingPoint.Acceleration, tmp.Acceleration);
...@@ -500,13 +510,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -500,13 +510,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
private OperatingPoint SearchBrakingPower(Second absTime, Meter ds, Radian gradient, private OperatingPoint SearchBrakingPower(Second absTime, Meter ds, Radian gradient,
MeterPerSquareSecond acceleration, IResponse initialResponse) MeterPerSquareSecond acceleration, IResponse initialResponse)
{ {
IterationStatistics.Increment(this, "SearchBrakingPower", 0);
var operatingPoint = new OperatingPoint { SimulationDistance = ds, Acceleration = acceleration }; var operatingPoint = new OperatingPoint { SimulationDistance = ds, Acceleration = acceleration };
operatingPoint = ComputeTimeInterval(operatingPoint.Acceleration, ds); operatingPoint = ComputeTimeInterval(operatingPoint.Acceleration, ds);
Watt deltaPower = null; Watt deltaPower = null;
initialResponse.Switch(). initialResponse.Switch().
Case<ResponseGearShift>(r => { Case<ResponseGearShift>(r => {
var nextResp = NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, IterationStatistics.Increment(this, "SearchBrakingPower");
gradient, true); var nextResp = NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration,gradient, true);
deltaPower = nextResp.GearboxPowerRequest; deltaPower = nextResp.GearboxPowerRequest;
}). }).
Case<ResponseUnderload>(r => Case<ResponseUnderload>(r =>
...@@ -522,15 +534,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -522,15 +534,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
evaluateFunction: x => { evaluateFunction: x => {
DataBus.BrakePower = x; DataBus.BrakePower = x;
operatingPoint = ComputeTimeInterval(operatingPoint.Acceleration, ds); operatingPoint = ComputeTimeInterval(operatingPoint.Acceleration, ds);
return NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, gradient,
true); IterationStatistics.Increment(this, "SearchBrakingPower");
return NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, gradient,true);
}, },
criterion: result => { criterion: result => {
var response = (ResponseDryRun)result; var response = (ResponseDryRun)result;
var delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.GearboxPowerRequest; var delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.GearboxPowerRequest;
return delta.Value(); return delta.Value();
}); });
return operatingPoint; return operatingPoint;
} catch (Exception) { } catch (Exception) {
Log.Error("Failed to find operating point for braking power! absTime: {0}", absTime); Log.Error("Failed to find operating point for braking power! absTime: {0}", absTime);
throw; throw;
...@@ -540,6 +555,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -540,6 +555,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected OperatingPoint SearchOperatingPoint(Second absTime, Meter ds, Radian gradient, protected OperatingPoint SearchOperatingPoint(Second absTime, Meter ds, Radian gradient,
MeterPerSquareSecond acceleration, IResponse initialResponse, bool coastingOrRoll = false) MeterPerSquareSecond acceleration, IResponse initialResponse, bool coastingOrRoll = false)
{ {
IterationStatistics.Increment(this, "SearchOperatingPoint", 0);
var retVal = new OperatingPoint { Acceleration = acceleration, SimulationDistance = ds }; var retVal = new OperatingPoint { Acceleration = acceleration, SimulationDistance = ds };
var actionRoll = !DataBus.ClutchClosed(absTime); var actionRoll = !DataBus.ClutchClosed(absTime);
...@@ -557,7 +574,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -557,7 +574,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Default(r => { throw new UnexpectedResponseException("Unknown response type.", r); }); Default(r => { throw new UnexpectedResponseException("Unknown response type.", r); });
} }
var delta = origDelta; var delta = origDelta;
try { try {
retVal.Acceleration = SearchAlgorithm.Search(acceleration, delta, retVal.Acceleration = SearchAlgorithm.Search(acceleration, delta,
Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating, Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating,
...@@ -575,6 +591,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -575,6 +591,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
retVal.SimulationInterval = tmp.SimulationInterval; retVal.SimulationInterval = tmp.SimulationInterval;
retVal.SimulationDistance = tmp.SimulationDistance; retVal.SimulationDistance = tmp.SimulationDistance;
} }
IterationStatistics.Increment(this, "SearchOperatingPoint");
var response = NextComponent.Request(absTime, retVal.SimulationInterval, acc, gradient, true); var response = NextComponent.Request(absTime, retVal.SimulationInterval, acc, gradient, true);
response.OperatingPoint = retVal; response.OperatingPoint = retVal;
return response; return response;
...@@ -608,11 +625,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -608,11 +625,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
} }
if (!retVal.Acceleration.IsBetween(DriverData.AccelerationCurve.MaxDeceleration(), if (!retVal.Acceleration.IsBetween(DriverData.AccelerationCurve.MaxDeceleration(),
DriverData.AccelerationCurve.MaxAcceleration())) { DriverData.AccelerationCurve.MaxAcceleration())) {
Log.Info("Operating Point outside driver acceleration limits: a: {0}", retVal.Acceleration); Log.Info("Operating Point outside driver acceleration limits: a: {0}", retVal.Acceleration);
} }
return ComputeTimeInterval(retVal.Acceleration, retVal.SimulationDistance);
return ComputeTimeInterval(retVal.Acceleration, retVal.SimulationDistance);
} }
/// <summary> /// <summary>
...@@ -796,19 +812,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -796,19 +812,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Response; public IResponse Response;
} }
[DebuggerDisplay("a: {Acceleration}, dt: {SimulationInterval}, ds: {SimulationDistance}")]
public struct OperatingPoint
{
public MeterPerSquareSecond Acceleration;
public Meter SimulationDistance;
public Second SimulationInterval;
public override string ToString()
{
return string.Format("a: {0}, dt: {1}, ds: {2}", Acceleration, SimulationInterval, SimulationDistance);
}
}
[Flags] [Flags]
protected enum LimitationMode protected enum LimitationMode
{ {
......
...@@ -215,10 +215,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -215,10 +215,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </returns> /// </returns>
public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun) public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun)
{ {
IterationStatistics.Increment(this, "Requests");
Log.Debug("Gearbox Power Request: torque: {0}, angularVelocity: {1}", torque, angularVelocity); Log.Debug("Gearbox Power Request: torque: {0}, angularVelocity: {1}", torque, angularVelocity);
if (DataBus.VehicleStopped) { if (DataBus.VehicleStopped) {
_engageTime = absTime; _engageTime = absTime;
} }
IResponse retVal; IResponse retVal;
// TODO: MQ 2016/03/10: investigate further the effects of having the condition angularvelocity != 0 // TODO: MQ 2016/03/10: investigate further the effects of having the condition angularvelocity != 0
if (ClutchClosed(absTime) /* && !angularVelocity.IsEqual(0) */) { if (ClutchClosed(absTime) /* && !angularVelocity.IsEqual(0) */) {
......
...@@ -159,7 +159,8 @@ namespace TUGraz.VectoCore.Utils ...@@ -159,7 +159,8 @@ namespace TUGraz.VectoCore.Utils
/// <summary> /// <summary>
/// Draws the delaunay map (except supertriangle). /// Draws the delaunay map (except supertriangle).
/// </summary> /// </summary>
private void DrawGraph(int i, List<Triangle> triangles, Triangle superTriangle, double xmin, double xmax, double ymin, [Conditional("TRACE")]
private static void DrawGraph(int i, List<Triangle> triangles, Triangle superTriangle, double xmin, double xmax, double ymin,
double ymax, Point lastPoint = null) double ymax, Point lastPoint = null)
{ {
using (var chart = new Chart { Width = 1000, Height = 1000 }) { using (var chart = new Chart { Width = 1000, Height = 1000 }) {
......
using System;
using System.Collections.Generic;
namespace TUGraz.VectoCore.Utils
{
internal static class DictionaryExtensionMethods
{
public static object GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary,TKey key)
{
TValue value;
return dictionary.TryGetValue(key, out value) ? (object)value : DBNull.Value;
}
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.Utils
{
public static class IterationStatistics
{
private static readonly ThreadLocal<List<DataEntry>> DataLocal =
new ThreadLocal<List<DataEntry>>(() => new List<DataEntry>());
public static List<DataEntry> Data
{
get { return DataLocal.Value; }
}
private static readonly ThreadLocal<Stopwatch> TimerLocal = new ThreadLocal<Stopwatch>(Stopwatch.StartNew);
private static Stopwatch Timer
{
get { return TimerLocal.Value; }
}
private static readonly ThreadLocal<Dictionary<string, Dictionary<string, double>>> CurrentLocal =
new ThreadLocal<Dictionary<string, Dictionary<string, double>>>(
() => new Dictionary<string, Dictionary<string, double>>());
private static Dictionary<string, Dictionary<string, double>> Current
{
get { return CurrentLocal.Value; }
set { CurrentLocal.Value = value; }
}
[Conditional("TRACE")]
public static void Increment<T>(T o, string key, double? value = null)
{
var t = typeof(T).Name;
if (!Current.ContainsKey(t))
Current[t] = new Dictionary<string, double>();
if (Current[t].ContainsKey(key))
if (value.HasValue)
Current[t][key] += value.Value;
else
Current[t][key]++;
else {
if (value.HasValue)
Current[t][key] = value.Value;
else
Current[t][key] = 1;
}
}
public static void StartIteration()
{
Timer.Restart();
}
[Conditional("TRACE"), MethodImpl(MethodImplOptions.Synchronized)]
public static void FinishIteration(Second absTime)
{
Timer.Stop();
Data.Add(new DataEntry(absTime, Timer.Elapsed, Current));
Current = new Dictionary<string, Dictionary<string, double>>();
}
[Conditional("TRACE")]
public static void FinishSimulation(string runName)
{
var table = new DataTable();
table.Columns.Add("Distance", typeof(double));
table.Columns.Add("Time", typeof(double));
table.Columns.Add("StepDuration", typeof(double));
table.Columns.Add("StepIterationCount", typeof(double));
table.Columns.Add("NumDriverRequests", typeof(double));
table.Columns.Add("NumAccelActions", typeof(double));
table.Columns.Add("NumBrakeActions", typeof(double));
table.Columns.Add("NumCoastActions", typeof(double));
table.Columns.Add("NumRollActions", typeof(double));
table.Columns.Add("SearchOPIterations", typeof(double));
table.Columns.Add("SearchBrakeIterations", typeof(double));
table.Columns.Add("NumGearboxRequests", typeof(double));
table.Columns.Add("NumEngineRequests", typeof(double));
foreach (var entry in Data) {
var row = table.NewRow();
row["StepDuration"] = entry.Duration.TotalMilliseconds;
if (entry.Values.ContainsKey("DistanceRun")) {
row["Distance"] = entry.Values["DistanceRun"].GetValueOrNull("Distance");
row["Time"] = entry.Values["DistanceRun"].GetValueOrNull("Time");
row["StepIterationCount"] = entry.Values["DistanceRun"].GetValueOrNull("Iterations");
}
if (entry.Values.ContainsKey("Driver")) {
row["NumDriverRequests"] = entry.Values["Driver"].GetValueOrNull("Requests");
row["NumAccelActions"] = entry.Values["Driver"].GetValueOrNull("Accelerate");
row["NumBrakeActions"] = entry.Values["Driver"].GetValueOrNull("Brake");
row["NumCoastActions"] = entry.Values["Driver"].GetValueOrNull("Coast");
row["NumRollActions"] = entry.Values["Driver"].GetValueOrNull("Roll");
row["SearchOPIterations"] = entry.Values["Driver"].GetValueOrNull("SearchOperatingPoint");
row["SearchBrakeIterations"] = entry.Values["Driver"].GetValueOrNull("SearchBrakingPower");
}
if (entry.Values.ContainsKey("Gearbox")) {
row["NumGearboxRequests"] = entry.Values["Gearbox"].GetValueOrNull("Requests");
}
if (entry.Values.ContainsKey("CombustionEngine")) {
row["NumEngineRequests"] = entry.Values["CombustionEngine"].GetValueOrNull("Requests");
}
table.Rows.Add(row);
}
var writer = new StreamWriter("statistics_" + runName + ".csv");
VectoCSVFile.Write(writer, table);
}
public sealed class DataEntry
{
public readonly TimeSpan Duration;
public readonly Second Time;
public readonly Dictionary<string, Dictionary<string, double>> Values;
public DataEntry(Second time, TimeSpan duration, Dictionary<string, Dictionary<string, double>> values)
{
Time = time;
Duration = duration;
Values = values;
}
}
}
}
\ No newline at end of file
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
using System; using System;
using System.Data; using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading;
using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
...@@ -85,15 +88,15 @@ namespace TUGraz.VectoCore.Utils ...@@ -85,15 +88,15 @@ namespace TUGraz.VectoCore.Utils
/// abortCriterion: result => true/false /// abortCriterion: result => true/false
/// </code> /// </code>
/// </summary> /// </summary>
public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction,
Func<T, object> evaluateFunction, Func<object, double> criterion, Func<object, int, bool> abortCriterion, Func<object, double> criterion, Func<object, int, bool> abortCriterion, ref int iterationCount) where T : SIBase<T>
ref int iterationCount) where T : SIBase<T>
{ {
T result; T result;
try { try {
result = InterpolateLinear(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, result = InterpolateSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion,
ref iterationCount); ref iterationCount);
} catch (VectoException ex) { }
catch (VectoException ex) {
var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName);
log.Debug("Falling back to LineSearch. InterpolationSearch failed: " + ex.Message); log.Debug("Falling back to LineSearch. InterpolationSearch failed: " + ex.Message);
result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount);
...@@ -116,7 +119,7 @@ namespace TUGraz.VectoCore.Utils ...@@ -116,7 +119,7 @@ namespace TUGraz.VectoCore.Utils
var origY = y; var origY = y;
var debug = new DebugData(); var debug = new DebugData();
debug.Add(new { x, y }); debug.Add(new { x, y });
log.Debug("Log Disabled during Search LineSearch."); log.Debug("Log Disabled during LineSearch.");
LogManager.DisableLogging(); LogManager.DisableLogging();
try { try {
for (var count = 1; count < 100; count++, iterationCount++) { for (var count = 1; count < 100; count++, iterationCount++) {
...@@ -126,7 +129,6 @@ namespace TUGraz.VectoCore.Utils ...@@ -126,7 +129,6 @@ namespace TUGraz.VectoCore.Utils
interval *= intervalFactor; interval *= intervalFactor;
x += interval * -y.Sign(); x += interval * -y.Sign();
var result = evaluateFunction(x); var result = evaluateFunction(x);
y = getYValue(result); y = getYValue(result);
debug.Add(new { x, y, delta = criterion(result), result }); debug.Add(new { x, y, delta = criterion(result), result });
...@@ -135,6 +137,7 @@ namespace TUGraz.VectoCore.Utils ...@@ -135,6 +137,7 @@ namespace TUGraz.VectoCore.Utils
log.Debug("LineSearch found an operating point after {0} function calls.", count); log.Debug("LineSearch found an operating point after {0} function calls.", count);
//iterationCount += count; //iterationCount += count;
LogManager.DisableLogging(); LogManager.DisableLogging();
AppendDebug(debug);
return x; return x;
} }
if (abortCriterion != null && abortCriterion(result, iterationCount)) { if (abortCriterion != null && abortCriterion(result, iterationCount)) {
...@@ -153,29 +156,52 @@ namespace TUGraz.VectoCore.Utils ...@@ -153,29 +156,52 @@ namespace TUGraz.VectoCore.Utils
log.Error("Exceeded max iterations when searching for operating point!"); log.Error("Exceeded max iterations when searching for operating point!");
log.Error("debug: {0}", debug); log.Error("debug: {0}", debug);
//WriteSerach(debug, "LineSearch.csv"); WriteSearch(debug, "LineSearch.csv");
throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug);
} }
[Conditional("TRACE")]
private static void AppendDebug(DebugData debug)
{
var xmin = debug.Data.Min(d => d.x).Value();
var xmax = debug.Data.Max(d => d.x).Value();
var ymin = debug.Data.Min(d => d.y).Value();
var ymax = debug.Data.Max(d => d.y).Value();
var rand = new Random().Next();
using (var f = new StreamWriter(File.Open("LineSearch-" + Thread.CurrentThread.ManagedThreadId + "-statistics.csv", FileMode.Append))) {
foreach (var d in debug.Data) {
f.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}",
rand,
(d.x.Value()-xmin)/(xmax-xmin),
(d.y.Value()-ymin)/(ymax-ymin),
d.x.Value()/Math.Max(Math.Abs(xmax),Math.Abs(xmin)),
d.y.Value()/Math.Max(Math.Abs(ymax),Math.Abs(ymin)),
d.x, d.y));
}
}
}
/// <summary> /// <summary>
/// Interpolating Search algorithm. /// Interpolating Search algorithm.
/// Calculates linear equation of 2 points and jumps directly to root-point. /// Calculates linear equation of 2 points and jumps directly to root-point.
/// </summary> /// </summary>
private static T InterpolateLinear<T>(T x1, SI y1, T interval, Func<object, SI> getYValue, private static T InterpolateSearch<T>(T x1, SI y1, T interval, Func<object, SI> getYValue,
Func<T, object> evaluateFunction, Func<object, double> criterion, Func<object, int, bool> abortCriterion, Func<T, object> evaluateFunction, Func<object, double> criterion, Func<object, int, bool> abortCriterion,
ref int iterationCount) where T : SIBase<T> ref int iterationCount) where T : SIBase<T>
{ {
var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName);
var debug = new DebugData(); var debug = new DebugData();
debug.Add(new { x = x1, y = y1 }); debug.Add(new { x = x1, y = y1 });
log.Debug("Log Disabled during Search InterpolateLinear."); log.Debug("Log Disabled during InterpolateSearch.");
LogManager.DisableLogging(); LogManager.DisableLogging();
try { try {
var x2 = x1 + interval; var x2 = x1 + interval;
var result = evaluateFunction(x2); var result = evaluateFunction(x2);
if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) {
LogManager.EnableLogging(); LogManager.EnableLogging();
log.Debug("InterpolateLinear found an operating point after 1 function call."); log.Debug("InterpolateSearch found an operating point after 1 function call.");
AppendDebug(debug);
LogManager.DisableLogging(); LogManager.DisableLogging();
iterationCount++; iterationCount++;
return x2; return x2;
...@@ -196,8 +222,9 @@ namespace TUGraz.VectoCore.Utils ...@@ -196,8 +222,9 @@ namespace TUGraz.VectoCore.Utils
} }
debug.Add(new { x = x2, y = getYValue(result), delta = criterion(result), result }); debug.Add(new { x = x2, y = getYValue(result), delta = criterion(result), result });
LogManager.EnableLogging(); LogManager.EnableLogging();
log.Debug("InterpolateLinear could not get more exact. Aborting after {0} function calls.", count); log.Debug("InterpolateSearch could not get more exact. Aborting after {0} function calls.", count);
LogManager.DisableLogging(); LogManager.DisableLogging();
AppendDebug(debug);
//iterationCount += count; //iterationCount += count;
return x2; return x2;
} }
...@@ -206,9 +233,9 @@ namespace TUGraz.VectoCore.Utils ...@@ -206,9 +233,9 @@ namespace TUGraz.VectoCore.Utils
if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) {
debug.Add(new { x = x2, y = getYValue(result), delta = criterion(result), result }); debug.Add(new { x = x2, y = getYValue(result), delta = criterion(result), result });
LogManager.EnableLogging(); LogManager.EnableLogging();
log.Debug("InterpolateLinear found an operating point after {0} function calls.", count); log.Debug("InterpolateSearch found an operating point after {0} function calls.", count);
LogManager.DisableLogging(); LogManager.DisableLogging();
//iterationCount += count; AppendDebug(debug);
return x2; return x2;
} }
if (abortCriterion != null && abortCriterion(result, iterationCount)) { if (abortCriterion != null && abortCriterion(result, iterationCount)) {
...@@ -223,16 +250,16 @@ namespace TUGraz.VectoCore.Utils ...@@ -223,16 +250,16 @@ namespace TUGraz.VectoCore.Utils
LogManager.EnableLogging(); LogManager.EnableLogging();
} }
//iterationCount += 30; log.Debug("InterpolateSearch could not find an operating point.");
log.Debug("InterpolateLinear could not find an operating point.");
log.Error("Exceeded max iterations when searching for operating point!"); log.Error("Exceeded max iterations when searching for operating point!");
log.Error("debug: {0}", debug); log.Error("debug: {0}", debug);
//WriteSerach(debug, "InterpolateSearch.csv"); WriteSearch(debug, "InterpolateSearch.csv");
throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug);
} }
private static void WriteSerach(DebugData debug, string filename) [Conditional("TRACE")]
private static void WriteSearch(DebugData debug, string filename)
{ {
var table = new DataTable(); var table = new DataTable();
table.Columns.Add("x", typeof(double)); table.Columns.Add("x", typeof(double));
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
...@@ -74,7 +74,8 @@ ...@@ -74,7 +74,8 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
...@@ -202,6 +203,8 @@ ...@@ -202,6 +203,8 @@
</Compile> </Compile>
<Compile Include="Utils\DataTableExtensionMethods.cs" /> <Compile Include="Utils\DataTableExtensionMethods.cs" />
<Compile Include="Utils\DateTimeFallbackDeserializer.cs" /> <Compile Include="Utils\DateTimeFallbackDeserializer.cs" />
<Compile Include="Utils\DictionaryExtensionMethods.cs" />
<Compile Include="Utils\IterationStatistics.cs" />
<Compile Include="Utils\RessourceHelper.cs" /> <Compile Include="Utils\RessourceHelper.cs" />
<Compile Include="Models\Declaration\Segment.cs" /> <Compile Include="Models\Declaration\Segment.cs" />
<Compile Include="Models\Declaration\Axle.cs" /> <Compile Include="Models\Declaration\Axle.cs" />
......
...@@ -42,11 +42,15 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries ...@@ -42,11 +42,15 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
public class SimpleCycleTest public class SimpleCycleTest
{ {
[TestInitialize] [TestInitialize]
public void DisableLogging() public void Init()
{ {
LogManager.DisableLogging(); LogManager.DisableLogging();
//GraphWriter.Disable(); #if TRACE
GraphWriter.Enable();
#else
GraphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
GraphWriter.Yfields = new[] { GraphWriter.Yfields = new[] {
......
...@@ -42,7 +42,7 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -42,7 +42,7 @@ namespace TUGraz.VectoCore.Tests.Integration
{ {
var fileWriter = new FileOutputWriter(modFileName); var fileWriter = new FileOutputWriter(modFileName);
var modData = new ModalDataContainer(modFileName, fileWriter) { WriteAdvancedAux = true }; var modData = new ModalDataContainer(modFileName, fileWriter) { WriteAdvancedAux = true };
var container = new VehicleContainer(ExecutionMode.Engineering, modData); var container = new VehicleContainer(ExecutionMode.Engineering, modData) { RunData = new VectoRunData { JobName = modFileName, Cycle = cycleData } };
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile);
var axleGearData = CreateAxleGearData(); var axleGearData = CreateAxleGearData();
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
...@@ -61,7 +62,7 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -61,7 +62,7 @@ namespace TUGraz.VectoCore.Tests.Integration
public static VectoRun CreateEngineeringRun(DrivingCycleData cycleData, string modFileName, public static VectoRun CreateEngineeringRun(DrivingCycleData cycleData, string modFileName,
bool overspeed = false) bool overspeed = false)
{ {
var container = CreatePowerTrain(cycleData, modFileName.Replace(".vmod", ""), overspeed); var container = CreatePowerTrain(cycleData, Path.GetFileNameWithoutExtension(modFileName), overspeed);
return new DistanceRun(container); return new DistanceRun(container);
} }
...@@ -70,7 +71,7 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -70,7 +71,7 @@ namespace TUGraz.VectoCore.Tests.Integration
{ {
var fileWriter = new FileOutputWriter(modFileName); var fileWriter = new FileOutputWriter(modFileName);
var modData = new ModalDataContainer(modFileName, fileWriter); var modData = new ModalDataContainer(modFileName, fileWriter);
var container = new VehicleContainer(ExecutionMode.Engineering, modData, null); var container = new VehicleContainer(ExecutionMode.Engineering, modData, null) { RunData = new VectoRunData{JobName = modFileName, Cycle = cycleData }};
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile);
var axleGearData = CreateAxleGearData(); var axleGearData = CreateAxleGearData();
......
...@@ -39,11 +39,14 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy ...@@ -39,11 +39,14 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
public class DriverStrategyTestCoach public class DriverStrategyTestCoach
{ {
[TestInitialize] [TestInitialize]
public void DisableLogging() public void Init()
{ {
//LogManager.DisableLogging(); //LogManager.DisableLogging();
//GraphWriter.Disable(); #if TRACE
GraphWriter.Enable();
#else
GraphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
GraphWriter.Yfields = new[] { GraphWriter.Yfields = new[] {
......
...@@ -43,7 +43,11 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy ...@@ -43,7 +43,11 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
public void DisableLogging() public void DisableLogging()
{ {
//LogManager.DisableLogging(); //LogManager.DisableLogging();
//GraphWriter.Disable(); #if TRACE
GraphWriter.Enable();
#else
GraphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
......
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