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

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

adapt p1 testcases to use smaller EM, smaller battery,

driving constant speed P1 hybrid works
AT gearbox trigger gearshift from hybrid strateyg,
hybrid strategy for AT - do not issue dryrun requests to bypass torque converter search
electric motor: do not throw execptions if used on test-powertrain
parent 3692d9d0
No related branches found
No related tags found
No related merge requests found
......@@ -156,6 +156,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public override void TriggerGearshift(Second absTime, Second dt)
{
//throw new System.NotImplementedException();
RequestAfterGearshift = true;
}
public override IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity)
......
......@@ -197,18 +197,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var avgEngineSpeed = GetEngineSpeed(angularVelocity);
var engineSpeedLimit = GetEngineSpeedLimit(absTime);
if (!dryRun && !angularVelocity.IsSmallerOrEqual(engineSpeedLimit)) {
if (DataBus.HybridControllerInfo?.ICESpeed != null && DataBus.HybridControllerInfo.ICESpeed != angularVelocity) {
return new ResponseInvalidOperatingPoint(this);
}
return new ResponseEngineSpeedTooHigh(this) {
DeltaEngineSpeed = avgEngineSpeed - engineSpeedLimit,
Engine = {
EngineSpeed = angularVelocity
}
};
}
var fullDragTorque = ModelData.FullLoadCurves[DataBus.GearboxInfo.Gear.Gear].DragLoadStationaryTorque(avgEngineSpeed);
var stationaryFullLoadTorque = ModelData.FullLoadCurves[DataBus.GearboxInfo.Gear.Gear].FullLoadStationaryTorque(avgEngineSpeed);
var dynamicFullLoadPower = ComputeFullLoadPower(avgEngineSpeed, stationaryFullLoadTorque, dt, dryRun);
......@@ -236,7 +225,49 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var deltaFull = totalTorqueDemand - dynamicFullLoadTorque;
//ComputeDelta(torqueOut, totalTorqueDemand, dynamicFullLoadTorque, gearboxFullLoad, true);
var deltaDrag = totalTorqueDemand - fullDragTorque; //ComputeDelta(torqueOut, totalTorqueDemand, fullDragTorque,
//gearboxFullLoad != null ? -gearboxFullLoad : null, false);
//gearboxFullLoad != null ? -gearboxFullLoad : null, false);
if (!dryRun && !angularVelocity.IsSmallerOrEqual(engineSpeedLimit)) {
if (DataBus.HybridControllerInfo?.ICESpeed != null && DataBus.HybridControllerInfo.ICESpeed != angularVelocity) {
return new ResponseInvalidOperatingPoint(this);
}
return new ResponseEngineSpeedTooHigh(this) {
DeltaEngineSpeed = avgEngineSpeed - engineSpeedLimit,
Engine = {
EngineSpeed = angularVelocity,
PowerRequest = torqueOut * avgEngineSpeed,
TorqueOutDemand = torqueOut,
TotalTorqueDemand = totalTorqueDemand,
DynamicFullLoadPower = dynamicFullLoadPower,
DynamicFullLoadTorque = dynamicFullLoadTorque,
StationaryFullLoadTorque = stationaryFullLoadTorque,
DragPower = fullDragTorque * avgEngineSpeed,
DragTorque = fullDragTorque,
AuxiliariesPowerDemand = auxTorqueDemand * avgEngineSpeed,
}
};
}
if (!dryRun && !angularVelocity.IsSmallerOrEqual(engineSpeedLimit)) {
if (DataBus.HybridControllerInfo?.ICESpeed != null && DataBus.HybridControllerInfo.ICESpeed != angularVelocity) {
return new ResponseInvalidOperatingPoint(this);
}
return new ResponseEngineSpeedTooHigh(this) {
DeltaEngineSpeed = avgEngineSpeed - engineSpeedLimit,
Engine = {
EngineSpeed = angularVelocity,
PowerRequest = torqueOut * avgEngineSpeed,
TorqueOutDemand = torqueOut,
TotalTorqueDemand = totalTorqueDemand,
DynamicFullLoadPower = dynamicFullLoadPower,
DynamicFullLoadTorque = dynamicFullLoadTorque,
StationaryFullLoadTorque = stationaryFullLoadTorque,
DragPower = fullDragTorque * avgEngineSpeed,
DragTorque = fullDragTorque,
AuxiliariesPowerDemand = auxTorqueDemand * avgEngineSpeed,
}
};
}
if (dryRun) {
return new ResponseDryRun(this) {
......
......@@ -28,6 +28,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected internal Joule ThermalBuffer = 0.SI<Joule>();
protected internal bool DeRatingActive = false;
private bool IsTestPowertrain;
public Joule OverloadBuffer { get; }
public NewtonMeter ContinuousTorque { get; }
......@@ -41,6 +43,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Position = position;
container.AddComponent(this); // We have to do this again because in the base class the position is unknown!
IsTestPowertrain = container is SimplePowertrainContainer;
ContinuousTorque = ModelData.ContinuousPower / ModelData.ContinuousPowerSpeed;
var contElPwr =
ModelData.EfficiencyMap.LookupElectricPower(ModelData.ContinuousPowerSpeed, -ContinuousTorque).ElectricalPower ??
......@@ -157,10 +161,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var emTorque = emTorqueDt == null ? null : ConvertDrivetrainTorqueToEm(emTorqueDt);
var emOff = emTorqueDt == null;
if (!dryRun && emTorqueDt != null && ((emTorque).IsSmaller(maxDriveTorqueEm ?? 0.SI<NewtonMeter>(), 1e-3) ||
(emTorque).IsGreater(maxRecuperationTorqueEm ?? 0.SI<NewtonMeter>(), 1e-3))) {
if (!dryRun && !IsTestPowertrain && emTorqueDt != null && ((emTorque).IsSmaller(maxDriveTorqueEm ?? 0.SI<NewtonMeter>(), 1e-3) ||
(emTorque).IsGreater(maxRecuperationTorqueEm ?? 0.SI<NewtonMeter>(), 1e-3))) {
// check if provided EM torque (drivetrain) is valid)
if (DataBus.HybridControllerInfo != null && (!avgDtSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position)) ||
if ((!avgDtSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position)) ||
!dt.IsEqual(DataBus.HybridControllerInfo.SimulationInterval))) {
return new ResponseInvalidOperatingPoint(this);
}
......@@ -233,8 +237,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var electricSupplyResponse =
ElectricPower.Request(absTime, dt, electricPower, dryRun);
if (!dryRun && !emOff && !(electricSupplyResponse is ElectricSystemResponseSuccess)) {
if (DataBus.HybridControllerInfo != null && !avgEmSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position))) {
if (!dryRun && !IsTestPowertrain && !emOff && !(electricSupplyResponse is ElectricSystemResponseSuccess)) {
if ( !avgEmSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position))) {
return new ResponseInvalidOperatingPoint(this);
}
throw new VectoException(
......
......@@ -559,15 +559,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
var avgEngineSpeed = (maxEmDriveResponse.Engine.EngineSpeed + DataBus.EngineInfo.EngineSpeed) / 2;
var maxTorque = SearchAlgorithm.Search(outTorque, deltaFullLoadTq * avgEngineSpeed, -outTorque * 0.1,
getYValue: resp => {
var r = resp as ResponseDryRun;
return r.DeltaFullLoad;
var r = resp as IResponse;
var deltaMaxTq = (r.Engine.TotalTorqueDemand -
r.Engine.DynamicFullLoadTorque);
return deltaMaxTq * avgEngineSpeed;
},
evaluateFunction: x => {
return RequestDryRun(absTime, dt, x, outAngularVelocity, currentGear, maxEmDriveSetting);
},
criterion: resp => {
var r = resp as ResponseDryRun;
return r.DeltaFullLoad.Value();
var r = resp as IResponse;
var deltaMaxTq = (r.Engine.TotalTorqueDemand -
r.Engine.DynamicFullLoadTorque);
return (deltaMaxTq * avgEngineSpeed).Value();
});
var delta = outTorque * outAngularVelocity - StrategyParameters.MaxDrivetrainPower;
if ((maxTorque * outAngularVelocity).IsSmaller(StrategyParameters.MaxDrivetrainPower)) {
......@@ -736,8 +740,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
maxRecuperationResponse.ElectricMotor.AngularVelocity,
maxRecuperationResponse.Engine.TorqueOutDemand, maxRecuperationResponse.ElectricMotor.MaxRecuperationTorque * 0.1,
getYValue: r => {
var response = r as ResponseDryRun;
return response.DeltaDragLoad;
var response = r as IResponse;
var deltaDragLoad = response.Engine.TotalTorqueDemand - response.Engine.DragTorque;
return deltaDragLoad;
},
evaluateFunction: emTq => {
var cfg = new HybridStrategyResponse() {
......@@ -751,8 +756,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
return RequestDryRun(absTime, dt, outTorque, outAngularVelocity, DataBus.GearboxInfo.GearEngaged(absTime) ? nextGear : new GearshiftPosition(0), cfg);
},
criterion: r => {
var response = r as ResponseDryRun;
return response.DeltaDragLoad.Value();
var response = r as IResponse;
var deltaDragLoad = response.Engine.TotalTorqueDemand - response.Engine.DragTorque;
return deltaDragLoad.Value();
}
);
if (emRecuperationTq.IsBetween(
......@@ -928,10 +934,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
return best;
}
var allOverload = eval.Where(x => !(x.IgnoreReason.BatteryDemandExceeded() || x.IgnoreReason.BatterySoCTooLow()))
var validResponses = eval.Where(x => x.Response != null).ToArray();
var allOverload = validResponses.Where(x => !(x.IgnoreReason.BatteryDemandExceeded() || x.IgnoreReason.BatterySoCTooLow()))
.All(x => x.IgnoreReason.EngineTorqueDemandTooHigh());
var allUnderload = eval.All(x => x.IgnoreReason.EngineTorqueDemandTooLow());
var allUnderload = validResponses.All(x => x.IgnoreReason.EngineTorqueDemandTooLow());
if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && allOverload) {
if (ElectricMotorCanPropellDuringTractionInterruption || DataBus.GearboxInfo.GearEngaged(absTime)) {
// overload, EM can support - use solution with max EM power
......@@ -1104,39 +1110,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
var nextGear = GearList.Successor(gear);
var emOffEntry = EvaluateConfigsForGear(
absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos, dryRun);
// GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, nextGear);
//if (emOffEntry != null) {
// CalcualteCosts(emOffEntry.Response, dt, emOffEntry, allowICEOff);
// responses.Add(emOffEntry);
// var emTqReq =
// (emOffEntry.Response.ElectricMotor.PowerRequest + emOffEntry.Response.ElectricMotor.InertiaPowerDemand) /
// emOffEntry.Response.ElectricMotor.AngularVelocity;
// IterateEMTorque(
// absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, emOffEntry.Response, emTqReq, emPos,
// responses);
//}
}
if (allowEmergencyDownshift && tmpBest != null && !tmpBest.ICEOff) {
var nextGear = GearList.Predecessor(gear);
var emOffEntry = EvaluateConfigsForGear(
absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos, dryRun);
// GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, nextGear);
//if (emOffEntry != null) {
// CalcualteCosts(emOffEntry.Response, dt, emOffEntry, allowICEOff);
// responses.Add(emOffEntry);
// var emTqReq =
// (emOffEntry.Response.ElectricMotor.PowerRequest + emOffEntry.Response.ElectricMotor.InertiaPowerDemand) /
// emOffEntry.Response.ElectricMotor.AngularVelocity;
// IterateEMTorque(
// absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, emOffEntry.Response, emTqReq, emPos,
// responses);
//}
}
return responses;
......@@ -1256,7 +1234,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
firstResponse.ElectricMotor.ElectricMotorPowerMech / firstResponse.ElectricMotor.AngularVelocity,
firstResponse.Engine.TorqueOutDemand, firstResponse.ElectricMotor.MaxDriveTorque * 0.1,
getYValue: r => {
var response = r as ResponseDryRun;
var response = r as IResponse;
return response.Engine.TorqueOutDemand;
},
evaluateFunction: emTq => {
......@@ -1270,7 +1248,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
return RequestDryRun(absTime, dt, outTorque, outAngularVelocity, nextGear, cfg);
},
criterion: r => {
var response = r as ResponseDryRun;
var response = r as IResponse;
return response.Engine.TorqueOutDemand.Value();
}
);
......@@ -1311,7 +1289,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
firstResponse.ElectricMotor.ElectricMotorPowerMech / firstResponse.ElectricMotor.AngularVelocity,
firstResponse.Engine.TorqueOutDemand, firstResponse.ElectricMotor.MaxRecuperationTorque * 0.1,
getYValue: r => {
var response = r as ResponseDryRun;
var response = r as IResponse;
return response.Engine.TorqueOutDemand;
},
evaluateFunction: emTq => {
......@@ -1325,7 +1303,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
return RequestDryRun(absTime, dt, outTorque, outAngularVelocity, nextGear, cfg);
},
criterion: r => {
var response = r as ResponseDryRun;
var response = r as IResponse;
return response.Engine.TorqueOutDemand.Value();
}
);
......
......@@ -41,6 +41,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
public const string AccelerationFile = @"TestData\Components\Truck.vacc";
public const string MotorFile240kW = @"TestData\Hybrids\ElectricMotor\GenericEMotor240kW.vem";
public const string P1HybridMotor = @"Testdata\Hybrids\GenericVehicle_P1-APT\GenericEMotor20kW.vem";
public const string P1BatteryFile = @"Testdata\Hybrids\GenericVehicle_P1-APT\GenericBattery.vbat";
public const string GearboxIndirectLoss = @"TestData\Components\Indirect Gear.vtlm";
public const string GearboxDirectLoss = @"TestData\Components\Direct Gear.vtlm";
......@@ -131,7 +134,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
var modFilename = string.Format("SimpleParallelHybrid-P1_constant_{0}-{1}_{2}_{3}.vmod", vmax, initialSoC, slope, gbxType.ToXMLFormat());
const PowertrainPosition pos = PowertrainPosition.HybridP1;
var job = CreateEngineeringRun(
cycle, modFilename, initialSoC, pos, 1.0, largeMotor: true, gearboxType: gbxType);
cycle, modFilename, initialSoC, pos, 1.0, largeMotor: false, gearboxType: gbxType);
var run = job.Runs.First().Run;
var hybridController = (HybridController)((VehicleContainer)run.GetContainer()).HybridController;
......@@ -1032,10 +1035,11 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
var airdragData = CreateAirdragData();
var driverData = CreateDriverData(AccelerationFile, true);
var electricMotorData =
MockSimulationDataFactory.CreateElectricMotorData(largeMotor ? MotorFile240kW : MotorFile, 1, pos, ratio, 1);
var emFile = pos == PowertrainPosition.HybridP1 ? P1HybridMotor : (largeMotor ? MotorFile240kW : MotorFile);
var electricMotorData = MockSimulationDataFactory.CreateElectricMotorData(emFile, 1, pos, ratio, 1);
var batteryData = MockSimulationDataFactory.CreateBatteryData(BatFile, initialBatCharge);
var batFile = pos == PowertrainPosition.HybridP1 ? P1BatteryFile : BatFile;
var batteryData = MockSimulationDataFactory.CreateBatteryData(batFile, initialBatCharge);
//batteryData.TargetSoC = 0.5;
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(
......
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