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

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

adding test for at gearbox, considering torque converter's inertia at engine

parent 67cbfb62
No related branches found
No related tags found
No related merge requests found
Showing
with 391 additions and 26 deletions
......@@ -142,7 +142,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
return retVal;
}
internal CombustionEngineData CreateEngineData(IEngineDeclarationInputData engine)
internal CombustionEngineData CreateEngineData(IEngineDeclarationInputData engine, GearboxType gearboxType)
{
if (!engine.SavedInDeclarationMode) {
WarnDeclarationMode("EngineData");
......@@ -152,7 +152,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
retVal.WHTCUrban = engine.WHTCUrban;
retVal.WHTCMotorway = engine.WHTCMotorway;
retVal.WHTCRural = engine.WHTCRural;
retVal.Inertia = DeclarationData.Engine.EngineInertia(retVal.Displacement);
retVal.Inertia = DeclarationData.Engine.EngineInertia(retVal.Displacement, gearboxType);
retVal.FullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve, true);
retVal.FullLoadCurve.EngineData = retVal;
return retVal;
......
......@@ -36,6 +36,7 @@ using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
......@@ -102,14 +103,15 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
Log.Error("{0} is in Declaration Mode but is used for Engineering Mode!", msg);
}
internal CombustionEngineData CreateEngineData(IEngineEngineeringInputData engine)
internal CombustionEngineData CreateEngineData(IEngineEngineeringInputData engine, IGearboxEngineeringInputData gbx)
{
if (engine.SavedInDeclarationMode) {
WarnEngineeringMode("EngineData");
}
var retVal = SetCommonCombustionEngineData(engine);
retVal.Inertia = engine.Inertia;
retVal.Inertia = engine.Inertia +
(gbx != null && gbx.Type == GearboxType.AT ? gbx.TorqueConverter.Inertia : 0.SI<KilogramSquareMeter>());
retVal.FullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve);
retVal.FullLoadCurve.EngineData = retVal;
return retVal;
......@@ -149,7 +151,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
} else {
throw new InvalidFileFormatException("Gear {0} LossMap or Efficiency missing.", i + 1);
}
var fullLoadCurve = IntersectFullLoadCurves(engineData.FullLoadCurve, gear.MaxTorque);
var shiftPolygon = gear.ShiftPolygon != null
? ShiftPolygonReader.Create(gear.ShiftPolygon)
......@@ -164,6 +166,18 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
});
}).ToDictionary(kv => kv.Key, kv => kv.Value);
if (gears.Any(g => g.TorqueConverterActive)) {
if (retVal.Type != GearboxType.AT) {
throw new VectoException("Torque Converter can only be used with AT gearbox model");
}
retVal.TorqueConverterData = TorqueConverterDataReader.Create(gearbox.TorqueConverter.TCData,
gearbox.TorqueConverter.ReferenceRPM);
} else {
if (retVal.Type == GearboxType.AT) {
throw new VectoException("AT gearbox model requires torque converter");
}
}
retVal.DownshiftAfterUpshiftDelay = gearbox.DownshiftAferUpshiftDelay;
retVal.UpshiftAfterDownshiftDelay = gearbox.UpshiftAfterDownshiftDelay;
retVal.UpshiftMinAcceleration = gearbox.UpshiftMinAcceleration;
......
......@@ -70,7 +70,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
var tempVehicle = dao.CreateVehicleData(InputDataProvider.VehicleInputData, segment.Missions.First(),
segment.Missions.First().Loadings.First().Value);
var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData);
var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData, InputDataProvider.GearboxInputData.Type);
var axlegearData = dao.CreateAxleGearData(InputDataProvider.AxleGearInputData, false);
var angularGearData = dao.CreateAngularGearData(InputDataProvider.AngularGearInputData, false);
var gearboxData = dao.CreateGearboxData(InputDataProvider.GearboxInputData, engineData, axlegearData.AxleGear.Ratio,
......
......@@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
foreach (var cycle in InputDataProvider.JobInputData().Cycles) {
var simulationRunData = new VectoRunData {
JobName = InputDataProvider.JobInputData().JobName,
EngineData = dao.CreateEngineData(InputDataProvider.EngineInputData),
EngineData = dao.CreateEngineData(InputDataProvider.EngineInputData, null),
Cycle = DrivingCycleDataReader.ReadFromDataTable(cycle.CycleData, CycleType.EngineOnly, cycle.Name, false),
ExecutionMode = ExecutionMode.Engineering
};
......
......@@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
{
var dao = new EngineeringDataAdapter();
var driver = dao.CreateDriverData(InputDataProvider.DriverInputData);
var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData);
var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData, InputDataProvider.GearboxInputData);
var tempVehicle = dao.CreateVehicleData(InputDataProvider.VehicleInputData);
......
......@@ -233,13 +233,16 @@ namespace TUGraz.VectoCore.Models.Declaration
public static class Engine
{
public static readonly KilogramSquareMeter ClutchInertia = 1.3.SI<KilogramSquareMeter>();
public static readonly KilogramSquareMeter TorqueConverterInertia = 1.2.SI<KilogramSquareMeter>();
public static readonly KilogramSquareMeter EngineBaseInertia = 0.41.SI<KilogramSquareMeter>();
public static readonly SI EngineDisplacementInertia = (0.27 * 1000).SI().Kilo.Gramm.Per.Meter; // [kg/m]
public static KilogramSquareMeter EngineInertia(SI displacement)
public static KilogramSquareMeter EngineInertia(SI displacement, GearboxType gbxType)
{
// VB Code: Return 1.3 + 0.41 + 0.27 * (Displ / 1000)
return ClutchInertia + EngineBaseInertia + EngineDisplacementInertia * displacement;
return (gbxType == GearboxType.AT ? TorqueConverterInertia : ClutchInertia) + EngineBaseInertia +
EngineDisplacementInertia * displacement;
}
}
......
......@@ -32,6 +32,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
......@@ -45,12 +46,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
[DataContract]
public class GearboxData : SimulationComponentData
{
public GearboxType Type { get; internal set; }
/// <summary>
/// The gear data.
/// </summary>
[Required, ValidateObject] public Dictionary<uint, GearData> Gears = new Dictionary<uint, GearData>();
public GearboxType Type { get; internal set; }
public TorqueConverterData TorqueConverterData { get; internal set; }
[Required, SIRange(0, 10)]
public KilogramSquareMeter Inertia { get; internal set; }
......@@ -86,9 +89,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
[Required, Range(0, 0.5)]
public double StartTorqueReserve { get; internal set; }
// MQ: TODO: move to Driver Data ?
[Required, SIRange(double.Epsilon, 5)]
public MeterPerSecond StartSpeed { get; internal set; }
// MQ: TODO: move to Driver Data ?
[Required, SIRange(double.Epsilon, 2)]
public MeterPerSquareSecond StartAcceleration { get; internal set; }
......
......@@ -8,13 +8,10 @@ using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
public class ATGearbox : AbstractGearbox<GearboxState>, IGearbox, ITnOutPort, ITnInPort,
public class ATGearbox : AbstractGearbox<ATGearbox.ATGearboxState>, IGearbox, ITnOutPort, ITnInPort,
IClutchInfo
{
public ATGearbox(IVehicleContainer container, GearboxData gearboxModelData) : base(container, gearboxModelData)
{
}
public ATGearbox(IVehicleContainer container, GearboxData gearboxModelData) : base(container, gearboxModelData) {}
protected override void DoWriteModalResults(IModalDataContainer container)
{
......@@ -26,8 +23,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
throw new System.NotImplementedException();
}
public override IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false)
public override IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity,
bool dryRun = false)
{
throw new System.NotImplementedException();
}
......@@ -42,6 +40,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
throw new System.NotImplementedException();
}
public class GearboxState : SimpleComponentState {}
public class ATGearboxState : GearboxState
{
public bool TorqueConverterOpen;
}
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ using System.IO;
using System.Linq;
using NUnit.Framework;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter;
......@@ -341,7 +342,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration
};
var dao = new DeclarationDataAdapter();
var engineData = dao.CreateEngineData(new JSONEngineDataV3(JSONInputDataFactory.ReadFile(engineFile), engineFile));
var engineData = dao.CreateEngineData(new JSONEngineDataV3(JSONInputDataFactory.ReadFile(engineFile), engineFile),
GearboxType.AMT);
var gearboxData = new JSONGearboxDataV5(JSONInputDataFactory.ReadFile(gearboxFile), gearboxFile);
......
......@@ -123,7 +123,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData
};
var dao = new EngineeringDataAdapter();
var engineData = dao.CreateEngineData(data);
var engineData = dao.CreateEngineData(data, null);
var results = engineData.Validate();
Assert.IsFalse(results.Any(), "Validation failed: " + "; ".Join(results.Select(r => r.ErrorMessage)));
......@@ -161,7 +161,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData
};
var dao = new DeclarationDataAdapter();
var engineData = dao.CreateEngineData(data);
var engineData = dao.CreateEngineData(data, GearboxType.AMT);
var results = engineData.Validate();
Assert.IsFalse(results.Any(), "Validation failed: " + "; ".Join(results.Select(r => r.ErrorMessage)));
......
M_shift in Nm,n_down in rpm,n_up in rpm
-200,600,800
0,600,800
3000,600,800
{
"Header": {
"CreatedBy": "Raphael Luz IVT TU-Graz (14fea510-e457-4bf6-860f-a9514dc327f1)",
"Date": "25.06.2015 11:23:46",
"AppVersion": "2.2 beta",
"FileVersion": 3
},
"Body": {
"SavedInDeclMode": false,
"ModelName": "Demo Engine",
"Displacement": 7700.0,
"IdlingSpeed": 600.0,
"Inertia": 3.8,
"FullLoadCurve": "FullLoad.vfld",
"FuelMap": "FCMap.vmap",
"WHTC-Urban": 0.0,
"WHTC-Rural": 0.0,
"WHTC-Motorway": 0.0
}
}
\ No newline at end of file
n in rpm,M in Nm,FC in g/h,
600,-45,0,
600,0,767,
600,100,1759,
600,200,2890,
600,300,4185,
600,400,5404,
600,500,6535,
600,600,7578,
800,-55,0,
800,0,951,
800,100,2346,
800,200,3653,
800,300,5328,
800,400,6903,
800,500,8503,
800,600,10003,
800,700,11641,
800,836,13867,
1000,-63,0,
1000,0,1006,
1000,100,2932,
1000,200,4503,
1000,300,6472,
1000,400,8503,
1000,500,10472,
1000,600,12504,
1000,700,14514,
1000,800,16546,
1000,900,18567,
1000,1000,20577,
1000,1070,21962,
1100,-69,0,
1100,0,1235,
1200,-75,0,
1200,0,1467,
1200,100,3063,
1200,200,5359,
1200,300,7701,
1200,400,10082,
1200,500,12504,
1200,600,14902,
1200,700,17182,
1200,800,19569,
1200,900,21989,
1200,1000,24411,
1200,1100,26819,
1200,1200,29601,
1300,-81,0,
1300,0,1684,
1300,100,3302,
1300,200,5828,
1300,300,8367,
1300,400,10926,
1300,500,13533,
1300,600,16046,
1300,700,18591,
1300,800,21172,
1300,900,23733,
1300,1000,26321,
1300,1100,28756,
1300,1200,31288,
1400,-88,0,
1400,0,1943,
1400,100,3660,
1400,200,6304,
1400,300,9031,
1400,400,11783,
1400,500,14466,
1400,600,17180,
1400,700,20015,
1400,800,22828,
1400,900,25498,
1400,1000,28127,
1400,1100,30815,
1400,1200,33609,
1500,-93,0,
1500,0,2167,
1500,100,3963,
1500,200,6793,
1500,300,9721,
1500,400,12670,
1500,500,15534,
1500,600,18413,
1500,700,21467,
1500,800,24495,
1500,900,27363,
1500,1000,30056,
1500,1100,33082,
1500,1200,36100,
1600,-98,0,
1600,0,2391,
1600,100,4272,
1600,200,7257,
1600,300,10398,
1600,400,13535,
1600,500,16711,
1600,600,19835,
1600,700,22965,
1600,800,26115,
1600,900,29164,
1600,1000,32057,
1600,1100,35231,
1600,1200,38423,
1700,-101,0,
1700,0,2641,
1700,100,4578,
1700,200,7768,
1700,300,11114,
1700,400,14439,
1700,500,17759,
1700,600,21069,
1700,700,24380,
1700,800,27739,
1700,900,31000,
1700,1000,34205,
1700,1100,37738,
1700,1165,40006,
1800,-104,0,
1800,0,2890,
1800,100,4965,
1800,200,8233,
1800,300,11783,
1800,400,15307,
1800,500,18849,
1800,600,22267,
1800,700,25749,
1800,800,29389,
1800,900,32951,
1800,1000,36568,
1800,1124,41263,
1900,-108,0,
1900,0,3192,
1900,100,5416,
1900,200,8777,
1900,300,12531,
1900,400,16204,
1900,500,19993,
1900,600,23620,
1900,700,27255,
1900,800,31168,
1900,900,35024,
1900,1000,38907,
1900,1080,41993,
2000,-112,0,
2000,0,3496,
2000,100,5853,
2000,200,9345,
2000,300,13315,
2000,400,17188,
2000,500,21137,
2000,600,25058,
2000,700,28927,
2000,800,33026,
2000,900,37178,
2000,1038,42689,
2100,-119,0,
2100,0,3873,
2100,100,6296,
2100,200,9929,
2100,300,14095,
2100,400,18157,
2100,500,22233,
2100,600,26479,
2100,700,30774,
2100,800,35001,
2100,900,39377,
2100,997,43557,
2200,-126,0,
2200,0,4247,
2200,100,6689,
2200,200,10535,
2200,300,14855,
2200,400,19151,
2200,500,23395,
2200,600,27834,
2200,700,32507,
2200,800,37130,
2200,900,41619,
2200,954,44014,
2300,-131,0,
2300,0,4523,
2300,100,7178,
2300,200,11221,
2300,300,15658,
2300,400,20237,
2300,500,24761,
2300,600,29476,
2300,700,34611,
2300,800,39599,
2300,898,44083,
2400,-136,0,
2400,0,4945,
2400,100,7525,
2400,200,11830,
2400,300,16443,
2400,400,21307,
2400,500,26324,
2400,600,31334,
2400,700,36714,
2400,815,42842,
2500,-141,0,
2500,0,5338,
2500,100,7731,
2500,200,12385,
2500,300,17231,
2500,400,22333,
2500,500,27940,
2500,600,33195,
2500,711,39440,
2600,-149,0,
2600,0,5700,
n in rpm,M_FL in Nm,M_frict in Nm,PT1 in s
575,570,-12,0.21
800,834,-16,0.47
1000,1068,-24,0.58
1200,1198,-33,0.53
1400,1198,-44,0.46
1600,1198,-56,0.35
1800,1122,-67,0.20
2000,1036,-82,0.11
2100,995,-89,0.11
2200,952,-97,0.11
2400,813,-119,0.11
2500,709,-134,0.11
2600,0,-148,0.11
{
"Header": {
"CreatedBy": "Raphael Luz IVT TU-Graz (14fea510-e457-4bf6-860f-a9514dc327f1)",
"Date": "25.06.2015 11:23:52",
"AppVersion": "2.2 beta",
"FileVersion": 5
},
"Body": {
"SavedInDeclMode": false,
"ModelName": "Gearbox",
"Inertia": 0.0,
"TracInt": 0.0,
"Gears": [
{
"Ratio": 6.2,
"Efficiency": "0.95"
},
{
"Ratio": 3.0,
"Efficiency": "0.96",
"TCactive": true,
"ShiftPolygon": "AT-Shift.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 3.0,
"Efficiency": "0.96",
"TCactive": false,
"ShiftPolygon": "AT-Shift.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 1.0,
"Efficiency": "0.98",
"TCactive": false,
"ShiftPolygon": "AT-Shift.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 0.8,
"Efficiency": "0.96",
"TCactive": false,
"ShiftPolygon": "AT-Shift.vgbs",
"FullLoadCurve": "<NOFILE>"
}
],
"TqReserve": 5.0,
"SkipGears": false,
"ShiftTime": 1,
"EaryShiftUp": false,
"StartTqReserve": 40.0,
"StartSpeed": 4.0,
"StartAcc": 0.8,
"GearboxType": "AT",
"TorqueConverter": {
"Enabled": true,
"File": "TorqueConverter.vtcc",
"RefRPM": 1000.0,
"Inertia": 0.5
}
}
}
\ No newline at end of file
Speed Ratio, Torque Ratio,MP1000
0,3.935741,563.6598
0.1,3.296827,534.1364
0.2,2.701476,504.6129
0.3,2.265852,472.1372
0.4,1.931875,421.9474
0.5,1.554335,354.0435
0.6,1.249399,268.4255
0.7,1.075149,114.9037
......@@ -53,14 +53,14 @@ namespace TUGraz.VectoCore.Tests.Utils
var engineInput = JSONInputDataFactory.ReadEngine(engineFile);
if (declarationMode) {
var dao = new DeclarationDataAdapter();
var engineData = dao.CreateEngineData(engineInput);
var engineData = dao.CreateEngineData(engineInput, gearboxInput.Type);
return dao.CreateGearboxData(gearboxInput, engineData, ((IAxleGearInputData)gearboxInput).Ratio, 0.5.SI<Meter>(),
false);
} else {
var dao = new EngineeringDataAdapter();
var engineData = dao.CreateEngineData(engineInput);
var engineData = dao.CreateEngineData(engineInput, gearboxInput);
return dao.CreateGearboxData(gearboxInput, engineData, ((IAxleGearInputData)gearboxInput).Ratio, 0.5.SI<Meter>(),
false);
true);
}
}
......@@ -75,7 +75,7 @@ namespace TUGraz.VectoCore.Tests.Utils
{
var dao = new EngineeringDataAdapter();
var engineInput = JSONInputDataFactory.ReadEngine(engineFile);
return dao.CreateEngineData(engineInput);
return dao.CreateEngineData(engineInput, null);
}
public static VehicleData CreateVehicleDataFromFile(string vehicleDataFile)
......
......@@ -95,6 +95,7 @@
<Compile Include="Models\Declaration\ShiftPolygonTest.cs" />
<Compile Include="Models\SimulationComponentData\TorqueConverterDataTest.cs" />
<Compile Include="Models\SimulationComponentData\ValidationTest.cs" />
<Compile Include="Models\SimulationComponent\ATGearboxTest.cs" />
<Compile Include="Models\Simulation\FactoryTest.cs" />
<Compile Include="Models\Simulation\LossMapRangeValidationTest.cs" />
<Compile Include="Models\Simulation\LACDecisionFactorTest.cs" />
......@@ -215,6 +216,24 @@
<None Include="TestData\Components\40t_Long_Haul_Truck_NoAng.vveh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\AT-Shift.vgbs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\Engine.veng">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\FCMap.vmap">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\FullLoad.vfld">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\Gearbox.vgbx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\AT_GBX\TorqueConverter.vtcc">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Components\Class4_40t_Long_Haul_Truck.vveh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
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