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

Skip to content
Snippets Groups Projects
Commit 805f4ceb authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

add info if the current powertrain is the 'real' powertrain or a test-powertrain to databus

use in brakes as for AT powertrains no dry-run requests are used and the brake power may get negative
parent 40a3cd8c
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,8 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus
IHybridControllerCtl HybridControllerCtl { get; }
IAngledriveInfo AngledriveInfo { get; }
bool IsTestPowertrain { get; }
}
public interface IPowertainInfo
......
......@@ -78,6 +78,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
public virtual ITorqueConverterControl TorqueConverterCtl { get; private set; }
public virtual bool IsTestPowertrain
{
get { return false; }
}
internal ISimulationOutPort Cycle;
......
......@@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
}
if (!dryRun && BrakePower < 0) {
if (!dryRun && !DataBus.IsTestPowertrain && BrakePower < 0) {
throw new VectoSimulationException("Negative Braking Power is not allowed! P_br: {0}", BrakePower);
}
CurrentState.SetState(outTorque + brakeTorque, outAngularVelocity, outTorque, outAngularVelocity);
......
......@@ -29,8 +29,6 @@ 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; }
......@@ -43,8 +41,6 @@ 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 ??
......@@ -161,7 +157,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var emTorque = emTorqueDt == null ? null : ConvertDrivetrainTorqueToEm(emTorqueDt);
var emOff = emTorqueDt == null;
if (!dryRun && !IsTestPowertrain && emTorqueDt != null && ((emTorque).IsSmaller(maxDriveTorqueEm ?? 0.SI<NewtonMeter>(), 1e-3) ||
if (!dryRun && !DataBus.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 ((!avgDtSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position)) ||
......@@ -237,7 +233,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var electricSupplyResponse =
ElectricPower.Request(absTime, dt, electricPower, dryRun);
if (!dryRun && !IsTestPowertrain && !emOff && !(electricSupplyResponse is ElectricSystemResponseSuccess)) {
if (!dryRun && !DataBus.IsTestPowertrain && !emOff && !(electricSupplyResponse is ElectricSystemResponseSuccess)) {
if ( !avgEmSpeed.IsEqual(DataBus.HybridControllerInfo.ElectricMotorSpeed(Position))) {
return new ResponseInvalidOperatingPoint(this);
}
......
......@@ -32,6 +32,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
public override IDriverInfo DriverInfo { get { return base.DriverInfo ?? this; } }
public override bool IsTestPowertrain
{
get { return true; }
}
#region Implementation of IDriverInfo
public DrivingBehavior DriverBehavior
......
......@@ -167,6 +167,10 @@ namespace TUGraz.VectoCore.Tests.Utils
public IHybridControllerInfo HybridControllerInfo { get; }
public IHybridControllerCtl HybridControllerCtl { get; }
public IAngledriveInfo AngledriveInfo { get; }
public bool IsTestPowertrain
{
get { return false; }
}
public Watt GearboxLoss()
{
......
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