Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 5d1ec14e authored by Michael KRISPER's avatar Michael KRISPER
Browse files

pwheel finished. some other tests failing.

parent f712ae09
No related branches found
No related tags found
No related merge requests found
Showing
with 209 additions and 114 deletions
......@@ -23,7 +23,7 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus
/// Defines interfaces for all different cockpits to access shared data of the powertrain.
/// </summary>
public interface IDataBus : IGearboxInfo, IEngineInfo, IVehicleInfo, IMileageCounter, IClutchInfo, IBrakes,
IRoadLookAhead, IDriverInfo
IRoadLookAhead, IDriverInfo, IDrivingCycleInfo
{
ExecutionMode ExecutionMode { get; set; }
}
......
......@@ -58,7 +58,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
var cycle = new PowertrainDrivingCycle(_container, data.Cycle);
var directAux = new Auxiliary(_container);
directAux.AddDirect(cycle);
directAux.AddDirect();
cycle.InPort().Connect(directAux.OutPort());
......@@ -70,31 +70,35 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
private VehicleContainer BuildPWheel(VectoRunData data)
{
var cycle = new PWheelCycle(_container, data.Cycle, data.AxleGearData.Ratio,
data.GearboxData.Gears.ToDictionary(g => g.Key, g => g.Value.Ratio));
data.GearboxData.Type = GearboxType.PWheel;
var gearbox = GetGearbox(_container, data.GearboxData);
var cycle = new PWheelCycle(_container, data.Cycle, data.AxleGearData.Ratio, (Gearbox)gearbox);
var tmp = AddComponent(cycle, new AxleGear(_container, data.AxleGearData));
switch (data.Retarder.Type) {
case RetarderData.RetarderType.Primary:
tmp = AddComponent(tmp, new Retarder(_container, data.Retarder.LossMap));
tmp = AddComponent(tmp, GetGearbox(_container, data.GearboxData));
tmp = AddComponent(tmp, gearbox);
break;
case RetarderData.RetarderType.Secondary:
tmp = AddComponent(tmp, GetGearbox(_container, data.GearboxData));
tmp = AddComponent(tmp, gearbox);
tmp = AddComponent(tmp, new Retarder(_container, data.Retarder.LossMap));
break;
case RetarderData.RetarderType.None:
tmp = AddComponent(tmp, GetGearbox(_container, data.GearboxData));
tmp = AddComponent(tmp, gearbox);
break;
case RetarderData.RetarderType.LossesIncludedInTransmission:
tmp = AddComponent(tmp, GetGearbox(_container, data.GearboxData));
tmp = AddComponent(tmp, gearbox);
break;
default:
throw new ArgumentOutOfRangeException();
}
var engine = new CombustionEngine(_container, data.EngineData);
// pWheel: pt1 disabled!!
var engine = new CombustionEngine(_container, data.EngineData, pt1Disabled: true);
var clutch = new Clutch(_container, data.EngineData, engine.IdleController);
// gearbox --> clutch
......@@ -109,10 +113,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
aux.AddConstant(auxData.ID, auxData.PowerDemand);
break;
case AuxiliaryDemandType.Direct:
aux.AddDirect(cycle);
aux.AddDirect();
break;
case AuxiliaryDemandType.Mapping:
aux.AddMapping(auxData.ID, cycle, auxData.Data);
aux.AddMapping(auxData.ID, auxData.Data);
break;
}
_modData.AddAuxiliary(auxData.ID);
......@@ -184,10 +188,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
aux.AddConstant(auxData.ID, auxData.PowerDemand);
break;
case AuxiliaryDemandType.Direct:
aux.AddDirect(cycle);
aux.AddDirect();
break;
case AuxiliaryDemandType.Mapping:
aux.AddMapping(auxData.ID, cycle, auxData.Data);
aux.AddMapping(auxData.ID, auxData.Data);
break;
}
_modData.AddAuxiliary(auxData.ID);
......@@ -218,6 +222,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
case GearboxType.Custom:
strategy = new CustomShiftStrategy(data, container);
break;
case GearboxType.PWheel:
strategy = new PWheelShiftStrategy(data, container);
break;
default:
throw new VectoSimulationException("Unknown Gearbox Type: {0}", data.Type);
}
......
......@@ -41,6 +41,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
internal IClutchInfo Clutch;
internal IDrivingCycleInfo DrivingCycle;
internal IRoadLookAhead Road;
internal ISimulationOutPort Cycle;
......@@ -150,7 +152,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
ExecutionMode executionMode = ExecutionMode.Declaration)
{
ModData = modData;
WriteSumData = writeSumData ?? delegate {};
WriteSumData = writeSumData ?? delegate { };
ExecutionMode = executionMode;
}
......@@ -179,9 +181,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
.If<IMileageCounter>(c => MilageCounter = c)
.If<IBrakes>(c => Brakes = c)
.If<IRoadLookAhead>(c => Road = c)
.If<IClutchInfo>(c => Clutch = c);
.If<IClutchInfo>(c => Clutch = c)
.If<IDrivingCycleInfo>(c => DrivingCycle = c);
}
public void CommitSimulationStep(Second time, Second simulationInterval)
{
Log.Info("VehicleContainer committing simulation. time: {0}, dist: {1}, speed: {2}", time, Distance, VehicleSpeed);
......@@ -267,5 +271,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
public VectoRunData RunData { get; set; }
public ExecutionMode ExecutionMode { get; set; }
public CycleData CycleData
{
get { return DrivingCycle.CycleData; }
}
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@
* limitations under the Licence.
*/
using System;
using System.ComponentModel.DataAnnotations;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
......
......@@ -25,7 +25,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
MT, // Manual Transmission
AMT, // Automated Manual Transmission
AT, // Automatic Transmission
Custom
Custom,
PWheel // for PWheel Mode where the gear is given by the cycle
}
public static class GearBoxTypeExtension
......
......@@ -27,6 +27,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
/// <summary>
/// Returns the data samples for the current position in the cycle.
/// </summary>
CycleData CycleData();
CycleData CycleData { get; }
}
}
\ No newline at end of file
......@@ -14,7 +14,6 @@
* limitations under the Licence.
*/
using TUGraz.VectoCore.Models.Connector.Ports;
using TUGraz.VectoCore.Models.Simulation.DataBus;
namespace TUGraz.VectoCore.Models.SimulationComponent
......
......@@ -122,21 +122,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
_auxDict[auxId] = speed => powerDemand;
}
public void AddDirect(IDrivingCycleInfo cycle)
public void AddDirect()
{
_auxDict[DirectAuxiliaryId] = speed => cycle.CycleData().LeftSample.AdditionalAuxPowerDemand;
_auxDict[DirectAuxiliaryId] = speed => DataBus.CycleData.LeftSample.AdditionalAuxPowerDemand;
}
public void AddMapping(string auxId, IDrivingCycleInfo cycle, AuxiliaryData data)
public void AddMapping(string auxId, AuxiliaryData data)
{
if (!cycle.CycleData().LeftSample.AuxiliarySupplyPower.ContainsKey("Aux_" + auxId)) {
if (!DataBus.CycleData.LeftSample.AuxiliarySupplyPower.ContainsKey("Aux_" + auxId)) {
var error = string.Format("driving cycle does not contain column for auxiliary: {0}", auxId);
Log.Error(error);
throw new VectoException(error);
}
_auxDict[auxId] = speed => {
var powerSupply = cycle.CycleData().LeftSample.AuxiliarySupplyPower["Aux_" + auxId];
var powerSupply = DataBus.CycleData.LeftSample.AuxiliarySupplyPower["Aux_" + auxId];
var nAuxiliary = speed * data.TransmissionRatio;
var powerAuxOut = powerSupply / data.EfficiencyToSupply;
var powerAuxIn = data.GetPowerDemand(nAuxiliary, powerAuxOut);
......
......@@ -36,6 +36,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </summary>
public class CombustionEngine : VectoSimulationComponent, ICombustionEngine, ITnOutPort
{
public bool PT1Disabled { get; set; }
public enum EngineOperationMode
{
Idle,
......@@ -63,9 +65,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected internal readonly CombustionEngineData Data;
public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData data)
public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData data, bool pt1Disabled = false)
: base(cockpit)
{
PT1Disabled = pt1Disabled;
Data = data;
PreviousState.OperationMode = EngineOperationMode.Idle;
......@@ -148,6 +151,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
CurrentState.EnginePower = LimitEnginePower(requestedEnginePower);
// = requestedEnginePower; //todo + _currentState.EnginePowerLoss;
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
var delta = requestedEnginePower - CurrentState.EnginePower;
if (delta.IsGreater(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) {
......@@ -160,15 +167,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
if (delta.IsSmaller(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) {
Log.Debug("requested engine power is below drag power: delta: {0}", delta);
return new ResponseUnderload { Delta = delta, EnginePowerRequest = requestedEnginePower, Source = this };
return new ResponseUnderload {
AbsTime = absTime,
Delta = delta,
EnginePowerRequest = requestedEnginePower,
Source = this
};
}
UpdateEngineState(CurrentState.EnginePower);
// = requestedEnginePower; //todo + _currentState.EnginePowerLoss;
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
UpdateEngineState(CurrentState.EnginePower);
return new ResponseSuccess { EnginePowerRequest = requestedEnginePower };
}
......@@ -315,11 +326,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var stationaryFullLoadTorque = Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity);
var stationaryFullLoadPower = stationaryFullLoadTorque * angularVelocity;
var pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value();
var powerRatio = PreviousState.EnginePower / stationaryFullLoadPower;
var tStarPrev = pt1 * Math.Log(1 / (1 - powerRatio.Value())).SI<Second>();
var tStar = tStarPrev + PreviousState.dt;
var dynFullPower = stationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value()));
Watt dynFullPower;
if (PT1Disabled) {
dynFullPower = stationaryFullLoadPower;
} else {
var pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value();
var powerRatio = PreviousState.EnginePower / stationaryFullLoadPower;
var tStarPrev = pt1 * Math.Log(1 / (1 - powerRatio.Value())).SI<Second>();
var tStar = tStarPrev + PreviousState.dt;
dynFullPower = stationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value()));
}
CurrentState.StationaryFullLoadPower = stationaryFullLoadPower;
CurrentState.StationaryFullLoadTorque = stationaryFullLoadTorque;
......@@ -330,6 +347,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Log.Debug("FullLoad: torque: {0}, power: {1}", CurrentState.DynamicFullLoadTorque, CurrentState.DynamicFullLoadPower);
}
protected bool IsFullLoad(Watt requestedPower, Watt maxPower)
{
var testValue = (requestedPower / maxPower).Cast<Scalar>() - 1.0;
......
......@@ -326,14 +326,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return LookAhead((LookaheadTimeSafetyMargin * DataBus.VehicleSpeed * time).Cast<Meter>());
}
public CycleData CycleData()
public CycleData CycleData
{
return new CycleData {
AbsTime = CurrentState.AbsTime,
AbsDistance = CurrentState.Distance,
LeftSample = CycleIntervalIterator.LeftSample,
RightSample = CycleIntervalIterator.RightSample
};
get
{
return new CycleData {
AbsTime = CurrentState.AbsTime,
AbsDistance = CurrentState.Distance,
LeftSample = CycleIntervalIterator.LeftSample,
RightSample = CycleIntervalIterator.RightSample
};
}
}
public class DrivingCycleEnumerator : IEnumerator<DrivingCycleData.DrivingCycleEntry>
......
......@@ -54,7 +54,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <summary>
/// True if gearbox is disengaged (no gear is set).
/// </summary>
protected bool Disengaged = true;
protected internal bool Disengaged = true;
/// <summary>
/// The power loss for the mod data.
......@@ -219,7 +219,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
ShiftTime = absTime;
}
IResponse retVal;
if (ClutchClosed(absTime)) {
if (DataBus.ClutchClosed(absTime)) {
retVal = RequestGearEngaged(absTime, dt, torque, angularVelocity, dryRun);
} else {
retVal = RequestGearDisengaged(absTime, dt, torque, angularVelocity, dryRun);
......
......@@ -98,16 +98,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
var request = NextComponent.Request(absTime, dt, LeftSample.Current.Torque, LeftSample.Current.AngularVelocity);
request.Switch()
.Case<ResponseSuccess>(() => {
// if response successfull update internal AbsTime for DoCommit
AbsTime = absTime + dt;
var response = NextComponent.Request(absTime, dt, LeftSample.Current.Torque,
DataBus.ClutchClosed(absTime) ? LeftSample.Current.AngularVelocity : 0.SI<PerSecond>());
AbsTime = absTime + dt;
response.Switch()
.Case<ResponseUnderload>(r => {
Log.Warn("PowertrainDrivingCycle got an underload response. Using PDrag.");
response = new ResponseSuccess();
})
.Case<ResponseOverload>(r => {
Log.Warn("PowertrainDrivingCycle got an underload response. Using PFullLoad.");
response = new ResponseSuccess();
})
.Case<ResponseSuccess>(() => { })
.Default(
r => { throw new UnexpectedResponseException("PowertrainDrivingCycle received an unexpected response.", r); });
return request;
return response;
}
public IResponse Initialize()
......@@ -155,42 +164,58 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
#endregion
public CycleData CycleData()
public CycleData CycleData
{
return new CycleData {
AbsTime = LeftSample.Current.Time,
AbsDistance = null,
LeftSample = LeftSample.Current,
RightSample = RightSample.Current,
};
get
{
return new CycleData {
AbsTime = LeftSample.Current.Time,
AbsDistance = null,
LeftSample = LeftSample.Current,
RightSample = RightSample.Current,
};
}
}
}
/// <summary>
/// Driving Cycle for the PWheel driving cycle.
/// </summary>
public class PWheelCycle : PowertrainDrivingCycle, IDriverInfo
public class PWheelCycle : PowertrainDrivingCycle, IDriverInfo, IClutchInfo
{
public Gearbox Gearbox { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PWheelCycle"/> class.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="cycle">The cycle.</param>
/// <param name="axleRatio">The axle ratio.</param>
/// <param name="gears">The gears.</param>
public PWheelCycle(IVehicleContainer container, DrivingCycleData cycle, double axleRatio,
IDictionary<uint, double> gears) : base(container, cycle)
/// <param name="gearbox"></param>
public PWheelCycle(IVehicleContainer container, DrivingCycleData cycle, double axleRatio, Gearbox gearbox)
: base(container, cycle)
{
if (!gears.ContainsKey(0)) {
gears[0] = 1;
}
Gearbox = gearbox;
foreach (var entry in Data.Entries) {
entry.AngularVelocity = entry.AngularVelocity / (axleRatio * gears[entry.Gear]);
entry.AngularVelocity = entry.AngularVelocity /
(axleRatio * (entry.Gear == 0 ? 1 : Gearbox.Data.Gears[entry.Gear].Ratio));
entry.Torque = entry.PWheel / entry.AngularVelocity;
}
}
public override IResponse Request(Second absTime, Second dt)
{
if (RightSample.Current == null) {
return new ResponseCycleFinished { Source = this };
}
Gearbox.Gear = LeftSample.Current.Gear;
Gearbox.Disengaged = LeftSample.Current.Gear == 0;
return base.Request(absTime, dt);
}
protected override void DoWriteModalResults(IModalDataContainer container)
{
container[ModalResultField.Pwheel] = LeftSample.Current.PWheel;
......@@ -204,15 +229,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </summary>
public bool VehicleStopped
{
get { return LeftSample.Current.AngularVelocity.IsEqual(0); }
}
public override IResponse Request(Second absTime, Second dt)
{
if (RightSample.Current == null) {
return new ResponseCycleFinished { Source = this };
}
return base.Request(absTime, dt);
get { return LeftSample.Current.PWheel.Abs().IsEqual(0); }
}
/// <summary>
......@@ -224,5 +241,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
#endregion
public bool ClutchClosed(Second absTime)
{
return LeftSample.Current.Gear != 0;
}
}
}
\ No newline at end of file
......@@ -351,6 +351,34 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
}
/// <summary>
/// Shift Strategy for PWheel Mode. The Cycle should set the gear, therefore the shift strategy has nothing to do.
/// </summary>
public class PWheelShiftStrategy : ShiftStrategy
{
public PWheelShiftStrategy(GearboxData data, IDataBus bus) : base(data, bus) {}
public override uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed)
{
return DataBus.CycleData.LeftSample.Gear;
}
public override void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed) {}
public override bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque,
PerSecond inAngularSpeed, uint gear, Second lastShiftTime)
{
return false;
}
public override uint InitGear(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed)
{
return DataBus.CycleData.LeftSample.Gear;
}
}
// TODO Implement ATShiftStrategy
public class ATShiftStrategy : ShiftStrategy
{
......
......@@ -123,15 +123,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
#endregion
public CycleData CycleData()
public CycleData CycleData
{
//todo: leftsample, rightsample
return new CycleData {
AbsTime = 0.SI<Second>(),
AbsDistance = 0.SI<Meter>(),
LeftSample = null,
RightSample = null
};
get
{
return new CycleData {
AbsTime = 0.SI<Second>(),
AbsDistance = 0.SI<Meter>(),
LeftSample = null,
RightSample = null
};
}
}
}
}
\ No newline at end of file
/*
/*
* Copyright 2015 European Union
*
* Licensed under the EUPL (the "Licence");
......@@ -13,7 +13,6 @@
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
using System.Reflection;
[assembly: AssemblyVersion("3.0.1.334")]
[assembly: AssemblyFileVersion("3.0.1.334")]
\ No newline at end of file
[assembly: AssemblyVersion("3.0.1.397")]
[assembly: AssemblyFileVersion("3.0.1.397")]
......@@ -49,7 +49,7 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle
MockSimulationDataFactory.CreateEngineDataFromFile(TestContext.DataRow["EngineFile"].ToString());
var aux = new Auxiliary(vehicle);
aux.AddDirect(cycle);
aux.AddDirect();
var engine = new EngineOnlyCombustionEngine(vehicle, engineData);
......
......@@ -137,7 +137,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
var aux = new Auxiliary(container);
aux.InPort().Connect(port);
aux.AddDirect(cycle);
aux.AddDirect();
var speed = 2358.RPMtoRad();
var torque = 500.SI<NewtonMeter>();
......@@ -179,8 +179,8 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
// efficiency_engine = 0.96
// efficiency_supply = 0.98
aux.AddMapping("ALT1", cycle, auxData);
aux.AddDirect(cycle);
aux.AddMapping("ALT1", auxData);
aux.AddDirect();
var constPower = 1200.SI<Watt>();
aux.AddConstant("CONSTANT", constPower);
......@@ -238,7 +238,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
// efficiency_engine = 0.96
// efficiency_supply = 0.98
aux.AddMapping(auxId, cycle, auxData);
aux.AddMapping(auxId, auxData);
var speed = 578.22461991.RPMtoRad(); // = 2358 (nAuxiliary) * ratio
var torque = 500.SI<NewtonMeter>();
......@@ -276,7 +276,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
var cycle = new MockDrivingCycle(container, data);
var aux = new Auxiliary(container);
AssertHelper.Exception<VectoException>(() => aux.AddMapping("NONEXISTING_AUX", cycle, null),
AssertHelper.Exception<VectoException>(() => aux.AddMapping("NONEXISTING_AUX", null),
"driving cycle does not contain column for auxiliary: NONEXISTING_AUX");
}
......
......@@ -35,25 +35,31 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
Stream cycleFile = new MemoryStream(Encoding.UTF8.GetBytes(inputData));
var drivingCycle = DrivingCycleDataReader.ReadFromStream(cycleFile, CycleType.PWheel);
var cycle = new PWheelCycle(container, drivingCycle, 2.3, new Dictionary<uint, double> { { 2, 3.5 } });
Assert.AreEqual(cycle.CycleData().LeftSample.Time, 1.SI<Second>());
Assert.AreEqual(cycle.CycleData().RightSample.Time, 2.SI<Second>());
var gearbox = new Gearbox(container,
new GearboxData {
Gears = new Dictionary<uint, GearData> { { 1, new GearData { Ratio = 2.0 } }, { 2, new GearData { Ratio = 3.5 } } }
}, new PWheelShiftStrategy(null, container));
Assert.AreEqual(1748.RPMtoRad() / (2.3 * 3.5), cycle.CycleData().LeftSample.AngularVelocity);
Assert.AreEqual(1400.RPMtoRad() / (2.3 * 3.5), cycle.CycleData().RightSample.AngularVelocity);
var cycle = new PWheelCycle(container, drivingCycle, 2.3, gearbox);
Assert.AreEqual(89.SI().Kilo.Watt, cycle.CycleData().LeftSample.PWheel);
Assert.AreEqual(120.SI().Kilo.Watt, cycle.CycleData().RightSample.PWheel);
Assert.AreEqual(container.CycleData.LeftSample.Time, 1.SI<Second>());
Assert.AreEqual(container.CycleData.RightSample.Time, 2.SI<Second>());
Assert.AreEqual(2u, cycle.CycleData().LeftSample.Gear);
Assert.AreEqual(2u, cycle.CycleData().RightSample.Gear);
Assert.AreEqual(1748.RPMtoRad() / (2.3 * 3.5), container.CycleData.LeftSample.AngularVelocity);
Assert.AreEqual(1400.RPMtoRad() / (2.3 * 3.5), container.CycleData.RightSample.AngularVelocity);
Assert.AreEqual(1300.SI<Watt>(), cycle.CycleData().LeftSample.AdditionalAuxPowerDemand);
Assert.AreEqual(400.SI<Watt>(), cycle.CycleData().RightSample.AdditionalAuxPowerDemand);
Assert.AreEqual(89.SI().Kilo.Watt, container.CycleData.LeftSample.PWheel);
Assert.AreEqual(120.SI().Kilo.Watt, container.CycleData.RightSample.PWheel);
Assert.AreEqual(89.SI().Kilo.Watt / (1748.RPMtoRad() / (2.3 * 3.5)), cycle.CycleData().LeftSample.Torque);
Assert.AreEqual(120.SI().Kilo.Watt / (1400.RPMtoRad() / (2.3 * 3.5)), cycle.CycleData().RightSample.Torque);
Assert.AreEqual(2u, container.CycleData.LeftSample.Gear);
Assert.AreEqual(2u, container.CycleData.RightSample.Gear);
Assert.AreEqual(1300.SI<Watt>(), container.CycleData.LeftSample.AdditionalAuxPowerDemand);
Assert.AreEqual(400.SI<Watt>(), container.CycleData.RightSample.AdditionalAuxPowerDemand);
Assert.AreEqual(89.SI().Kilo.Watt / (1748.RPMtoRad() / (2.3 * 3.5)), container.CycleData.LeftSample.Torque);
Assert.AreEqual(120.SI().Kilo.Watt / (1400.RPMtoRad() / (2.3 * 3.5)), container.CycleData.RightSample.Torque);
}
/// <summary>
......@@ -119,7 +125,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
jobContainer.WaitFinished();
Assert.IsTrue(jobContainer.Runs.All(r => r.Success));
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Join("", jobContainer.Runs.Select(r => r.ExecException)));
ResultFileHelper.TestSumFile(@"TestData\Results\Pwheel\Atego_ges.v2.vsum", @"TestData\Jobs\Pwheel.vsum");
......@@ -147,8 +153,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
jobContainer.WaitFinished();
Assert.IsTrue(jobContainer.Runs.All(r => r.Success),
string.Join("", jobContainer.Runs.Select(r => r.ExecException.ToString())));
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Join("", jobContainer.Runs.Select(r => r.ExecException)));
ResultFileHelper.TestModFile(@"TestData\Results\Pwheel\Atego_HDVCO2_RD_#1_AuxStd.vmod",
@"TestData\Jobs\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod");
......
......@@ -47,14 +47,17 @@ namespace TUGraz.VectoCore.Tests.Utils
}
public CycleData CycleData()
public CycleData CycleData
{
return new CycleData {
AbsTime = 0.SI<Second>(),
AbsDistance = 0.SI<Meter>(),
LeftSample = _left.Current,
RightSample = _right.Current
};
get
{
return new CycleData {
AbsTime = 0.SI<Second>(),
AbsDistance = 0.SI<Meter>(),
LeftSample = _left.Current,
RightSample = _right.Current
};
}
}
protected override void DoWriteModalResults(IModalDataContainer container)
......
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