diff --git a/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs b/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs index ce11e51e74dddc8983c374de3d64e046e428b595..ea62f4d299be43e83ee886f749636b5510394047 100644 --- a/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -38,11 +38,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { public JSONEngineDataV3(JObject data, string fileName) : base(data, fileName) {} - public virtual string ModelName - { - get { return Body.GetEx<string>(JsonKeys.Engine_ModelName); } - } - public virtual CubicMeter Displacement { get { return Body.GetEx<double>(JsonKeys.Engine_Displacement).SI().Cubic.Centi.Meter.Cast<CubicMeter>(); } @@ -92,5 +87,40 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON return Body.GetEx<double>(JsonKeys.Engine_WHTC_Urban).SI().Gramm.Per.Kilo.Watt.Hour.Cast<KilogramPerWattSecond>(); } } + + public string Vendor + { + get { return "N/A"; } + } + + public string MakeAndModel + { + get { return Body.GetEx<string>(JsonKeys.Engine_ModelName); } + } + + public string Creator + { + get { return "N/A"; } + } + + public string Date + { + get { return "N/A"; } + } + + public string TypeId + { + get { return "N/A"; } + } + + public string DigestValue + { + get { return "N/A"; } + } + + public IntegrityStatus IntegrityStatus + { + get { return IntegrityStatus.Unknown; } + } } } \ No newline at end of file diff --git a/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index 963d4b66a759f52cb7f59a165395d87c293a669f..92e4e3121e954496f9edf75e91bb71ebb8e0aee8 100644 --- a/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -151,9 +151,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public virtual bool Enabled { - get - { - return false; // TODO @@@ + get { return false; // TODO @@@ } } @@ -190,5 +188,40 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } #endregion + + public string Vendor + { + get { return "N/A"; } + } + + public string MakeAndModel + { + get { return "N/A"; } + } + + public string Creator + { + get { return "N/A"; } + } + + public string Date + { + get { return "N/A"; } + } + + public string TypeId + { + get { return "N/A"; } + } + + public string DigestValue + { + get { return ""; } + } + + public IntegrityStatus IntegrityStatus + { + get { return IntegrityStatus.Unknown; } + } } } \ No newline at end of file diff --git a/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 91d82c4db8dc1c41aff7a20ed173bb4e634e8902..3cc0f03bb882071d6583b90ffd6873288ea17074 100644 --- a/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -106,6 +106,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region IRetarderInputData + public string ModelName + { + get { return ""; } + } + public virtual RetarderData.RetarderType Type { get @@ -133,5 +138,40 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } #endregion + + public string Vendor + { + get { return "N/A"; } + } + + public string MakeAndModel + { + get { return "N/A"; } + } + + public string Creator + { + get { return "N/A"; } + } + + public string Date + { + get { return "N/A"; } + } + + public string TypeId + { + get { return "N/A"; } + } + + public string DigestValue + { + get { return ""; } + } + + public IntegrityStatus IntegrityStatus + { + get { return IntegrityStatus.Unknown; } + } } } \ No newline at end of file diff --git a/VectoCore/InputData/Impl/InputData.cs b/VectoCore/InputData/Impl/InputData.cs index 1f9d90b5100d09e64ba8e7007d5b262418fff348..c22f1741cbcc6a14029f3be2d6ca46001a21dfeb 100644 --- a/VectoCore/InputData/Impl/InputData.cs +++ b/VectoCore/InputData/Impl/InputData.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; using System.Data; +using TUGraz.VectoCore.InputData; +using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; @@ -60,10 +62,31 @@ namespace TUGraz.VectoCore.InputData.Impl public class AxleInputData : IAxleInputData { + public bool SavedInDeclarationMode + { + get { throw new System.NotImplementedException(); } + } + + public string Vendor { get; internal set; } + + public string MakeAndModel { get; internal set; } + + public string Creator { get; internal set; } + + public string Date { get; internal set; } + + public string TypeId { get; internal set; } + + public string DigestValue { get; internal set; } + + public IntegrityStatus IntegrityStatus { get; internal set; } + public string Wheels { get; internal set; } public bool TwinTyres { get; internal set; } + public AxleType AxleType { get; internal set; } + public double RollResistanceCoefficient { get; internal set; } public Newton TyreTestLoad { get; internal set; } diff --git a/VectoCore/InputData/InputData.cs b/VectoCore/InputData/InputData.cs index 42881afd2db2f33f40099d64b67b0fc630b5f8df..03b598a80ffe73da8508182de68e01e695580ac8 100644 --- a/VectoCore/InputData/InputData.cs +++ b/VectoCore/InputData/InputData.cs @@ -27,10 +27,27 @@ namespace TUGraz.VectoCore.InputData string JobName { get; } } - public interface IVehicleInputData + public interface IComponentInputData { bool SavedInDeclarationMode { get; } + string Vendor { get; } + + string MakeAndModel { get; } + + string Creator { get; } + + string Date { get; } + + string TypeId { get; } + + string DigestValue { get; } + + IntegrityStatus IntegrityStatus { get; } + } + + public interface IVehicleInputData : IComponentInputData + { /// <summary> /// P036 /// cf. VECTO Input Parameters.xlsx @@ -113,10 +130,8 @@ namespace TUGraz.VectoCore.InputData DataTable CrosswindCorrectionMap { get; } } - public interface IRetarderInputData + public interface IRetarderInputData : IComponentInputData { - bool SavedInDeclarationMode { get; } - /// <summary> /// P052 /// cf. VECTO Input Parameters.xlsx @@ -137,7 +152,7 @@ namespace TUGraz.VectoCore.InputData DataTable LossMap { get; } } - public interface IAxleInputData + public interface IAxleInputData : IComponentInputData { /// <summary> /// P108 @@ -151,6 +166,8 @@ namespace TUGraz.VectoCore.InputData /// </summary> bool TwinTyres { get; } + AxleType AxleType { get; } + /// <summary> /// P046 /// cf. VECTO Input Parameters.xlsx @@ -176,16 +193,9 @@ namespace TUGraz.VectoCore.InputData KilogramSquareMeter Inertia { get; } } - public interface IGearboxInputData - { - bool SavedInDeclarationMode { get; } - - /// <summary> - /// P075 - /// cf. VECTO Input Parameters.xlsx - /// </summary> - string ModelName { get; } + public interface IGearboxInputData : IComponentInputData + { /// <summary> /// P076 /// cf. VECTO Input Parameters.xlsx @@ -297,10 +307,8 @@ namespace TUGraz.VectoCore.InputData bool TorqueConverterActive { get; } } - public interface IAxleGearInputData + public interface IAxleGearInputData : IComponentInputData { - bool SavedInDeclarationMode { get; } - /// <summary> /// P078 /// cf. VECTO Input Parameters.xlsx @@ -343,16 +351,8 @@ namespace TUGraz.VectoCore.InputData DataTable TCData { get; } } - public interface IEngineInputData + public interface IEngineInputData : IComponentInputData { - bool SavedInDeclarationMode { get; } - - /// <summary> - /// P059 - /// cf. VECTO Input Parameters.xlsx - /// </summary> - string ModelName { get; } - /// <summary> /// P061 /// cf. VECTO Input Parameters.xlsx diff --git a/VectoCore/InputData/IntegrityStatus.cs b/VectoCore/InputData/IntegrityStatus.cs new file mode 100644 index 0000000000000000000000000000000000000000..1c7289e660141ee319e5a4c8d152dc3fc8a8dfd8 --- /dev/null +++ b/VectoCore/InputData/IntegrityStatus.cs @@ -0,0 +1,11 @@ +namespace TUGraz.VectoCore.InputData +{ + public enum IntegrityStatus + { + Unknown, + NoDigestProvided, + NotChecked, + DigestValid, + DigestInvalid + } +} \ No newline at end of file diff --git a/VectoCore/InputData/Reader/DataObjectAdaper/AbstractSimulationDataAdapter.cs b/VectoCore/InputData/Reader/DataObjectAdaper/AbstractSimulationDataAdapter.cs index 4e536457162d54115feada26ee98041ca4cd6f96..d2c7e160d83562bedc8fd902aa10ce7cc2d6ccc0 100644 --- a/VectoCore/InputData/Reader/DataObjectAdaper/AbstractSimulationDataAdapter.cs +++ b/VectoCore/InputData/Reader/DataObjectAdaper/AbstractSimulationDataAdapter.cs @@ -15,7 +15,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper { var retVal = new VehicleData { SavedInDeclarationMode = data.SavedInDeclarationMode, - VehicleCategory = data.VehicleCategory, + Vendor = data.Vendor, + MakeAndModel = data.MakeAndModel, + Creator = data.Creator, + Date = data.Date, + TypeId = data.TypeId, + DigestValue = data.DigestValue, + IntegrityStatus = data.IntegrityStatus, AxleConfiguration = data.AxleConfiguration, CurbWeight = data.CurbWeight, //CurbWeigthExtra = data.CurbWeightExtra.SI<Kilogram>(), @@ -35,6 +41,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper internal RetarderData SetCommonRetarderData(IRetarderInputData data) { var retarder = new RetarderData { + SavedInDeclarationMode = data.SavedInDeclarationMode, + Vendor = data.Vendor, + MakeAndModel = data.MakeAndModel, + Creator = data.Creator, + Date = data.Date, + TypeId = data.TypeId, + DigestValue = data.DigestValue, + IntegrityStatus = data.IntegrityStatus, Type = data.Type, }; if (retarder.Type == RetarderData.RetarderType.Primary || retarder.Type == RetarderData.RetarderType.Secondary) { @@ -48,7 +62,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper { var retVal = new CombustionEngineData { SavedInDeclarationMode = data.SavedInDeclarationMode, - ModelName = data.ModelName, + Vendor = data.Vendor, + MakeAndModel = data.MakeAndModel, + Creator = data.Creator, + Date = data.Date, + TypeId = data.TypeId, + DigestValue = data.DigestValue, + IntegrityStatus = data.IntegrityStatus, Displacement = data.Displacement, IdleSpeed = data.IdleSpeed, ConsumptionMap = FuelConsumptionMap.Create(data.FuelConsumptionMap), @@ -63,15 +83,31 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper { return new GearboxData { SavedInDeclarationMode = data.SavedInDeclarationMode, - ModelName = data.ModelName, + Vendor = data.Vendor, + MakeAndModel = data.MakeAndModel, + Creator = data.Creator, + Date = data.Date, + TypeId = data.TypeId, + DigestValue = data.DigestValue, + IntegrityStatus = data.IntegrityStatus, Type = data.Type }; } - internal AxleGearData CreateAxleGearData(IAxleGearInputData axleGear) + internal AxleGearData CreateAxleGearData(IAxleGearInputData data) { - var axleLossMap = TransmissionLossMap.Create(axleGear.LossMap, axleGear.Ratio, "AxleGear"); - return new AxleGearData() { LossMap = axleLossMap, Ratio = axleGear.Ratio, TorqueConverterActive = false }; + var axleLossMap = TransmissionLossMap.Create(data.LossMap, data.Ratio, "AxleGear"); + return new AxleGearData() { + SavedInDeclarationMode = data.SavedInDeclarationMode, + Vendor = data.Vendor, + MakeAndModel = data.MakeAndModel, + Creator = data.Creator, + Date = data.Date, + TypeId = data.TypeId, + DigestValue = data.DigestValue, + IntegrityStatus = data.IntegrityStatus, + AxleGear = new GearData() { LossMap = axleLossMap, Ratio = data.Ratio, TorqueConverterActive = false } + }; } /// <summary> diff --git a/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs b/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs index 7d6f46610d26b3470e26905184fb95c6c47a8e6b..a6c41182bef29417e244ebb913bec03b61c1d381 100644 --- a/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs +++ b/VectoCore/InputData/Reader/DataObjectAdaper/DeclarationDataAdapter.cs @@ -95,6 +95,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper for (var i = 0; i < mission.AxleWeightDistribution.Length; i++) { var axleInput = axles[i]; var axle = new Axle { + WheelsDimension = axleInput.Wheels, + AxleType = axleInput.AxleType, AxleWeightShare = mission.AxleWeightDistribution[i], TwinTyres = axleInput.TwinTyres, RollResistanceCoefficient = axleInput.RollResistanceCoefficient, @@ -105,6 +107,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper } axleData.AddRange(mission.TrailerAxleWeightDistribution.Select(tmp => new Axle { + AxleType = AxleType.Trailer, AxleWeightShare = tmp, TwinTyres = DeclarationData.Trailer.TwinTyres, RollResistanceCoefficient = DeclarationData.Trailer.RollResistanceCoefficient, @@ -164,7 +167,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper var gearLossMap = TransmissionLossMap.Create(gear.LossMap, gear.Ratio, string.Format("Gear {0}", i + 1)); var gearFullLoad = gear.FullLoadCurve == null ? engine.FullLoadCurve - : FullLoadCurve.Create(gear.FullLoadCurve); + : FullLoadCurve.Create(gear.FullLoadCurve, true); var fullLoadCurve = IntersectFullLoadCurves(engine.FullLoadCurve, gearFullLoad); var shiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(fullLoadCurve, engine.IdleSpeed); @@ -190,7 +193,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper var retVal = new List<VectoRunData.AuxData>(); foreach (var auxData in auxInputData.Auxiliaries) { var aux = new VectoRunData.AuxData { DemandType = AuxiliaryDemandType.Constant }; - + aux.Technology = auxData.Technology; switch (AuxiliaryTypeHelper.Parse(auxData.Type)) { case AuxiliaryType.Fan: aux.PowerDemand = DeclarationData.Fan.Lookup(mission, auxData.Technology); @@ -211,6 +214,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper case AuxiliaryType.ElectricSystem: aux.PowerDemand = DeclarationData.ElectricSystem.Lookup(mission, auxData.TechList.ToArray()); aux.ID = Constants.Auxiliaries.IDs.ElectricSystem; + aux.TechList = auxData.TechList.ToArray(); break; default: continue; diff --git a/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs b/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs index cf3d081c6ba3073c62b4c4838b3796ad418748ee..7e4a80d17baf0be53784694818d2387d72e1a784 100644 --- a/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs +++ b/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs @@ -48,6 +48,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper var axles = data.Axles; retVal.AxleData = axles.Select(axle => new Axle { + WheelsDimension = axle.Wheels, Inertia = axle.Inertia, TwinTyres = axle.TwinTyres, RollResistanceCoefficient = axle.RollResistanceCoefficient, diff --git a/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs b/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs index 9ce06880fb116df1f136a7e018365024dd1f9f60..06bf0ed36f0b177c4c2be07571cb75dd2062af9f 100644 --- a/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs +++ b/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs @@ -5,6 +5,7 @@ using TUGraz.VectoCore.Models; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.PDF; using TUGraz.VectoCore.Utils; @@ -37,8 +38,22 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData); var gearboxData = dao.CreateGearboxData(InputDataProvider.GearboxInputData, engineData); + var axlegearData = dao.CreateAxleGearData(InputDataProvider.AxleGearInputData); + var retarderData = dao.CreateRetarderData(InputDataProvider.RetarderInputData); - ConfigureReport(engineData, gearboxData, segment); + if (Report != null) { + var powertrainConfig = new VectoRunData() { + VehicleData = dao.CreateVehicleData(InputDataProvider.VehicleInputData, segment.Missions.First(), + segment.Missions.First().Loadings.First().Value), + EngineData = engineData, + GearboxData = gearboxData, + AxleGearData = axlegearData, + Retarder = retarderData, + Aux = dao.CreateAuxiliaryData(InputDataProvider.AuxiliaryInputData(), segment.Missions.First().MissionType, + segment.VehicleClass) + }; + Report.InitializeReport(powertrainConfig, segment); + } foreach (var mission in segment.Missions) { DrivingCycleData cycle; @@ -53,13 +68,12 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl Loading = loading.Key, VehicleData = dao.CreateVehicleData(InputDataProvider.VehicleInputData, mission, loading.Value), EngineData = engineData, - GearboxData = dao.CreateGearboxData(InputDataProvider.GearboxInputData, engineData), - AxleGearData = dao.CreateAxleGearData(InputDataProvider.AxleGearInputData), - Aux = - dao.CreateAuxiliaryData(InputDataProvider.AuxiliaryInputData(), mission.MissionType, - segment.VehicleClass), + GearboxData = gearboxData, + AxleGearData = axlegearData, + Aux = dao.CreateAuxiliaryData(InputDataProvider.AuxiliaryInputData(), mission.MissionType, + segment.VehicleClass), Cycle = cycle, - Retarder = dao.CreateRetarderData(InputDataProvider.RetarderInputData), + Retarder = retarderData, DriverData = driverdata, IsEngineOnly = false, JobName = InputDataProvider.JobInputData().JobName, @@ -76,22 +90,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl } } - private void ConfigureReport(CombustionEngineData engineData, GearboxData gearboxData, Segment segment) - { - if (Report == null) { - return; - } - Report.EngineModel = engineData.ModelName; - Report.EngineStr = string.Format("{0} l, {1} kW", - engineData.Displacement.ConvertTo().Cubic.Dezi.Meter.ToOutputFormat(1), - engineData.FullLoadCurve.MaxPower.ConvertTo().Kilo.Watt.ToOutputFormat(0)); - Report.Flc = engineData.FullLoadCurve; - Report.GearboxModel = gearboxData.ModelName; - Report.GearboxStr = string.Format("{0}-Speed {1}", gearboxData.Gears.Count, gearboxData.Type); - Report.Segment = segment; - Report.ResultCount = segment.Missions.Sum(m => m.Loadings.Count); - } - internal Segment GetVehicleClassification(VehicleCategory category, AxleConfiguration axles, Kilogram grossMassRating, Kilogram curbWeight) { diff --git a/VectoCore/Models/Declaration/Axle.cs b/VectoCore/Models/Declaration/Axle.cs index 995f76aa7f36137701b477fe2b349be7e6b7d9ed..2763dbf090248f56a0b8f29fd38625463f5dcde1 100644 --- a/VectoCore/Models/Declaration/Axle.cs +++ b/VectoCore/Models/Declaration/Axle.cs @@ -14,12 +14,15 @@ * limitations under the Licence. */ +using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration { - public class Axle + public class Axle : SimulationComponentData { + public object WheelsDimension { get; internal set; } + public KilogramSquareMeter Inertia { get; internal set; } public double RollResistanceCoefficient { get; internal set; } @@ -29,5 +32,6 @@ namespace TUGraz.VectoCore.Models.Declaration public double AxleWeightShare { get; internal set; } public bool TwinTyres { get; internal set; } + public AxleType AxleType { get; internal set; } } } \ No newline at end of file diff --git a/VectoCore/Models/Declaration/AxleConfiguration.cs b/VectoCore/Models/Declaration/AxleConfiguration.cs index 18731c19e9a436dbf9431a00bb51524f506a621f..8a53a87cf85a9c4918947ce1a1c90de2e11c40dd 100644 --- a/VectoCore/Models/Declaration/AxleConfiguration.cs +++ b/VectoCore/Models/Declaration/AxleConfiguration.cs @@ -33,6 +33,13 @@ namespace TUGraz.VectoCore.Models.Declaration AxleConfig_8x8, } + public enum AxleType + { + VehicleDriven, + VehicleNonDriven, + Trailer + } + public static class AxleConfigurationHelper { private const string Prefix = "AxleConfig_"; diff --git a/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/Models/Simulation/Data/VectoRunData.cs index 635b14c7261a36c2d0fcbdf61efab517476d7a06..1b345cd38c6ab4770e094b3e009f61e3e5fd1a7e 100644 --- a/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -21,6 +21,7 @@ using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.PDF; using TUGraz.VectoCore.Utils; @@ -126,7 +127,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data if (axleGearData != null) { var axleAngularVelocity = angularVelocity / gear.Value.Ratio; try { - axleGearData.LossMap.GetOutTorque(axleAngularVelocity, axleTorque); + axleGearData.AxleGear.LossMap.GetOutTorque(axleAngularVelocity, axleTorque); } catch (VectoException) { return new ValidationResult( diff --git a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 009952a63431a401d95cfd98c177780870f55981..f208b051ea6b3dc6d868aaa63953ad53cb1bb688 100644 --- a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -73,7 +73,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl data.GearboxData.Type = GearboxType.PWheel; var gearbox = GetGearbox(_container, data.GearboxData); - var cycle = new PWheelCycle(_container, data.Cycle, data.AxleGearData.Ratio, (Gearbox)gearbox); + var cycle = new PWheelCycle(_container, data.Cycle, data.AxleGearData.AxleGear.Ratio, (Gearbox)gearbox); var tmp = AddComponent(cycle, new AxleGear(_container, data.AxleGearData)); diff --git a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 03246ac05136ef6a61e150c34795d6e48ec02941..f585c672500be3c15617bdd4abfc798618eea511 100644 --- a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -47,7 +47,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl private readonly ExecutionMode _mode; - public SimulatorFactory(ExecutionMode mode, IInputDataProvider dataProvider, IOutputDataWriter writer) + public SimulatorFactory(ExecutionMode mode, IInputDataProvider dataProvider, IOutputDataWriter writer, + DeclarationReport report = null) { Log.Fatal("########## VectoCore Version {0} ##########", Assembly.GetExecutingAssembly().GetName().Version); JobNumber = Interlocked.Increment(ref _jobNumberCounter); @@ -55,9 +56,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ModWriter = writer; switch (mode) { case ExecutionMode.Declaration: - var report = new DeclarationReport(WindowsIdentity.GetCurrent().Name, - dataProvider.JobInputData().JobName, writer); - + report = report ?? new PDFDeclarationReport(writer); + var windowsIdentity = WindowsIdentity.GetCurrent(); + report.Creator = windowsIdentity != null ? windowsIdentity.Name : "N/A"; + report.JobName = dataProvider.JobInputData().JobName; DataReader = new DeclarationModeVectoRunDataFactory(dataProvider, report); break; case ExecutionMode.Engineering: diff --git a/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs b/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs index 2236d6ba45a72e3d36152498135b62ab17ca9997..5e5e4c17263c4fbfd3ec30ba1d6412f882620d88 100644 --- a/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs +++ b/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs @@ -2,5 +2,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { - public class AxleGearData : GearData {} + public class AxleGearData : SimulationComponentData + { + public GearData AxleGear; + } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index 5295acdb7b386d4c25f468a295c042ee2ba0394c..2b6b27987310a4bc711cfe22f610ba1df86c69b7 100644 --- a/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -23,8 +23,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { public class CombustionEngineData : SimulationComponentData { - public string ModelName { get; internal set; } - [Required, SIRange(1000 / (Constants.Kilo * Constants.Kilo), 20000 / (Constants.Kilo * Constants.Kilo))] public CubicMeter Displacement { get; internal set; } @@ -55,7 +53,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data protected bool Equals(CombustionEngineData other) { - return Equals(FullLoadCurve, other.FullLoadCurve) && string.Equals(ModelName, other.ModelName) && + return Equals(FullLoadCurve, other.FullLoadCurve) && string.Equals(MakeAndModel, other.MakeAndModel) && Equals(Displacement, other.Displacement) && Equals(IdleSpeed, other.IdleSpeed) && Equals(Inertia, other.Inertia) && Equals(WHTCUrban, other.WHTCUrban) && Equals(WHTCRural, other.WHTCRural) && Equals(WHTCMotorway, other.WHTCMotorway) && Equals(ConsumptionMap, other.ConsumptionMap); @@ -79,7 +77,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { unchecked { var hashCode = (FullLoadCurve != null ? FullLoadCurve.GetHashCode() : 0); - hashCode = (hashCode * 397) ^ (ModelName != null ? ModelName.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (MakeAndModel != null ? MakeAndModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Displacement != null ? Displacement.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IdleSpeed != null ? IdleSpeed.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Inertia != null ? Inertia.GetHashCode() : 0); diff --git a/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs b/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs index 5d21f7b85819ec91f6cc9907668387c83d98edd0..5f3b04d0c7c71a9c5a014fbdb45188631344380f 100644 --- a/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs +++ b/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs @@ -16,8 +16,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Data; +using System.Diagnostics.Contracts; +using System.Dynamic; using System.Linq; using TUGraz.VectoCore.Utils; @@ -33,15 +34,53 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine private PerSecond _engineSpeedHi; // 70% of Pmax private PerSecond _n95hSpeed; // 95% of Pmax - [Required] + public static EngineFullLoadCurve ReadFromFile(string fileName, bool declarationMode = false) + { + var curve = FullLoadCurve.ReadFromFile(fileName, declarationMode, true); + return new EngineFullLoadCurve { FullLoadEntries = curve.FullLoadEntries, PT1Data = curve.PT1Data }; + } + + public static EngineFullLoadCurve Create(DataTable data, bool declarationMode = false) + { + var curve = FullLoadCurve.Create(data, declarationMode, true); + return new EngineFullLoadCurve() { FullLoadEntries = curve.FullLoadEntries, PT1Data = curve.PT1Data }; + } + + public Watt FullLoadStationaryPower(PerSecond angularVelocity) + { + return Formulas.TorqueToPower(FullLoadStationaryTorque(angularVelocity), angularVelocity); + } + + public Watt DragLoadStationaryPower(PerSecond angularVelocity) + { + Contract.Requires(angularVelocity.HasEqualUnit(new SI().Radian.Per.Second)); + Contract.Ensures(Contract.Result<SI>().HasEqualUnit(new SI().Watt)); + + return Formulas.TorqueToPower(DragLoadStationaryTorque(angularVelocity), angularVelocity); + } + + public CombustionEngineData EngineData { get; internal set; } + + public Second PT1(PerSecond angularVelocity) + { + return PT1Data.Lookup(angularVelocity); + } + + /// <summary> /// Get the engine's preferred speed from the given full-load curve (i.e. Speed at 51% torque/speed-integral between idling and N95h.) /// </summary> public PerSecond PreferredSpeed { - get { return _preferredSpeed ?? (_preferredSpeed = ComputePreferredSpeed()); } + get + { + if (_preferredSpeed == null) { + ComputePreferredSpeed(); + } + return _preferredSpeed; + } } public PerSecond N95hSpeed @@ -49,6 +88,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine get { return _n95hSpeed ?? (_n95hSpeed = FindEngineSpeedForPower(0.95 * MaxPower).Last()); } } + public PerSecond LoSpeed { get { return _engineSpeedLo ?? (_engineSpeedLo = FindEngineSpeedForPower(0.55 * MaxPower).First()); } @@ -59,6 +99,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine get { return _engineSpeedHi ?? (_engineSpeedHi = FindEngineSpeedForPower(0.7 * MaxPower).Last()); } } + public NewtonMeter MaxLoadTorque { get { return FullLoadEntries.Max(x => x.TorqueFullLoad); } @@ -69,44 +110,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine get { return FullLoadEntries.Min(x => x.TorqueDrag); } } - /// <summary> - /// Reads the EngineFullLoadCurve from a csv file. - /// </summary> - /// <param name="fileName">Name of the file.</param> - /// <param name="declarationMode">if set to <c>true</c> then the file is read in declaration mode.</param> - public new static EngineFullLoadCurve ReadFromFile(string fileName, bool declarationMode = false) - { - var curve = FullLoadCurve.ReadFromFile(fileName, declarationMode); - return new EngineFullLoadCurve { FullLoadEntries = curve.FullLoadEntries, PT1Data = curve.PT1Data }; - } - - /// <summary> - /// Creates the FullLoadCurve from a datatable. - /// </summary> - /// <param name="data">The data.</param> - /// <param name="declarationMode">if set to <c>true</c> then the file is read in declaration mode.</param> - public new static EngineFullLoadCurve Create(DataTable data, bool declarationMode = false) - { - var curve = FullLoadCurve.Create(data, declarationMode); - return new EngineFullLoadCurve() { FullLoadEntries = curve.FullLoadEntries, PT1Data = curve.PT1Data }; - } - - public Watt FullLoadStationaryPower(PerSecond angularVelocity) - { - return Formulas.TorqueToPower(FullLoadStationaryTorque(angularVelocity), angularVelocity); - } - - public Watt DragLoadStationaryPower(PerSecond angularVelocity) - { - return DragLoadStationaryTorque(angularVelocity) * angularVelocity; - } - - public Second PT1(PerSecond angularVelocity) - { - return PT1Data.Lookup(angularVelocity); - } - private PerSecond ComputePreferredSpeed() + private void ComputePreferredSpeed() { var maxArea = ComputeArea(EngineData.IdleSpeed, N95hSpeed); @@ -116,12 +121,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine var additionalArea = ComputeArea(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed); if (area + additionalArea > 0.51 * maxArea) { var deltaArea = 0.51 * maxArea - area; - return ComputeEngineSpeedForSegmentArea(FullLoadEntries[idx - 1], FullLoadEntries[idx], deltaArea); + _preferredSpeed = ComputeEngineSpeedForSegmentArea(FullLoadEntries[idx - 1], FullLoadEntries[idx], deltaArea); + return; } area += additionalArea; } Log.Warn("Could not compute preferred speed, check FullLoadCurve! N95h: {0}, maxArea: {1}", N95hSpeed, maxArea); - return null; } private PerSecond ComputeEngineSpeedForSegmentArea(FullLoadCurveEntry p1, FullLoadCurveEntry p2, Watt area) @@ -145,7 +150,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine return retVal.First(x => x >= p1.EngineSpeed && x <= p2.EngineSpeed).SI<PerSecond>(); } - private IEnumerable<PerSecond> FindEngineSpeedForPower(Watt power) + private List<PerSecond> FindEngineSpeedForPower(Watt power) { var retVal = new List<PerSecond>(); for (var idx = 1; idx < FullLoadEntries.Count; idx++) { @@ -156,7 +161,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine return retVal; } - private IEnumerable<PerSecond> FindEngineSpeedForPower(FullLoadCurveEntry p1, FullLoadCurveEntry p2, Watt power) + private List<PerSecond> FindEngineSpeedForPower(FullLoadCurveEntry p1, FullLoadCurveEntry p2, Watt power) { var k = (p2.TorqueFullLoad - p1.TorqueFullLoad) / (p2.EngineSpeed - p1.EngineSpeed); var d = p2.TorqueFullLoad - k * p2.EngineSpeed; diff --git a/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs b/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs index 40832e2e4286eb03702a3d4dedd361ddbc8c3ea8..9fe9f82d583d4962d3e8037d6add9f97612295fb 100644 --- a/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs +++ b/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs @@ -53,21 +53,27 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data get { return _maxPower ?? ComputeRatedSpeed().Item2; } } - public static FullLoadCurve ReadFromFile(string fileName, bool declarationMode = false) + public static FullLoadCurve ReadFromFile(string fileName, bool declarationMode = false, bool engineFld = false) { try { var data = VectoCSVFile.Read(fileName); - return Create(data, declarationMode); + return Create(data, declarationMode, engineFld); } catch (Exception ex) { throw new VectoException("ERROR while reading FullLoadCurve File: " + ex.Message); } } - public static FullLoadCurve Create(DataTable data, bool declarationMode = false) + public static FullLoadCurve Create(DataTable data, bool declarationMode = false, bool engineFld = false) { - if (data.Columns.Count < 3) { - throw new VectoException("FullLoadCurve Data File must consist of at least 3 columns."); + if (engineFld) { + if (data.Columns.Count < 3) { + throw new VectoException("Engine FullLoadCurve Data File must consist of at least 3 columns."); + } + } else { + if (data.Columns.Count < 2) { + throw new VectoException("Gearbox FullLoadCurve Data File must consist of at least 2 columns."); + } } if (data.Rows.Count < 2) { @@ -76,8 +82,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data } List<FullLoadCurveEntry> entriesFld; - if (HeaderIsValid(data.Columns)) { - entriesFld = CreateFromColumnNames(data); + if (HeaderIsValid(data.Columns, engineFld)) { + entriesFld = CreateFromColumnNames(data, engineFld); } else { Logger<FullLoadCurve>().Warn( "FullLoadCurve: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: '{3}'. Falling back to column index.", @@ -85,7 +91,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data Fields.TorqueDrag, string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); - entriesFld = CreateFromColumnIndizes(data); + entriesFld = CreateFromColumnIndizes(data, engineFld); } LookupData<PerSecond, Second> tmp; @@ -98,30 +104,30 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data return new FullLoadCurve { FullLoadEntries = entriesFld, PT1Data = tmp }; } - private static bool HeaderIsValid(DataColumnCollection columns) + private static bool HeaderIsValid(DataColumnCollection columns, bool engineFld) { return columns.Contains(Fields.EngineSpeed) - && columns.Contains(Fields.TorqueDrag) - && columns.Contains(Fields.TorqueFullLoad); + && columns.Contains(Fields.TorqueFullLoad) + && (!engineFld || columns.Contains(Fields.TorqueDrag)); } - private static List<FullLoadCurveEntry> CreateFromColumnNames(DataTable data) + private static List<FullLoadCurveEntry> CreateFromColumnNames(DataTable data, bool engineFld) { return (from DataRow row in data.Rows select new FullLoadCurveEntry { EngineSpeed = row.ParseDouble(Fields.EngineSpeed).RPMtoRad(), TorqueFullLoad = row.ParseDouble(Fields.TorqueFullLoad).SI<NewtonMeter>(), - TorqueDrag = row.ParseDouble(Fields.TorqueDrag).SI<NewtonMeter>() + TorqueDrag = (engineFld ? row.ParseDouble(Fields.TorqueDrag).SI<NewtonMeter>() : null) }).ToList(); } - private static List<FullLoadCurveEntry> CreateFromColumnIndizes(DataTable data) + private static List<FullLoadCurveEntry> CreateFromColumnIndizes(DataTable data, bool engineFld) { return (from DataRow row in data.Rows select new FullLoadCurveEntry { EngineSpeed = row.ParseDouble(0).RPMtoRad(), TorqueFullLoad = row.ParseDouble(1).SI<NewtonMeter>(), - TorqueDrag = row.ParseDouble(2).SI<NewtonMeter>() + TorqueDrag = (engineFld ? row.ParseDouble(2).SI<NewtonMeter>() : null) }).ToList(); } diff --git a/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs b/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs index 6bd7e9f348c233cba539f037b2c25cc1f8be1822..6ba972425c543804994b1433d01e575a78ca9356 100644 --- a/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs +++ b/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs @@ -14,10 +14,25 @@ * limitations under the Licence. */ +using TUGraz.VectoCore.InputData; + namespace TUGraz.VectoCore.Models.SimulationComponent.Data { public class SimulationComponentData : LoggingObject { public bool SavedInDeclarationMode { get; internal set; } + + public string Vendor { get; internal set; } + + public string MakeAndModel { get; internal set; } + + public string Creator { get; internal set; } + public string Date { get; internal set; } + + public string TypeId { get; internal set; } + + public string DigestValue { get; internal set; } + + public IntegrityStatus IntegrityStatus { get; internal set; } } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs b/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs index 28a297e64c63cba34b8c491d309523403990788c..f0b5b0f662993376ea41387440b9ab2e0ea6ff6d 100644 --- a/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -18,6 +18,7 @@ using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; 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.OutputData; using TUGraz.VectoCore.Utils; @@ -27,11 +28,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public class AxleGear : VectoSimulationComponent, IPowerTrainComponent, ITnInPort, ITnOutPort { protected ITnOutPort NextComponent; - private readonly GearData _gearData; + private readonly AxleGearData _gearData; protected Watt Loss; - public AxleGear(VehicleContainer container, GearData gearData) : base(container) + public AxleGear(VehicleContainer container, AxleGearData gearData) : base(container) { _gearData = gearData; } @@ -56,10 +57,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { Log.Debug("request: torque: {0}, angularVelocity: {1}", torque, angularVelocity); - var inAngularVelocity = angularVelocity * _gearData.Ratio; + var inAngularVelocity = angularVelocity * _gearData.AxleGear.Ratio; var inTorque = angularVelocity.IsEqual(0) ? 0.SI<NewtonMeter>() - : _gearData.LossMap.GetInTorque(inAngularVelocity, torque); + : _gearData.AxleGear.LossMap.GetInTorque(inAngularVelocity, torque); var outPower = torque * angularVelocity; var inPower = inTorque * inAngularVelocity; @@ -73,8 +74,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) { - var inAngularVelocity = angularVelocity * _gearData.Ratio; - var inTorque = _gearData.LossMap.GetInTorque(inAngularVelocity, torque); + var inAngularVelocity = angularVelocity * _gearData.AxleGear.Ratio; + var inTorque = _gearData.AxleGear.LossMap.GetInTorque(inAngularVelocity, torque); return NextComponent.Initialize(inTorque, inAngularVelocity); } @@ -86,7 +87,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override void DoCommitSimulationStep() { - if (_gearData.LossMap.Extrapolated) { + if (_gearData.AxleGear.LossMap.Extrapolated) { // todo (MK, 2015-12-14): should we throw an interpolation error in EngineOnly Mode also? if (DataBus.ExecutionMode == ExecutionMode.Declaration) { throw new VectoException("AxleGear LossMap data was extrapolated: range for loss map is not sufficient."); diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 37518b537335ca2122a118d771f041191308bfa9..b036dea94c8bb1327432162ad18d1fc38a752806 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -290,8 +290,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var curve = DataBus.GearFullLoadCurve; if (curve != null) { var gearboxFullLoad = curve.FullLoadStationaryTorque(CurrentState.EngineSpeed) * CurrentState.EngineSpeed; - var gearboxDragLoad = curve.DragLoadStationaryTorque(CurrentState.EngineSpeed) * CurrentState.EngineSpeed; - requestedEnginePower = VectoMath.Limit(requestedEnginePower, gearboxDragLoad, gearboxFullLoad); + // var gearboxDragLoad = curve.DragLoadStationaryTorque(CurrentState.EngineSpeed) * CurrentState.EngineSpeed; + requestedEnginePower = VectoMath.Limit(requestedEnginePower, -gearboxFullLoad, gearboxFullLoad); } return VectoMath.Limit(requestedEnginePower, CurrentState.FullDragPower, CurrentState.DynamicFullLoadPower); diff --git a/VectoCore/OutputData/DeclarationReport.cs b/VectoCore/OutputData/DeclarationReport.cs new file mode 100644 index 0000000000000000000000000000000000000000..100d38f6d01cfc26981645dba278fd7b080fce63 --- /dev/null +++ b/VectoCore/OutputData/DeclarationReport.cs @@ -0,0 +1,117 @@ +/* +* Copyright 2015 European Union +* +* Licensed under the EUPL (the "Licence"); +* You may not use this work except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* http://ec.europa.eu/idabc/eupl5 +* +* Unless required by applicable law or agreed to in writing, software +* 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. +*/ + +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using Font = System.Drawing.Font; +using Image = iTextSharp.text.Image; +using Rectangle = System.Drawing.Rectangle; + +namespace TUGraz.VectoCore.OutputData +{ + /// <summary> + /// Class for creating a declaration report. + /// </summary> + public abstract class DeclarationReport + { + /// <summary> + /// Container class for one mission and the modData for the different loadings. + /// </summary> + protected class ResultContainer + { + /// <summary> + /// The mission + /// </summary> + public Mission Mission; + + /// <summary> + /// Dictionary of LoadingTypes and their resulting Modal Data + /// </summary> + public Dictionary<LoadingType, IModalDataContainer> ModData; + } + + /// <summary> + /// Dictionary of MissionTypes and their corresponding results. + /// </summary> + protected readonly Dictionary<MissionType, ResultContainer> _missions = + new Dictionary<MissionType, DeclarationReport.ResultContainer>(); + + /// <summary> + /// The full load curve. + /// </summary> + internal FullLoadCurve Flc { get; set; } + + /// <summary> + /// The declaration segment from the segment table + /// </summary> + internal Segment Segment { get; set; } + + /// <summary> + /// The creator name for the report. + /// </summary> + public string Creator { get; internal set; } + + /// <summary> + /// The name of the job file (report name will be the same) + /// </summary> + public string JobName { get; set; } + + /// <summary> + /// The result count determines how many results must be given before the report gets written. + /// </summary> + public int ResultCount { get; set; } + + + /// <summary> + /// Adds the result of one run for the specific mission and loading. If all runs finished (given by the resultCount) the report will be written. + /// </summary> + /// <param name="loadingType">Type of the loading.</param> + /// <param name="mission">The mission.</param> + /// <param name="modData">The mod data.</param> + [MethodImpl(MethodImplOptions.Synchronized)] + public void AddResult(LoadingType loadingType, Mission mission, IModalDataContainer modData) + { + if (!_missions.ContainsKey(mission.MissionType)) { + _missions[mission.MissionType] = new DeclarationReport.ResultContainer { + Mission = mission, + ModData = new Dictionary<LoadingType, IModalDataContainer>() + }; + } + _missions[mission.MissionType].ModData[loadingType] = modData; + + + if (ResultCount == _missions.Sum(v => v.Value.ModData.Count)) { + DoWriteReport(); + } + } + + protected internal abstract void DoWriteReport(); + + public void InitializeReport(VectoRunData modelData, Segment segment) + { + Segment = segment; + ResultCount = segment.Missions.Sum(m => m.Loadings.Count); + + DoInitializeReport(modelData, segment); + } + + protected abstract void DoInitializeReport(VectoRunData modelData, Segment segment); + } +} \ No newline at end of file diff --git a/VectoCore/OutputData/FileIO/FileOutputWriter.cs b/VectoCore/OutputData/FileIO/FileOutputWriter.cs index 7c65078348019bbf1325cf8c9c7b09a5a3dc8846..fd13735fbd7cf03a031360f713e50006227f1f2c 100644 --- a/VectoCore/OutputData/FileIO/FileOutputWriter.cs +++ b/VectoCore/OutputData/FileIO/FileOutputWriter.cs @@ -14,10 +14,18 @@ namespace TUGraz.VectoCore.OutputData.FileIO private readonly string _basePath; private readonly string _jobName; + /// <summary> + /// + /// </summary> + /// <param name="jobFile">full path of the json job-file. jobName and basePath are extracted</param> public FileOutputWriter(string jobFile) : this(Path.GetFileNameWithoutExtension(jobFile), Path.GetDirectoryName(jobFile)) {} - + /// <summary> + /// + /// </summary> + /// <param name="jobName">Name of the job, used for the filename of the sum-file</param> + /// <param name="basePath">path where to store the sum-file and report</param> public FileOutputWriter(string jobName, string basePath) { _jobName = jobName; diff --git a/VectoCore/OutputData/PDF/DeclarationReport.cs b/VectoCore/OutputData/PDF/PDFDeclarationReport.cs similarity index 83% rename from VectoCore/OutputData/PDF/DeclarationReport.cs rename to VectoCore/OutputData/PDF/PDFDeclarationReport.cs index c260d6bc2453c97ca8a7ea0a6fc4d94b670086cf..d897a05e5f88db5e746fe1ef1584de987c6a328e 100644 --- a/VectoCore/OutputData/PDF/DeclarationReport.cs +++ b/VectoCore/OutputData/PDF/PDFDeclarationReport.cs @@ -1,19 +1,3 @@ -/* -* Copyright 2015 European Union -* -* Licensed under the EUPL (the "Licence"); -* You may not use this work except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* http://ec.europa.eu/idabc/eupl5 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - using System; using System.Collections.Generic; using System.Drawing; @@ -21,11 +5,9 @@ using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows.Forms.DataVisualization.Charting; using iTextSharp.text; using iTextSharp.text.pdf; -using Org.BouncyCastle.Crypto.IO; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; @@ -36,48 +18,9 @@ using Rectangle = System.Drawing.Rectangle; namespace TUGraz.VectoCore.OutputData.PDF { - /// <summary> - /// Class for creating a declaration report. - /// </summary> - public class DeclarationReport + public class PDFDeclarationReport : DeclarationReport { - /// <summary> - /// Container class for one mission and the modData for the different loadings. - /// </summary> - private class ResultContainer - { - /// <summary> - /// The mission - /// </summary> - public Mission Mission; - - /// <summary> - /// Dictionary of LoadingTypes and their resulting Modal Data - /// </summary> - public Dictionary<LoadingType, IModalDataContainer> ModData; - } - - /// <summary> - /// Dictionary of MissionTypes and their corresponding results. - /// </summary> - private readonly Dictionary<MissionType, ResultContainer> _missions = new Dictionary<MissionType, ResultContainer>(); - - /// <summary> - /// The full load curve. - /// </summary> - internal FullLoadCurve Flc { get; set; } - - /// <summary> - /// The declaration segment from the segment table - /// </summary> - internal Segment Segment { get; set; } - - /// <summary> - /// The creator name for the report. - /// </summary> - private readonly string _creator; - - private IReportWriter _writer; + private readonly IReportWriter _writer; /// <summary> /// The engine model string from engine file. @@ -99,61 +42,15 @@ namespace TUGraz.VectoCore.OutputData.PDF /// </summary> public string GearboxStr { get; set; } - /// <summary> - /// The name of the job file (report name will be the same) - /// </summary> - public string JobName { get; set; } - - /// <summary> - /// The result count determines how many results must be given before the report gets written. - /// </summary> - public int ResultCount { get; set; } - - /// <summary> - /// The base path of the application - /// </summary> - /// <summary> - /// Initializes a new instance of the <see cref="DeclarationReport"/> class. - /// </summary> - /// <param name="creator">The creator name.</param> - /// <param name="jobName"></param> - /// <param name="writer"></param> - public DeclarationReport(string creator, string jobName, IReportWriter writer) + public PDFDeclarationReport(IReportWriter writer) { - _creator = creator; - JobName = jobName; _writer = writer; } - - /// <summary> - /// Adds the result of one run for the specific mission and loading. If all runs finished (given by the resultCount) the report will be written. - /// </summary> - /// <param name="loadingType">Type of the loading.</param> - /// <param name="mission">The mission.</param> - /// <param name="modData">The mod data.</param> - [MethodImpl(MethodImplOptions.Synchronized)] - public void AddResult(LoadingType loadingType, Mission mission, IModalDataContainer modData) - { - if (!_missions.ContainsKey(mission.MissionType)) { - _missions[mission.MissionType] = new ResultContainer { - Mission = mission, - ModData = new Dictionary<LoadingType, IModalDataContainer> { { loadingType, modData } } - }; - } else { - _missions[mission.MissionType].ModData[loadingType] = modData; - } - - if (ResultCount == _missions.Sum(v => v.Value.ModData.Count)) { - WriteReport(); - } - } - - /// <summary> /// Creates the report and writes it to a pdf file. /// </summary> - private void WriteReport() + protected internal override void DoWriteReport() { var titlePage = CreateTitlePage(_missions); var cyclePages = _missions.OrderBy(m => m.Key).Select((m, i) => CreateCyclePage(m.Value, i + 2, _missions.Count + 1)); @@ -161,13 +58,23 @@ namespace TUGraz.VectoCore.OutputData.PDF MergeDocuments(titlePage, cyclePages, _writer.WriterStream(ReportType.DeclarationReportPdf)); } + protected override void DoInitializeReport(VectoRunData modelData, Segment segment) + { + EngineModel = modelData.EngineData.MakeAndModel; + EngineStr = string.Format("{0} l, {1} kW", + modelData.EngineData.Displacement.ConvertTo().Cubic.Dezi.Meter.ToOutputFormat(1), + modelData.EngineData.FullLoadCurve.MaxPower.ConvertTo().Kilo.Watt.ToOutputFormat(0)); + Flc = modelData.EngineData.FullLoadCurve; + GearboxModel = modelData.GearboxData.ModelName; + GearboxStr = string.Format("{0}-Speed {1}", modelData.GearboxData.Gears.Count, modelData.GearboxData.Type); + } /// <summary> /// Creates the title page. /// </summary> /// <param name="missions">The missions.</param> /// <returns>the out stream of the pdf stamper with the title page.</returns> - private Stream CreateTitlePage(Dictionary<MissionType, ResultContainer> missions) + private Stream CreateTitlePage(Dictionary<MissionType, DeclarationReport.ResultContainer> missions) { var stream = new MemoryStream(); var resourceName = string.Format("{0}Report.title{1}CyclesTemplate.pdf", RessourceHelper.Namespace, missions.Count); @@ -180,11 +87,11 @@ namespace TUGraz.VectoCore.OutputData.PDF pdfFields.SetField("version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); pdfFields.SetField("Job", JobName); pdfFields.SetField("Date", DateTime.Now.ToString(CultureInfo.InvariantCulture)); - pdfFields.SetField("Created", _creator); + pdfFields.SetField("Created", Creator); pdfFields.SetField("Config", string.Format(CultureInfo.InvariantCulture, "{0}t {1} {2}", - Segment.GrossVehicleMassRating.ConvertTo().Ton.ToOutputFormat(1), - Segment.AxleConfiguration.GetName(), Segment.VehicleCategory)); + Segment.GrossVehicleMassRating.ConvertTo().Ton.ToOutputFormat(1), Segment.AxleConfiguration.GetName(), + Segment.VehicleCategory)); pdfFields.SetField("HDVclass", "HDV Class " + Segment.VehicleClass.GetClassNumber()); pdfFields.SetField("Engine", EngineStr); pdfFields.SetField("EngM", EngineModel); @@ -241,7 +148,6 @@ namespace TUGraz.VectoCore.OutputData.PDF return stream; } - /// <summary> /// Creates the cycle page. /// </summary> @@ -249,7 +155,7 @@ namespace TUGraz.VectoCore.OutputData.PDF /// <param name="currentPageNr">The current page nr.</param> /// <param name="pageCount">The page count.</param> /// <returns>the out stream of the pdfstamper for a single cycle page</returns> - private Stream CreateCyclePage(ResultContainer results, int currentPageNr, int pageCount) + private Stream CreateCyclePage(DeclarationReport.ResultContainer results, int currentPageNr, int pageCount) { var stream = new MemoryStream(); @@ -260,7 +166,7 @@ namespace TUGraz.VectoCore.OutputData.PDF pdfFields.SetField("version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); pdfFields.SetField("Job", JobName); pdfFields.SetField("Date", DateTime.Now.ToString(CultureInfo.InvariantCulture)); - pdfFields.SetField("Created", _creator); + pdfFields.SetField("Created", Creator); pdfFields.SetField("Config", string.Format("{0}t {1} {2}", Segment.GrossVehicleMassRating.ConvertTo().Ton.ToOutputFormat(1), Segment.AxleConfiguration.GetName(), Segment.VehicleCategory)); @@ -318,6 +224,7 @@ namespace TUGraz.VectoCore.OutputData.PDF /// <summary> /// Merges the given stream to one document and writes it to a file on disk. /// </summary> + /// <param name="titlePage"></param> /// <param name="pages">The pages.</param> /// <param name="reportWriter"></param> private static void MergeDocuments(Stream titlePage, IEnumerable<Stream> pages, Stream reportWriter) @@ -340,7 +247,7 @@ namespace TUGraz.VectoCore.OutputData.PDF /// </summary> /// <param name="missions">The missions.</param> /// <returns></returns> - private static Bitmap DrawCo2MissionsChart(Dictionary<MissionType, ResultContainer> missions) + private static Bitmap DrawCo2MissionsChart(Dictionary<MissionType, DeclarationReport.ResultContainer> missions) { var co2Chart = new Chart { Width = 1500, Height = 700 }; co2Chart.Legends.Add(new Legend("main") { @@ -395,7 +302,7 @@ namespace TUGraz.VectoCore.OutputData.PDF /// </summary> /// <param name="missions">The missions.</param> /// <returns></returns> - private static Bitmap DrawCo2SpeedChart(Dictionary<MissionType, ResultContainer> missions) + private static Bitmap DrawCo2SpeedChart(Dictionary<MissionType, DeclarationReport.ResultContainer> missions) { var co2SpeedChart = new Chart { Width = 1500, Height = 700 }; co2SpeedChart.Legends.Add(new Legend("main") { @@ -461,7 +368,7 @@ namespace TUGraz.VectoCore.OutputData.PDF /// </summary> /// <param name="results">The results.</param> /// <returns></returns> - private static Bitmap DrawCycleChart(ResultContainer results) + private static Bitmap DrawCycleChart(DeclarationReport.ResultContainer results) { var missionCycleChart = new Chart { Width = 2000, Height = 400 }; missionCycleChart.Legends.Add(new Legend("main") { diff --git a/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/OutputData/SummaryDataContainer.cs index 7c936ff92913d93f14b642d3eb6409b73f7fc8b5..f5460ec8d3b8b67db1927b4fccf8f4ca86b6ee01 100644 --- a/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/OutputData/SummaryDataContainer.cs @@ -263,7 +263,9 @@ namespace TUGraz.VectoCore.OutputData var sortedAndFilteredTable = new DataView(_table, "", JOB, DataViewRowState.CurrentRows).ToTable(false, dataColumns.ToArray()); - _sumWriter.WriteSumData(sortedAndFilteredTable); + if (_sumWriter != null) { + _sumWriter.WriteSumData(sortedAndFilteredTable); + } } } } \ No newline at end of file diff --git a/VectoCore/Properties/AssemblyInfo.cs b/VectoCore/Properties/AssemblyInfo.cs index 330385c5bfaa463f42db83e62968b5e25d4e2f9b..142bbd4ef083edda5ef22bc4703e0f298741a181 100644 --- a/VectoCore/Properties/AssemblyInfo.cs +++ b/VectoCore/Properties/AssemblyInfo.cs @@ -27,4 +27,6 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("b843f4c2-660b-4a3e-a336-c1f9c20aa993")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")] \ No newline at end of file +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPI")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")] \ No newline at end of file diff --git a/VectoCore/VectoCore.csproj b/VectoCore/VectoCore.csproj index 28ee46f8481e159a84edb11a6af3473a2159f463..97971db563276ff162f2eaebe3579dd0529858c8 100644 --- a/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore.csproj @@ -119,6 +119,7 @@ <Compile Include="InputData\FileIO\JSON\JSONVehicleData.cs" /> <Compile Include="InputData\IInputDataProvider.cs" /> <Compile Include="InputData\InputData.cs" /> + <Compile Include="InputData\IntegrityStatus.cs" /> <Compile Include="InputData\IVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\DataObjectAdaper\AbstractSimulationDataAdapter.cs" /> <Compile Include="InputData\Reader\DataObjectAdaper\DeclarationDataAdapter.cs" /> @@ -183,11 +184,12 @@ <Compile Include="Models\Simulation\Impl\DistanceRun.cs" /> <Compile Include="Models\Simulation\Impl\PowertrainBuilder.cs" /> <Compile Include="Models\Simulation\Impl\TimeRun.cs" /> + <Compile Include="OutputData\DeclarationReport.cs" /> <Compile Include="OutputData\FileIO\FileOutputWriter.cs" /> <Compile Include="OutputData\IModalDataContainer.cs" /> <Compile Include="OutputData\IDataWriter.cs" /> <Compile Include="OutputData\ModalDataContainer.cs" /> - <Compile Include="OutputData\PDF\DeclarationReport.cs" /> + <Compile Include="OutputData\PDF\PDFDeclarationReport.cs" /> <Compile Include="OutputData\SummaryDataContainer.cs" /> <Compile Include="Properties\Version.cs"> <AutoGen>True</AutoGen> diff --git a/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCoreTest/Integration/CoachPowerTrain.cs index 7d8e6fdd692df5c703f9ad915904b1a737784077..6dd730d43ac861fb0cb89f468fc2e1b99f7af364 100644 --- a/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -117,12 +117,14 @@ namespace TUGraz.VectoCore.Tests.Integration }; } - private static GearData CreateAxleGearData() + private static AxleGearData CreateAxleGearData() { const double ratio = 3.240355; - return new GearData { - Ratio = ratio, - LossMap = TransmissionLossMap.ReadFromFile(AxleGearLossMap, ratio, "AxleGear") + return new AxleGearData { + AxleGear = new GearData { + Ratio = ratio, + LossMap = TransmissionLossMap.ReadFromFile(AxleGearLossMap, ratio, "AxleGear") + } }; } diff --git a/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 72c0ffff24032ea296e041c5a7411e87437fded1..d9fe807fb150f3b637850b7a5fe456074a82472a 100644 --- a/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; using NLog; using TUGraz.VectoCore.Configuration; @@ -311,12 +312,14 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns }; } - private static GearData CreateAxleGearData() + private static AxleGearData CreateAxleGearData() { var ratio = 3.240355; - return new GearData { - Ratio = ratio, - LossMap = TransmissionLossMap.ReadFromFile(AxleLossMap, ratio, "AxleGear") + return new AxleGearData { + AxleGear = new GearData { + Ratio = ratio, + LossMap = TransmissionLossMap.ReadFromFile(AxleLossMap, ratio, "AxleGear") + } }; } diff --git a/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index d577fd2a778fcc9f0d500e14e958f23523c6c43e..637cca23c0adf70c1609765f723dc2b7aef4336a 100644 --- a/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -228,11 +228,13 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns modData.Finish(VectoRun.Status.Success); } - private static GearData CreateAxleGearData() + private static AxleGearData CreateAxleGearData() { - return new GearData { - Ratio = 3.0 * 3.5, - LossMap = TransmissionLossMap.ReadFromFile(GbxLossMap, 3.0 * 3.5, "AxleGear") + return new AxleGearData() { + AxleGear = new GearData { + Ratio = 3.0 * 3.5, + LossMap = TransmissionLossMap.ReadFromFile(GbxLossMap, 3.0 * 3.5, "AxleGear") + } }; } diff --git a/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCoreTest/Integration/Truck40tPowerTrain.cs index 692c25da696b88644859c3ed58999b5979b9131e..89fce4cfa4c4d89e36a9a2a9605c83cf0ee689bd 100644 --- a/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -125,12 +125,14 @@ namespace TUGraz.VectoCore.Tests.Integration }; } - private static GearData CreateAxleGearData() + private static AxleGearData CreateAxleGearData() { const double ratio = 2.59; - return new GearData { - Ratio = ratio, - LossMap = TransmissionLossMap.ReadFromFile(AxleGearLossMap, ratio, "AxleGear") + return new AxleGearData { + AxleGear = new GearData { + Ratio = ratio, + LossMap = TransmissionLossMap.ReadFromFile(AxleGearLossMap, ratio, "AxleGear") + } }; } diff --git a/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs b/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs index 7d5e9357708baf91a5538a0bd1f2b05c4d7766ac..63299d3908446d42ac0965064a00a7d203222ccd 100644 --- a/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs +++ b/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs @@ -135,8 +135,10 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation { const double ratio = 2.59; return new AxleGearData { - Ratio = ratio, - LossMap = TransmissionLossMap.ReadFromFile(lossMap, ratio, "AxleGear") + AxleGear = new GearData { + Ratio = ratio, + LossMap = TransmissionLossMap.ReadFromFile(lossMap, ratio, "AxleGear") + } }; } } diff --git a/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs b/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs index 4c5d35e97f4d41e1e94e170d8418a867e478d040..eef42290a3b26b2ec9aabdd9e2dcfcd59f706a15 100644 --- a/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs @@ -95,9 +95,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var loss = 9401.44062.SI<Watt>(); - Assert.AreEqual(Formulas.PowerToTorque(PvD + loss, angSpeed * axleGearData.Ratio).Value(), + Assert.AreEqual(Formulas.PowerToTorque(PvD + loss, angSpeed * axleGearData.AxleGear.Ratio).Value(), mockPort.Torque.Value(), 0.01, "Torque Engine Side"); - Assert.AreEqual((angSpeed * axleGearData.Ratio).Value(), mockPort.AngularVelocity.Value(), 0.01, + Assert.AreEqual((angSpeed * axleGearData.AxleGear.Ratio).Value(), mockPort.AngularVelocity.Value(), 0.01, "Torque Engine Side"); } diff --git a/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs b/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs index d6cd16825e2b198e44758128558bfe1032457e9d..97d7d2fdb4e465ac1d49185eab55c223c4b51cd6 100644 --- a/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs +++ b/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs @@ -165,8 +165,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData }; var axleGearData = new AxleGearData() { - Ratio = 1, - LossMap = TransmissionLossMap.ReadFromFile(@"TestData\Components\limited.vtlm", 1, "1"), + AxleGear = new GearData { + Ratio = 1, + LossMap = TransmissionLossMap.ReadFromFile(@"TestData\Components\limited.vtlm", 1, "1"), + } }; var runData = new VectoRunData { GearboxData = gearboxData, EngineData = engineData, AxleGearData = axleGearData }; diff --git a/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs b/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs index de651db2faf9bc2627d87a3e68394abc9f203a7c..8d051e9d2b05436169b04cbe728c5dfbf981c83e 100644 --- a/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs +++ b/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs @@ -74,9 +74,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData var torqueToWheels = Formulas.PowerToTorque(PvD, SpeedToAngularSpeed(speed, rdyn)); var torqueFromEngine = 0.SI<NewtonMeter>(); - var angSpeed = SpeedToAngularSpeed(speed, rdyn) * axleData.Ratio; + var angSpeed = SpeedToAngularSpeed(speed, rdyn) * axleData.AxleGear.Ratio; if (TestContext.DataRow["Gear"].ToString() == "A") { - torqueFromEngine = axleData.LossMap.GetInTorque(angSpeed, torqueToWheels); + torqueFromEngine = axleData.AxleGear.LossMap.GetInTorque(angSpeed, torqueToWheels); } var powerEngine = Formulas.TorqueToPower(torqueFromEngine, angSpeed); diff --git a/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index beaafc6f5bb8be14582ebe9a19c7e4cfc4d2e763..23f7809ecdc032ce3a28cd0005bdd1551c824b64 100644 --- a/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -42,7 +42,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData fullLoad.Rows.Add("3", "3", "-3", "3"); var data = new CombustionEngineData { - ModelName = "asdf", + MakeAndModel = "asdf", Displacement = 6374.SI().Cubic.Centi.Meter.Cast<CubicMeter>(), IdleSpeed = 560.RPMtoRad(), Inertia = 1.SI<KilogramSquareMeter>(), @@ -79,8 +79,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData }; var axleGearData = new AxleGearData { + AxleGear = new GearData { Ratio = 1, LossMap = TransmissionLossMap.ReadFromFile(@"TestData\Components\limited.vtlm", 1, "1"), + } }; container.RunData = new VectoRunData { diff --git a/VectoCoreTest/VectoCoreTest.csproj b/VectoCoreTest/VectoCoreTest.csproj index cf48e297eca1ed41be2c171256927ff28758a75a..36e2471e8f32f2938c920f1867450667f1ceec69 100644 --- a/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCoreTest/VectoCoreTest.csproj @@ -81,7 +81,6 @@ <Compile Include="Models\SimulationComponentData\ValidationTest.cs" /> <Compile Include="Models\Simulation\FactoryTest.cs" /> <Compile Include="Models\Simulation\LossMapRangeValidationTest.cs" /> - <Compile Include="Models\Simulation\PwheelModeTests.cs" /> <Compile Include="Reports\SumWriterTest.cs" /> <Compile Include="Utils\GraphWriter.cs" /> <Compile Include="Integration\EngineOnlyCycle\EngineOnlyCycleTest.cs" /> @@ -228,57 +227,6 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="TestData\Components\Indirect Gear.vtlm" /> - <None Include="TestData\Components\Pwheel\Atego.vveh"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\Atego_ges.v2.vsig"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\axle_losses_r390_80_serie_1306.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\Gear2_pt1_rep1_actual.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\G_85-6_6_7-0_17.vgbx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_1.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_2.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_3.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_4.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_5.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\losses_g85_6_6696_0728_1401_loss_6.vtlm"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\o9061750850E4.vfld"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\OM906.veng"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\om9062101120_e4e5_b7c_sl2499_20110727.vmap"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\RD_#1_Pwheel_AuxStd.vdri"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\ShiftPolygons_o9061750850E4.vgbs"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Components\Pwheel\Truck.vacc"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="TestData\Components\Retarder.vrlm"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -618,9 +566,7 @@ <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_30_downhill_15.vmod" /> <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_30_Increasing_Slope.vmod" /> <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_50_Decreasing_Slope.vmod" /> - <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_50_Dec_Increasing_Slope.vmod"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> + <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_50_Dec_Increasing_Slope.vmod" /> <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_50_downhill_15.vmod" /> <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_50_Increasing_Slope.vmod" /> <None Include="TestData\Integration\DriverStrategy\Vecto2.2\Coach\24t Coach_Cycle_Drive_80_Decreasing_Slope.vmod" /> @@ -719,9 +665,6 @@ <None Include="TestData\Integration\FullPowerTrain\unlimited.vacc"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Jobs\40t_Long_Haul_Truck_wrong_AUX.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="TestData\Jobs\40t_Long_Haul_Truck_invalid-JSON.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -800,12 +743,6 @@ <None Include="TestData\Jobs\EngineOnlyJob.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Jobs\Pwheel_ultimate.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Jobs\Pwheel.vecto"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="TestData\Results\Engineering\24t Coach.vsum"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -869,30 +806,12 @@ <None Include="TestData\Results\EngineOnlyCycles\24tCoach_EngineOnlyPaux.vmod"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Results\Integration\Coach_DriverStrategy_Drive_50_slope_dec-inc.vmod"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> <None Include="TestData\Results\Integration\job.vsum"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="TestData\Results\Integration\job_1-Gear-Test-dist.vmod"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="TestData\Results\Pwheel\Atego_ges.v2.vsig"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Results\Pwheel\Atego_ges.v2.vsum"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Results\Pwheel\Atego_ges.v2.vsum.json"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Results\Pwheel\Atego_ges_Gear2_pt1_rep1_actual.vmod"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestData\Results\Pwheel\Atego_HDVCO2_RD_#1_AuxStd.vmod"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> </ItemGroup> <ItemGroup> <None Include="TestData\Cycles\EngineOnly_FullLoad.vdri">