diff --git a/HashingCmd/Program.cs b/HashingCmd/Program.cs index 843ea558fdd22a6791efa23d2ca5349564b4df8c..eb75536b8d1c1a0b3278512386d9fb8ebb785f98 100644 --- a/HashingCmd/Program.cs +++ b/HashingCmd/Program.cs @@ -70,7 +70,7 @@ hashingcmd.exe static Dictionary<string, HashingAction> actions = new Dictionary<string, HashingAction>(); - static bool _validateXML = false; + static bool _validateXML; private static bool xmlValid = true; static int Main(string[] args) diff --git a/HashingTool/App.xaml.cs b/HashingTool/App.xaml.cs index abfae08d0452baabecbaf4bc6c2c0c2382402d32..810fa2a70f71ebc9bb1d1065fd1a0db3f8c63b49 100644 --- a/HashingTool/App.xaml.cs +++ b/HashingTool/App.xaml.cs @@ -29,20 +29,12 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - namespace HashingTool { /// <summary> /// Interaction logic for App.xaml /// </summary> - public partial class App : Application + public partial class App { } } diff --git a/HashingTool/MainWindow.xaml.cs b/HashingTool/MainWindow.xaml.cs index fcf72b2498fe36dafb625adfc4fc0b75b2242584..ebdebd827e35326cb6052b51a116e60eb1b255bb 100644 --- a/HashingTool/MainWindow.xaml.cs +++ b/HashingTool/MainWindow.xaml.cs @@ -29,31 +29,16 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - namespace HashingTool { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> - public partial class MainWindow : Window + public partial class MainWindow { public MainWindow() { InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/VECTO.sln.DotSettings b/VECTO.sln.DotSettings index 5e2e17e67b6bab61d1229d5068df245ad4c1db32..5adda17e090802935ac3a546d7d9bd9549bd32a0 100644 --- a/VECTO.sln.DotSettings +++ b/VECTO.sln.DotSettings @@ -24,6 +24,7 @@ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AT/@EntryIndexedValue">AT</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CSV/@EntryIndexedValue">CSV</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HVAC/@EntryIndexedValue">HVAC</s:String> + <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JSON/@EntryIndexedValue">JSON</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MT/@EntryIndexedValue">MT</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PT/@EntryIndexedValue">PT</s:String> diff --git a/VECTO/GUI/EngineForm.Designer.vb b/VECTO/GUI/EngineForm.Designer.vb index 3452dbda44e28d23d7a23a6704f3b538dea516c2..4fbc991ddcede0ddfba0a74a5acdfc18312aea73 100644 --- a/VECTO/GUI/EngineForm.Designer.vb +++ b/VECTO/GUI/EngineForm.Designer.vb @@ -72,6 +72,10 @@ Partial Class EngineForm Me.PnInertia = New System.Windows.Forms.Panel() Me.GrWHTC = New System.Windows.Forms.GroupBox() Me.PnWhtcDeclaration = New System.Windows.Forms.Panel() + Me.Label20 = New System.Windows.Forms.Label() + Me.tbRegPerCorrFactor = New System.Windows.Forms.TextBox() + Me.Label19 = New System.Windows.Forms.Label() + Me.tbNCVCorrFactor = New System.Windows.Forms.TextBox() Me.lblColdHotFactor = New System.Windows.Forms.Label() Me.TbColdHotFactor = New System.Windows.Forms.TextBox() Me.BtWHTCimport = New System.Windows.Forms.Button() @@ -101,10 +105,6 @@ Partial Class EngineForm Me.Label17 = New System.Windows.Forms.Label() Me.Label18 = New System.Windows.Forms.Label() Me.cbFuelType = New System.Windows.Forms.ComboBox() - Me.Label19 = New System.Windows.Forms.Label() - Me.tbNCVCorrFactor = New System.Windows.Forms.TextBox() - Me.Label20 = New System.Windows.Forms.Label() - Me.tbRegPerCorrFactor = New System.Windows.Forms.TextBox() Me.ToolStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -429,6 +429,38 @@ Partial Class EngineForm Me.PnWhtcDeclaration.Size = New System.Drawing.Size(472, 95) Me.PnWhtcDeclaration.TabIndex = 8 ' + 'Label20 + ' + Me.Label20.AutoSize = True + Me.Label20.Location = New System.Drawing.Point(99, 76) + Me.Label20.Name = "Label20" + Me.Label20.Size = New System.Drawing.Size(89, 13) + Me.Label20.TabIndex = 9 + Me.Label20.Text = "Reg. Per. Corr. F." + ' + 'tbRegPerCorrFactor + ' + Me.tbRegPerCorrFactor.Location = New System.Drawing.Point(194, 73) + Me.tbRegPerCorrFactor.Name = "tbRegPerCorrFactor" + Me.tbRegPerCorrFactor.Size = New System.Drawing.Size(57, 20) + Me.tbRegPerCorrFactor.TabIndex = 10 + ' + 'Label19 + ' + Me.Label19.AutoSize = True + Me.Label19.Location = New System.Drawing.Point(274, 53) + Me.Label19.Name = "Label19" + Me.Label19.Size = New System.Drawing.Size(66, 13) + Me.Label19.TabIndex = 7 + Me.Label19.Text = "NCV Corr. F." + ' + 'tbNCVCorrFactor + ' + Me.tbNCVCorrFactor.Location = New System.Drawing.Point(343, 50) + Me.tbNCVCorrFactor.Name = "tbNCVCorrFactor" + Me.tbNCVCorrFactor.Size = New System.Drawing.Size(57, 20) + Me.tbNCVCorrFactor.TabIndex = 8 + ' 'lblColdHotFactor ' Me.lblColdHotFactor.AutoSize = True @@ -675,38 +707,6 @@ Partial Class EngineForm Me.cbFuelType.Size = New System.Drawing.Size(143, 21) Me.cbFuelType.TabIndex = 51 ' - 'Label19 - ' - Me.Label19.AutoSize = True - Me.Label19.Location = New System.Drawing.Point(274, 53) - Me.Label19.Name = "Label19" - Me.Label19.Size = New System.Drawing.Size(66, 13) - Me.Label19.TabIndex = 7 - Me.Label19.Text = "NCV Corr. F." - ' - 'tbNCVCorrFactor - ' - Me.tbNCVCorrFactor.Location = New System.Drawing.Point(343, 50) - Me.tbNCVCorrFactor.Name = "tbNCVCorrFactor" - Me.tbNCVCorrFactor.Size = New System.Drawing.Size(57, 20) - Me.tbNCVCorrFactor.TabIndex = 8 - ' - 'Label20 - ' - Me.Label20.AutoSize = True - Me.Label20.Location = New System.Drawing.Point(99, 76) - Me.Label20.Name = "Label20" - Me.Label20.Size = New System.Drawing.Size(89, 13) - Me.Label20.TabIndex = 9 - Me.Label20.Text = "Reg. Per. Corr. F." - ' - 'tbRegPerCorrFactor - ' - Me.tbRegPerCorrFactor.Location = New System.Drawing.Point(194, 73) - Me.tbRegPerCorrFactor.Name = "tbRegPerCorrFactor" - Me.tbRegPerCorrFactor.Size = New System.Drawing.Size(57, 20) - Me.tbRegPerCorrFactor.TabIndex = 10 - ' 'EngineForm ' Me.AcceptButton = Me.ButOK diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index 84c1ff1abc7a18b8eba041078327f717e80e259c..a6d9823964c289b0bc1a415d4c5ffed1e70b1047 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -55,7 +55,7 @@ Public Class EngineForm cbFuelType.ValueMember = "Value" cbFuelType.DisplayMember = "Label" cbFuelType.DataSource = - [Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast(Of TUGraz.VectoCommon.Models.FuelType).Select( + [Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast (Of TUGraz.VectoCommon.Models.FuelType).Select( Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() _changed = False @@ -67,7 +67,7 @@ Public Class EngineForm If Not Cfg.DeclMode Then Exit Sub - TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0) / 1000.0 / 1000.0).SI(Of CubicMeter), + TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0)/1000.0/1000.0).SI (Of CubicMeter), GearboxType.AMT).ToGUIFormat() End Sub @@ -166,7 +166,7 @@ Public Class EngineForm If ChangeCheckCancel() Then Exit Sub - Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), + Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), IEngineeringInputDataProvider) engine = inputData.EngineInputData @@ -178,14 +178,14 @@ Public Class EngineForm Close() MainForm.RbDecl.Checked = Not MainForm.RbDecl.Checked MainForm.OpenVectoFile(file) - Case -1 + Case - 1 Exit Sub End Select End If Dim basePath As String = Path.GetDirectoryName(file) TbName.Text = engine.Model - TbDispl.Text = (engine.Displacement * 1000 * 1000).ToGUIFormat() + TbDispl.Text = (engine.Displacement*1000*1000).ToGUIFormat() TbInertia.Text = engine.Inertia.ToGUIFormat() TbNleerl.Text = engine.IdleSpeed.AsRPM.ToGUIFormat() @@ -199,7 +199,7 @@ Public Class EngineForm tbNCVCorrFactor.Text = engine.CorrectionFactorNCV.ToGUIFormat() tbRegPerCorrFactor.Text = engine.CorrectionFactorRegPer.ToGUIFormat() tbMaxTorque.Text = engine.MaxTorqueDeclared.ToGUIFormat() - tbRatedPower.Text = (engine.RatedPowerDeclared.Value() / 1000).ToGUIFormat() + tbRatedPower.Text = (engine.RatedPowerDeclared.Value()/1000).ToGUIFormat() tbRatedSpeed.Text = engine.RatedSpeedDeclared.AsRPM.ToGUIFormat() cbFuelType.SelectedValue = engine.FuelType @@ -253,9 +253,9 @@ Public Class EngineForm engine.ColdHotBalancingFactorInput = TbColdHotFactor.Text.ToDouble(0) - engine.ratedPowerInput = (tbRatedPower.Text.ToDouble(0) * 1000).SI(Of Watt)() + engine.ratedPowerInput = (tbRatedPower.Text.ToDouble(0)*1000).SI (Of Watt)() engine.ratedSpeedInput = tbRatedSpeed.Text.ToDouble(0).RPMtoRad() - engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI(Of NewtonMeter)() + engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI (Of NewtonMeter)() engine.FuelTypeInput = CType(cbFuelType.SelectedValue, TUGraz.VectoCommon.Models.FuelType) @@ -385,7 +385,7 @@ Public Class EngineForm End Sub Private Sub UpdatePic() - Dim fullLoadCurve As FullLoadCurve = Nothing + Dim fullLoadCurve As EngineFullLoadCurve = Nothing Dim fcMap As FuelConsumptionMap = Nothing @@ -397,7 +397,7 @@ Public Class EngineForm Dim fldFile As String = If(Not String.IsNullOrWhiteSpace(_engFile), Path.Combine(Path.GetDirectoryName(_engFile), TbFLD.Text), TbFLD.Text) If File.Exists(fldFile) Then _ - fullLoadCurve = FullLoadCurveReader.Create(VectoCSVFile.Read(fldFile), engineFld:=True) + fullLoadCurve = FullLoadCurveReader.Create(VectoCSVFile.Read(fldFile)) Catch ex As Exception End Try diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index d2e992bdec8dd65118bf8bfd028db0993fcf1885..e3f15ef78e66dafce6c44f3f08a90e28c285642b 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -808,7 +808,7 @@ Public Class GearboxForm Dim vehicle As IVehicleEngineeringInputData = inputData.VehicleInputData 'inputData = TryCast(JSONInputDataFactory.ReadComponentData(vectoJob.PathEng(False)), IEngineeringInputDataProvider) Dim engine As IEngineEngineeringInputData = inputData.EngineInputData - Dim engineFld As EngineFullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve) + Dim engineFld As EngineFullLoadCurve = FullLoadCurveReader.Create(engine.FullLoadCurve) s = New Series diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index e2809573dc515e88bd8cb3ae6076ac1d4b8cc75b..ce2b03abbdff27287b6d501d5b4ca3e3e34dea92 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -1238,7 +1238,7 @@ lbDlog: engine.IdleSpeed.Value() - Dim fullLoadCurve As FullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve) + Dim fullLoadCurve As EngineFullLoadCurve = FullLoadCurveReader.Create(engine.FullLoadCurve) s = New Series s.Points.DataBindXY(fullLoadCurve.FullLoadEntries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index 80eef36a757434b16c5f1f9c288a66ea2e7864b1..73e9e94c92796843087dff9ccd8d1e2f73ed8d0d 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -148,7 +148,6 @@ Public Class Engine End Sub ''' <summary> - ''' Save file. <see cref="P:VECTO.cENG.FilePath" /> must be set before calling. ''' </summary> ''' <returns>True if successful.</returns> ''' <remarks></remarks> @@ -178,7 +177,6 @@ Public Class Engine ''' <summary> - ''' Get or set Filepath before calling <see cref="M:VECTO.cENG.ReadFile" /> or <see cref="M:VECTO.cENG.SaveFile" /> ''' </summary> ''' <value></value> ''' <returns>Full filepath</returns> diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index c25999ffe0b93fd107e43a7574b56f535e8ec515..985ffd31b46ca79e163783d1f8921344a0ec04d4 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -20,6 +20,7 @@ Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Impl +Imports TUGraz.VectoCore.InputData.Reader Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Engine @@ -263,10 +264,10 @@ Public Class Gearbox .IdleSpeed = 600.RPMtoRad() } - Dim fldCurve As EngineFullLoadCurve = EngineFullLoadCurve.Create(VectoCSVFile.ReadStream(fldData)) + Dim fldCurve As EngineFullLoadCurve = FullLoadCurveReader.Create(VectoCSVFile.ReadStream(fldData)) Dim fullLoadCurves As Dictionary(Of UInteger, EngineFullLoadCurve) = New Dictionary(Of UInteger, EngineFullLoadCurve)() - fullLoadCurves(0) = EngineFullLoadCurve.Create(VectoCSVFile.ReadStream(fldData)) + fullLoadCurves(0) = FullLoadCurveReader.Create(VectoCSVFile.ReadStream(fldData)) fullLoadCurves(0).EngineData = retVal For i As Integer = 0 To gears.Count - 1 fullLoadCurves(CType(i + 1, UInteger)) = AbstractSimulationDataAdapter.IntersectFullLoadCurves(fullLoadCurves(0), diff --git a/VECTO/VECTO_Global.vb b/VECTO/VECTO_Global.vb index 15f5bbc3880ad564280f3b2ee1482737a62644b1..ed057a0acfa47ed474d3083d4291461fa5119a2c 100644 --- a/VECTO/VECTO_Global.vb +++ b/VECTO/VECTO_Global.vb @@ -11,7 +11,6 @@ Imports System.ComponentModel Imports System.IO Imports System.Text -Imports vectolic Public Module VECTO_Global Public Const VECTOvers As String = "3" diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 862f5604db5742afa7dfad1d028f9578b3b76eca..e0b3dda19ce31af5313ff7bbcfca876ec0de135f 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -169,7 +169,7 @@ namespace TUGraz.VectoCommon.InputData double Efficiency { get; } } - public interface IAxleDeclarationInputData : IComponentInputData + public interface IAxleDeclarationInputData { /// <summary> /// P108 diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index 806864cf64dcff63eb588516417b3235d95f9c6e..702b48516202017c610f5db17d6c1db4e18e305f 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -40,9 +40,6 @@ namespace TUGraz.VectoCore.Configuration public const double Kilo = 1000; public const double MeterPerSecondToKMH = 3.6; - // mk-2016-10-11: const never used. Delete? - [Obsolete] public const double SecondsPerHour = 3600; - public static class Auxiliaries { public const string Cycle = "cycle"; @@ -124,10 +121,6 @@ namespace TUGraz.VectoCore.Configuration /// </summary> public static readonly Radian DrivingCycleRoadGradientTolerance = 1E-12.SI<Radian>(); - //VectoMath.InclinationToAngle(0.25 / 100.0).Value(); - - public const int DriverSearchLoopThreshold = 200; - /// <summary> /// Tolerance for searching operating point with line search. /// </summary> @@ -144,8 +137,6 @@ namespace TUGraz.VectoCore.Configuration public static readonly MeterPerSecond ATGearboxDisengageWhenHaltingSpeed = 5.KMPHtoMeterPerSecond(); - public static readonly MeterPerSquareSecond MinimumAcceleration = 0.1.SI<MeterPerSquareSecond>(); - public static Meter DriverActionDistanceTolerance = 0.25.SI<Meter>(); public static MeterPerSecond VehicleSpeedHaltTolerance = 1e-3.SI<MeterPerSecond>(); @@ -158,19 +149,12 @@ namespace TUGraz.VectoCore.Configuration public static readonly PerSecond EngineIdlingSearchInterval = 10.SI<PerSecond>(); - public const int EngineSearchLoopThreshold = 100; - public const int MaximumIterationCountForSimulationStep = 30; - public static readonly MeterPerSecond VehicleStopClutchDisengageSpeed = 10.KMPHtoMeterPerSecond(); - public static readonly Meter GearboxLookaheadForAccelerationEstimation = 100.SI<Meter>(); public static Kilogram MaximumGrossVehicleWeight = 40000.SI<Kilogram>(); public static Kilogram MaximumGrossVehicleWeightEMS = 60000.SI<Kilogram>(); - - // the torque converter characteristics curve has to be defined up to this speed ratio - public const double RequiredTorqueConverterSpeedRatio = 2.2; } public static class XML diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 1518f394d189391c3c6cb7322a3058bfbb453dff..09458a755462727b2034e92c4760930df0d1f491 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -172,7 +172,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public IDriverEngineeringInputData DriverInputData { - get { return DriverInputData; } + get { throw new NotImplementedException(); } } public IPTOTransmissionInputData PTOTransmissionInputData @@ -180,6 +180,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return PTOTransmission; } } - public XElement XMLHash { get { return null; } } + public XElement XMLHash + { + get { return null; } + } } } \ 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 eced7e2b039587dfd85b12f3ce8001175f25241c..40c51b99237df7b314571c3891e69e39f783980a 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -241,11 +241,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return "N/A"; } } - public string TechnicalReportId - { - get { return "N/A"; } - } - public CertificationMethod CertificationMethod { get { return CertificationMethod.NotCertified; } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index 3bc2b7ce19b77b193425a9f2843ce70013765dbd..c1d0b8718d109a2f2c948677a850e7f794efdfcd 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -53,12 +53,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON private readonly string _sourceFile; - protected readonly JObject Header; protected readonly JObject Body; protected JSONFile(JObject data, string filename, bool tolerateMissing = false) { - Header = (JObject)data.GetEx(JsonKeys.JsonHeader); + //var header = (JObject)data.GetEx(JsonKeys.JsonHeader); Body = (JObject)data.GetEx(JsonKeys.JsonBody); _sourceFile = Path.GetFullPath(filename); TolerateMissing = tolerateMissing; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index b0f30c2c3c616d735c46ca9146a13070f426a45c..1c94164cb9175244aa8207c95e59bed08f75cae5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -358,21 +358,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return "N.A."; } } - public string Creator - { - get { return "N/A"; } - } - public string Date { get { return "N/A"; } } - public string TechnicalReportId - { - get { return "N.A."; } - } - public CertificationMethod CertificationMethod { get { return CertificationMethod.NotCertified; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs index 34a60a8fdc8ee2407b40682a71200ffe9907d4de..057e3de639db737d29229ab6597beadc7c0765cc 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs @@ -132,7 +132,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration { var path = Helper.Query(XBasePath, relativePath.Any() ? relativePath : null); - var node = Navigator.SelectSingleNode(path.ToString(), Manager); + var node = Navigator.SelectSingleNode(path, Manager); if (node == null) { throw new VectoException("Node {0} not found in input data", path); } @@ -160,6 +160,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration XPathNavigator origin = null) { var startNode = origin ?? Navigator.SelectSingleNode(XBasePath, Manager); + if (startNode == null) { + throw new VectoException("start node for base-path {0} not found!", XBasePath); + } var table = new TableData(); foreach (var entry in attributeMapping) { if (startNode.Select(Helper.Query(relativePath, "@" + entry.Value), Manager).Count == 0) { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs index 26914ebc3eae421dfa076b64cdcd27b4ded8265f..f921a8d1e2af6810696526f7a344c6fd1532ee4f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs index 814e9f2b62a56a68a3f24945d6274c74727fcc57..6fc74dfd724de6ccb284eded5c5390abf7d2087e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System.ComponentModel.DataAnnotations; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs index 243a461d7e657d41c23afb5faceef165ed5ea341..7802aaed52e94ea61d8b5530dbd3ba65031c9628 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs @@ -29,11 +29,9 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System.Xml; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.InputData.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs index 586cd40f5cc4ace67cd54756238f7216ed9d0b46..9da4b9b423c9c0ebd737d6f5e1ea116bddec7866 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs @@ -59,7 +59,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration //XmlSchemaValidationFlags.ProcessSchemaLocation | XmlSchemaValidationFlags.ReportValidationWarnings }; - settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); + settings.ValidationEventHandler += ValidationCallBack; settings.Schemas.Add(GetXMLSchema("")); inputData = XmlReader.Create(inputData, settings); diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs index c7555dc60842d95a256091e140bd0a7b4a631684..8ccdc2d5b4149977de835720726e3e907fc0de3d 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs @@ -96,13 +96,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration } } - - public SquareMeter AirDragArea - { - get { return GetDoubleElementValue(XMLNames.Vehicle_AirDragArea).SI<SquareMeter>(); } - } - - public AxleConfiguration AxleConfiguration { get { return AxleConfigurationHelper.Parse(GetElementValue(XMLNames.Vehicle_AxleConfiguration)); } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs index 53ae8e952ecdfcdbbc0f7dae04ed9b7249add0be..534f23669ecddd7819b1a2903b8428c4fa2ae36b 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs index a8c9c5fd45f27350122732ffc661746ebd0c75f8..d0780b1a3d4c3ef5f5aaf6468a43fbaf14aafa5f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs @@ -44,7 +44,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering public AngledriveType Type { - get { return InputData._vehicleInputData.AngledriveType; } + get { return InputData.VehicleData.AngledriveType; } } public double Ratio diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs index 4df2e7626661368b4657390f9bc8ad44c855b22b..433866eab031864040c15ff80d297724cb7c64ad 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System.Collections.Generic; using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.Exceptions; @@ -37,7 +36,6 @@ using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader; namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs index 042195b6b1bdbeb66a84429b052d8a053d66ddcc..c18a55d51f1b02d2a622d33bd5854e118de0bc2e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs @@ -51,8 +51,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering protected internal XMLEngineeringAuxiliaryDataProvider XMLEngineeringAuxiliaryData; protected internal XMLEngineeringDriverDataProvider XMLEngineeringDriverData; protected internal XMLEngineeringJobInputDataProvider XMLEngineeringJobData; - protected internal XMLEngineeringVehicleDataProvider _vehicleInputData; - protected internal XMLEngineeringAxlegearDataProvider _axleGearInputData; + protected internal XMLEngineeringVehicleDataProvider VehicleData; + protected internal XMLEngineeringAxlegearDataProvider AxlegearData; public XMLEngineeringInputDataProvider(string filename, bool verifyXml) { @@ -95,7 +95,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering //XmlSchemaValidationFlags.ProcessSchemaLocation | XmlSchemaValidationFlags.ReportValidationWarnings }; - settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); + settings.ValidationEventHandler += ValidationCallBack; settings.Schemas.Add(GetXMLSchema("")); } try { @@ -131,16 +131,16 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering } ReadVehicle(settings); - XMLEngineeringDriverData = XMLEngineeringJobData.GetDriverData(settings); - _axleGearInputData = _vehicleInputData.GetAxleGearInputData(settings); - AngledriveInputData = _vehicleInputData.GetAngularGearInputData(settings); - EngineInputData = _vehicleInputData.GetEngineInputData(settings); - RetarderInputData = _vehicleInputData.GetRetarderInputData(settings); - XMLEngineeringAuxiliaryData = _vehicleInputData.GetAuxiliaryData(settings); - GearboxInputData = _vehicleInputData.GetGearboxData(settings); + XMLEngineeringDriverData = XMLEngineeringJobData.GetDriverData(); + AxlegearData = VehicleData.GetAxleGearInputData(settings); + AngledriveInputData = VehicleData.GetAngularGearInputData(); + EngineInputData = VehicleData.GetEngineInputData(settings); + RetarderInputData = VehicleData.GetRetarderInputData(settings); + XMLEngineeringAuxiliaryData = VehicleData.GetAuxiliaryData(settings); + GearboxInputData = VehicleData.GetGearboxData(settings); TorqueConverterInputData = GearboxInputData.TorqueConverter; - PTOTransmissionInputData = _vehicleInputData.GetPTOData(settings); - AirdragInputData = _vehicleInputData.GetAirdragInputData(settings); + PTOTransmissionInputData = VehicleData.GetPTOData(); + AirdragInputData = VehicleData.GetAirdragInputData(settings); } private static void ValidationCallBack(object sender, ValidationEventArgs args) @@ -162,7 +162,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering helper.AddNamespaces(manager); var vehicle = nav.SelectSingleNode(vehiclePath, manager); if (vehicle != null) { - _vehicleInputData = new XMLEngineeringVehicleDataProvider(this, Document, vehiclePath, + VehicleData = new XMLEngineeringVehicleDataProvider(this, Document, vehiclePath, Path.GetDirectoryName(Path.GetFullPath(FileName))); return; } @@ -181,7 +181,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering helper.QueryAbs( helper.NSPrefix("VectoComponentEngineering", Constants.XML.RootNSPrefix), XMLNames.Component_Vehicle); - _vehicleInputData = new XMLEngineeringVehicleDataProvider(this, vehicleDocument, vehicleCompPath, + VehicleData = new XMLEngineeringVehicleDataProvider(this, vehicleDocument, vehicleCompPath, Path.GetDirectoryName(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(FileName) ?? "./", vehicleFile)))); return; } catch (XmlSchemaValidationException validationException) { @@ -209,7 +209,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering public IVehicleEngineeringInputData VehicleInputData { - get { return _vehicleInputData; } + get { return VehicleData; } } public IAirdragEngineeringInputData AirdragInputData { get; private set; } @@ -221,7 +221,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering public IAxleGearInputData AxleGearInputData { - get { return _axleGearInputData; } + get { return AxlegearData; } } public IAngledriveInputData AngledriveInputData { get; private set; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs index bc977cf3c55744dd2eb9edc7b3eb27181afdcef1..546ae85752aee4d55523d594607ec0ee8a8ddbae 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs @@ -151,7 +151,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { return InputData.JobInputData().EngineOnlyMode ? InputData.EngineInputData.Model - : InputData._vehicleInputData.GetVehicleID; + : InputData.VehicleData.GetVehicleID; } } @@ -252,7 +252,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering } } - public XMLEngineeringDriverDataProvider GetDriverData(XmlReaderSettings settings) + public XMLEngineeringDriverDataProvider GetDriverData() { return new XMLEngineeringDriverDataProvider(InputData, XMLDocument, XBasePath, FSBasePath); } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs index 38c81327ea763ae182f3ca5455a9f3915dfa60b5..c4a62ea94b51ecbcbb3d740a9302dc4960a5f516 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs @@ -29,13 +29,11 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System.Collections.Generic; using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; -using TUGraz.VectoCore.InputData.Reader.ComponentData; namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering { @@ -47,12 +45,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering public RetarderType Type { - get { return InputData._vehicleInputData.RetarderType; } + get { return InputData.VehicleData.RetarderType; } } public double Ratio { - get { return InputData._vehicleInputData.RetarderRatio; } + get { return InputData.VehicleData.RetarderRatio; } } public TableData LossMap @@ -60,10 +58,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { if (ElementExists(Helper.Query(XMLNames.Retarder_RetarderLossMap, XMLNames.Retarder_RetarderLossMap_Entry))) { - var mapping = new Dictionary<string, string> { - { XMLNames.Retarder_RetarderLossmap_RetarderSpeed_Attr, RetarderLossMapReader.Fields.RetarderSpeed }, - { XMLNames.Retarder_RetarderLossmap_TorqueLoss_Attr, RetarderLossMapReader.Fields.TorqueLoss } - }; return ReadTableData(AttributeMappings.RetarderLossmapMapping, Helper.Query(XMLNames.Retarder_RetarderLossMap, XMLNames.Retarder_RetarderLossMap_Entry)); } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs index 641bd74759da0f999d1969172501cee162a80471..51c7aa0cac35f8c51cb6e7fe3b57be4a26f7f114 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs @@ -44,7 +44,6 @@ using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Impl; -using TUGraz.VectoCore.Models.Declaration; namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering { @@ -288,7 +287,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering throw new VectoException("Component {0} not found!", componentName); } - public XMLEngineeringAngledriveDataProvider GetAngularGearInputData(XmlReaderSettings settings) + public XMLEngineeringAngledriveDataProvider GetAngularGearInputData() { return new XMLEngineeringAngledriveDataProvider(InputData, XMLDocument, Helper.Query(XBasePath, XMLNames.Vehicle_Components, XMLNames.Component_Angledrive, XMLNames.ComponentDataWrapper) @@ -297,7 +296,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering #region "PTO" - public IPTOTransmissionInputData GetPTOData(XmlReaderSettings settings) + public IPTOTransmissionInputData GetPTOData() { return this; } diff --git a/VectoCore/VectoCore/InputData/Impl/InputData.cs b/VectoCore/VectoCore/InputData/Impl/InputData.cs index 7817248f8b13dc7680d3c63667c56d9900f72431..2cf2e38474fb9c16315d837e51ac4af51003be1d 100644 --- a/VectoCore/VectoCore/InputData/Impl/InputData.cs +++ b/VectoCore/VectoCore/InputData/Impl/InputData.cs @@ -30,7 +30,6 @@ */ using System.Collections.Generic; -using System.Data; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -100,20 +99,6 @@ namespace TUGraz.VectoCore.InputData.Impl public string Source { get; internal set; } - public string Manufacturer { get; internal set; } - - public string Model { get; internal set; } - - public string Date { get; internal set; } - - public string TechnicalReportId { get; internal set; } - - public CertificationMethod CertificationMethod { get; internal set; } - - public string CertificationNumber { get; internal set; } - - public string DigestValue { get; internal set; } - public string Wheels { get; internal set; } public bool TwinTyres { get; internal set; } diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs index ea04f91475282503c24bf66b416d5d54f791e627..b91df9cffcd4bf39c1c1d2fdbe8625aeb423ac97 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs @@ -42,7 +42,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader.ComponentData { - public class AccelerationCurveReader + public static class AccelerationCurveReader { public static AccelerationCurveData ReadFromStream(Stream stream) { diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs index c3cfb24d4d8ecae196c68ae29068696f01aaf5c0..a12bcf233bf31659457ac9be1d377d5d9e2611c5 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs @@ -30,9 +30,6 @@ */ using System.Data; -using System.IO; -using System.Text; -using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs index be941535acd2cf16098e93d6c5d1feb8746fe80e..d1017ec3c3817f47e928ad749fcea0c241b9456c 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs @@ -29,9 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Data; using System.Diagnostics; using System.IO; @@ -59,15 +57,6 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData }.ToList(); } - // TODO mk2017-04-24: remove this method? static code analysis says it is not used. - [Obsolete("Is this still used? Static Code Analysis says No.", true)] - public static List<CrossWindCorrectionEntry> ReadSpeedDependentCorrectionFromFile(string fileName, - SquareMeter aerodynamicDragArea) - { - var data = VectoCSVFile.Read(fileName); - return ParseSpeedDependent(data, aerodynamicDragArea); - } - public static List<CrossWindCorrectionEntry> ReadSpeedDependentCorrectionCurveFromStream(Stream inputData, SquareMeter aerodynamicDragArea) { diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs index e03cbb248e78366b9312d48370ca1de1db879d08..2fb38d0b9648298f7764c2c9984fe481b63f818f 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs @@ -36,7 +36,6 @@ using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; @@ -44,19 +43,6 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData { public static class PTOIdleLossMapReader { - /// <summary> - /// Read the retarder loss map from a file. - /// </summary> - /// <param name="fileName"></param> - /// <returns></returns> - public static PTOLossMap ReadFromFile(string fileName) - { - try { - return Create(VectoCSVFile.Read(fileName)); - } catch (Exception ex) { - throw new VectoException("ERROR while loading PTO Idle LossMap: " + ex.Message); - } - } public static PTOLossMap ReadFromStream(Stream stream) { diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs index 2f697de424a86d57d8155816358311852f54b57c..5562408687062c31720e6ffab784c42d7308e249 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs @@ -42,7 +42,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader.ComponentData { - public class TorqueConverterDataReader + public static class TorqueConverterDataReader { public static TorqueConverterData ReadFromFile(string filename, PerSecond referenceRpm, PerSecond maxRpm, ExecutionMode mode, double ratio, MeterPerSquareSecond lcMinAcceleration, MeterPerSquareSecond ccMinAcceleration) diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs index 0d95a4d4cf1e3b23540314a6970791b209748149..4ab5e65d5704f55d2ab793fbd8054709b255095c 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs @@ -41,7 +41,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader.ComponentData { - public sealed class TransmissionLossMapReader + public static class TransmissionLossMapReader { public static TransmissionLossMap ReadFromFile(string fileName, double gearRatio, string gearName) { diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs index 4bd060470e0c18a4d2bb33434fca5171c0b6e0d9..5244265f0a0b6eb5a8f370a7cadfab1eb7cb2b1e 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs @@ -37,7 +37,6 @@ using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; @@ -153,7 +152,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter }; } - protected TransmissionLossMap CreateGearLossMap(ITransmissionInputData gear, uint i, bool useEfficiencyFallback, bool extendLossMap) + protected TransmissionLossMap CreateGearLossMap(ITransmissionInputData gear, uint i, bool useEfficiencyFallback, + bool extendLossMap) { if (gear.LossMap != null) { return TransmissionLossMapReader.Create(gear.LossMap, gear.Ratio, string.Format("Gear {0}", i + 1), extendLossMap); @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter throw new InvalidFileFormatException("Gear {0} LossMap missing.", i + 1); } - protected static void CreateTCSecondGearATSerial(IGearboxDeclarationInputData gearbox, GearData gearData, + protected static void CreateTCSecondGearATSerial(GearData gearData, ShiftPolygon shiftPolygon) { gearData.TorqueConverterRatio = gearData.Ratio; @@ -172,7 +172,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter gearData.TorqueConverterShiftPolygon = shiftPolygon; } - protected static void CreateTCFirstGearATSerial(IGearboxDeclarationInputData gearbox, GearData gearData, + protected static void CreateTCFirstGearATSerial(GearData gearData, ShiftPolygon shiftPolygon) { gearData.TorqueConverterRatio = gearData.Ratio; @@ -180,8 +180,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter gearData.TorqueConverterShiftPolygon = shiftPolygon; } - protected static void CretateTCFirstGearATPowerSplit(IGearboxDeclarationInputData gearbox, GearData gearData, uint i, - ShiftPolygon shiftPolygon) + protected static void CretateTCFirstGearATPowerSplit(GearData gearData, uint i, ShiftPolygon shiftPolygon) { gearData.TorqueConverterRatio = 1; gearData.TorqueConverterGearLossMap = TransmissionLossMapReader.Create(1, 1, string.Format("TCGear {0}", i + 1)); @@ -288,12 +287,12 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return engineCurve; } - var entries = new List<FullLoadCurve.FullLoadCurveEntry>(); + var entries = new List<EngineFullLoadCurve.FullLoadCurveEntry>(); var firstEntry = engineCurve.FullLoadEntries.First(); if (firstEntry.TorqueFullLoad < maxTorque) { entries.Add(engineCurve.FullLoadEntries.First()); } else { - entries.Add(new FullLoadCurve.FullLoadCurveEntry { + entries.Add(new EngineFullLoadCurve.FullLoadCurveEntry { EngineSpeed = firstEntry.EngineSpeed, TorqueFullLoad = maxTorque, TorqueDrag = firstEntry.TorqueDrag @@ -305,7 +304,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter entries.Add(entry.Item2); } else if (entry.Item1.TorqueFullLoad > maxTorque && entry.Item2.TorqueFullLoad > maxTorque) { // segment is above maxTorque line -> add limited entry - entries.Add(new FullLoadCurve.FullLoadCurveEntry { + entries.Add(new EngineFullLoadCurve.FullLoadCurveEntry { EngineSpeed = entry.Item2.EngineSpeed, TorqueFullLoad = maxTorque, TorqueDrag = entry.Item2.TorqueDrag @@ -317,12 +316,12 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter var edgeDrag = Edge.Create(new Point(entry.Item1.EngineSpeed.Value(), entry.Item1.TorqueDrag.Value()), new Point(entry.Item2.EngineSpeed.Value(), entry.Item2.TorqueDrag.Value())); var intersectionX = (maxTorque.Value() - edgeFull.OffsetXY) / edgeFull.SlopeXY; - entries.Add(new FullLoadCurve.FullLoadCurveEntry { + entries.Add(new EngineFullLoadCurve.FullLoadCurveEntry { EngineSpeed = intersectionX.SI<PerSecond>(), TorqueFullLoad = maxTorque, TorqueDrag = VectoMath.Interpolate(edgeDrag.P1, edgeDrag.P2, intersectionX).SI<NewtonMeter>() }); - entries.Add(new FullLoadCurve.FullLoadCurveEntry { + entries.Add(new EngineFullLoadCurve.FullLoadCurveEntry { EngineSpeed = entry.Item2.EngineSpeed, TorqueFullLoad = entry.Item2.TorqueFullLoad > maxTorque ? maxTorque : entry.Item2.TorqueFullLoad, TorqueDrag = entry.Item2.TorqueDrag @@ -330,10 +329,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } } - var flc = new EngineFullLoadCurve { - FullLoadEntries = entries.ToList(), + var flc = new EngineFullLoadCurve(entries.ToList(), engineCurve.PT1Data) { EngineData = engineCurve.EngineData, - PT1Data = engineCurve.PT1Data }; return flc; } diff --git a/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs index 666f4c68a4dae77a0b738f0b245fdd4d922bad92..dca2a2c2b7d73f5648178f329a8e313f94cef61d 100644 --- a/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs @@ -37,13 +37,12 @@ using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader { - public class FullLoadCurveReader : LoggingObject + public static class FullLoadCurveReader { public static EngineFullLoadCurve ReadFromFile(string fileName, bool declarationMode = false) { @@ -70,7 +69,7 @@ namespace TUGraz.VectoCore.InputData.Reader if (HeaderIsValid(data.Columns)) { entriesFld = CreateFromColumnNames(data); } else { - Logger<EngineFullLoadCurve>().Warn( + LoggingObject.Logger<EngineFullLoadCurve>().Warn( "FullLoadCurve: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: '{3}'. Falling back to column index.", Fields.EngineSpeed, Fields.TorqueFullLoad, Fields.TorqueDrag, string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); @@ -82,14 +81,10 @@ namespace TUGraz.VectoCore.InputData.Reader if (declarationMode) { tmp = new PT1(); } else { - if (data.Columns.Count > 3) { - tmp = new PT1(data); - } else { - tmp = new PT1(); - } + tmp = data.Columns.Count > 3 ? new PT1(data) : new PT1(); } entriesFld.Sort((entry1, entry2) => entry1.EngineSpeed.Value().CompareTo(entry2.EngineSpeed.Value())); - return new EngineFullLoadCurve { FullLoadEntries = entriesFld, PT1Data = tmp }; + return new EngineFullLoadCurve(entriesFld, tmp); } private static bool HeaderIsValid(DataColumnCollection columns) diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs index 47f3607160369483f2750bd6cdd4b6cd1af83bb3..ad566d84908c2995154cb0b59625870f3355eac5 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs @@ -76,12 +76,9 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl return InputDataProvider.JobInputData().Cycles.Select(cycle => { DrivingCycleData drivingCycle; - if (CyclesCache.ContainsKey(cycle.CycleData.Source)) { - drivingCycle = CyclesCache[cycle.CycleData.Source]; - } else { - drivingCycle = DrivingCycleDataReader.ReadFromDataTable(cycle.CycleData, cycle.Name, crossWindRequired); - //CyclesCache.Add(cycle.CycleData.Source, drivingCycle); - } + drivingCycle = CyclesCache.ContainsKey(cycle.CycleData.Source) + ? CyclesCache[cycle.CycleData.Source] + : DrivingCycleDataReader.ReadFromDataTable(cycle.CycleData, cycle.Name, crossWindRequired); return new VectoRunData { JobName = InputDataProvider.JobInputData().JobName, EngineData = engineData, diff --git a/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs b/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs index 25ddd4a0a33cca66b73122a6ae91f9b5640c36cd..72ded465a88707b7aa3c65f27b39386b9212c8c2 100644 --- a/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs @@ -41,7 +41,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader { - public class ShiftPolygonReader : LoggingObject + public static class ShiftPolygonReader { public static ShiftPolygon ReadFromFile(string fileName) { @@ -68,7 +68,7 @@ namespace TUGraz.VectoCore.InputData.Reader entriesDown = CreateFromColumnNames(data, Fields.AngularSpeedDown); entriesUp = CreateFromColumnNames(data, Fields.AngularSpeedUp); } else { - Logger<ShiftPolygon>() + LoggingObject.Logger<ShiftPolygon>() .Warn( "ShiftPolygon: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: '{3}'. Falling back to column index", Fields.Torque, Fields.AngularSpeedUp, Fields.AngularSpeedDown, diff --git a/VectoCore/VectoCore/Models/Declaration/Axle.cs b/VectoCore/VectoCore/Models/Declaration/Axle.cs index 15b27a6fe1dae4af8c5fe25e6efdea1e8c515f81..6e638a2722980feef418a5c94964f615b85ceda3 100644 --- a/VectoCore/VectoCore/Models/Declaration/Axle.cs +++ b/VectoCore/VectoCore/Models/Declaration/Axle.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Declaration/FuelData.cs b/VectoCore/VectoCore/Models/Declaration/FuelData.cs index 14fe60f51f3d945e7b3548ab4b9bfcf6b890738c..6a90f2a395fce849dd11a55bf60935153fadff5a 100644 --- a/VectoCore/VectoCore/Models/Declaration/FuelData.cs +++ b/VectoCore/VectoCore/Models/Declaration/FuelData.cs @@ -79,11 +79,6 @@ namespace TUGraz.VectoCore.Models.Declaration .ToDictionary(e => e.FuelType); } - public FuelType[] GetFuelTypes() - { - return Data.Keys.ToArray(); - } - public class Entry { public Entry(FuelType type, KilogramPerCubicMeter density, double weight, JoulePerKilogramm heatingValue) diff --git a/VectoCore/VectoCore/Models/Declaration/PT1.cs b/VectoCore/VectoCore/Models/Declaration/PT1.cs index 58ca28845c98f30a65e23e3a66f99ed18663f864..09bbb9244f46b00ab7c635380df56d658fb11557 100644 --- a/VectoCore/VectoCore/Models/Declaration/PT1.cs +++ b/VectoCore/VectoCore/Models/Declaration/PT1.cs @@ -34,9 +34,7 @@ using System.Collections.Generic; using System.Data; using System.Linq; using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration @@ -87,8 +85,8 @@ namespace TUGraz.VectoCore.Models.Declaration if (data.Columns.Contains(Fields.EngineSpeed) && data.Columns.Contains(Fields.PT1)) { _entries = data.Rows.Cast<DataRow>() .Select( - r => new KeyValuePair<PerSecond, Second>(DataTableExtensionMethods.ParseDouble(r, Fields.EngineSpeed).RPMtoRad(), - DataTableExtensionMethods.ParseDouble(r, Fields.PT1).SI<Second>())) + r => new KeyValuePair<PerSecond, Second>(r.ParseDouble(Fields.EngineSpeed).RPMtoRad(), + r.ParseDouble(Fields.PT1).SI<Second>())) .OrderBy(x => x.Key).ToList(); } else { _entries = data.Rows.Cast<DataRow>() @@ -99,10 +97,9 @@ namespace TUGraz.VectoCore.Models.Declaration public override PT1Result Lookup(PerSecond key) { - var index = 1; - bool extrapolated = key.IsSmaller(_entries[0].Key) || key.IsGreater(_entries.Last().Key); + var extrapolated = key.IsSmaller(_entries[0].Key) || key.IsGreater(_entries.Last().Key); - index = _entries.FindIndex(x => x.Key.IsGreater(key)); + var index = _entries.FindIndex(x => x.Key.IsGreater(key)); if (index <= 0) { index = key.IsGreater(_entries[0].Key) ? _entries.Count - 1 : 1; } diff --git a/VectoCore/VectoCore/Models/Declaration/Segments.cs b/VectoCore/VectoCore/Models/Declaration/Segments.cs index ca1951e2f6f380a444c90bca91311aef216c544f..3fe152361c100e093fa640a77e38eeef2f59db1f 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segments.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segments.cs @@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.Declaration trailers.Sum(t => t.TrailerCurbWeight).DefaultIfNull(0); var payloads = row.Field<string>(missionType.ToString()).Split('/'); - Kilogram refLoad = null, lowLoad = 0.SI<Kilogram>(); + Kilogram refLoad, lowLoad = 0.SI<Kilogram>(); if (payloads.Length == 2) { lowLoad = GetLoading(payloads[0], grossVehicleWeight, trailers, true); refLoad = GetLoading(payloads[1], grossVehicleWeight, trailers, false); diff --git a/VectoCore/VectoCore/Models/Declaration/Wheels.cs b/VectoCore/VectoCore/Models/Declaration/Wheels.cs index 582e221ae5e1eecd9c26defb356e0a79561748b1..06914b3490d3260febeb3b35e8080a91ab3b0537 100644 --- a/VectoCore/VectoCore/Models/Declaration/Wheels.cs +++ b/VectoCore/VectoCore/Models/Declaration/Wheels.cs @@ -30,7 +30,6 @@ */ using System; -using System.Collections.Generic; using System.Data; using System.Linq; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs index 6c0870d42d307b9afa02c1c15a82f0a7ec59a461..94cf6d06a3edf198fd708388fc83a0b3cd7f0506 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs @@ -31,7 +31,6 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Models.Simulation.DataBus diff --git a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs index 46e518f1ae3b3372be8f89787d54b1c1af050619..5ea36cc1c43e70ca7afeb9e09aabec174ccd9efa 100644 --- a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs @@ -31,7 +31,6 @@ using System; using System.ComponentModel.DataAnnotations; -using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation.Data; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 551e52b2f5ae04b886ec6c16935cf7d01c41c382..87754ccb9183c250b90ea51c5c08047ef3edb699 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -33,7 +33,6 @@ using System; using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; @@ -152,8 +151,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl powertrain.AddComponent(engine, idleController) .AddAuxiliaries(container, data); - _modData.HasTorqueConverter = data.GearboxData.Type.AutomaticTransmission(); - + return container; } @@ -180,8 +178,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl powertrain.AddComponent(new CombustionEngine(container, data.EngineData)) .AddAuxiliaries(container, data); - _modData.HasTorqueConverter = data.GearboxData.Type.AutomaticTransmission(); - return container; } @@ -214,8 +210,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl powertrain.AddComponent(engine, idleController) .AddAuxiliaries(container, data); - _modData.HasTorqueConverter = data.GearboxData.Type.AutomaticTransmission(); - return container; } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 1bf9fa1f511c98094c04b7decc5cb0106a07b405..a70fc63fd8a592a130e56e669186d8590b8ad005 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -33,7 +33,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Security.Principal; using System.Threading; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; @@ -125,7 +124,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl : null; if (ActualModalData) { - modDataFilter = new[] { new ActualModalDataFilter(), }; + modDataFilter = new IModalDataFilter[] { new ActualModalDataFilter(), }; } @@ -154,7 +153,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl WriteModalResults = _mode != ExecutionMode.Declaration || WriteModalResults }; var current = i++; - var builder = new PowertrainBuilder(modContainer, (modData) => { + var builder = new PowertrainBuilder(modContainer, modData => { if (SumData != null) { SumData.Write(modData, JobNumber, current, d); //SumData.Write(modContainer, d.JobName, string.Format("{0}-{1}", JobNumber, current), diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs index 4468139f3727de1200a61fc8a2448de02a35ff93..0bd336c0cee33fb29798e69a5768a676075ededa 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs @@ -142,6 +142,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl } catch (Exception ve2) { ve = new VectoException("Multiple Exceptions occured.", new AggregateException(ve, new VectoException("Exception during finishing Simulation.", ve2))); + throw ve; } throw ex; } catch (Exception e) { diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index a4dfbd5cabef074cecfb6d42f77e15e528e1c350..c6022e6d61b21733efdb38f073269d15c7dada32 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -37,7 +37,6 @@ using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs index 7c16736a3bebee4b70286465224d38f80fc2e6c3..95d82da586774d375452ce0a986420fe37457b45 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs @@ -86,21 +86,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data return index; } - public MeterPerSquareSecond MinDeceleration() - { - return _entries.Max(x => x.Value.Deceleration); - } - public MeterPerSquareSecond MaxDeceleration() { return _entries.Min(x => x.Value.Deceleration); } - public MeterPerSquareSecond MinAcceleration() - { - return _entries.Min(x => x.Value.Acceleration); - } - public MeterPerSquareSecond MaxAcceleration() { return _entries.Max(x => x.Value.Acceleration); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs index a499a5465325ab8f9a775da771610c1a5af4544f..1ab6911924dfff1b599bdd4bb13b576a35309976 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader.ComponentData; @@ -62,11 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data return value.Value.SI<Watt>(); } value = _map.Extrapolate(nAuxiliary.Value(), powerAuxOut.Value()); - if (value.HasValue) { - return value.Value.SI<Watt>(); - } - throw new VectoException("AuxiliaryData {2}: Interpolation failed. nAux: {0}, powerOut:{1}", nAuxiliary.AsRPM, - powerAuxOut, auxId); + return value.Value.SI<Watt>(); } internal AuxiliaryData(string id, double transmissionRatio, double efficiencyToEngine, double efficiencyToSupply, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs index 9e753dcb2624574639b371d5b17b625d5dcb31b8..3118eec25d6bf887af0b98a75ba673d12ce7989f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index f9a305a769d63e9b290f5e0280f80499c970381a..bcb9fd79bf2554ed1dff5dc017a77a76ef3cefcb 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -29,13 +29,11 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; namespace TUGraz.VectoCore.Models.SimulationComponent.Data diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs index 73a1e6ffd73add75f82a26dea3b4f90dcda5e2b3..dd44953fce634f726e7273da339c5952dd13784a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs @@ -34,7 +34,6 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Models.Simulation.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs index be235259e15e25899382ee675bd7ade159208603..cb135b8e3be607b2a8db28e9c6a02f10eae026cc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs @@ -36,7 +36,6 @@ using System.Diagnostics; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs index aaedc3db532b5a9a77e7c371d3b15dbce89a8991..09bf6a89cd6ddf409a477424eaeb177d03baaf6d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs @@ -32,13 +32,11 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Data; using System.Diagnostics; using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Utils; @@ -60,13 +58,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine private PerSecond _n95hSpeed; // 95% of Pmax private PerSecond _n80hSpeed; // 80% of Pmax - [Required, ValidateObject] internal List<FullLoadCurveEntry> FullLoadEntries; + [Required, ValidateObject] readonly internal List<FullLoadCurveEntry> FullLoadEntries; private SortedList<PerSecond, int> _quickLookup; - [Required] internal LookupData<PerSecond, PT1.PT1Result> PT1Data; + [Required] readonly internal LookupData<PerSecond, PT1.PT1Result> PT1Data; - internal EngineFullLoadCurve() {} + internal EngineFullLoadCurve(List<FullLoadCurveEntry> entries, LookupData<PerSecond, PT1.PT1Result> pt1Data) + { + FullLoadEntries = entries; + PT1Data = pt1Data; + } public Watt FullLoadStationaryPower(PerSecond angularVelocity) { @@ -113,7 +115,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine get { return _maxDragTorque ?? FindMaxDragTorque(); } } - public virtual NewtonMeter FullLoadStationaryTorque(PerSecond angularVelocity) + public NewtonMeter FullLoadStationaryTorque(PerSecond angularVelocity) { var idx = FindIndex(angularVelocity); return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, @@ -121,7 +123,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine angularVelocity); } - public virtual NewtonMeter DragLoadStationaryTorque(PerSecond angularVelocity) + public NewtonMeter DragLoadStationaryTorque(PerSecond angularVelocity) { var idx = FindIndex(angularVelocity); return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs index 2dfc3f7668a3bb5eecb00acf033abf8014bf064b..306828b54ba48bbccdb59340c6f141ddffcc1281 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs @@ -89,7 +89,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox } var result = gearData.TorqueConverterShiftPolygon.Validate(mode, gbxType, emsMission); if (result.Any()) { - return new ValidationResult(string.Format("Validation of GearData failed"), result.Select(x => x.ErrorMessage)); + return new ValidationResult("Validation of GearData failed", result.Select(x => x.ErrorMessage)); } } return ValidationResult.Success; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs index 07e62381ee442de0471acdced853c8ea2d1471e9..591212a1e45f7c0c1c5f93f309073e59fafa7398 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs @@ -34,7 +34,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs index 01f4af9bfb086930d1e85443323debd3e156dadd..6438cf798c45e14398c6a7b5768e5df34e3fe05c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs @@ -133,10 +133,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox get { return _entries[i]; } } +#if DEBUG public void DrawGraph() { _lossMap.DrawGraph(); } +#endif [DebuggerDisplay("GearLossMapEntry({InputSpeed}, {InputTorque}, {TorqueLoss})")] public class GearLossMapEntry diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs index 1d33219f7beee704a921d036f88849c3556ee61e..31d10fc0203ad520e6172958b2f9a472c211d6dd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs @@ -37,9 +37,7 @@ using System.Linq; using System.Runtime.Serialization; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; -using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs index 2eed9ad6e2c9c73582017e403fa7955f36a86ddd..41740fad5fce5efa6a5a6e111af5af055725876b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs @@ -30,12 +30,8 @@ */ using System.ComponentModel.DataAnnotations; -using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.OutputData.XML; -using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/IAuxiliary.cs deleted file mode 100644 index 4adffdb5b711aa8d9652d432ed95ec502a892258..0000000000000000000000000000000000000000 --- a/VectoCore/VectoCore/Models/SimulationComponent/IAuxiliary.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines interfaces for auxiliary components. - /// </summary> - public interface IAuxiliary : IPowerTrainComponent {} -} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs index 92c7dc90e56f68092123ec72d3fdd87c7b187758..69c07e5fb1fd2d67e057d34d07960537ab38a29c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs @@ -31,13 +31,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent { - public enum ClutchState - { - ClutchClosed, - ClutchOpened, - ClutchSlipping - } - public interface IClutch : IPowerTrainComponent { //ITnOutPort IdleControlPort { get; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs index b2ae9d8dfb8d6971702dff80c32f2124eb34c454..aa2af093b01c72d48f4895058d22be8957b0a5a5 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; namespace TUGraz.VectoCore.Models.SimulationComponent diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index 83fc6641c1ff0f8a4dff28d02e3fe228cfde41c3..2ed53294a82f32ac92f68924c8add9ef99c0d150 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -35,7 +35,6 @@ using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { @@ -111,13 +110,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fullLoadPower = response.DynamicFullLoadPower; //EnginePowerRequest - response.DeltaFullLoad; var reserve = 1 - response.EnginePowerRequest / fullLoadPower; - var inTorque = response.ClutchPowerRequest / inAngularSpeed; - - + if (response.EngineSpeed > DataBus.EngineIdleSpeed && reserve >= ModelData.StartTorqueReserve) { _nextGear = gear; - //_gearbox.LastUpshift = absTime; - //_gearbox.LastDownshift = absTime; return gear; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index c1194b4181101058e91c296872cf2830d80f5dd7..27701f2cca2d930ad01372e559140aae0a45879d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -52,14 +52,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// </summary> [Required, ValidateObject] internal readonly GearboxData ModelData; - protected KilogramSquareMeter EngineInertia; - protected AbstractGearbox(IVehicleContainer container, VectoRunData runData) : base(container) { ModelData = runData.GearboxData; - EngineInertia = runData.EngineData != null - ? runData.EngineData.Inertia - : 0.SI<KilogramSquareMeter>(); } #region ITnOutPort @@ -148,7 +143,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected internal WattSecond ComputeShiftLosses(NewtonMeter outTorque, PerSecond outAngularVelocity) { var torqueGbxIn = outTorque / ModelData.Gears[Gear].Ratio; - var deltaEngineSpeed = DataBus.EngineSpeed - outAngularVelocity * ModelData.Gears[Gear].Ratio; var deltaClutchSpeed = (DataBus.EngineSpeed - PreviousState.OutAngularVelocity * ModelData.Gears[Gear].Ratio) / 2; var shiftLossEnergy = torqueGbxIn * deltaClutchSpeed * ModelData.PowershiftShiftTime; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs index 9901d0c982528a9007ab69f06b5052abe5afcdbd..114e359f2dd78eac0775c43b9cfadcb647da2e86 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs @@ -38,7 +38,6 @@ using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.OutputData; -using TUGraz.VectoCore.Utils; using VectoAuxiliaries; using VectoAuxiliaries.Pneumatics; @@ -61,22 +60,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // mAAUX_Global.advancedAuxModel.Signals.DeclarationMode = Cfg.DeclMode // mAAUX_Global.advancedAuxModel.Signals.WHTC = Declaration.WHTCcorrFactor CurrentState = new BusAuxState(); - PreviousState = new BusAuxState(); - PreviousState.AngularSpeed = engineIdleSpeed; + PreviousState = new BusAuxState { AngularSpeed = engineIdleSpeed }; AdditionalAux = additionalAux; DataBus = container; - var tmpAux = new AdvancedAuxiliaries(); - - //var actuationsMap = new PneumaticActuationsMAP(); - - - // 'Set Statics - tmpAux.VectoInputs.Cycle = DetermineCycle(cycleName); - tmpAux.VectoInputs.VehicleWeightKG = vehicleWeight; - // tmpAux.Signals.TotalCycleTimeSeconds = - // tmpAux.actuationsMap.GetNumActuations(new ActuationsKey("CycleTime", tmpAux.VectoInputs.Cycle)); + var tmpAux = new AdvancedAuxiliaries { + VectoInputs = { + Cycle = DetermineCycle(cycleName), + VehicleWeightKG = vehicleWeight + } + }; _fcMapAdapter = new FuelConsumptionAdapter() { FcMap = fcMap }; tmpAux.VectoInputs.FuelMap = _fcMapAdapter; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index 92f2cc3addee9502a27439b6c66c396517be0d2d..8a5301b7f74888cf28cbccaa2d46e1a0e6e256db 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -47,7 +47,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { private readonly PerSecond _idleSpeed; private readonly PerSecond _ratedSpeed; - private const double ClutchEff = 1; public IIdleController IdleController { get { return _idleController; } @@ -145,13 +144,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // Reason: if angularVelocity = 0 also the power (torque * angularVelocity) is 0 and then // the torque demand for the engine is 0. no drag torque although vehicle has to decelerate // "the clutch" eats up the whole torque - var effectiveAngularVelocity = angularVelocity.IsEqual(0.SI<PerSecond>()) - ? (PreviousState.OutAngularVelocity + angularVelocity) / 2 - : angularVelocity; var engineSpeed = VectoMath.Max(_idleSpeed, angularVelocity); angularVelocityIn = _clutchSpeedSlippingFactor * engineSpeed + _idleSpeed; - //torqueIn = torque * effectiveAngularVelocity / ClutchEff / angularVelocityIn; + } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 09c8096309d4317782ccfa6cb0fe438fa977f51f..f547e7f470117e1b7e248b56c09909811604973e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -301,12 +301,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ModelData.FullLoadCurves[0].N95hSpeed); } - private NewtonMeter ComputeDelta(NewtonMeter torqueOut, NewtonMeter totalTorqueDemand, NewtonMeter maxEngineTorque) - { - var deltaEngine = totalTorqueDemand - maxEngineTorque; - return deltaEngine; - } - public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) { if (outAngularVelocity == null) { @@ -419,25 +413,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion - /// <summary> - /// Updates the engine state dependend on the requested power [W]. - /// </summary> - protected virtual void UpdateEngineState(Watt requestedEnginePower, PerSecond avgEngineSpeed) - { - if (requestedEnginePower < -ZeroThreshold) { - CurrentState.OperationMode = IsFullLoad(requestedEnginePower, CurrentState.DynamicFullLoadTorque * avgEngineSpeed) - ? EngineOperationMode.FullLoad - : EngineOperationMode.Load; - } else if (requestedEnginePower > ZeroThreshold) { - CurrentState.OperationMode = IsFullLoad(requestedEnginePower, CurrentState.FullDragTorque * avgEngineSpeed) - ? EngineOperationMode.FullDrag - : EngineOperationMode.Drag; - } else { - // -ZeroThreshold <= requestedEnginePower <= ZeroThreshold - CurrentState.OperationMode = EngineOperationMode.Idle; - } - } - /// <summary> /// computes full load power from gear [-], angularVelocity [rad/s] and dt [s]. /// </summary> @@ -450,7 +425,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.StationaryFullLoadTorque = ModelData.FullLoadCurves[DataBus.Gear].FullLoadStationaryTorque(angularVelocity); var stationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity; - Watt dynFullPowerCalculated = 0.SI<Watt>(); + Watt dynFullPowerCalculated; // disable pt1 behaviour if PT1Disabled is true, or if the previous enginepower is greater than the current stationary fullload power (in this case the pt1 calculation fails) if (PT1Disabled || PreviousState.EnginePower.IsGreaterOrEqual(stationaryFullLoadPower)) { @@ -550,14 +525,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { if (!_dataBus.VehicleStopped && _dataBus.Gear != _dataBus.NextGear.Gear && _dataBus.Gear != 0 && _dataBus.NextGear.Gear != 0) { - return RequestDoubleClutch(absTime, dt, outTorque, outAngularVelocity, dryRun); - } else { - return RequestIdling(absTime, dt, outTorque, outAngularVelocity, dryRun); + return RequestDoubleClutch(absTime, dt, outTorque, outAngularVelocity); } + return RequestIdling(absTime, dt, outTorque, outAngularVelocity); } - private IResponse RequestDoubleClutch(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) + private IResponse RequestDoubleClutch(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { if (outAngularVelocity != null) { throw new VectoException("IdleController can only handle idle requests, i.e. angularVelocity == null!"); @@ -582,8 +555,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var engineMaxSpeed = VectoMath.Min(_dataBus.GetGearData(_dataBus.NextGear.Gear).MaxSpeed, _engine.ModelData.FullLoadCurves[0].N95hSpeed); nextAngularSpeed = velocitySlope < 0 - ? VectoMath.LimitTo(VectoMath.Max(_engineTargetSpeed, nextAngularSpeed), _engine.EngineIdleSpeed, engineMaxSpeed) - : VectoMath.LimitTo(VectoMath.Min(_engineTargetSpeed, nextAngularSpeed), _engine.EngineIdleSpeed, engineMaxSpeed); + ? VectoMath.Max(_engineTargetSpeed, nextAngularSpeed).LimitTo(_engine.EngineIdleSpeed, engineMaxSpeed) + : VectoMath.Min(_engineTargetSpeed, nextAngularSpeed).LimitTo(_engine.EngineIdleSpeed, engineMaxSpeed); var retVal = RequestPort.Request(absTime, dt, 0.SI<NewtonMeter>(), nextAngularSpeed); @@ -619,8 +592,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return retVal; } - private IResponse RequestIdling(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) + private IResponse RequestIdling(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { if (outAngularVelocity != null) { throw new VectoException("IdleController can only handle idle requests, i.e. angularVelocity == null!"); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index da05cbaf73afd19285ea9b89b1b5a2e3faba0bf8..54884eff4050d13fdc9c4fdf56a9cb294bad15bd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -49,7 +49,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// <summary> /// True if gearbox is disengaged (no gear is set). /// </summary> - protected internal Second Disengaged = null; + protected internal Second Disengaged; protected bool? TorqueConverterActive; @@ -104,7 +104,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl inTorque += torqueLossInertia; - response = (TorqueConverterActive != null && TorqueConverterActive.Value) + response = TorqueConverterActive != null && TorqueConverterActive.Value && TorqueConverter != null ? TorqueConverter.Initialize(inTorque, inAngularVelocity) : NextComponent.Initialize(inTorque, inAngularVelocity); } else { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index e02d2635379cec11eccbed66612a9d4904ad356e..3ec8fcafdff0c0ef11fbbf2f2051f8e7ccf961c2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private void UpdateDrivingAction(Meter currentDistance, Meter ds) { - var nextAction = GetNextDrivingAction(currentDistance, ds); + var nextAction = GetNextDrivingAction(ds); if (NextDrivingAction == null) { if (nextAction != null) { // take the new action @@ -168,7 +168,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Log.Debug("Next Driving Action: {0}", NextDrivingAction); } - protected internal DrivingBehaviorEntry GetNextDrivingAction(Meter minDistance, Meter ds) + protected internal DrivingBehaviorEntry GetNextDrivingAction(Meter ds) { var currentSpeed = Driver.DataBus.VehicleSpeed; @@ -582,7 +582,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DefaultDriverStrategy.BrakingSafetyMargin; DriverStrategy.BrakeTrigger.BrakingStartDistance = DriverStrategy.BrakeTrigger.TriggerDistance - brakingDistance; if (Phase == BrakingPhase.Coast) { - var nextBrakeAction = DriverStrategy.GetNextDrivingAction(DataBus.Distance, ds); + var nextBrakeAction = DriverStrategy.GetNextDrivingAction(ds); if (nextBrakeAction != null && !DriverStrategy.BrakeTrigger.TriggerDistance.IsEqual(nextBrakeAction.TriggerDistance) && nextBrakeAction.BrakingStartDistance.IsSmaller(DriverStrategy.BrakeTrigger.BrakingStartDistance)) { DriverStrategy.BrakeTrigger = nextBrakeAction; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 44fef3bf3e1619b44afcf0f633ae32c402a5d5c8..c634c5d5b716647c76ce8cd119eaa5f7dce52610 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -130,7 +130,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return CurrentState.Response; } } - if (CycleIntervalIterator.LastEntry && PreviousState.Distance.IsEqual(CycleIntervalIterator.RightSample.Distance)) { + if (CycleIntervalIterator.LastEntry && PreviousState.Distance.IsEqual(Right.Distance)) { CurrentState.Response = new ResponseCycleFinished(); return CurrentState.Response; } @@ -159,7 +159,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // only drive until next sample point in cycle with speed change Log.Debug("Limiting distance to next sample point {0}", - CycleIntervalIterator.RightSample.Distance - PreviousState.Distance); + Right.Distance - PreviousState.Distance); CurrentState.Response = new ResponseDrivingCycleDistanceExceeded { Source = this, MaxDistance = nextSpeedChange - PreviousState.Distance @@ -325,7 +325,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // separately test for equality and greater than to have tolerance for equality comparison if (stopTime.IsEqual(0)) { - while (stopTime.IsEqual(0) && CurrentState.Distance.IsGreaterOrEqual(CycleIntervalIterator.RightSample.Distance) && + while (stopTime.IsEqual(0) && CurrentState.Distance.IsGreaterOrEqual(Right.Distance) && !CycleIntervalIterator.LastEntry) { // we have reached the end of the current interval in the cycle, move on... CycleIntervalIterator.MoveNext(); @@ -347,10 +347,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private Radian ComputeGradient(Meter ds) { - //var leftSamplePoint = Left; - var cycleIterator = CycleIntervalIterator.Clone(); - while (cycleIterator.RightSample.Distance < PreviousState.Distance + ds && !cycleIterator.LastEntry) { + while (Right.Distance < PreviousState.Distance + ds && !cycleIterator.LastEntry) { cycleIterator.MoveNext(); } var leftSamplePoint = cycleIterator.LeftSample; @@ -510,13 +508,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return PreviousState.Altitude; } } - internal void SetDriveOffDistance(Meter startDistance) - { - while (CycleIntervalIterator.MoveNext() && CycleIntervalIterator.RightSample.Distance < startDistance) {} - PreviousState.Distance = startDistance; - CycleStartDistance = startDistance; - } - public sealed class DrivingCycleState { public DrivingCycleState Clone() diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index 6264f2e361376100f5e2c0dd75c737ebdeca5cd3..f962ee57850afb9becc7033702a3c97bc48e15a3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -187,7 +187,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl retVal = NextComponent.Request(absTime, limitedOperatingPoint.SimulationInterval, limitedOperatingPoint.Acceleration, gradient); - retVal.Acceleration = limitedOperatingPoint.Acceleration; + if (retVal != null) { + retVal.Acceleration = limitedOperatingPoint.Acceleration; + } retVal.Switch(). Case<ResponseUnderload>(() => operatingPoint = limitedOperatingPoint) . // acceleration is limited by driver model, operating point moves below drag curve diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs index 03ba010b74bad50031d612d17c0e9e12919e38bc..23fe76fe9670ec7b08e80252827604cafa48df43 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs @@ -59,11 +59,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return LeftSample; } } - public DrivingCycleData.DrivingCycleEntry Next - { - get { return RightSample; } - } - public DrivingCycleData.DrivingCycleEntry LeftSample { get { return _data.Entries[_currentCycleIndex]; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 91078169572f0ebe1700a9a147765ef9f69c4917..25f6ed90f2f3f52f25998f38409a485e06001967 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -185,15 +185,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun); } - IResponse retVal; - // TODO MQ 2016/03/10: investigate further the effects of having the condition angularvelocity != 0 - if (ClutchClosed(absTime) /* && !angularVelocity.IsEqual(0) */) { - retVal = RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, dryRun); - } else { - retVal = RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun); - } - - return retVal; + return ClutchClosed(absTime) + ? RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, dryRun) + : RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun); } /// <summary> diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs index 6682c6287a8cfa4f09ad3e45485abab7cff8df99..e541ca5304c9c34daae4182f3bfb54e9cda8403a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs @@ -32,7 +32,6 @@ using System; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.OutputData; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs index e3f9d3f5a44c6025422a436e176d7e61c0b83d5e..ff1a63301f24694d6683c2326bf1b7883f4e266f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs @@ -31,7 +31,6 @@ using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent.Data; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs index d10714a91db57a2f0b5dba905a63cfd83620cfea..ff169975d52b90ac088289cef4a8633480103702 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } protected readonly IDrivingCycleData Data; - private bool _isInitializing; + protected internal readonly DrivingCycleEnumerator CycleIterator; protected Second AbsTime { get; set; } @@ -99,15 +99,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AbsTime = first.Time; - _isInitializing = true; - var response = NextComponent.Initialize(first.VehicleTargetSpeed, first.RoadGradient); if (!(response is ResponseSuccess)) { throw new UnexpectedResponseException("MeasuredSpeedDrivingCycle: Couldn't find start gear.", response); } - _isInitializing = false; - response.AbsTime = AbsTime; return response; } @@ -127,8 +123,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return new ResponseCycleFinished { AbsTime = absTime, Source = this }; } + if (CycleIterator.RightSample == null) { + throw new VectoException("Exceeding cycle!"); + } // interval exceeded - if (CycleIterator.RightSample != null && (absTime + dt).IsGreater(CycleIterator.RightSample.Time)) { + if ((absTime + dt).IsGreater(CycleIterator.RightSample.Time)) { return new ResponseFailTimeInterval { AbsTime = absTime, Source = this, @@ -137,9 +136,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // calc acceleration from speed diff vehicle to cycle - var targetSpeed = CycleIterator.RightSample == null - ? 0.KMPHtoMeterPerSecond() - : CycleIterator.RightSample.VehicleTargetSpeed; + var targetSpeed = CycleIterator.RightSample.VehicleTargetSpeed; if (targetSpeed.IsEqual(0.KMPHtoMeterPerSecond(), 0.5.KMPHtoMeterPerSecond())) { targetSpeed = 0.KMPHtoMeterPerSecond(); } @@ -172,13 +169,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl response.Switch() .Case<ResponseGearShift>(() => response = NextComponent.Request(absTime, dt, acceleration, gradient)) .Case<ResponseUnderload>(r => { + var acceleration1 = acceleration; DataBus.BrakePower = SearchAlgorithm.Search(DataBus.BrakePower, r.Delta, -r.Delta, getYValue: result => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)result).DeltaDragLoad : ((ResponseDryRun)result).GearboxPowerRequest, evaluateFunction: x => { DataBus.BrakePower = x; - return NextComponent.Request(absTime, dt, acceleration, gradient, true); + return NextComponent.Request(absTime, dt, acceleration1, gradient, true); }, criterion: y => DataBus.ClutchClosed(absTime) ? ((ResponseDryRun)y).DeltaDragLoad.Value() @@ -295,11 +293,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AdvanceState(); } - public string CycleName - { - get { return Data.Name; } - } - public double Progress { get { return AbsTime == null ? 0 : AbsTime.Value() / Data.Entries.Last().Time.Value(); } @@ -360,11 +353,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Data.Finish(); } - public bool VehicleStopped - { - get { return !_isInitializing && CycleIterator.LeftSample.VehicleTargetSpeed.IsEqual(0); } - } - public DrivingBehavior DriverBehavior { get; internal set; } public MeterPerSquareSecond DriverAcceleration { get; protected set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs index ae0b89117951da85948703a794296b3c761ada39..61c379c36b45f0eea62f0bf73b5f67cd96f3c709 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index 65ce76834398b6ba575563cedabd0c337d5ae69e..4b2364963ed7c3fb384949a40b16216894cba2fc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -35,7 +35,6 @@ using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation; @@ -155,11 +154,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return response; } - public string CycleName - { - get { return Data.Name; } - } - public double Progress { get { return AbsTime.Value() / Data.Entries.Last().Time.Value(); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs index cbdd2f497450c9ee7bc41cc849c95fa973e5faa2..74e54b75309afa23927a763b6a83fd3d05dd8ce3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -107,20 +107,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var engineResponse = (ResponseDryRun) NextComponent.Request(absTime, dt, inTorque, operatingPoint.InAngularVelocity, true); - //TorqueConverterOperatingPoint dryOperatingPoint; - //if (false && DataBus.VehicleStopped && DataBus.DriverBehavior == DrivingBehavior.Driving && outTorque.IsGreater(0)) { - // dryOperatingPoint = ModelData.FindOperatingPoint(DataBus.EngineIdleSpeed, outAngularVelocity); - //} else { - //dryOperatingPoint = (DataBus.DriverBehavior != DrivingBehavior.Braking && DataBus.BrakePower.IsEqual(0)) || - // (outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0)) - // ? GetMaxPowerOperatingPoint(dt, outAngularVelocity, engineResponse, - // PreviousState.InTorque * PreviousState.InAngularVelocity) - // : GetDragPowerOperatingPoint(dt, outAngularVelocity, engineResponse, - // PreviousState.InTorque * PreviousState.InAngularVelocity); - //} - var condition1 = (DataBus.DriverBehavior != DrivingBehavior.Braking && DataBus.BrakePower.IsEqual(0)); - var condition2 = (outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0)); - var engineOK = engineResponse.DeltaDragLoad.IsGreaterOrEqual(0) && engineResponse.DeltaFullLoad.IsSmallerOrEqual(0); if (DataBus.DriverBehavior != DrivingBehavior.Braking && engineOK && operatingPoint.Creeping) { var delta = (outTorque - operatingPoint.OutTorque) * @@ -188,7 +174,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var operatingPoint = ModelData.FindOperatingPointForPowerDemand( engineResponse.DragPower - engineResponse.AuxiliariesPowerDemand, DataBus.EngineSpeed, outAngularVelocity, _engineInertia, dt, previousPower); - var maxInputSpeed = VectoMath.Min<PerSecond>(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); + var maxInputSpeed = VectoMath.Min(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); if (operatingPoint.InAngularVelocity.IsGreater(maxInputSpeed)) { operatingPoint = ModelData.FindOperatingPoint(maxInputSpeed, outAngularVelocity); } @@ -211,7 +197,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var operatingPoint = ModelData.FindOperatingPointForPowerDemand( engineResponse.DynamicFullLoadPower - engineResponse.AuxiliariesPowerDemand, DataBus.EngineSpeed, outAngularVelocity, _engineInertia, dt, previousPower); - var maxInputSpeed = VectoMath.Min<PerSecond>(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); + var maxInputSpeed = VectoMath.Min(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); if (operatingPoint.InAngularVelocity.IsGreater(maxInputSpeed)) { operatingPoint = ModelData.FindOperatingPoint(maxInputSpeed, outAngularVelocity); } @@ -242,7 +228,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl "TorqueConverter: Invalid operating point, inAngularVelocity would be below engine's idle speed: {0}", operatingPoint.InAngularVelocity); } - var maxInputSpeed = VectoMath.Min<PerSecond>(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); + var maxInputSpeed = VectoMath.Min(ModelData.TorqueConverterSpeedLimit, DataBus.EngineRatedSpeed); if (operatingPoint.InAngularVelocity.IsGreater(maxInputSpeed)) { operatingPoint = ModelData.FindOperatingPoint(maxInputSpeed, outAngularVelocity); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs index 2ccd9340152c2014dc40af21c12fc8e0218ee621..02b6f946b4adb76309092158d5f534201c21f17b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs @@ -59,7 +59,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent dataBus.AddComponent(this); } - public virtual void CommitSimulationStep(IModalDataContainer container) + public void CommitSimulationStep(IModalDataContainer container) { if (container != null) { DoWriteModalResults(container); diff --git a/VectoCore/VectoCore/OutputData/DeclarationReport.cs b/VectoCore/VectoCore/OutputData/DeclarationReport.cs index ccb7e0918dfb9686244358b6ca531afe0d3afc8f..06e0eb19d3fd776278ce0676b96f432b30247bd1 100644 --- a/VectoCore/VectoCore/OutputData/DeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/DeclarationReport.cs @@ -30,10 +30,8 @@ */ using System.Collections.Generic; -using System.Linq; using System.Runtime.CompilerServices; using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -91,10 +89,6 @@ namespace TUGraz.VectoCore.OutputData /// </summary> internal Segment Segment { get; set; } - /// <summary> - /// The creator name for the report. - /// </summary> - public string Creator { get; set; } /// <summary> /// The result count determines how many results must be given before the report gets written. diff --git a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs index b746e576059d8c6090e39da57e944c2adb4c2636..3c02ee5f910afc12e8a69b78b866c3e3ab31a70a 100644 --- a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs @@ -32,15 +32,12 @@ using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics; using System.Linq; -using System.Runtime.Remoting.Metadata.W3cXsd2001; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.OutputData { @@ -66,8 +63,6 @@ namespace TUGraz.VectoCore.OutputData /// <returns></returns> object this[string auxId] { get; set; } - bool HasTorqueConverter { get; set; } - /// <summary> /// Commits the data of the current simulation step. /// </summary> @@ -92,7 +87,7 @@ namespace TUGraz.VectoCore.OutputData IEnumerable<T> GetValues<T>(Func<DataRow, T> selectorFunc); - Dictionary<string, DataColumn> Auxiliaries { get; set; } + Dictionary<string, DataColumn> Auxiliaries { get; } T TimeIntegral<T>(ModalResultField field, Func<SI, bool> filter = null) where T : SIBase<T>; @@ -120,12 +115,6 @@ namespace TUGraz.VectoCore.OutputData return data.GetValues<T>(field).Min(); } - public static SI Average(this IEnumerable<SI> self, Func<SI, bool> filter) - { - var values = self.Where(filter ?? (x => x != null && !double.IsNaN(x.Value()))).ToList(); - return values.Any() ? values.Sum() / values.Count : null; - } - /// <summary> /// Returns a default value if the SI object is null. /// </summary> @@ -205,11 +194,6 @@ namespace TUGraz.VectoCore.OutputData return data.TimeIntegral<MeterPerSecond>(ModalResultField.acc) / data.Duration(); } - public static Second[] SimulationIntervals(this IModalDataContainer data) - { - return data.GetValues<Second>(ModalResultField.simulationInterval).ToArray(); - } - public static Meter AltitudeDelta(this IModalDataContainer data) { var altitudes = data.GetValues<Meter>(ModalResultField.altitude).ToList(); diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index a6a5ec86d9048b2ce3a067e5e493585093d0ede0..df2e9f577d4b338de31d49c6c45523ce9f914b8d 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -32,7 +32,6 @@ using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics; using System.Globalization; using System.Linq; using System.Runtime.CompilerServices; diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index 52b9aa338432e4cccde803649303c40a83f2f22f..ae7b6eca0b150c5d490956e6db6a6b79bfbac936 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -30,7 +30,6 @@ */ using System; -using System.Collections.Generic; using System.Data; using System.Linq; using System.Runtime.CompilerServices; diff --git a/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs b/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs index 7fcae3888a0a7b28636dc292102cbe71904697b7..607adb784bc693047c1366257ebca829b96ddda7 100644 --- a/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs @@ -29,14 +29,11 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; using System.Collections.Generic; using System.Data; using System.Linq; -using System.Xml; using System.Xml.Linq; using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs index 6ac920a5d48ab19ecc851c691ee4cc85dc888152..7eb67d882a11b67a9d729635055176ac722cb3dc 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs @@ -134,8 +134,6 @@ namespace TUGraz.VectoCore.OutputData.XML private object[] GetSuccessResultEntry(XMLDeclarationReport.ResultEntry result) { - var fuel = FuelData.Instance().Lookup(result.FuelType); - return new object[] { new XElement(tns + "Payload", new XAttribute("unit", "kg"), result.Payload.ToXMLFormat(0)), new XElement(tns + "FuelType", result.FuelType.ToXMLFormat()), diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs index 2a6d7d236533ad65e0cc9fec014c7e253966dec0..32f2845e5a6a141c766f3fa81d83e27cdae709ef 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs @@ -180,20 +180,21 @@ namespace TUGraz.VectoCore.OutputData.XML } - public static List<XElement> GetResults(XMLDeclarationReport.ResultEntry result, XNamespace tns, bool fullOutput) + public static IEnumerable<XElement> GetResults(ResultEntry result, XNamespace tns, bool fullOutput) { var fuel = FuelData.Instance().Lookup(result.FuelType); - var retVal = new List<XElement>(); + var retVal = new List<XElement> { + new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/km"), + (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter).Value() + .ToMinSignificantDigits(3, 1)), + new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/t-km"), + (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter / + result.Payload.ConvertTo().Ton).Value().ToMinSignificantDigits(3, 1)), + new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/m³-km"), + (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter / result.CargoVolume).Value + ().ToMinSignificantDigits(3, 1)) + }; //FC - retVal.Add(new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/km"), - (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter).Value() - .ToMinSignificantDigits(3, 1))); - retVal.Add(new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/t-km"), - (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter / - result.Payload.ConvertTo().Ton).Value().ToMinSignificantDigits(3, 1))); - retVal.Add(new XElement(tns + "FuelConsumption", new XAttribute("unit", "g/m³-km"), - (result.FuelConsumptionTotal.ConvertTo().Gramm / result.Distance.ConvertTo().Kilo.Meter / result.CargoVolume).Value() - .ToMinSignificantDigits(3, 1))); if (fullOutput) { retVal.Add(new XElement(tns + "FuelConsumption", new XAttribute("unit", "MJ/km"), (result.EnergyConsumptionTotal / result.Distance.ConvertTo().Kilo.Meter / 1e6).Value().ToMinSignificantDigits(3, 1))); diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs index a939ad939e050a61deba4d067f0aa97eb6d4bcfd..ff0de725730524b7b94b9ebfa6e8ff8d23a1776e 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs @@ -34,7 +34,6 @@ using System.Collections.Generic; using System.Linq; using System.Xml; using System.Xml.Linq; -using DocumentFormat.OpenXml.Drawing.Diagrams; using TUGraz.IVT.VectoXML; using TUGraz.IVT.VectoXML.Writer; using TUGraz.VectoCommon.InputData; @@ -43,7 +42,6 @@ using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; namespace TUGraz.VectoCore.OutputData.XML { @@ -123,10 +121,6 @@ namespace TUGraz.VectoCore.OutputData.XML var vehicle = data.VehicleInputData; var angledrive = data.AngledriveInputData; - var aux = data.AuxiliaryInputData(); - var numSteeredaxles = aux.Auxiliaries.First(x => x.Type == AuxiliaryType.SteeringPump).Technology.Count; - //var pto = data.PTOTransmissionInputData; - return new XElement(tns + XMLNames.Component_Vehicle, new XAttribute(XMLNames.Component_ID_Attr, "VEH-" + vehicle.Model), GetDefaultComponentElements(vehicle.CertificationNumber, vehicle.Model, "N.A."), diff --git a/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs index 1fe9a0412d0887b98556c7001f57516d18dfecfd..c1cdce193139ab2da84f6623e9ba4febc77ff4af 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs @@ -221,7 +221,7 @@ namespace TUGraz.VectoCore.OutputData.XML return new XElement(tns + XMLNames.Component_Vehicle, new XAttribute(XMLNames.Component_ID_Attr, "VEH-" + vehicle.Model), - GetDefaultComponentElements(vehicle.CertificationNumber, vehicle.Model), + GetDefaultComponentElements(vehicle.Model), new XElement(tns + XMLNames.Vehicle_VehicleCategory, vehicle.VehicleCategory.ToXMLFormat()), new XElement(tns + XMLNames.Vehicle_AxleConfiguration, vehicle.AxleConfiguration.GetName()), new XElement(tns + XMLNames.Vehicle_CurbMassChassis, vehicle.CurbMassChassis.Value().ToXMLFormat(0)), @@ -260,17 +260,13 @@ namespace TUGraz.VectoCore.OutputData.XML return null; } var ptoLossMap = new XElement(tns + XMLNames.Vehicle_PTOIdleLossMap); - if (_singleFile) { - ptoLossMap.Add(EmbedDataTable(pto.PTOLossMap, AttributeMappings.PTOLossMap)); - } else { - ptoLossMap.Add(ExtCSVResource(pto.PTOLossMap, "PTO_LossMap.vptol")); - } + ptoLossMap.Add(_singleFile + ? EmbedDataTable(pto.PTOLossMap, AttributeMappings.PTOLossMap) + : ExtCSVResource(pto.PTOLossMap, "PTO_LossMap.vptol")); var ptoCycle = new XElement(tns + XMLNames.Vehicle_PTOCycle); - if (_singleFile) { - ptoCycle.Add(EmbedDataTable(pto.PTOCycle, AttributeMappings.PTOCycleMap)); - } else { - ptoCycle.Add(ExtCSVResource(pto.PTOCycle, "PTO_cycle.vptoc")); - } + ptoCycle.Add(_singleFile + ? EmbedDataTable(pto.PTOCycle, AttributeMappings.PTOCycleMap) + : ExtCSVResource(pto.PTOCycle, "PTO_cycle.vptoc")); return new object[] { ptoLossMap, ptoCycle }; } @@ -301,7 +297,7 @@ namespace TUGraz.VectoCore.OutputData.XML var angledrive = new XElement(tns + XMLNames.Component_Angledrive, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, "ANGL-" + data.Model), - GetDefaultComponentElements(data.CertificationNumber, data.Model), + GetDefaultComponentElements(data.Model), new XElement(tns + XMLNames.AngleDrive_Ratio, data.Ratio.ToXMLFormat(3)), data.LossMap == null ? new XElement(tns + XMLNames.AngleDrive_TorqueLossMap, @@ -362,7 +358,7 @@ namespace TUGraz.VectoCore.OutputData.XML var axle = axleData[i]; axles.Add(new XElement(tns + XMLNames.AxleWheels_Axles_Axle, new XAttribute(XMLNames.AxleWheels_Axles_Axle_AxleNumber_Attr, i + 1), - GetDefaultComponentElements(string.Format("WHEEL-{0}_{1}", i, axle.Wheels), axle.Wheels), + GetDefaultComponentElements(axle.Wheels), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_AxleType, i == 1 ? AxleType.VehicleDriven.ToString() : AxleType.VehicleNonDriven.ToString()), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_TwinTyres_Attr, axle.TwinTyres), @@ -411,7 +407,7 @@ namespace TUGraz.VectoCore.OutputData.XML var typeId = string.Format("AXLGEAR-{0:0.000}", data.Ratio); var axl = new XElement(tns + XMLNames.Component_Axlegear, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, typeId), - GetDefaultComponentElements(typeId, "N.A."), + GetDefaultComponentElements("N.A."), new XElement(tns + XMLNames.Axlegear_Ratio, data.Ratio.ToXMLFormat(3)), data.LossMap == null ? new XElement(tns + XMLNames.Axlegear_TorqueLossMap, @@ -428,7 +424,7 @@ namespace TUGraz.VectoCore.OutputData.XML { var retarder = new XElement(tns + XMLNames.Component_Retarder, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, "RET-none"), - GetDefaultComponentElements(data.CertificationNumber, data.Model), + GetDefaultComponentElements(data.Model), new XElement(tns + XMLNames.Retarder_RetarderLossMap, _singleFile ? EmbedDataTable(data.LossMap, AttributeMappings.RetarderLossmapMapping) @@ -470,7 +466,7 @@ namespace TUGraz.VectoCore.OutputData.XML var gbx = new XElement(tns + XMLNames.Component_Gearbox, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, string.Format("GBX-{0}", data.Model)), - GetDefaultComponentElements(string.Format("GBX-{0}", data.Model), data.Model), + GetDefaultComponentElements(data.Model), new XElement(tns + XMLNames.Gearbox_TransmissionType, data.Type.ToXMLFormat()), new XElement(tns + XMLNames.Gearbox_Inertia, data.Inertia.Value()), new XElement(tns + XMLNames.Gearbox_TractionInterruption, data.TractionInterruption.Value()), gears), @@ -487,7 +483,7 @@ namespace TUGraz.VectoCore.OutputData.XML var tc = new XElement(tns + XMLNames.Component_TorqueConverter, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, string.Format("TC-{0}", torqueConverterData.Model)), - GetDefaultComponentElements(string.Format("TC-{0}", torqueConverterData.Model), torqueConverterData.Model), + GetDefaultComponentElements(torqueConverterData.Model), new XElement(tns + XMLNames.TorqueConverter_ReferenceRPM, torqueConverterData.ReferenceRPM.AsRPM.ToXMLFormat()), new XElement(tns + XMLNames.TorqueConverter_Characteristics, _singleFile @@ -525,7 +521,7 @@ namespace TUGraz.VectoCore.OutputData.XML var engine = new XElement(tns + XMLNames.Component_Engine, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, string.Format("ENG-{0}", data.Model)), - GetDefaultComponentElements(string.Format("ENG-{0}", data.Model), data.Model), + GetDefaultComponentElements(data.Model), new XElement(tns + XMLNames.Engine_Displacement, (data.Displacement.Value() * 1000 * 1000).ToXMLFormat(0)), new XElement(tns + XMLNames.Engine_IdlingSpeed, data.IdleSpeed.AsRPM.ToXMLFormat(0)), new XElement(tns + XMLNames.Engine_Inertia, data.Inertia.Value()), @@ -544,7 +540,7 @@ namespace TUGraz.VectoCore.OutputData.XML return new XElement(tns + XMLNames.Component_AirDrag, new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), - GetDefaultComponentElements(data.Model, "N.A."), + GetDefaultComponentElements("N.A."), new XElement(tns + XMLNames.Vehicle_CrossWindCorrectionMode, data.CrossWindCorrectionMode.ToXMLFormat()), new XElement(tns + XMLNames.Vehicle_AirDragArea, data.AirDragArea.Value().ToXMLFormat(2))), GetCrossWindCorrectionData(data) @@ -592,7 +588,7 @@ namespace TUGraz.VectoCore.OutputData.XML }; } - protected XElement[] GetDefaultComponentElements(string componentId, string makeAndModel) + protected XElement[] GetDefaultComponentElements(string makeAndModel) { return new[] { new XElement(tns + XMLNames.Component_Manufacturer, Vendor), diff --git a/VectoCore/VectoCore/Utils/DelaunayMap.cs b/VectoCore/VectoCore/Utils/DelaunayMap.cs index f7c751035d3bf68c16d6c6f884b60ddf4347da01..27a3a265f55a023a0b8c85d7ff0fe4b2c38e71c5 100644 --- a/VectoCore/VectoCore/Utils/DelaunayMap.cs +++ b/VectoCore/VectoCore/Utils/DelaunayMap.cs @@ -46,7 +46,7 @@ namespace TUGraz.VectoCore.Utils { public sealed class DelaunayMap : LoggingObject { - private ICollection<Point> Points = new HashSet<Point>(); + private ICollection<Point> _points = new HashSet<Point>(); private Triangle[] _triangles; private Edge[] _convexHull; @@ -63,16 +63,16 @@ namespace TUGraz.VectoCore.Utils public void AddPoint(double x, double y, double z) { - Points.Add(new Point(x, y, z)); + _points.Add(new Point(x, y, z)); } public IReadOnlyCollection<Point> Entries { get { - var retVal = new Point[Points.Count]; + var retVal = new Point[_points.Count]; var i = 0; - foreach (var pt in Points) { + foreach (var pt in _points) { retVal[i++] = new Point(pt.X * (_maxX - _minX) + _minX, pt.Y * (_maxY - _minY) + _minY, pt.Z); } return retVal; @@ -88,27 +88,27 @@ namespace TUGraz.VectoCore.Utils /// </remarks> public void Triangulate() { - if (Points.Count < 3) { + if (_points.Count < 3) { throw new ArgumentException(string.Format("{0}: Triangulation needs at least 3 Points. Got {1} Points.", _mapName, - Points.Count)); + _points.Count)); } SanitycheckInputPoints(); // The "supertriangle" encompasses all triangulation points. // This is just a helper triangle which initializes the algorithm and will be removed in the end of the algorithm. - _maxX = Points.Max(p => p.X); - _maxY = Points.Max(p => p.Y); - _minX = Points.Min(p => p.X); - _minY = Points.Min(p => p.Y); - Points = - Points.Select(p => new Point((p.X - _minX) / (_maxX - _minX), (p.Y - _minY) / (_maxY - _minY), p.Z)).ToList(); + _maxX = _points.Max(p => p.X); + _maxY = _points.Max(p => p.Y); + _minX = _points.Min(p => p.X); + _minY = _points.Min(p => p.Y); + _points = + _points.Select(p => new Point((p.X - _minX) / (_maxX - _minX), (p.Y - _minY) / (_maxY - _minY), p.Z)).ToList(); var superTriangle = new Triangle(new Point(-1, -1), new Point(4, -1), new Point(-1, 4)); var triangles = new List<Triangle> { superTriangle }; var pointCount = 0; - var points = Points.ToArray(); + var points = _points.ToArray(); // iteratively add each point into the correct triangle and split up the triangle foreach (var point in points) { @@ -155,7 +155,7 @@ namespace TUGraz.VectoCore.Utils private void SanitycheckInputPoints() { - var duplicates = Points.GroupBy(pt => new { pt.X, pt.Y }, x => x).Where(g => g.Count() > 1).ToList(); + var duplicates = _points.GroupBy(pt => new { pt.X, pt.Y }, x => x).Where(g => g.Count() > 1).ToList(); foreach (var duplicate in duplicates) { Log.Error("{0}: Input Point appears twice: x: {1}, y: {2}", duplicate.Key.X, duplicate.Key.Y); @@ -169,7 +169,7 @@ namespace TUGraz.VectoCore.Utils public void DrawGraph() { var superTriangle = new Triangle(new Point(-1, -1), new Point(4, -1), new Point(-1, 4)); - DrawGraph(0, _triangles, superTriangle, Points.ToArray()); + DrawGraph(0, _triangles, superTriangle, _points.ToArray()); } /// <summary> diff --git a/VectoCore/VectoCore/Utils/Formulas.cs b/VectoCore/VectoCore/Utils/Formulas.cs index 7bfe279f31669951bef7cf27d5919fc3463c9bc2..c8085d74a3c714804bbc2d72e8cf0b3c5b2c9f5b 100644 --- a/VectoCore/VectoCore/Utils/Formulas.cs +++ b/VectoCore/VectoCore/Utils/Formulas.cs @@ -29,7 +29,6 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Utils diff --git a/VectoCore/VectoCore/Utils/Physics.cs b/VectoCore/VectoCore/Utils/Physics.cs index ac63dd4bb2a355c97e0d8eb15277624e040a226a..2bb5897943dfca6ff612d00630a04814ffa8296e 100644 --- a/VectoCore/VectoCore/Utils/Physics.cs +++ b/VectoCore/VectoCore/Utils/Physics.cs @@ -33,7 +33,7 @@ using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Utils { - public class Physics + public static class Physics { /// <summary> /// The standard acceleration for gravity on earth. @@ -44,7 +44,7 @@ namespace TUGraz.VectoCore.Utils /// <summary> /// Density of air. /// </summary> - public static KilogramPerCubicMeter AirDensity = 1.188.SI<KilogramPerCubicMeter>(); + public static readonly KilogramPerCubicMeter AirDensity = 1.188.SI<KilogramPerCubicMeter>(); public const double RollResistanceExponent = 0.9; diff --git a/VectoCore/VectoCore/Utils/RessourceHelper.cs b/VectoCore/VectoCore/Utils/RessourceHelper.cs index 205c8489ce2464aa88e84c9e1db01a06ddbf0479..757bcdc36f180d74765be70fba6f7f39745d5b0e 100644 --- a/VectoCore/VectoCore/Utils/RessourceHelper.cs +++ b/VectoCore/VectoCore/Utils/RessourceHelper.cs @@ -55,7 +55,7 @@ namespace TUGraz.VectoCore.Utils public static Stream LoadResourceAsStream(ResourceType type, string resourceName) { - var resourceBase = ""; + string resourceBase; switch (type) { case ResourceType.XMLSchema: resourceBase = "TUGraz.VectoCore.Resources.XSD."; diff --git a/VectoCore/VectoCore/Utils/StreamExtensions.cs b/VectoCore/VectoCore/Utils/StreamExtensions.cs deleted file mode 100644 index cbdd33e8b54fbf55fad999e655701e9c4c410e9f..0000000000000000000000000000000000000000 --- a/VectoCore/VectoCore/Utils/StreamExtensions.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace TUGraz.VectoCore.Utils -{ - internal static class StreamExtensions - { - public static IEnumerable<string> ReadLines(this Stream stream) - { - using (var reader = new StreamReader(stream, Encoding.UTF8)) { - while (!reader.EndOfStream) { - yield return reader.ReadLine(); - } - } - } - } -} \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/SwitchExtension.cs b/VectoCore/VectoCore/Utils/SwitchExtension.cs index be4d29ad289f4fa7260a1db02cedbe3cfc2dead8..9d8be316dd109043e185ff0bf7de825b9484580b 100644 --- a/VectoCore/VectoCore/Utils/SwitchExtension.cs +++ b/VectoCore/VectoCore/Utils/SwitchExtension.cs @@ -31,7 +31,6 @@ using System; using System.Diagnostics; -using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Utils { @@ -79,7 +78,7 @@ namespace TUGraz.VectoCore.Utils [DebuggerHidden] public Switch<T> Case<TFilter>() where TFilter : T { - return Case<TFilter>(() => {}); + return Case<TFilter>(() => { }); } @@ -121,10 +120,5 @@ namespace TUGraz.VectoCore.Utils action(_value); } } - - public Switch<T> Case(Func<object, bool> action, Func<object, SI> func) - { - throw new NotImplementedException(); - } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/VectoCSVFile.cs b/VectoCore/VectoCore/Utils/VectoCSVFile.cs index 4074edab9e64f52dbb61e98fc1865fb3a0c1730c..d24b079902dd0878541aa7fe72f55aa449684608 100644 --- a/VectoCore/VectoCore/Utils/VectoCSVFile.cs +++ b/VectoCore/VectoCore/Utils/VectoCSVFile.cs @@ -111,12 +111,15 @@ namespace TUGraz.VectoCore.Utils TrimWhiteSpace = true }; - string[] colsWithoutComment; + string[] colsWithoutComment = { }; try { - colsWithoutComment = p.ReadFields() - .Select(l => l.Contains(Comment) ? l.Substring(0, l.IndexOf(Comment)) : l) - .ToArray(); + var fields = p.ReadFields(); + if (fields != null) { + colsWithoutComment = fields + .Select(l => l.Contains(Comment) ? l.Substring(0, l.IndexOf(Comment, StringComparison.Ordinal)) : l) + .ToArray(); + } } catch (ArgumentNullException) { throw new CSVReadException("CSV Read Error: File was empty."); } @@ -149,12 +152,17 @@ namespace TUGraz.VectoCore.Utils var lineNumber = 1; do { - var cells = firstLineIsData - ? colsWithoutComment - : p.ReadFields() - .Select(l => l.Contains(Comment) ? l.Substring(0, l.IndexOf(Comment)) : l) - .Select(s => s.Trim()) - .ToArray(); + string[] cells = {}; + if (firstLineIsData) { + cells = colsWithoutComment; + } else { + var fields = p.ReadFields(); + if (fields != null) { + cells = fields.Select(l => l.Contains(Comment) ? l.Substring(0, l.IndexOf(Comment, StringComparison.Ordinal)) : l) + .Select(s => s.Trim()) + .ToArray(); + } + } firstLineIsData = false; if (table.Columns.Count != cells.Length && !ignoreEmptyColumns) { throw new CSVReadException( diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index d277b6f734c25a3b93e662c42b616051092ee2aa..fbd96c8c14ce1ae290b1965a68e50433b40d7a5f 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -150,7 +150,6 @@ <Compile Include="InputData\Reader\DataObjectAdapter\EngineeringDataAdapter.cs" /> <Compile Include="InputData\Reader\DrivingCycleDataReader.cs" /> <Compile Include="InputData\Reader\FullLoadCurveReader.cs" /> - <Compile Include="InputData\Reader\Impl\AbstractVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\DeclarationModeVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\DrivingCycleProxy.cs" /> <Compile Include="InputData\Reader\Impl\EngineeringModeVectoRunDataFactory.cs" /> @@ -224,7 +223,6 @@ <Compile Include="Models\SimulationComponent\Data\DriverData.cs" /> <Compile Include="Models\SimulationComponent\Data\ICrossWindCorrection.cs" /> <Compile Include="Models\SimulationComponent\Data\CrosswindCorrectionVAirBeta.cs" /> - <Compile Include="Models\SimulationComponent\IAuxiliary.cs" /> <Compile Include="Models\SimulationComponent\IAxlegear.cs" /> <Compile Include="Models\SimulationComponent\IBrakes.cs" /> <Compile Include="Models\SimulationComponent\IIdleController.cs" /> @@ -249,7 +247,6 @@ <Compile Include="Models\Simulation\DataBus\IClutchInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IDriverInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IWheelsInfo.cs" /> - <Compile Include="Models\SimulationComponent\Data\FullLoadCurve.cs" /> <Compile Include="Models\Simulation\DataBus\IMileageCounter.cs" /> <Compile Include="Utils\DebugData.cs" /> <Compile Include="Models\Simulation\Impl\DistanceRun.cs" /> @@ -329,7 +326,6 @@ <Compile Include="Models\Simulation\DataBus\IVehicleInfo.cs" /> <Compile Include="Models\Simulation\IVehicleContainer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Utils\StreamExtensions.cs" /> <Compile Include="Utils\SwitchExtension.cs" /> <Compile Include="Utils\VectoCSVFile.cs" /> <Compile Include="Utils\DelaunayMap.cs" /> diff --git a/VectoCore/VectoCoreTest/Utils/MockRunData.cs b/VectoCore/VectoCoreTest/Utils/MockRunData.cs index 486e03dc0b972f7037ffdf330f60e07276e1efe5..9a7066e28a8c007a024c2bf8ea10d823c184eb2e 100644 --- a/VectoCore/VectoCoreTest/Utils/MockRunData.cs +++ b/VectoCore/VectoCoreTest/Utils/MockRunData.cs @@ -67,8 +67,8 @@ namespace TUGraz.VectoCore.Tests.Utils Displacement = 0.SI<CubicMeter>(), FullLoadCurves = new Dictionary<uint, EngineFullLoadCurve>() { { - 0, new EngineFullLoadCurve() { - FullLoadEntries = new List<EngineFullLoadCurve.FullLoadCurveEntry>() { + 0, new EngineFullLoadCurve( + new List<EngineFullLoadCurve.FullLoadCurveEntry>() { new EngineFullLoadCurve.FullLoadCurveEntry() { EngineSpeed = 600.RPMtoRad(), TorqueDrag = -100.SI<NewtonMeter>(), @@ -84,8 +84,7 @@ namespace TUGraz.VectoCore.Tests.Utils TorqueDrag = -150.SI<NewtonMeter>(), TorqueFullLoad = 400.SI<NewtonMeter>() }, - } - } + }, null) } } };