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

Skip to content
Snippets Groups Projects
Commit fea403d5 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

Merge pull request #407 in VECTO/vecto-sim from...

Merge pull request #407 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-466-update-vehicle-loadings to develop

* commit '1a99570e':
  remove unnecessary parameter for computing payload, adapt testcase due to changed simulation runs (no full-load any more)
  adapt xml writer to changes in schema
  update payload10% computation: use separate lookup, make pc-formula in segment table more explicit, i.e. use pc50 or pc75 instead and map to according lookup
  updating segment table: add payloads for 'low loaded vehicle', update payloads for municipal, construction cycles
parents fe903969 1a99570e
No related branches found
No related tags found
No related merge requests found
Showing
with 163 additions and 129 deletions
......@@ -72,19 +72,23 @@ namespace TUGraz.VectoCore.Models.Declaration
/// Formula for calculating the payload for a given gross vehicle weight.
/// (so called "pc-formula", Whitebook Apr 2016, Part 1, p.187)
/// </summary>
public static Kilogram GetPayloadForGrossVehicleWeight(Kilogram grossVehicleWeight, MissionType missionType)
public static Kilogram GetPayloadForGrossVehicleWeight(Kilogram grossVehicleWeight, string equationName)
{
return missionType == MissionType.LongHaul
? Payloads.Lookup75Percent(grossVehicleWeight)
: Payloads.Lookup50Percent(grossVehicleWeight);
if (equationName.ToLower().StartsWith("pc10")) {
return Payloads.Lookup10Percent(grossVehicleWeight);
}
if (equationName.ToLower().StartsWith("pc75")) {
return Payloads.Lookup75Percent(grossVehicleWeight);
}
return Payloads.Lookup50Percent(grossVehicleWeight);
}
/// <summary>
/// Returns the payload for a trailer. This is 75% of (GVW-CurbWeight).
/// </summary>
public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight)
public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight, bool lowLoading)
{
return Payloads.LookupTrailer(grossVehicleWeight, curbWeight);
return Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1);
}
public static int PoweredAxle()
......@@ -164,7 +168,7 @@ namespace TUGraz.VectoCore.Models.Declaration
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 const double TorqueLimitGearboxFactor = 0.9;
public const double TorqueLimitVehicleFactor = 0.95;
......
......@@ -40,6 +40,7 @@ namespace TUGraz.VectoCore.Models.Declaration
{
FullLoading,
ReferenceLoad,
LowLoading,
EmptyLoading,
}
......@@ -52,6 +53,8 @@ namespace TUGraz.VectoCore.Models.Declaration
return "F";
case LoadingType.ReferenceLoad:
return "R";
case LoadingType.LowLoading:
return "L";
case LoadingType.EmptyLoading:
return "E";
default:
......@@ -73,6 +76,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public List<MissionTrailer> Trailer;
public Kilogram MinLoad;
public Kilogram LowLoad;
public Kilogram RefLoad;
public Kilogram MaxLoad;
......@@ -82,9 +86,8 @@ namespace TUGraz.VectoCore.Models.Declaration
{
get {
return new Dictionary<LoadingType, Kilogram> {
{ LoadingType.EmptyLoading, MinLoad },
{ LoadingType.LowLoading, LowLoad },
{ LoadingType.ReferenceLoad, RefLoad },
{ LoadingType.FullLoading, MaxLoad }
};
}
}
......
......@@ -52,12 +52,20 @@ namespace TUGraz.VectoCore.Models.Declaration
/// <summary>
/// Obsolete. Call Lookup50Percent, Lookup75Percent or LookupTrailer instead!
/// </summary>
[Obsolete("Call Lookup50Percent, Lookup75Percent or LookupTrailer!", true)]
[Obsolete("Call Lookup10Percent, Lookup50Percent, Lookup75Percent or LookupTrailer!", true)]
private new PayloadEntry Lookup(Kilogram grossVehicleWeight)
{
throw new InvalidOperationException("Call Lookup50Percent, Lookup75Percent or LookupTrailer!");
}
public Kilogram Lookup10Percent(Kilogram grossVehicleWeight)
{
var section = Data.GetSection(d => d.Key > grossVehicleWeight);
return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key,
section.Item1.Value.Payload10Percent, section.Item2.Value.Payload10Percent,
grossVehicleWeight);
}
public Kilogram Lookup50Percent(Kilogram grossVehicleWeight)
{
var section = Data.GetSection(d => d.Key > grossVehicleWeight);
......@@ -85,6 +93,7 @@ namespace TUGraz.VectoCore.Models.Declaration
.ToDictionary(
kv => kv.ParseDouble("grossvehicleweight").SI<Kilogram>(),
kv => new PayloadEntry {
Payload10Percent = kv.ParseDouble("payload10%").SI<Kilogram>(),
Payload50Percent = kv.ParseDouble("payload50%").SI<Kilogram>(),
Payload75Percent = kv.ParseDouble("payload75%").SI<Kilogram>()
});
......@@ -92,6 +101,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public sealed class PayloadEntry
{
public Kilogram Payload10Percent;
public Kilogram Payload50Percent;
public Kilogram Payload75Percent;
}
......
......@@ -53,8 +53,7 @@ namespace TUGraz.VectoCore.Models.Declaration
protected override string ErrorMessage
{
get
{
get {
return
"ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleWeight: {2}";
}
......@@ -116,8 +115,8 @@ namespace TUGraz.VectoCore.Models.Declaration
return (considerInvalid || isValid == "1")
&& category == vehicleCategory.ToString()
&& axleConf == axleConfiguration.GetName()
// MK 2016-06-07: normally the next condition should be "mass > massMin", except for 7.5t where is should be ">="
// in any case ">=" is also correct, because the segment table is sorted by weight.
// MK 2016-06-07: normally the next condition should be "mass > massMin", except for 7.5t where is should be ">="
// in any case ">=" is also correct, because the segment table is sorted by weight.
&& massMin <= grossVehicleMassRating && grossVehicleMassRating <= massMax;
});
} catch (InvalidOperationException e) {
......@@ -145,8 +144,9 @@ namespace TUGraz.VectoCore.Models.Declaration
return new[] { "1", "2", "3", "4" }.Contains(r.Field<string>("hdvclass"))
&& massMin <= grossVehicleMassRating && grossVehicleMassRating <= massMax;
});
if (rigidGVWrow != null)
if (rigidGVWrow != null) {
vehicleHeight = rigidGVWrow.ParseDouble("height").SI<Meter>();
}
}
return vehicleHeight;
......@@ -196,17 +196,17 @@ namespace TUGraz.VectoCore.Models.Declaration
var maxLoad = gvw - curbWeight - body.CurbWeight -
trailers.Sum(t => t.TrailerCurbWeight).DefaultIfNull(0);
var refLoadValue = row.ParseDoubleOrGetDefault(missionType.ToString(), double.NaN);
Kilogram refLoad;
if (double.IsNaN(refLoadValue)) {
refLoad = DeclarationData.GetPayloadForGrossVehicleWeight(grossVehicleWeight, missionType) +
trailers.Sum(t => DeclarationData.GetPayloadForTrailerWeight(t.TrailerGrossVehicleWeight, t.TrailerCurbWeight))
.DefaultIfNull(0);
var payloads = row.Field<string>(missionType.ToString()).Split('/');
Kilogram refLoad = null, lowLoad = 0.SI<Kilogram>();
if (payloads.Length == 2) {
lowLoad = GetLoading(payloads[0], grossVehicleWeight, trailers, true);
refLoad = GetLoading(payloads[1], grossVehicleWeight, trailers, false);
} else {
refLoad = refLoadValue.SI<Kilogram>();
refLoad = GetLoading(row.Field<string>(missionType.ToString()), grossVehicleWeight, trailers, false);
}
refLoad = VectoMath.Min(refLoad, maxLoad);
refLoad = refLoad.LimitTo(0.SI<Kilogram>(), maxLoad);
lowLoad = lowLoad.LimitTo(0.SI<Kilogram>(), maxLoad);
var mission = new Mission {
MissionType = missionType,
......@@ -221,6 +221,7 @@ namespace TUGraz.VectoCore.Models.Declaration
MinLoad = 0.SI<Kilogram>(),
MaxLoad = maxLoad,
RefLoad = refLoad,
LowLoad = lowLoad,
TotalCargoVolume = body.CargoVolume + trailers.Sum(t => t.CargoVolume).DefaultIfNull(0),
};
missions.Add(mission);
......@@ -228,6 +229,18 @@ namespace TUGraz.VectoCore.Models.Declaration
return missions.ToArray();
}
private static Kilogram GetLoading(string payloadStr, Kilogram grossVehicleWeight, IEnumerable<MissionTrailer> trailers, bool lowLoading)
{
var refLoadValue = payloadStr.ToDouble(double.NaN);
if (double.IsNaN(refLoadValue)) {
return DeclarationData.GetPayloadForGrossVehicleWeight(grossVehicleWeight, payloadStr) +
trailers.Sum(
t => DeclarationData.GetPayloadForTrailerWeight(t.TrailerGrossVehicleWeight, t.TrailerCurbWeight, lowLoading))
.DefaultIfNull(0);
}
return refLoadValue.SI<Kilogram>();
}
/// <summary>
/// Checks if a trailer should be used for the current missionType.
/// </summary>
......
......@@ -14,8 +14,8 @@ namespace TUGraz.IVT.VectoXML.Writer
public abstract class AbstractXMLWriter
{
//protected const string SchemaLocationBaseUrl = "http://markus.quaritsch.at/VECTO/";
protected const string SchemaLocationBaseUrl = "http://www.ivt.tugraz.at/VECTO/";
protected const string SchemaVersion = "0.6";
protected const string SchemaLocationBaseUrl = "https://webgate.ec.europa.eu/CITnet/svn/VECTO/trunk/Share/XML/XSD/";
protected const string SchemaVersion = "0.8";
protected XNamespace tns;
protected XNamespace rootNamespace;
......
......@@ -286,8 +286,8 @@ namespace TUGraz.VectoCore.OutputData.XML
return new XElement(tns + XMLNames.Component_AxleWheels,
new XElement(tns + XMLNames.ComponentDataWrapper,
new XAttribute(XMLNames.Component_ID_Attr,
string.Format("AXLWHL-{0}", data.AxleConfiguration.GetName())),
//new XAttribute(XMLNames.Component_ID_Attr,
// string.Format("AXLWHL-{0}", data.AxleConfiguration.GetName())),
new XElement(tns + XMLNames.AxleWheels_Axles, axles))
);
}
......
Gross Vehicle Weight,Payload 50%,Payload 75%
7500,1250,1900
16000,4600,6900
Gross Vehicle Weight,Payload 10%,Payload 50%,Payload 75%
7500,250,1250,1900
16000,920,4600,6900
......@@ -183,8 +183,8 @@ namespace TUGraz.VectoCore.Tests.Integration
[TestMethod, TestCategory("LongRunning")]
public void Truck40t_Mod1Hz_Test()
{
var modFileName = "40t_Long_Haul_Truck_RegionalDeliveryFullLoading.vmod";
var modFileName1Hz = "40t_Long_Haul_Truck_RegionalDeliveryFullLoading_1Hz.vmod";
var modFileName = "40t_Long_Haul_Truck_RegionalDeliveryReferenceLoad.vmod";
var modFileName1Hz = "40t_Long_Haul_Truck_RegionalDeliveryReferenceLoad_1Hz.vmod";
if (File.Exists(modFileName)) {
File.Delete(modFileName);
......@@ -208,7 +208,7 @@ namespace TUGraz.VectoCore.Tests.Integration
var jobContainer = new JobContainer(sumData);
jobContainer.AddRuns(factory);
var i = 8;
var i = 5;
jobContainer.Runs[i].Run.Run();
Assert.IsTrue(jobContainer.Runs[i].Run.FinishedWithoutErrors,
string.Format("{0}", jobContainer.Runs[i].ExecException));
......
......@@ -310,7 +310,7 @@ namespace TUGraz.VectoCore.Tests.XML
jobContainer.AddRuns(runsFactory);
Assert.AreEqual(12, jobContainer.Runs.Count);
Assert.AreEqual(8, jobContainer.Runs.Count);
}
[TestMethod]
......
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