diff --git a/VectoCommon/VectoCommon/Models/IResponse.cs b/VectoCommon/VectoCommon/Models/IResponse.cs index 0df0a998670c69d8612b02903020111337cdee8d..d77b29441b52cb98e1653ebc66d9177e55c0ab9f 100644 --- a/VectoCommon/VectoCommon/Models/IResponse.cs +++ b/VectoCommon/VectoCommon/Models/IResponse.cs @@ -45,8 +45,6 @@ namespace TUGraz.VectoCommon.Models Second SimulationInterval { get; set; } object Source { get; } - //Watt ClutchPowerRequest { get; set; } - Watt GearboxPowerRequest { get; set; } Watt AxlegearPowerRequest { get; set; } Watt WheelsPowerRequest { get; set; } Watt VehiclePowerRequest { get; set; } diff --git a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs index 8744495b94a00791b5fbbcc1b801dd34238c7903..9683b4bee75de09735a39b35da995f5c64728069 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -67,8 +67,6 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public Second SimulationInterval { get; set; } public Meter SimulationDistance { get; set; } public Watt AngledrivePowerRequest { get; set; } - //public Watt ClutchPowerRequest { get; set; } - public Watt GearboxPowerRequest { get; set; } public Watt AxlegearPowerRequest { get; set; } public Watt WheelsPowerRequest { get; set; } public Watt VehiclePowerRequest { get; set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 768780ccdaa2de8090eb1b0be625711a761f0ce5..2048bd4ce1b9e76dc8a7b702dc1509f7e63bec03 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -203,7 +203,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl EngineSpeed = response.Engine.EngineSpeed, PowerRequest = response.Engine.PowerRequest, }, - GearboxPowerRequest = outTorque * outAngularVelocity, + Gearbox = { + PowerRequest = outTorque * outAngularVelocity, + } }; } @@ -242,8 +244,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (ConsiderShiftLosses(_strategy.NextGear, outTorque) && !RequestAfterGearshift) { retVal = new ResponseFailTimeInterval(this) { DeltaT = ModelData.PowershiftShiftTime, - GearboxPowerRequest = + Gearbox = { + PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0 + } }; RequestAfterGearshift = true; LastShift = absTime; @@ -254,7 +258,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } while (loop && ++count < 2); - retVal.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; + retVal.Gearbox.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; return retVal; } @@ -352,7 +356,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dryRun) { // if gearbox is disengaged the 0[W]-line is the limit for drag and full load. return new ResponseDryRun(this) { - GearboxPowerRequest = outTorque * avgAngularVelocity, + Gearbox = { PowerRequest = outTorque * avgAngularVelocity }, DeltaDragLoad = outTorque * avgAngularVelocity, DeltaFullLoad = outTorque * avgAngularVelocity, }; @@ -361,7 +365,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Constants.SimulationSettings.LineSearchTolerance)) { return new ResponseOverload(this) { Delta = outTorque * avgAngularVelocity, - GearboxPowerRequest = outTorque * avgAngularVelocity + Gearbox = {PowerRequest = outTorque * avgAngularVelocity } }; } @@ -369,7 +373,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Constants.SimulationSettings.LineSearchTolerance)) { return new ResponseUnderload(this) { Delta = outTorque * avgAngularVelocity, - GearboxPowerRequest = outTorque * avgAngularVelocity + Gearbox = { PowerRequest = outTorque * avgAngularVelocity } }; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index ae2f6261992d2a30ce9132695cfecca4767f1c2c..29c19dee344f2e353e8d334ca16b2745477513ad 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -132,7 +132,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PreviousState.InertiaTorqueLossOut = 0.SI<NewtonMeter>(); PreviousState.Gear = Gear; - response.GearboxPowerRequest = inTorque * inAngularVelocity; + response.Gearbox.PowerRequest = inTorque * inAngularVelocity; return response; } @@ -174,7 +174,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ? RequestDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun) : RequestEngaged(absTime, dt, outTorque, outAngularVelocity, dryRun); - retVal.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2; + retVal.Gearbox.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2; return retVal; } @@ -243,7 +243,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } if (dryRun) { var dryRunResponse = HandleDryRunRequest(absTime, dt, torqueConverterLocked, inTorque, inAngularVelocity); - dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity; + dryRunResponse.Gearbox.PowerRequest = outTorque * avgOutAngularVelocity; return dryRunResponse; } @@ -265,7 +265,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.InAngularVelocity); } var response = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity); - response.GearboxPowerRequest = outTorque * avgOutAngularVelocity; + response.Gearbox.PowerRequest = outTorque * avgOutAngularVelocity; return response; } @@ -320,7 +320,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dryRun) { // if gearbox is disengaged the 0-line is the limit for drag and full load return new ResponseDryRun(this) { - GearboxPowerRequest = outTorque * avgOutAngularVelocity, + Gearbox = {PowerRequest = outTorque * avgOutAngularVelocity, }, DeltaDragLoad = outTorque * avgOutAngularVelocity, DeltaFullLoad = outTorque * avgOutAngularVelocity, }; @@ -330,14 +330,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl !outAngularVelocity.IsEqual(0)) { return new ResponseOverload(this) { Delta = outTorque * avgOutAngularVelocity, - GearboxPowerRequest = outTorque * avgOutAngularVelocity + Gearbox = { PowerRequest = outTorque * avgOutAngularVelocity } }; } if ((outTorque * avgOutAngularVelocity).IsSmaller(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance)) { return new ResponseUnderload(this) { Delta = outTorque * avgOutAngularVelocity, - GearboxPowerRequest = outTorque * avgOutAngularVelocity + Gearbox = { PowerRequest = outTorque * avgOutAngularVelocity } }; } @@ -362,7 +362,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl disengagedResponse.Engine.EngineSpeed); } } - disengagedResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity; + disengagedResponse.Gearbox.PowerRequest = outTorque * avgOutAngularVelocity; CurrentState.SetState(0.SI<NewtonMeter>(), disengagedResponse.Engine.EngineSpeed, 0.SI<NewtonMeter>(), outAngularVelocity); CurrentState.Gear = Gear; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index ceb922a05a8158ce976ce391afbf91024d99668b..ccfa9f667b62d22c2503bee988f49bddc9d4f1d2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -739,7 +739,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var nextResp = NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, gradient, true); - deltaPower = nextResp.GearboxPowerRequest; + deltaPower = nextResp.Gearbox.PowerRequest; }). Case<ResponseEngineSpeedTooHigh>(r => { IterationStatistics.Increment(this, "SearchBrakingPower"); @@ -747,10 +747,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var nextResp = NextComponent.Request(absTime, operatingPoint.SimulationInterval, operatingPoint.Acceleration, gradient, true); - deltaPower = nextResp.GearboxPowerRequest; + deltaPower = nextResp.Gearbox.PowerRequest; }). Case<ResponseUnderload>(r => - deltaPower = DataBus.ClutchClosed(absTime) ? r.Delta : r.GearboxPowerRequest). + deltaPower = DataBus.ClutchClosed(absTime) ? r.Delta : r.Gearbox.PowerRequest). Default( r => { throw new UnexpectedResponseException("cannot use response for searching braking power!", r); @@ -761,7 +761,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl deltaPower.Abs() * (DataBus.GearboxType.AutomaticTransmission() ? 0.5 : 1), getYValue: result => { var response = (ResponseDryRun)result; - return DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.GearboxPowerRequest; + return DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad : response.Gearbox.PowerRequest; }, evaluateFunction: x => { DataBus.BrakePower = x; @@ -777,7 +777,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var response = (ResponseDryRun)result; var delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad - : response.GearboxPowerRequest; + : response.Gearbox.PowerRequest; return delta.Value(); }, forceLineSearch: DataBus.GearboxType.AutomaticTransmission() && !DataBus.TCLocked); @@ -796,7 +796,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var response = (ResponseDryRun)result; return DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad - : response.GearboxPowerRequest; + : response.Gearbox.PowerRequest; }, evaluateFunction: x => { DataBus.BrakePower = x; @@ -812,7 +812,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var response = (ResponseDryRun)result; var delta = DataBus.ClutchClosed(absTime) ? response.DeltaDragLoad - : response.GearboxPowerRequest; + : response.Gearbox.PowerRequest; return Math.Min(delta.Value(), 0); }, forceLineSearch: true); @@ -853,7 +853,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (searchEngineSpeed) { return r.DeltaEngineSpeed * 1.SI<NewtonMeter>(); } - return actionRoll ? r.GearboxPowerRequest : (coastingOrRoll ? r.DeltaDragLoad : r.DeltaFullLoad); + return actionRoll ? r.Gearbox.PowerRequest : (coastingOrRoll ? r.DeltaDragLoad : r.DeltaFullLoad); }, evaluateFunction: acc => { @@ -889,7 +889,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return r.DeltaEngineSpeed.Value(); } delta = actionRoll - ? r.GearboxPowerRequest + ? r.Gearbox.PowerRequest : (coastingOrRoll ? r.DeltaDragLoad : r.DeltaFullLoad); return delta.Value(); }, @@ -918,9 +918,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Watt origDelta = null; if (actionRoll) { initialResponse.Switch(). - Case<ResponseDryRun>(r => origDelta = r.GearboxPowerRequest). + Case<ResponseDryRun>(r => origDelta = r.Gearbox.PowerRequest). Case<ResponseOverload>(r => origDelta = r.Delta). - Case<ResponseFailTimeInterval>(r => origDelta = r.GearboxPowerRequest). + Case<ResponseFailTimeInterval>(r => origDelta = r.Gearbox.PowerRequest). Default(r => { throw new UnexpectedResponseException("SearchOperatingPoint: Unknown response type.", r); }); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 79718049bdc8f887a3c029cd23a5fa724643ffd0..8b7e352a7858b5275adc24982afe57571414c28a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PowerRequest = response.Clutch.PowerRequest, OutputSpeed = response.Clutch.OutputSpeed }, - GearboxPowerRequest = outTorque * outAngularVelocity, + Gearbox = { PowerRequest = outTorque * outAngularVelocity, }, DeltaFullLoad = response.Engine.PowerRequest - fullLoad }; } @@ -273,7 +273,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if gearbox is disengaged the 0[W]-line is the limit for drag and full load. var delta = inTorque * avgInAngularVelocity; return new ResponseDryRun(this) { - GearboxPowerRequest = delta, + Gearbox = { PowerRequest = delta,}, DeltaDragLoad = delta, DeltaFullLoad = delta, }; @@ -285,7 +285,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (shiftTimeExceeded && EngageTime - absTime > Constants.SimulationSettings.LowerBoundTimeInterval / 2) { return new ResponseFailTimeInterval(this) { DeltaT = EngageTime - absTime, - GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0 + Gearbox = { PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0 } }; } @@ -299,14 +299,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if ((inTorque * avgInAngularVelocity).IsGreater(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance)) { return new ResponseOverload(this) { Delta = inTorque * avgInAngularVelocity, - GearboxPowerRequest = inTorque * avgInAngularVelocity + Gearbox = { PowerRequest = inTorque * avgInAngularVelocity } }; } if ((inTorque * avgInAngularVelocity).IsSmaller(0.SI<Watt>(), Constants.SimulationSettings.LineSearchTolerance)) { return new ResponseUnderload(this) { Delta = inTorque * avgInAngularVelocity, - GearboxPowerRequest = inTorque * avgInAngularVelocity + Gearbox = { PowerRequest = inTorque * avgInAngularVelocity } }; } @@ -324,7 +324,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //CurrentState.InAngularVelocity = response.EngineSpeed; - response.GearboxPowerRequest = outTorque * avgAngularVelocity; + response.Gearbox.PowerRequest = outTorque * avgAngularVelocity; return response; } @@ -350,7 +350,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (dryRun) { var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true); - dryRunResponse.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; + dryRunResponse.Gearbox.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; return dryRunResponse; } @@ -374,7 +374,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return new ResponseGearShift(this) { SimulationInterval = ModelData.TractionInterruption, - GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0 + Gearbox = {PowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0 } }; } } @@ -393,7 +393,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // end critical section - response.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + response.Gearbox.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; return response; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs index cc38e72aa880ab59d0bb895f1e5f4ecd18cf82bb..c1a9bd354cec501e227782f1a511cf19192d0070 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs @@ -231,14 +231,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DataBus.BrakePower = SearchAlgorithm.Search(DataBus.BrakePower, r.Delta, -r.Delta, getYValue: result => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)result).DeltaDragLoad - : ((ResponseDryRun)result).GearboxPowerRequest, + : ((ResponseDryRun)result).Gearbox.PowerRequest, evaluateFunction: x => { DataBus.BrakePower = x; return NextComponent.Request(absTime, dt, acc, gradient, true); }, criterion: y => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)y).DeltaDragLoad.Value() - : ((ResponseDryRun)y).GearboxPowerRequest.Value()); + : ((ResponseDryRun)y).Gearbox.PowerRequest.Value()); Log.Info( "Found operating point for braking. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}, BrakePower: {4}", absTime, dt, acceleration, gradient, DataBus.BrakePower); @@ -278,14 +278,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DataBus.BrakePower = SearchAlgorithm.Search(DataBus.BrakePower, r.Delta, -r.Delta, getYValue: result => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)result).DeltaDragLoad - : ((ResponseDryRun)result).GearboxPowerRequest, + : ((ResponseDryRun)result).Gearbox.PowerRequest, evaluateFunction: x => { DataBus.BrakePower = x; return NextComponent.Request(absTime, dt, acc, gradient, true); }, criterion: y => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)y).DeltaDragLoad.Value() - : ((ResponseDryRun)y).GearboxPowerRequest.Value()); + : ((ResponseDryRun)y).Gearbox.PowerRequest.Value()); Log.Info( "Found operating point for braking. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}, BrakePower: {4}", absTime, dt, acceleration, gradient, DataBus.BrakePower); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs index bc962fa415ff6d4e5fbe953cd95c575be3696199..677661e9e6916af15d86ff937b317fa923688822 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs @@ -238,7 +238,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PowerRequest = response.Clutch.PowerRequest, OutputSpeed = response.Clutch.OutputSpeed }, - GearboxPowerRequest = outTorque * outAngularVelocity, + Gearbox = { + PowerRequest = outTorque * outAngularVelocity, + } //DeltaFullLoad = response.EnginePowerRequest - fullLoad }; } diff --git a/VectoCore/VectoCoreTest/Utils/MockPorts.cs b/VectoCore/VectoCoreTest/Utils/MockPorts.cs index 82044c12799e7552aea837cea2497838ed9eb036..196ee9217546919b8774ee75cf63e98279d8ee43 100644 --- a/VectoCore/VectoCoreTest/Utils/MockPorts.cs +++ b/VectoCore/VectoCoreTest/Utils/MockPorts.cs @@ -64,7 +64,7 @@ namespace TUGraz.VectoCore.Tests.Utils EngineSpeed = outAngularVelocity, DynamicFullLoadPower = (outTorque + 2300.SI<NewtonMeter>()) * outAngularVelocity, }, - GearboxPowerRequest = outTorque * outAngularVelocity, + Gearbox = { PowerRequest = outTorque * outAngularVelocity, }, Clutch = { PowerRequest = outTorque * outAngularVelocity, }, @@ -78,7 +78,7 @@ namespace TUGraz.VectoCore.Tests.Utils PowerRequest = outTorque * outAngularVelocity, EngineSpeed = outAngularVelocity, }, - GearboxPowerRequest = outTorque * outAngularVelocity, + Gearbox = { PowerRequest = outTorque * outAngularVelocity, }, Clutch = { PowerRequest = outTorque * outAngularVelocity, }