Newer
Older
/*
* This file is part of VECTO.
*
* Copyright © 2012-2016 European Union
*
* Developed by Graz University of Technology,
* Institute of Internal Combustion Engines and Thermodynamics,
* Institute of Technical Informatics
*
* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use VECTO except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* https://joinup.ec.europa.eu/community/eupl/og_page/eupl
*
* Unless required by applicable law or agreed to in writing, VECTO
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*
* Authors:
* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology
* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology
* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology
* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology
* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Collections.Generic;
using System.Linq;

Markus Quaritsch
committed
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.Reader;
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
using TUGraz.VectoCore.OutputData;
using TUGraz.VectoCore.OutputData.FileIO;
using TUGraz.VectoCore.Tests.Utils;
using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels;
namespace TUGraz.VectoCore.Tests.Integration
{
public class CoachAdvancedAuxPowertrain
{
public const string AccelerationFile = @"TestData\Components\Truck.vacc";
public const string EngineFile = @"TestData\Components\24t Coach.veng";
public const string AxleGearLossMap = @"TestData\Components\Axle.vtlm";
public const string GearboxIndirectLoss = @"TestData\Components\Indirect Gear.vtlm";
public const string GearboxDirectLoss = @"TestData\Components\Direct Gear.vtlm";
public const string GearboxShiftPolygonFile = @"TestData\Components\ShiftPolygons.vgbs";
public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld";
public const string AdvancedAuxFile = @"Testdata\Integration\BusAuxiliaries\AdvAuxTest.aaux";
public static VectoRun CreateEngineeringRun(DrivingCycleData cycleData, string modFileName,
bool overspeed = false)
{
var container = CreatePowerTrain(cycleData, modFileName.Replace(".vmod", ""), overspeed);
return new DistanceRun(container);
}
public static VehicleContainer CreatePowerTrain(DrivingCycleData cycleData, string modFileName,
bool overspeed = false)
{
var fileWriter = new FileOutputWriter(modFileName);

Michael KRISPER
committed
var modData = new ModalDataContainer(modFileName, fileWriter, ExecutionMode.Engineering) { WriteAdvancedAux = true };
var container = new VehicleContainer(ExecutionMode.Engineering, modData) {
RunData = new VectoRunData { JobName = modFileName, Cycle = cycleData }
};
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile);
var axleGearData = CreateAxleGearData();
var gearboxData = CreateGearboxData();
var vehicleData = CreateVehicleData(3300.SI<Kilogram>());
var driverData = CreateDriverData(AccelerationFile, overspeed);
var cycle = new DistanceBasedDrivingCycle(container, cycleData);
var engine = new CombustionEngine(container, engineData);
var clutch = new Clutch(container, engineData, engine.IdleController);
dynamic tmp = Port.AddComponent(cycle, new Driver(container, driverData, new DefaultDriverStrategy()));
tmp = Port.AddComponent(tmp, new Vehicle(container, vehicleData));
tmp = Port.AddComponent(tmp, new Wheels(container, vehicleData.DynamicTyreRadius, vehicleData.WheelsInertia));
tmp = Port.AddComponent(tmp, new Brakes(container));
tmp = Port.AddComponent(tmp, new AxleGear(container, axleGearData));
tmp = Port.AddComponent(tmp, new DummyRetarder(container));
tmp = Port.AddComponent(tmp,
new Gearbox(container, gearboxData, new AMTShiftStrategy(gearboxData, container)));
tmp = Port.AddComponent(tmp, clutch);
var aux = new BusAuxiliariesAdapter(container, AdvancedAuxFile, "Coach",
vehicleData.TotalVehicleWeight(), engineData.ConsumptionMap, engineData.IdleSpeed);
engine.Connect(aux.Port());
Port.AddComponent(tmp, engine);
engine.IdleController.RequestPort = clutch.IdleControlPort;
return container;
}
private static GearboxData CreateGearboxData()
{
var ratios = new[] { 6.38, 4.63, 3.44, 2.59, 1.86, 1.35, 1, 0.76 };
return new GearboxData {
Gears = ratios.Select((ratio, i) =>
Tuple.Create((uint)i,
new GearData {
FullLoadCurve = FullLoadCurveReader.ReadFromFile(GearboxFullLoadCurveFile),
LossMap = ratio.IsEqual(1)
? TransmissionLossMap.ReadFromFile(GearboxIndirectLoss, ratio, string.Format("Gear {0}", i))
: TransmissionLossMap.ReadFromFile(GearboxDirectLoss, ratio, string.Format("Gear {0}", i)),
ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile)
}))
.ToDictionary(k => k.Item1 + 1, v => v.Item2),
ShiftTime = 2.SI<Second>(),
Inertia = 0.SI<KilogramSquareMeter>(),
TractionInterruption = 1.SI<Second>(),
StartSpeed = 2.SI<MeterPerSecond>(),
StartAcceleration = 0.6.SI<MeterPerSquareSecond>(),
StartTorqueReserve = 0.2,
SkipGears = true,
TorqueReserve = 0.2,
UpshiftAfterDownshiftDelay = 10.SI<Second>(),
DownshiftAfterUpshiftDelay = 10.SI<Second>(),
UpshiftMinAcceleration = 0.1.SI<MeterPerSquareSecond>()
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
};
}
private static AxleGearData CreateAxleGearData()
{
const double ratio = 3.240355;
return new AxleGearData {
AxleGear = new GearData {
Ratio = ratio,
LossMap = TransmissionLossMap.ReadFromFile(AxleGearLossMap, ratio, "AxleGear")
}
};
}
private static VehicleData CreateVehicleData(Kilogram loading)
{
var axles = new List<Axle> {
new Axle {
AxleWeightShare = 0.4375,
Inertia = 21.66667.SI<KilogramSquareMeter>(),
RollResistanceCoefficient = 0.0055,
TwinTyres = false,
TyreTestLoad = 62538.75.SI<Newton>()
},
new Axle {
AxleWeightShare = 0.375,
Inertia = 10.83333.SI<KilogramSquareMeter>(),
RollResistanceCoefficient = 0.0065,
TwinTyres = true,
TyreTestLoad = 52532.55.SI<Newton>()
},
new Axle {
AxleWeightShare = 0.1875,
Inertia = 21.66667.SI<KilogramSquareMeter>(),
RollResistanceCoefficient = 0.0055,
TwinTyres = false,
TyreTestLoad = 62538.75.SI<Newton>()
}
};
return new VehicleData {
AxleConfiguration = AxleConfiguration.AxleConfig_6x2,
//AerodynamicDragAera = 3.2634.SI<SquareMeter>(),
//CrossWindCorrectionMode = CrossWindCorrectionMode.NoCorrection,
CrossWindCorrectionCurve =
new CrosswindCorrectionCdxALookup(CrossWindCorrectionCurveReader.GetNoCorrectionCurve(3.2634.SI<SquareMeter>()),
CrossWindCorrectionMode.NoCorrection),
CurbWeight = 15700.SI<Kilogram>(),
Loading = loading,
DynamicTyreRadius = 0.52.SI<Meter>(),
AxleData = axles,
SavedInDeclarationMode = false
};
}
private static DriverData CreateDriverData(string accelerationFile, bool overspeed = false)
{
return new DriverData {
AccelerationCurve = AccelerationCurveData.ReadFromFile(accelerationFile),
LookAheadCoasting = new DriverData.LACData {
Enabled = true,

Markus Quaritsch
committed
//MinSpeed = 50.KMPHtoMeterPerSecond(),
//Deceleration = -0.5.SI<MeterPerSquareSecond>()
LookAheadDistanceFactor = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor,
LookAheadDecisionFactor = new LACDecisionFactor()
},
OverSpeedEcoRoll = overspeed
? new DriverData.OverSpeedEcoRollData {

Markus Quaritsch
committed
Mode = DriverMode.Overspeed,
MinSpeed = 50.KMPHtoMeterPerSecond(),
OverSpeed = 5.KMPHtoMeterPerSecond()
}
: new DriverData.OverSpeedEcoRollData {

Markus Quaritsch
committed
Mode = DriverMode.Off
},
StartStop = new VectoRunData.StartStopData {
Enabled = false
}
};
}
}
}