diff --git a/VectoCommon/VectoCommon/InputData/DataSourceType.cs b/VectoCommon/VectoCommon/InputData/DataSourceType.cs index 609549cb7e192e8f2b1dc6b3bc177bfc7cd36341..917b6b4c6fa7b65b2ab03f177c78c138482ea398 100644 --- a/VectoCommon/VectoCommon/InputData/DataSourceType.cs +++ b/VectoCommon/VectoCommon/InputData/DataSourceType.cs @@ -36,5 +36,6 @@ namespace TUGraz.VectoCommon.InputData Embedded, CSVFile, JSONFile, + Missing } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs index d347dff1c31aa0407c761b562d97363eb2d7f0fc..fab89a437a1b686e28ec7188dc73fa4575ae8190 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -96,7 +96,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON throw; } return - new TableData(Path.Combine(BasePath, Body[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix); + new TableData(Path.Combine(BasePath, Body[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix, + DataSourceType.Missing); } } } @@ -111,7 +112,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, Body[JsonKeys.Engine_FullLoadCurveFile].ToString()) + MissingFileSuffix); + return new TableData( + Path.Combine(BasePath, Body[JsonKeys.Engine_FullLoadCurveFile].ToString()) + MissingFileSuffix, + DataSourceType.Missing); } } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index df8823e554dd324cba19ce0f3c68ee50af55ee13..36078cbb5969e69d9ced0c95195f8c299cdd7b2c 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -81,7 +81,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON return ReadTableData(shiftpolygonFile, "TorqueConverter Shift Polygon"); } catch (Exception) { if (TolerateMissing) { - return new TableData(Path.Combine(BasePath, shiftpolygonFile) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, shiftpolygonFile) + MissingFileSuffix, DataSourceType.Missing); } } return null; @@ -156,7 +156,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, lossMap.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, lossMap.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } return null; @@ -217,7 +217,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } return new TableData(Path.Combine(BasePath, Body[JsonKeys.Gearbox_Gears][1]["ShiftPolygon"].ToString()) + - MissingFileSuffix); + MissingFileSuffix, DataSourceType.Missing); } } } @@ -298,7 +298,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - retVal.LossMap = new TableData(Path.Combine(BasePath, lossMap.ToString()) + MissingFileSuffix); + retVal.LossMap = new TableData(Path.Combine(BasePath, lossMap.ToString()) + MissingFileSuffix, DataSourceType.Missing); } } else { retVal.Efficiency = gear[JsonKeys.Gearbox_Gear_Efficiency] != null @@ -311,7 +311,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON retVal.ShiftPolygon = ReadTableData(gear.GetEx<string>(JsonKeys.Gearbox_Gear_ShiftPolygonFile), string.Format("Gear {0} shiftPolygon", gearNumber)); } catch (Exception) { - retVal.ShiftPolygon = new TableData(Path.Combine(BasePath, shiftPolygonFile.Value<string>()) + MissingFileSuffix); + retVal.ShiftPolygon = new TableData(Path.Combine(BasePath, shiftPolygonFile.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } //retVal.ShiftPolygon = gear[JsonKeys.Gearbox_Gear_ShiftPolygonFile] != null @@ -460,7 +460,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON "TorqueConverter Data"); } catch (Exception) { if (TolerateMissing) { - return new TableData(Path.Combine(BasePath, tcFile) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, tcFile) + MissingFileSuffix, DataSourceType.Missing); } } return null; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index 1d7d3a8a72336b93e0f825d2bcd7a9a1c24c92b6..5551a51205ea4a4b5d69816f5b231c6f0d32f4f3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -379,7 +379,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw new VectoException("Driving Cycle could not be read: " + cycleFile); } - cycleData = new TableData(cycleFile + MissingFileSuffix); + cycleData = new TableData(cycleFile + MissingFileSuffix, DataSourceType.Missing); } } retVal.Add(new CycleInputData() { @@ -461,7 +461,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } catch (Exception) { if (TolerateMissing) { speedDependentLookup = - new TableData(Path.Combine(BasePath, lac["DF_targetSpeedLookup"].Value<string>()) + MissingFileSuffix); + new TableData(Path.Combine(BasePath, lac["DF_targetSpeedLookup"].Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } @@ -473,7 +473,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } catch (Exception) { if (TolerateMissing) { velocityDropLookup = - new TableData(Path.Combine(BasePath, lac["Df_velocityDropLookup"].Value<string>()) + MissingFileSuffix); + new TableData(Path.Combine(BasePath, lac["Df_velocityDropLookup"].Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } @@ -537,7 +537,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw new VectoException("Failed to read Driver Acceleration Curve: " + e.Message, e); } - return new TableData(Path.Combine(BasePath, acceleration.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, acceleration.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 1e85ad5c8cfcce1cd16a9a2d33e9e15e0a8b36ad..1c427117120bbdf3b22f1c272150ddb0fcbdb54e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -140,7 +140,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, Body["CdCorrFile"].ToString()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, Body["CdCorrFile"].ToString()) + MissingFileSuffix, DataSourceType.Missing); } } } @@ -179,7 +179,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } return null; @@ -233,7 +233,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } @@ -277,7 +277,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, lossmapFile.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } @@ -300,7 +300,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON if (!TolerateMissing) { throw; } - return new TableData(Path.Combine(BasePath, cycle.Value<string>()) + MissingFileSuffix); + return new TableData(Path.Combine(BasePath, cycle.Value<string>()) + MissingFileSuffix, DataSourceType.Missing); } } } diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs index 2198d7812b87181d49d2f4d0cc1b54c56a178082..268d0c253a1ce246f2051d4d984f13a2bd0c787c 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs @@ -62,7 +62,7 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData /// <returns></returns> public static TransmissionLossMap Create(DataTable data, double gearRatio, string gearName) { - if (data.Columns.Count < 3) { + if (data == null || data.Columns.Count < 3) { throw new VectoException("TransmissionLossMap Data File for {0} must consist of 3 columns.", gearName); } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 80f797559e48c365690e306e379a5a0286dce22b..6d77286bfff62ff87df1db68ea2ac51ea29a2ca1 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -179,7 +179,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter if (gearbox.Type.AutomaticTransmission() && gear.ShiftPolygon == null) { throw new VectoException("Shiftpolygons are required for AT Gearboxes!"); } - var shiftPolygon = gear.ShiftPolygon != null + var shiftPolygon = gear.ShiftPolygon != null && gear.ShiftPolygon.SourceType != DataSourceType.Missing ? ShiftPolygonReader.Create(gear.ShiftPolygon) : DeclarationData.Gearbox.ComputeShiftPolygon((int)i, fullLoadCurve, gearbox.Gears, engineData, axlegearRatio, dynamicTyreRadius);