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

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

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

Merge pull request #203 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:hotfix/VECTO-296-improve-errorhandling-when-reading to master

* commit '61f03629':
  adapt 12t delivery truck to work with most recent vecto version
  make vecto exception with message, inner and params public, json parser: aggregate exception messages, engineering data adapter: check if demand map for auxiliary is given
parents 3819e395 61f03629
No related branches found
No related tags found
No related merge requests found
{
"Header": {
"CreatedBy": "John.Norris@ricardo-aea.com, Rasa.Narkeviciute@ricardo-aea.com, Scott.Hanchett@ricardo-aea.com, Dana.Nurse@ricardo-aea.com, pascal.revereault@ricardo.com, james.baxter@ricardo.com (51e9f02e-c88f-4c25-9798-3f807530e154)",
"Date": "20/07/2015 12:19:33",
"AppVersion": "2.0.4-beta",
"CreatedBy": " ()",
"Date": "17.06.2016 08:12:45",
"AppVersion": "2.2",
"FileVersion": 2
},
"Body": {
......@@ -18,40 +18,7 @@
"AuxiliaryAssembly": "CLASSIC",
"AuxiliaryVersion": "CLASSIC",
"AdvancedAuxiliaryFilePath": "",
"Aux": [
{
"ID": "FAN",
"Type": "Fan",
"Path": "<NOFILE>",
"Technology": ""
},
{
"ID": "STP",
"Type": "Steering pump",
"Path": "<NOFILE>",
"Technology": ""
},
{
"ID": "AC",
"Type": "HVAC",
"Path": "<NOFILE>",
"Technology": ""
},
{
"ID": "ES",
"Type": "Electric System",
"Path": "<NOFILE>",
"Technology": "",
"TechList": []
},
{
"ID": "PS",
"Type": "Pneumatic System",
"Path": "<NOFILE>",
"Technology": ""
}
],
"VACC": "Coach.vacc",
"VACC": "Truck.vacc",
"EngineOnlyMode": false,
"StartStop": {
"Enabled": true,
......
{
"Header": {
"CreatedBy": "Terry Burns (cdfbee63-58c9-44d5-a649-9903ea7eb6b5)",
"Date": "13/01/2015 08:55:15",
"AppVersion": "2.0.4-beta",
"FileVersion": 2
"CreatedBy": " ()",
"Date": "17.06.2016 07:48:12",
"AppVersion": "2.2",
"FileVersion": 3
},
"Body": {
"SavedInDeclMode": false,
......@@ -11,15 +11,10 @@
"Displacement": 7700.0,
"IdlingSpeed": 600.0,
"Inertia": 3.789,
"FullLoadCurves": [
{
"Path": "12t Delivery Truck.vfld",
"Gears": "0 - 99"
}
],
"FullLoadCurve": "12t Delivery Truck.vfld",
"FuelMap": "12t Delivery Truck.vmap",
"WHTC-Urban": 215.0,
"WHTC-Rural": 202.0,
"WHTC-Motorway": 204.0
"WHTC-Urban": 0.0,
"WHTC-Rural": 0.0,
"WHTC-Motorway": 0.0
}
}
\ No newline at end of file
{
"Header": {
"CreatedBy": "Terry Burns (cdfbee63-58c9-44d5-a649-9903ea7eb6b5)",
"Date": "13/01/2015 08:55:19",
"AppVersion": "2.0.4-beta",
"FileVersion": 4
"CreatedBy": " ()",
"Date": "17.06.2016 08:12:24",
"AppVersion": "2.2",
"FileVersion": 5
},
"Body": {
"SavedInDeclMode": false,
......@@ -19,37 +19,43 @@
"Ratio": 6.75,
"LossMap": "Indirect Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 3.6,
"LossMap": "Indirect Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 2.13,
"LossMap": "Indirect Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 1.39,
"LossMap": "Indirect Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 1.0,
"LossMap": "Direct Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
},
{
"Ratio": 0.78,
"LossMap": "Indirect Gear.vtlm",
"TCactive": false,
"ShiftPolygon": "-"
"ShiftPolygon": "ShiftPolygons.vgbs",
"FullLoadCurve": "<NOFILE>"
}
],
"TqReserve": 20.0,
......
{
"Header": {
"CreatedBy": "Terry Burns (cdfbee63-58c9-44d5-a649-9903ea7eb6b5)",
"Date": "13/01/2015 08:55:12",
"AppVersion": "2.0.4-beta",
"FileVersion": 5
"CreatedBy": " ()",
"Date": "17.06.2016 07:50:47",
"AppVersion": "2.2",
"FileVersion": 7
},
"Body": {
"SavedInDeclMode": false,
......@@ -12,11 +12,10 @@
"CurbWeightExtra": 0.0,
"Loading": 0.0,
"MassMax": 11.9,
"Cd": 0.6,
"CrossSecArea": 8.8,
"CdA": 5.28,
"rdyn": 406.9297,
"Rim": "15° DC Rims",
"CdCorrMode": "CdOfV",
"CdCorrMode": "Off",
"CdCorrFile": "12t Delivery Truck.vcdv",
"Retarder": {
"Type": "None",
......@@ -28,16 +27,16 @@
"Axles": [
{
"Inertia": 6.0,
"Wheels": "245/70 R 19.5",
"AxleWeightShare": 0.0,
"Wheels": "245/70 R19.5",
"AxleWeightShare": 0.4,
"TwinTyres": false,
"RRCISO": 0.008343465,
"FzISO": 20800.0
},
{
"Inertia": 6.0,
"Wheels": "245/70 R 19.5",
"AxleWeightShare": 0.0,
"Wheels": "245/70 R19.5",
"AxleWeightShare": 0.6,
"TwinTyres": true,
"RRCISO": 0.00943769,
"FzISO": 20800.0
......
......@@ -60,7 +60,7 @@ namespace TUGraz.VectoCommon.Exceptions
LogManager.Flush();
}
protected VectoException(string message, Exception inner, params object[] args)
public VectoException(string message, Exception inner, params object[] args)
: base(string.Format(message, args), inner)
{
LogManager.Flush();
......
......@@ -209,31 +209,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
if (!EmptyOrInvalidFileName(gearboxFile)) {
Gearbox = JSONInputDataFactory.ReadGearbox(Path.Combine(BasePath, gearboxFile));
}
} catch (Exception e) {
throw new VectoException("Failed to read Gearbox file.", e);
}
try {
var axleGear = Gearbox as IAxleGearInputData;
if (axleGear != null) {
AxleGear = axleGear;
}
} catch (Exception e) {
throw new VectoException("Failed to read AxleGear file.", e);
}
try {
Engine = JSONInputDataFactory.ReadEngine(
Path.Combine(BasePath, Body.GetEx(JsonKeys.Vehicle_EngineFile).Value<string>()));
} catch (Exception e) {
throw new VectoException("Failed to read Engine file.", e);
}
try {
var vehicleFile = Body.GetEx(JsonKeys.Vehicle_VehicleFile).Value<string>();
if (!EmptyOrInvalidFileName(vehicleFile)) {
VehicleData = JSONInputDataFactory.ReadJsonVehicle(
Path.Combine(BasePath, vehicleFile));
}
} catch (Exception e) {
throw new VectoException("Failed to read Vehicle file.", e);
throw new VectoException("Failed to read input data: {0}", e, e.Message);
}
var retarder = VehicleData as IRetarderInputData;
if (retarder != null) {
......@@ -265,7 +256,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IVehicleEngineeringInputData VehicleInputData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
if (VehicleData == null) {
......@@ -277,7 +269,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IGearboxEngineeringInputData GearboxInputData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
if (Gearbox == null) {
......@@ -289,7 +282,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IAxleGearInputData AxleGearInputData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
if (AxleGear == null) {
......@@ -306,7 +300,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IEngineEngineeringInputData EngineInputData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
if (Engine == null) {
......@@ -333,7 +328,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IRetarderInputData RetarderInputData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
if (Retarder == null) {
......@@ -359,7 +355,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual IList<ICycleData> Cycles
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
var retVal = new List<ICycleData>();
......@@ -467,7 +464,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public virtual DataTable AccelerationCurve
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design",
"CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
get
{
var acceleration = Body[JsonKeys.DriverData_AccelerationCurve];
......
......@@ -173,12 +173,17 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper
WarnEngineeringMode("AuxData");
}
return auxInputData.Auxiliaries.Select(a => new VectoRunData.AuxData {
ID = a.ID,
Technology = a.Technology,
TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(),
DemandType = AuxiliaryDemandType.Mapping,
Data = new AuxiliaryData(a, a.ID) //AuxiliaryData.Create(a.DemandMap)
return auxInputData.Auxiliaries.Select(a => {
if (a.DemandMap == null) {
throw new VectoSimulationException("Demand Map for auxiliary {0} {1} required", a.ID, a.Technology);
}
return new VectoRunData.AuxData {
ID = a.ID,
Technology = a.Technology,
TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(),
DemandType = AuxiliaryDemandType.Mapping,
Data = new AuxiliaryData(a, a.ID) //AuxiliaryData.Create(a.DemandMap)
};
}).Concat(new VectoRunData.AuxData { ID = "", DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()).ToList();
}
......
......@@ -86,7 +86,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
var torque = busAux.PowerDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed,
(internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed);
Assert.AreEqual(6086.9321, (torque * engineSpeed).Value(), 1e-3);
busAux.CommitSimulationStep(modalData);
busAux.DoWriteModalResults(modalData);
}
Assert.AreEqual(79.303, ((SI)modalData[ModalResultField.AA_TotalCycleFC_Grams]).Value(), 0.0001);
......@@ -98,7 +98,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
var torque = busAux.PowerDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed,
(internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed);
Assert.AreEqual(8954.1396, (torque * engineSpeed).Value(), 1e-3);
busAux.CommitSimulationStep(modalData);
busAux.DoWriteModalResults(modalData);
}
Assert.AreEqual(82.5783, ((SI)modalData[ModalResultField.AA_TotalCycleFC_Grams]).Value(), 0.0001);
......@@ -110,7 +110,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
var torque = busAux.PowerDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed,
(internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed);
Assert.AreEqual(6086.9321, (torque * engineSpeed).Value(), 1e-3);
busAux.CommitSimulationStep(modalData);
busAux.DoWriteModalResults(modalData);
}
Assert.AreEqual(162.4654, ((SI)modalData[ModalResultField.AA_TotalCycleFC_Grams]).Value(), 0.0001);
......
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