From b892b882aed6de8080f1869def0a7e5b5b2daabd Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 22 Jun 2022 10:59:06 +0200 Subject: [PATCH] rename columns for IEPC in vmod file, use separate gearbox derived from APTN to write vmod output, adding missing file --- .../Simulation/Data/ModalResultField.cs | 18 ++++++----- .../Simulation/Impl/PowertrainBuilder.cs | 4 +-- .../Models/SimulationComponent/Impl/IEPC.cs | 12 ++++---- .../SimulationComponent/Impl/IEPCGearbox.cs | 30 +++++++++++++++++++ .../OutputData/ModalDataContainer.cs | 18 +++++------ .../Common/Hybrid_Parameters.vhctl | 18 +++++++++++ 6 files changed, 75 insertions(+), 25 deletions(-) create mode 100644 VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPCGearbox.cs create mode 100644 VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/Common/Hybrid_Parameters.vhctl diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs index c447ede967..3480f889dd 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs @@ -395,17 +395,19 @@ namespace TUGraz.VectoCore.Models.Simulation.Data [ModalResultField(typeof(SI), caption: "EM_{0}_off")] EM_Off_, - [ModalResultField(typeof(SI), caption: "n_{0}_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_IEPC_, - [ModalResultField(typeof(SI), caption: "T_{0} [Nm]")] T_IEPC_, - [ModalResultField(typeof(SI), caption: "T_{0}_map [Nm]")] T_IEPC_map_, - [ModalResultField(typeof(SI), caption: "T_{0}_drive_max [Nm]")] T_IEPC_drive_max_, - [ModalResultField(typeof(SI), caption: "T_{0}_gen_max [Nm]")] T_IEPC_gen_max_, - [ModalResultField(typeof(SI), caption: "P_{0}_gen_max [kW]", outputFactor: 1e-3)] P_IEPC_gen_max_, - [ModalResultField(typeof(SI), caption: "P_{0}_drive_max [kW]", outputFactor: 1e-3)] P_IEPC_drive_max_, + [ModalResultField(typeof(SI), caption: "n_{0}_int_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_IEPC_int_, + [ModalResultField(typeof(SI), caption: "T_{0}_int [Nm]")] T_IEPC_, + [ModalResultField(typeof(SI), caption: "T_{0}_int_map [Nm]")] T_IEPC_map_, + [ModalResultField(typeof(SI), caption: "T_{0}_int_drive_max [Nm]")] T_IEPC_int_drive_max_, + [ModalResultField(typeof(SI), caption: "T_{0}_int_gen_max [Nm]")] T_IEPC_int_gen_max_, + [ModalResultField(typeof(SI), caption: "P_{0}_int_gen_max [kW]", outputFactor: 1e-3)] P_IEPC_int_gen_max_, + [ModalResultField(typeof(SI), caption: "P_{0}_int_drive_max [kW]", outputFactor: 1e-3)] P_IEPC_int_drive_max_, [ModalResultField(typeof(SI), caption: "P_{0}_inertia_loss [kW]", outputFactor: 1e-3)] P_IEPC_electricMotorInertiaLoss_, - [ModalResultField(typeof(SI), caption: "P_{0}_mech_map [kW]", outputFactor: 1e-3)] P_IEPC_mech_map_, + [ModalResultField(typeof(SI), caption: "P_{0}_int_mech_map [kW]", outputFactor: 1e-3)] P_IEPC_int_mech_map_, [ModalResultField(typeof(SI), caption: "P_{0}_el [kW]", outputFactor: 1e-3)] P_IEPC_el_, [ModalResultField(typeof(SI), caption: "P_{0}_out [kW]", outputFactor: 1e-3)] P_IEPC_out_, + [ModalResultField(typeof(SI), caption: "n_IEPC_out_avg [kW]", outputFactor: 1e-3)] n_IEPC_out_avg, + [ModalResultField(typeof(SI), caption: "T_IEPC_out [kW]", outputFactor: 1e-3)] T_IEPC_out, [ModalResultField(typeof(SI), caption: "P_{0}_loss [kW]", outputFactor: 1e-3)] P_IEPC_electricMotorLoss_, [ModalResultField(typeof(SI), caption: "{0}_off")] IEPC_Off_, [ModalResultField(typeof(SI), caption: "{0}_OVL [%]", outputFactor: 100)] IEPC_OvlBuffer_, diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index f9fc271aaa..7566e08ec0 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -891,7 +891,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl //-->AxleGear-->APTNGearbox or SinglespeedGearbox-->Engine E2 var gearbox = data.GearboxData.Gears.Count > 1 - ? (IGearbox)new APTNGearbox(container, new APTNShiftStrategy(container)) + ? (IGearbox)new IEPCGearbox(container, new APTNShiftStrategy(container)) : new SingleSpeedGearbox(container, data.GearboxData); em = GetElectricMachine(PowertrainPosition.IEPC, data.ElectricMachinesData, container, es, ctl); powertrain @@ -985,7 +985,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl //-->AxleGear-->APTNGearbox or SinglespeedGearbox-->Engine E2 var gearbox = data.GearboxData.Gears.Count > 1 - ? (IGearbox)new APTNGearbox(container, new APTNShiftStrategy(container)) + ? (IGearbox)new IEPCGearbox(container, new APTNShiftStrategy(container)) : new SingleSpeedGearbox(container, data.GearboxData); em = GetElectricMachine(PowertrainPosition.IEPC, data.ElectricMachinesData, container, es, ctl); powertrain diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPC.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPC.cs index 64ab097e1a..867a88f2ba 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPC.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPC.cs @@ -21,18 +21,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl{ var avgDTSpeed = (prevDtSpeed + CurrentState.DrivetrainSpeed) / 2; //container[ModalResultField.EM_ratio_, Position] = ModelData.RatioADC.SI<Scalar>(); - container[ModalResultField.n_IEPC_, Position] = avgEMSpeed; + container[ModalResultField.n_IEPC_int_, Position] = avgEMSpeed; container[ModalResultField.T_IEPC_, Position] = CurrentState.EMTorque; container[ModalResultField.T_IEPC_map_, Position] = CurrentState.EmTorqueMap; - container[ModalResultField.T_IEPC_drive_max_, Position] = CurrentState.DriveMax; - container[ModalResultField.T_IEPC_gen_max_, Position] = CurrentState.DragMax; + container[ModalResultField.T_IEPC_int_drive_max_, Position] = CurrentState.DriveMax; + container[ModalResultField.T_IEPC_int_gen_max_, Position] = CurrentState.DragMax; - container[ModalResultField.P_IEPC_gen_max_, Position] = (CurrentState.DragMax ?? 0.SI<NewtonMeter>()) * avgEMSpeed; - container[ModalResultField.P_IEPC_drive_max_, Position] = (CurrentState.DriveMax ?? 0.SI<NewtonMeter>()) * avgEMSpeed; + container[ModalResultField.P_IEPC_int_gen_max_, Position] = (CurrentState.DragMax ?? 0.SI<NewtonMeter>()) * avgEMSpeed; + container[ModalResultField.P_IEPC_int_drive_max_, Position] = (CurrentState.DriveMax ?? 0.SI<NewtonMeter>()) * avgEMSpeed; //container[ModalResultField.P_EM_electricMotor_em_mech_, Position] = (CurrentState.EMTorque ?? 0.SI<NewtonMeter>()) * avgEMSpeed; - container[ModalResultField.P_IEPC_mech_map_, Position] = (CurrentState.EmTorqueMap ?? 0.SI<NewtonMeter>()) * avgEMSpeed; + container[ModalResultField.P_IEPC_int_mech_map_, Position] = (CurrentState.EmTorqueMap ?? 0.SI<NewtonMeter>()) * avgEMSpeed; //container[ModalResultField.P_EM_in_, Position] = CurrentState.DrivetrainInTorque * avgDTSpeed; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPCGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPCGearbox.cs new file mode 100644 index 0000000000..ccc88dd513 --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IEPCGearbox.cs @@ -0,0 +1,30 @@ +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class IEPCGearbox : APTNGearbox + { + public IEPCGearbox(IVehicleContainer container, IShiftStrategy strategy) : base(container, strategy) { } + + protected override void DoWriteModalResults(Second time, Second simulationInterval, + IModalDataContainer container) + { + //var avgInAngularSpeed = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; + //var avgOutAngularSpeed = (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + //var inPower = CurrentState.InTorque * avgInAngularSpeed; + //var outPower = CurrentState.OutTorque * avgOutAngularSpeed; + container[ModalResultField.Gear] = Disengaged || DataBus.VehicleInfo.VehicleStopped ? 0 : Gear.Gear; + //container[ModalResultField.P_gbx_loss] = inPower - outPower; + //container[ModalResultField.P_gbx_inertia] = CurrentState.InertiaTorqueLossOut * avgOutAngularSpeed; + //container[ModalResultField.P_gbx_in] = inPower; + container[ModalResultField.n_IEPC_out_avg] = (PreviousState.OutAngularVelocity + + CurrentState.OutAngularVelocity) / 2.0; + container[ModalResultField.T_IEPC_out] = CurrentState.OutTorque; + //container[ModalResultField.T_gbx_in] = CurrentState.InTorque; + _strategy.WriteModalResults(container); + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index 2a43cc6435..fe7610ff63 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -95,15 +95,15 @@ namespace TUGraz.VectoCore.OutputData }; private readonly ModalResultField[] _iepcColumns = { - ModalResultField.n_IEPC_, + ModalResultField.n_IEPC_int_, ModalResultField.T_IEPC_, ModalResultField.T_IEPC_map_, - ModalResultField.T_IEPC_drive_max_, - ModalResultField.T_IEPC_gen_max_, - ModalResultField.P_IEPC_gen_max_, - ModalResultField.P_IEPC_drive_max_, + ModalResultField.T_IEPC_int_drive_max_, + ModalResultField.T_IEPC_int_gen_max_, + ModalResultField.P_IEPC_int_gen_max_, + ModalResultField.P_IEPC_int_drive_max_, ModalResultField.P_IEPC_electricMotorInertiaLoss_, - ModalResultField.P_IEPC_mech_map_, + ModalResultField.P_IEPC_int_mech_map_, ModalResultField.P_IEPC_el_, ModalResultField.P_IEPC_out_, ModalResultField.P_IEPC_electricMotorLoss_, @@ -356,7 +356,7 @@ namespace TUGraz.VectoCore.OutputData } var elPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_el_ : ModalResultField.P_EM_electricMotor_el_; - var mechPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_mech_map_ : ModalResultField.P_EM_mech_; + var mechPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_int_mech_map_ : ModalResultField.P_EM_mech_; var selected = Data.AsEnumerable().Select(r => { var dt = r.Field<Second>(ModalResultField.simulationInterval.GetName()); return new { @@ -417,7 +417,7 @@ namespace TUGraz.VectoCore.OutputData } var offField = emPos == PowertrainPosition.IEPC ? ModalResultField.IEPC_Off_ : ModalResultField.EM_Off_; var elPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_el_ : ModalResultField.P_EM_electricMotor_el_; - var mechPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_mech_map_ : ModalResultField.P_EM_mech_; + var mechPwrField = emPos == PowertrainPosition.IEPC ? ModalResultField.P_IEPC_int_mech_map_ : ModalResultField.P_EM_mech_; var selected = Data.AsEnumerable().Select(r => { var dt = r.Field<Second>(ModalResultField.simulationInterval.GetName()); return new { @@ -531,7 +531,7 @@ namespace TUGraz.VectoCore.OutputData public PerSecond ElectricMotorAverageSpeed(PowertrainPosition emPos) { var field = emPos == PowertrainPosition.IEPC - ? ModalResultField.n_IEPC_ + ? ModalResultField.n_IEPC_int_ : ModalResultField.n_EM_electricMotor_; var integral = GetValues(x => x.Field<PerSecond>(string.Format(field.GetCaption(), emPos.GetName())).Value() * x.Field<Second>(ModalResultField.simulationInterval.GetName()).Value()).Sum(); diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/Common/Hybrid_Parameters.vhctl b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/Common/Hybrid_Parameters.vhctl new file mode 100644 index 0000000000..2f2ed814fc --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/Common/Hybrid_Parameters.vhctl @@ -0,0 +1,18 @@ +{ + "Header": { + "CreatedBy": "", + "Date": "2020-09-07T15:28:08.3781385Z", + "AppVersion": "3", + "FileVersion": 2 + }, + "Body": { + "----EquivalenceFactor": 2.0, + "MinSoC": 24.0, + "----MaxSoC": 80.0, + "TargetSoC": 70.0, + "----AuxBufferTime": 5.0, + "----AuxBufferChgTime": 5.0, + "----MinICEOnTime": 10.0, + "GensetMinOptPowerFactor": 0.2 + } +} \ No newline at end of file -- GitLab