diff --git a/VectoCommon/VectoCommon/Models/IResponse.cs b/VectoCommon/VectoCommon/Models/IResponse.cs index d77b29441b52cb98e1653ebc66d9177e55c0ab9f..d6f4c10092c235cd266fed20c8e4da33e9ab59f7 100644 --- a/VectoCommon/VectoCommon/Models/IResponse.cs +++ b/VectoCommon/VectoCommon/Models/IResponse.cs @@ -40,16 +40,12 @@ namespace TUGraz.VectoCommon.Models /// </summary> public interface IResponse { + object Source { get; } + Second AbsTime { get; set; } Meter SimulationDistance { get; set; } Second SimulationInterval { get; set; } - object Source { get; } - Watt AxlegearPowerRequest { get; set; } - Watt WheelsPowerRequest { get; set; } - Watt VehiclePowerRequest { get; set; } - Watt BrakePower { get; set; } - Watt AngledrivePowerRequest { get; set; } DriverResponse Driver { get; } @@ -59,6 +55,18 @@ namespace TUGraz.VectoCommon.Models GearboxResponse Gearbox { get; } + TorqueConverterResponse TorqueConverter { get; } + + AxlegearResponse Axlegear { get; } + + AngledriveResponse Angledrive { get; } + + WheelsResponse Wheels { get; } + + VehicleResponse Vehicle { get; } + + BrakesResponse Brakes { get; } + } public abstract class AbstractComponentResponse @@ -125,4 +133,48 @@ namespace TUGraz.VectoCommon.Models public NewtonMeter OutputTorque { get; set; } } + + public class TorqueConverterResponse : AbstractPowertrainComponentResponse + { + public TorqueConverterOperatingPoint TorqueConverterOperatingPoint { get; set; } + + public NewtonMeter TorqueConverterTorqueDemand { get; set; } + + } + + [DebuggerDisplay("P_out: {PowerRequest}; T_card: {CardanTorque}")] + public class AxlegearResponse : AbstractPowertrainComponentResponse + { + public NewtonMeter CardanTorque { get; set; } + + public NewtonMeter OutputTorque { get; set; } + + public PerSecond OutputSpeed { get; set; } + } + + [DebuggerDisplay("P_out: {PowerRequest}")] + public class AngledriveResponse : AbstractPowertrainComponentResponse + { + public NewtonMeter OutputTorque { get; set; } + + public PerSecond OutputSpeed { get; set; } + + } + + [DebuggerDisplay("P_out: {PowerRequest}")] + public class WheelsResponse : AbstractPowertrainComponentResponse { } + + [DebuggerDisplay("v_veh: {VehicleSpeed}")] + + public class VehicleResponse : AbstractComponentResponse + { + public MeterPerSecond VehicleSpeed { get; set; } + } + + [DebuggerDisplay("P_brake: {BrakePower}")] + + public class BrakesResponse : AbstractComponentResponse + { + public Watt BrakePower { get; set; } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/TorqueConverterOperatingPoint.cs b/VectoCommon/VectoCommon/Models/TorqueConverterOperatingPoint.cs new file mode 100644 index 0000000000000000000000000000000000000000..f728d8ed7886209d96d6e5220a1dd46571b4d273 --- /dev/null +++ b/VectoCommon/VectoCommon/Models/TorqueConverterOperatingPoint.cs @@ -0,0 +1,21 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCommon.Models { + public class TorqueConverterOperatingPoint + { + public PerSecond OutAngularVelocity; + public NewtonMeter OutTorque; + + public PerSecond InAngularVelocity; + public NewtonMeter InTorque; + + public double SpeedRatio; + public double TorqueRatio; + public bool Creeping; + + public override string ToString() + { + return $"n_out: {OutAngularVelocity}, n_in: {InAngularVelocity}, tq_out: {OutTorque}, tq_in {InTorque}, nu: {SpeedRatio}, my: {TorqueRatio}"; + } + } +} \ No newline at end of file diff --git a/VectoCommon/VectoCommon/VectoCommon.csproj b/VectoCommon/VectoCommon/VectoCommon.csproj index 99f42fb174d0e61d53e2cc07077550b7c73d066e..c1d43d6b6482009d6677a2d1b579e453c8d80662 100644 --- a/VectoCommon/VectoCommon/VectoCommon.csproj +++ b/VectoCommon/VectoCommon/VectoCommon.csproj @@ -83,6 +83,7 @@ <Compile Include="Models\OperatingPoint.cs" /> <Compile Include="Models\RetarderType.cs" /> <Compile Include="Models\SimulationType.cs" /> + <Compile Include="Models\TorqueConverterOperatingPoint.cs" /> <Compile Include="Models\VehicleCategory.cs" /> <Compile Include="Models\WHRType.cs" /> <Compile Include="OutputData\IOutputFileWriter.cs" /> diff --git a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs index 9683b4bee75de09735a39b35da995f5c64728069..4e28ba506dd103dc13478a7eb46097f40a353d7e 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -49,16 +49,18 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl Engine = new EngineResponse(); Clutch = new ClutchResponse(); Gearbox = new GearboxResponse(); - //Axlegear = new AxlegearResponse(); - //Angledrive = new AngledriveResponse(); - //Wheels = new WheelsResponse(); - //Vehicle = new VehicleResponse(); - //Brakes = new BrakesResponse(); - //ElectricMotor = new ElectricMotorResponse(); - ////ElectricSystem = new - //TorqueConverter = new TorqueConverterResponse(); - //HybridController = new HybridControllerResponse(); - } + Axlegear = new AxlegearResponse(); + Angledrive = new AngledriveResponse(); + Wheels = new WheelsResponse(); + Vehicle = new VehicleResponse(); + Brakes = new BrakesResponse(); + //ElectricMotor = new ElectricMotorResponse(); + ////ElectricSystem = new + TorqueConverter = new TorqueConverterResponse(); + //HybridController = new HybridControllerResponse(); + } + + public object Source { get; } @@ -66,11 +68,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public Second AbsTime { get; set; } public Second SimulationInterval { get; set; } public Meter SimulationDistance { get; set; } - public Watt AngledrivePowerRequest { get; set; } - public Watt AxlegearPowerRequest { get; set; } - public Watt WheelsPowerRequest { get; set; } - public Watt VehiclePowerRequest { get; set; } - public Watt BrakePower { get; set; } + public GearboxResponse Gearbox { get; } public DriverResponse Driver { get; } @@ -79,8 +77,18 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public ClutchResponse Clutch { get; } - public TorqueConverterOperatingPoint TorqueConverterOperatingPoint { get; set; } + public AxlegearResponse Axlegear { get; } + + public AngledriveResponse Angledrive { get; } + public TorqueConverterResponse TorqueConverter { get; } + + public WheelsResponse Wheels { get; } + + public VehicleResponse Vehicle { get; } + + public BrakesResponse Brakes { get; } + public override string ToString() { var t = GetType(); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs index c5a63ad3c5c6ea0feb0e4e441c403904df5762e7..98c357d2b45bd5a92894b6e80388b1219ec29e2c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs @@ -35,6 +35,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Linq; using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; @@ -347,26 +348,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox } - - public class TorqueConverterOperatingPoint - { - public PerSecond OutAngularVelocity; - public NewtonMeter OutTorque; - - public PerSecond InAngularVelocity; - public NewtonMeter InTorque; - - public double SpeedRatio; - public double TorqueRatio; - public bool Creeping; - - public override string ToString() - { - return string.Format("n_out: {0}, n_in: {1}, tq_out: {2}, tq_in {3}, nu: {4}, my: {5}", OutAngularVelocity, - InAngularVelocity, OutTorque, InTorque, SpeedRatio, TorqueRatio); - } - } - + [DebuggerDisplay("nu: {SpeedRatio}, mu: {TorqueRatio}, T_ref: {Torque}")] public class TorqueConverterEntry { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs index 21f21d0e3d3b521d34e154ed3cc19e6be7272140..28ec760e1de677ec38d197465e331d81605c7c00 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs @@ -46,7 +46,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl bool dryRun = false) { var retVal = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); - retVal.AngledrivePowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + retVal.Angledrive.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + retVal.Angledrive.OutputTorque = outTorque; + retVal.Angledrive.OutputSpeed = outAngularVelocity; return retVal; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs index 5cbc3220df1b6a9d8e54e321aac8eaa51231cd5b..7188c675aa8e671fff7a82b6338d229f1c6d677c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -46,7 +46,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl bool dryRun = false) { var retVal = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); - retVal.AxlegearPowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + retVal.Axlegear.PowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + retVal.Axlegear.CardanTorque = PreviousState.InTorque; return retVal; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs index b91d9b2d8f7f2dbbf0e78d643d45fe8f1cece850..6933d79050ac828fc6f0cd17bc8de009cd944342 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs @@ -77,7 +77,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.SetState(outTorque + brakeTorque, outAngularVelocity, outTorque, outAngularVelocity); var retVal = NextComponent.Request(absTime, dt, outTorque + brakeTorque, outAngularVelocity, dryRun); - retVal.BrakePower = brakeTorque * avgAngularSpeed; + retVal.Brakes.BrakePower = brakeTorque * avgAngularSpeed; return retVal; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index ccfa9f667b62d22c2503bee988f49bddc9d4f1d2..a4aa54ee4b8181f119296d49084cf75cda7aebf0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -556,7 +556,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl operatingPoint.Acceleration, DataBus.BrakePower); if (DataBus.BrakePower < 0) { var overload = new ResponseOverload(this) { - BrakePower = DataBus.BrakePower, + Brakes = { BrakePower = DataBus.BrakePower, }, Driver = { Acceleration = operatingPoint.Acceleration } }; DataBus.BrakePower = 0.SI<Watt>(); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs index 24d54404c440fdc67774632aae7e13b992364a91..228c0f50b770b7e7b815e6889007e4fdb7598f6c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -106,7 +106,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var inTorque = CalculateAverageInTorque(operatingPoint); if (dryRun) { - return HandleDryRun(absTime, dt, outTorque, outAngularVelocity, inTorque, operatingPoint); + var retValD = HandleDryRun(absTime, dt, outTorque, outAngularVelocity, inTorque, operatingPoint); + retValD.TorqueConverter.TorqueConverterTorqueDemand = outTorque; + return retValD; } // normal request @@ -117,9 +119,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl (PreviousState.OutAngularVelocity + operatingPoint.OutAngularVelocity) / 2.0; if (!delta.IsEqual(0, Constants.SimulationSettings.LineSearchTolerance)) { return delta > 0 - ? new ResponseOverload(this) { Delta = delta, TorqueConverterOperatingPoint = operatingPoint } + ? new ResponseOverload(this) { Delta = delta, TorqueConverter = { TorqueConverterOperatingPoint = operatingPoint }} : (IResponse) - new ResponseUnderload(this) {Delta = delta, TorqueConverterOperatingPoint = operatingPoint }; + new ResponseUnderload(this) {Delta = delta, TorqueConverter = { TorqueConverterOperatingPoint = operatingPoint } }; } } @@ -169,7 +171,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return new ResponseDryRun(this) { DeltaFullLoad = delta, DeltaDragLoad = delta, - TorqueConverterOperatingPoint = operatingPoint + TorqueConverter = { + TorqueConverterOperatingPoint = operatingPoint + } }; } @@ -194,7 +198,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return new ResponseDryRun(this) { DeltaFullLoad = 10 * deltaMax, DeltaDragLoad = 10 * deltaMin, - TorqueConverterOperatingPoint = DataBus.DriverInfo.DrivingAction == DrivingAction.Brake ? dryOperatingPointMin : dryOperatingPointMax + TorqueConverter = { + TorqueConverterOperatingPoint = DataBus.DriverInfo.DrivingAction == DrivingAction.Brake ? dryOperatingPointMin : dryOperatingPointMax + } }; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs index b7d4981be1a7a9a1d80bd9c01ab24025336320e3..21a13b180c24d5987e8dd8a7d9b1b6eaedc65449 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs @@ -134,6 +134,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var retval = NextComponent.Request(absTime, dt, CurrentState.VehicleTractionForce, CurrentState.Velocity, dryRun); + retval.Vehicle.VehicleSpeed = CurrentState.Velocity; return retval; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs index 0ad78d12456db4b2b2d7962e4ceb933e915e0cc4..a323a2ff8697e9d0c9ff13bc010bca994cb8df8a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs @@ -82,7 +82,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var retVal = NextComponent.Request(absTime, dt, CurrentState.TorqueIn, CurrentState.AngularVelocity, dryRun); - retVal.WheelsPowerRequest = CurrentState.TorqueIn * avgAngularSpeed; + retVal.Wheels.PowerRequest = CurrentState.TorqueIn * avgAngularSpeed; return retVal; }