From 2696b64826a73a541b4f2c334f1c8e14e839d494 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Fri, 18 Jun 2021 13:20:45 +0200 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFupdate=20electric=20motor=20form=20to?= =?UTF-8?q?=20use=20two=20voltage=20levels,=20adapt=20input=20data,=20json?= =?UTF-8?q?=20reader,=20json=20writer=20for=20electric=20motor,=20adapt=20?= =?UTF-8?q?testcases=20to=20make=20it=20compile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VECTO/GUI/ElectricMotorForm.Designer.vb | 536 +++++++++++++----- VECTO/GUI/ElectricMotorForm.vb | 87 +-- VECTO/Input Files/ElectricMachine.vb | 145 ++++- VECTO/Input Files/Vehicle.vb | 7 +- .../InputData/DeclarationInputData.cs | 17 +- .../FileIO/JSON/JSONElectricMotor.cs | 49 +- .../VectoCore/InputData/Impl/InputData.cs | 12 + .../EngineeringDataAdapter.cs | 22 +- .../Simulation/DataBus/IElectricMotorInfo.cs | 6 +- .../Data/ElectricMotor/ElectricMotorData.cs | 76 ++- .../Impl/DefaultDriverStrategy.cs | 3 +- .../SimulationComponent/Impl/ElectricMotor.cs | 72 ++- .../SimulationComponent/Impl/Gearbox.cs | 2 +- .../Impl/PEVAMTShiftStrategy.cs | 18 +- .../VelocitySpeedGearshiftPreprocessor.cs | 4 +- .../Strategies/HybridStrategy.cs | 6 +- .../OutputData/FileIO/JSONFileWriter.cs | 20 +- .../FileIO/JsonReadHybridTest.cs | 8 +- .../SimulationComponent/ElectricMotorTest.cs | 2 +- .../ElectricMotorEfficienyMapTest.cs | 9 +- 20 files changed, 788 insertions(+), 313 deletions(-) diff --git a/VECTO/GUI/ElectricMotorForm.Designer.vb b/VECTO/GUI/ElectricMotorForm.Designer.vb index 12c33f543a..70818ca193 100644 --- a/VECTO/GUI/ElectricMotorForm.Designer.vb +++ b/VECTO/GUI/ElectricMotorForm.Designer.vb @@ -60,18 +60,18 @@ Partial Class ElectricMotorForm Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.pnInertia = New System.Windows.Forms.Panel() - Me.tbDragTorque = New System.Windows.Forms.TextBox() - Me.lblDragTorque = New System.Windows.Forms.Label() - Me.btnBrowseDragCurve = New System.Windows.Forms.Button() - Me.btnDragCurveOpen = New System.Windows.Forms.Button() - Me.btnEmMapOpen = New System.Windows.Forms.Button() - Me.btnBrowseEmMap = New System.Windows.Forms.Button() - Me.lblEmMap = New System.Windows.Forms.Label() - Me.tbMap = New System.Windows.Forms.TextBox() - Me.btnMaxTorqueCurveOpen = New System.Windows.Forms.Button() - Me.btnBrowseMaxTorque = New System.Windows.Forms.Button() - Me.lblMaxTorque = New System.Windows.Forms.Label() - Me.tbMaxTorque = New System.Windows.Forms.TextBox() + Me.tbDragTorqueHi = New System.Windows.Forms.TextBox() + Me.lblDragTorqueHi = New System.Windows.Forms.Label() + Me.btnBrowseDragCurveHi = New System.Windows.Forms.Button() + Me.btnDragCurveOpenHi = New System.Windows.Forms.Button() + Me.btnEmMapOpenHi = New System.Windows.Forms.Button() + Me.btnBrowseEmMapHi = New System.Windows.Forms.Button() + Me.lblPowerMapHi = New System.Windows.Forms.Label() + Me.tbMapHi = New System.Windows.Forms.TextBox() + Me.btnMaxTorqueCurveOpenHi = New System.Windows.Forms.Button() + Me.btnBrowseMaxTorqueHi = New System.Windows.Forms.Button() + Me.lblMaxTorqueHi = New System.Windows.Forms.Label() + Me.tbMaxTorqueHi = New System.Windows.Forms.TextBox() Me.lblTitle = New System.Windows.Forms.Label() Me.PicBox = New System.Windows.Forms.PictureBox() Me.Panel1 = New System.Windows.Forms.Panel() @@ -98,6 +98,26 @@ Partial Class ElectricMotorForm Me.lblOverloadSpeed = New System.Windows.Forms.Label() Me.lblOverloadSpeedUnit = New System.Windows.Forms.Label() Me.tbOvlSpeed = New System.Windows.Forms.TextBox() + Me.gbVoltageLevelHi = New System.Windows.Forms.GroupBox() + Me.lblVoltageHi = New System.Windows.Forms.Label() + Me.lblVoltageHiUnit = New System.Windows.Forms.Label() + Me.tbVoltageHi = New System.Windows.Forms.TextBox() + Me.gbVoltageLevelLow = New System.Windows.Forms.GroupBox() + Me.lblVoltageLow = New System.Windows.Forms.Label() + Me.lblVoltageLowUnit = New System.Windows.Forms.Label() + Me.tbVoltageLow = New System.Windows.Forms.TextBox() + Me.lblMaxTorqueLow = New System.Windows.Forms.Label() + Me.tbDragTorqueLow = New System.Windows.Forms.TextBox() + Me.lblDragTorqueLow = New System.Windows.Forms.Label() + Me.btnBrowseDragCurveLow = New System.Windows.Forms.Button() + Me.btnDragCurveOpenLow = New System.Windows.Forms.Button() + Me.tbMapLow = New System.Windows.Forms.TextBox() + Me.lblPowerMapLow = New System.Windows.Forms.Label() + Me.btnBrowseEmMapLow = New System.Windows.Forms.Button() + Me.btnEmMapOpenLow = New System.Windows.Forms.Button() + Me.tbMaxTorqueLow = New System.Windows.Forms.TextBox() + Me.btnMaxTorqueCurveOpenLow = New System.Windows.Forms.Button() + Me.btnBrowseMaxTorqueLow = New System.Windows.Forms.Button() Me.ToolStrip1.SuspendLayout Me.StatusStrip1.SuspendLayout CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit @@ -110,6 +130,8 @@ Partial Class ElectricMotorForm Me.Panel4.SuspendLayout Me.pnOverloadTq.SuspendLayout Me.Panel6.SuspendLayout + Me.gbVoltageLevelHi.SuspendLayout + Me.gbVoltageLevelLow.SuspendLayout Me.SuspendLayout ' 'tbInertia @@ -141,7 +163,7 @@ Partial Class ElectricMotorForm ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(811, 343) + Me.ButCancel.Location = New System.Drawing.Point(811, 574) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 13 @@ -151,7 +173,7 @@ Partial Class ElectricMotorForm 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(730, 343) + Me.ButOK.Location = New System.Drawing.Point(730, 574) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 12 @@ -243,7 +265,7 @@ Partial Class ElectricMotorForm ' Me.StatusStrip1.ImageScalingSize = New System.Drawing.Size(24, 24) Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 368) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 599) Me.StatusStrip1.Name = "StatusStrip1" Me.StatusStrip1.Size = New System.Drawing.Size(898, 22) Me.StatusStrip1.SizingGrip = false @@ -311,113 +333,113 @@ Partial Class ElectricMotorForm Me.pnInertia.Size = New System.Drawing.Size(221, 30) Me.pnInertia.TabIndex = 3 ' - 'tbDragTorque - ' - Me.tbDragTorque.Location = New System.Drawing.Point(12, 296) - Me.tbDragTorque.Name = "tbDragTorque" - Me.tbDragTorque.Size = New System.Drawing.Size(434, 20) - Me.tbDragTorque.TabIndex = 5 - ' - 'lblDragTorque - ' - Me.lblDragTorque.AutoSize = true - Me.lblDragTorque.Location = New System.Drawing.Point(12, 280) - Me.lblDragTorque.Name = "lblDragTorque" - Me.lblDragTorque.Size = New System.Drawing.Size(98, 13) - Me.lblDragTorque.TabIndex = 38 - Me.lblDragTorque.Text = "Drag Torque Curve" - ' - 'btnBrowseDragCurve - ' - Me.btnBrowseDragCurve.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.btnBrowseDragCurve.Location = New System.Drawing.Point(446, 294) - Me.btnBrowseDragCurve.Name = "btnBrowseDragCurve" - Me.btnBrowseDragCurve.Size = New System.Drawing.Size(24, 24) - Me.btnBrowseDragCurve.TabIndex = 6 - Me.btnBrowseDragCurve.TabStop = false - Me.btnBrowseDragCurve.UseVisualStyleBackColor = true - ' - 'btnDragCurveOpen - ' - Me.btnDragCurveOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.btnDragCurveOpen.Location = New System.Drawing.Point(469, 294) - Me.btnDragCurveOpen.Name = "btnDragCurveOpen" - Me.btnDragCurveOpen.Size = New System.Drawing.Size(24, 24) - Me.btnDragCurveOpen.TabIndex = 7 - Me.btnDragCurveOpen.TabStop = false - Me.btnDragCurveOpen.UseVisualStyleBackColor = true - ' - 'btnEmMapOpen - ' - Me.btnEmMapOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.btnEmMapOpen.Location = New System.Drawing.Point(469, 335) - Me.btnEmMapOpen.Name = "btnEmMapOpen" - Me.btnEmMapOpen.Size = New System.Drawing.Size(24, 24) - Me.btnEmMapOpen.TabIndex = 42 - Me.btnEmMapOpen.TabStop = false - Me.btnEmMapOpen.UseVisualStyleBackColor = true - ' - 'btnBrowseEmMap - ' - Me.btnBrowseEmMap.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.btnBrowseEmMap.Location = New System.Drawing.Point(446, 335) - Me.btnBrowseEmMap.Name = "btnBrowseEmMap" - Me.btnBrowseEmMap.Size = New System.Drawing.Size(24, 24) - Me.btnBrowseEmMap.TabIndex = 41 - Me.btnBrowseEmMap.TabStop = false - Me.btnBrowseEmMap.UseVisualStyleBackColor = true - ' - 'lblEmMap - ' - Me.lblEmMap.AutoSize = true - Me.lblEmMap.Location = New System.Drawing.Point(12, 321) - Me.lblEmMap.Name = "lblEmMap" - Me.lblEmMap.Size = New System.Drawing.Size(163, 13) - Me.lblEmMap.TabIndex = 43 - Me.lblEmMap.Text = "Electric Power Consumption Map" - ' - 'tbMap - ' - Me.tbMap.Location = New System.Drawing.Point(12, 337) - Me.tbMap.Name = "tbMap" - Me.tbMap.Size = New System.Drawing.Size(434, 20) - Me.tbMap.TabIndex = 40 - ' - 'btnMaxTorqueCurveOpen - ' - Me.btnMaxTorqueCurveOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.btnMaxTorqueCurveOpen.Location = New System.Drawing.Point(469, 254) - Me.btnMaxTorqueCurveOpen.Name = "btnMaxTorqueCurveOpen" - Me.btnMaxTorqueCurveOpen.Size = New System.Drawing.Size(24, 24) - Me.btnMaxTorqueCurveOpen.TabIndex = 46 - Me.btnMaxTorqueCurveOpen.TabStop = false - Me.btnMaxTorqueCurveOpen.UseVisualStyleBackColor = true - ' - 'btnBrowseMaxTorque - ' - Me.btnBrowseMaxTorque.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.btnBrowseMaxTorque.Location = New System.Drawing.Point(446, 254) - Me.btnBrowseMaxTorque.Name = "btnBrowseMaxTorque" - Me.btnBrowseMaxTorque.Size = New System.Drawing.Size(24, 24) - Me.btnBrowseMaxTorque.TabIndex = 45 - Me.btnBrowseMaxTorque.TabStop = false - Me.btnBrowseMaxTorque.UseVisualStyleBackColor = true - ' - 'lblMaxTorque - ' - Me.lblMaxTorque.AutoSize = true - Me.lblMaxTorque.Location = New System.Drawing.Point(12, 239) - Me.lblMaxTorque.Name = "lblMaxTorque" - Me.lblMaxTorque.Size = New System.Drawing.Size(222, 13) - Me.lblMaxTorque.TabIndex = 47 - Me.lblMaxTorque.Text = "Max Drive and Max Generation Torque Curve" - ' - 'tbMaxTorque - ' - Me.tbMaxTorque.Location = New System.Drawing.Point(12, 255) - Me.tbMaxTorque.Name = "tbMaxTorque" - Me.tbMaxTorque.Size = New System.Drawing.Size(434, 20) - Me.tbMaxTorque.TabIndex = 44 + 'tbDragTorqueHi + ' + Me.tbDragTorqueHi.Location = New System.Drawing.Point(6, 103) + Me.tbDragTorqueHi.Name = "tbDragTorqueHi" + Me.tbDragTorqueHi.Size = New System.Drawing.Size(406, 20) + Me.tbDragTorqueHi.TabIndex = 5 + ' + 'lblDragTorqueHi + ' + Me.lblDragTorqueHi.AutoSize = true + Me.lblDragTorqueHi.Location = New System.Drawing.Point(6, 87) + Me.lblDragTorqueHi.Name = "lblDragTorqueHi" + Me.lblDragTorqueHi.Size = New System.Drawing.Size(98, 13) + Me.lblDragTorqueHi.TabIndex = 38 + Me.lblDragTorqueHi.Text = "Drag Torque Curve" + ' + 'btnBrowseDragCurveHi + ' + Me.btnBrowseDragCurveHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseDragCurveHi.Location = New System.Drawing.Point(420, 100) + Me.btnBrowseDragCurveHi.Name = "btnBrowseDragCurveHi" + Me.btnBrowseDragCurveHi.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseDragCurveHi.TabIndex = 6 + Me.btnBrowseDragCurveHi.TabStop = false + Me.btnBrowseDragCurveHi.UseVisualStyleBackColor = true + ' + 'btnDragCurveOpenHi + ' + Me.btnDragCurveOpenHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnDragCurveOpenHi.Location = New System.Drawing.Point(443, 100) + Me.btnDragCurveOpenHi.Name = "btnDragCurveOpenHi" + Me.btnDragCurveOpenHi.Size = New System.Drawing.Size(24, 24) + Me.btnDragCurveOpenHi.TabIndex = 7 + Me.btnDragCurveOpenHi.TabStop = false + Me.btnDragCurveOpenHi.UseVisualStyleBackColor = true + ' + 'btnEmMapOpenHi + ' + Me.btnEmMapOpenHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnEmMapOpenHi.Location = New System.Drawing.Point(443, 141) + Me.btnEmMapOpenHi.Name = "btnEmMapOpenHi" + Me.btnEmMapOpenHi.Size = New System.Drawing.Size(24, 24) + Me.btnEmMapOpenHi.TabIndex = 42 + Me.btnEmMapOpenHi.TabStop = false + Me.btnEmMapOpenHi.UseVisualStyleBackColor = true + ' + 'btnBrowseEmMapHi + ' + Me.btnBrowseEmMapHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseEmMapHi.Location = New System.Drawing.Point(420, 141) + Me.btnBrowseEmMapHi.Name = "btnBrowseEmMapHi" + Me.btnBrowseEmMapHi.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseEmMapHi.TabIndex = 41 + Me.btnBrowseEmMapHi.TabStop = false + Me.btnBrowseEmMapHi.UseVisualStyleBackColor = true + ' + 'lblPowerMapHi + ' + Me.lblPowerMapHi.AutoSize = true + Me.lblPowerMapHi.Location = New System.Drawing.Point(6, 128) + Me.lblPowerMapHi.Name = "lblPowerMapHi" + Me.lblPowerMapHi.Size = New System.Drawing.Size(163, 13) + Me.lblPowerMapHi.TabIndex = 43 + Me.lblPowerMapHi.Text = "Electric Power Consumption Map" + ' + 'tbMapHi + ' + Me.tbMapHi.Location = New System.Drawing.Point(6, 144) + Me.tbMapHi.Name = "tbMapHi" + Me.tbMapHi.Size = New System.Drawing.Size(406, 20) + Me.tbMapHi.TabIndex = 40 + ' + 'btnMaxTorqueCurveOpenHi + ' + Me.btnMaxTorqueCurveOpenHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnMaxTorqueCurveOpenHi.Location = New System.Drawing.Point(443, 60) + Me.btnMaxTorqueCurveOpenHi.Name = "btnMaxTorqueCurveOpenHi" + Me.btnMaxTorqueCurveOpenHi.Size = New System.Drawing.Size(24, 24) + Me.btnMaxTorqueCurveOpenHi.TabIndex = 46 + Me.btnMaxTorqueCurveOpenHi.TabStop = false + Me.btnMaxTorqueCurveOpenHi.UseVisualStyleBackColor = true + ' + 'btnBrowseMaxTorqueHi + ' + Me.btnBrowseMaxTorqueHi.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseMaxTorqueHi.Location = New System.Drawing.Point(420, 60) + Me.btnBrowseMaxTorqueHi.Name = "btnBrowseMaxTorqueHi" + Me.btnBrowseMaxTorqueHi.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseMaxTorqueHi.TabIndex = 45 + Me.btnBrowseMaxTorqueHi.TabStop = false + Me.btnBrowseMaxTorqueHi.UseVisualStyleBackColor = true + ' + 'lblMaxTorqueHi + ' + Me.lblMaxTorqueHi.AutoSize = true + Me.lblMaxTorqueHi.Location = New System.Drawing.Point(6, 46) + Me.lblMaxTorqueHi.Name = "lblMaxTorqueHi" + Me.lblMaxTorqueHi.Size = New System.Drawing.Size(222, 13) + Me.lblMaxTorqueHi.TabIndex = 47 + Me.lblMaxTorqueHi.Text = "Max Drive and Max Generation Torque Curve" + ' + 'tbMaxTorqueHi + ' + Me.tbMaxTorqueHi.Location = New System.Drawing.Point(6, 62) + Me.tbMaxTorqueHi.Name = "tbMaxTorqueHi" + Me.tbMaxTorqueHi.Size = New System.Drawing.Size(406, 20) + Me.tbMaxTorqueHi.TabIndex = 44 ' 'lblTitle ' @@ -650,13 +672,221 @@ Partial Class ElectricMotorForm Me.tbOvlSpeed.Size = New System.Drawing.Size(49, 20) Me.tbOvlSpeed.TabIndex = 3 ' + 'gbVoltageLevelHi + ' + Me.gbVoltageLevelHi.Controls.Add(Me.lblVoltageHi) + Me.gbVoltageLevelHi.Controls.Add(Me.lblVoltageHiUnit) + Me.gbVoltageLevelHi.Controls.Add(Me.tbVoltageHi) + Me.gbVoltageLevelHi.Controls.Add(Me.lblMaxTorqueHi) + Me.gbVoltageLevelHi.Controls.Add(Me.tbDragTorqueHi) + Me.gbVoltageLevelHi.Controls.Add(Me.lblDragTorqueHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnBrowseDragCurveHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnDragCurveOpenHi) + Me.gbVoltageLevelHi.Controls.Add(Me.tbMapHi) + Me.gbVoltageLevelHi.Controls.Add(Me.lblPowerMapHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnBrowseEmMapHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnEmMapOpenHi) + Me.gbVoltageLevelHi.Controls.Add(Me.tbMaxTorqueHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnMaxTorqueCurveOpenHi) + Me.gbVoltageLevelHi.Controls.Add(Me.btnBrowseMaxTorqueHi) + Me.gbVoltageLevelHi.Location = New System.Drawing.Point(12, 418) + Me.gbVoltageLevelHi.Name = "gbVoltageLevelHi" + Me.gbVoltageLevelHi.Size = New System.Drawing.Size(482, 170) + Me.gbVoltageLevelHi.TabIndex = 50 + Me.gbVoltageLevelHi.TabStop = false + Me.gbVoltageLevelHi.Text = "Voltage Level High" + ' + 'lblVoltageHi + ' + Me.lblVoltageHi.AutoSize = true + Me.lblVoltageHi.Location = New System.Drawing.Point(12, 21) + Me.lblVoltageHi.Name = "lblVoltageHi" + Me.lblVoltageHi.Size = New System.Drawing.Size(43, 13) + Me.lblVoltageHi.TabIndex = 48 + Me.lblVoltageHi.Text = "Voltage" + ' + 'lblVoltageHiUnit + ' + Me.lblVoltageHiUnit.AutoSize = true + Me.lblVoltageHiUnit.Location = New System.Drawing.Point(189, 21) + Me.lblVoltageHiUnit.Name = "lblVoltageHiUnit" + Me.lblVoltageHiUnit.Size = New System.Drawing.Size(20, 13) + Me.lblVoltageHiUnit.TabIndex = 50 + Me.lblVoltageHiUnit.Text = "[V]" + ' + 'tbVoltageHi + ' + Me.tbVoltageHi.Location = New System.Drawing.Point(136, 19) + Me.tbVoltageHi.Name = "tbVoltageHi" + Me.tbVoltageHi.Size = New System.Drawing.Size(49, 20) + Me.tbVoltageHi.TabIndex = 49 + ' + 'gbVoltageLevelLow + ' + Me.gbVoltageLevelLow.Controls.Add(Me.lblVoltageLow) + Me.gbVoltageLevelLow.Controls.Add(Me.lblVoltageLowUnit) + Me.gbVoltageLevelLow.Controls.Add(Me.tbVoltageLow) + Me.gbVoltageLevelLow.Controls.Add(Me.lblMaxTorqueLow) + Me.gbVoltageLevelLow.Controls.Add(Me.tbDragTorqueLow) + Me.gbVoltageLevelLow.Controls.Add(Me.lblDragTorqueLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnBrowseDragCurveLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnDragCurveOpenLow) + Me.gbVoltageLevelLow.Controls.Add(Me.tbMapLow) + Me.gbVoltageLevelLow.Controls.Add(Me.lblPowerMapLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnBrowseEmMapLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnEmMapOpenLow) + Me.gbVoltageLevelLow.Controls.Add(Me.tbMaxTorqueLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnMaxTorqueCurveOpenLow) + Me.gbVoltageLevelLow.Controls.Add(Me.btnBrowseMaxTorqueLow) + Me.gbVoltageLevelLow.Location = New System.Drawing.Point(12, 242) + Me.gbVoltageLevelLow.Name = "gbVoltageLevelLow" + Me.gbVoltageLevelLow.Size = New System.Drawing.Size(482, 170) + Me.gbVoltageLevelLow.TabIndex = 51 + Me.gbVoltageLevelLow.TabStop = false + Me.gbVoltageLevelLow.Text = "Voltage Level Low" + ' + 'lblVoltageLow + ' + Me.lblVoltageLow.AutoSize = true + Me.lblVoltageLow.Location = New System.Drawing.Point(12, 21) + Me.lblVoltageLow.Name = "lblVoltageLow" + Me.lblVoltageLow.Size = New System.Drawing.Size(43, 13) + Me.lblVoltageLow.TabIndex = 48 + Me.lblVoltageLow.Text = "Voltage" + ' + 'lblVoltageLowUnit + ' + Me.lblVoltageLowUnit.AutoSize = true + Me.lblVoltageLowUnit.Location = New System.Drawing.Point(189, 21) + Me.lblVoltageLowUnit.Name = "lblVoltageLowUnit" + Me.lblVoltageLowUnit.Size = New System.Drawing.Size(20, 13) + Me.lblVoltageLowUnit.TabIndex = 50 + Me.lblVoltageLowUnit.Text = "[V]" + ' + 'tbVoltageLow + ' + Me.tbVoltageLow.Location = New System.Drawing.Point(136, 19) + Me.tbVoltageLow.Name = "tbVoltageLow" + Me.tbVoltageLow.Size = New System.Drawing.Size(49, 20) + Me.tbVoltageLow.TabIndex = 49 + ' + 'lblMaxTorqueLow + ' + Me.lblMaxTorqueLow.AutoSize = true + Me.lblMaxTorqueLow.Location = New System.Drawing.Point(6, 46) + Me.lblMaxTorqueLow.Name = "lblMaxTorqueLow" + Me.lblMaxTorqueLow.Size = New System.Drawing.Size(222, 13) + Me.lblMaxTorqueLow.TabIndex = 47 + Me.lblMaxTorqueLow.Text = "Max Drive and Max Generation Torque Curve" + ' + 'tbDragTorqueLow + ' + Me.tbDragTorqueLow.Location = New System.Drawing.Point(6, 103) + Me.tbDragTorqueLow.Name = "tbDragTorqueLow" + Me.tbDragTorqueLow.Size = New System.Drawing.Size(406, 20) + Me.tbDragTorqueLow.TabIndex = 5 + ' + 'lblDragTorqueLow + ' + Me.lblDragTorqueLow.AutoSize = true + Me.lblDragTorqueLow.Location = New System.Drawing.Point(6, 87) + Me.lblDragTorqueLow.Name = "lblDragTorqueLow" + Me.lblDragTorqueLow.Size = New System.Drawing.Size(98, 13) + Me.lblDragTorqueLow.TabIndex = 38 + Me.lblDragTorqueLow.Text = "Drag Torque Curve" + ' + 'btnBrowseDragCurveLow + ' + Me.btnBrowseDragCurveLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseDragCurveLow.Location = New System.Drawing.Point(420, 100) + Me.btnBrowseDragCurveLow.Name = "btnBrowseDragCurveLow" + Me.btnBrowseDragCurveLow.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseDragCurveLow.TabIndex = 6 + Me.btnBrowseDragCurveLow.TabStop = false + Me.btnBrowseDragCurveLow.UseVisualStyleBackColor = true + ' + 'btnDragCurveOpenLow + ' + Me.btnDragCurveOpenLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnDragCurveOpenLow.Location = New System.Drawing.Point(443, 100) + Me.btnDragCurveOpenLow.Name = "btnDragCurveOpenLow" + Me.btnDragCurveOpenLow.Size = New System.Drawing.Size(24, 24) + Me.btnDragCurveOpenLow.TabIndex = 7 + Me.btnDragCurveOpenLow.TabStop = false + Me.btnDragCurveOpenLow.UseVisualStyleBackColor = true + ' + 'tbMapLow + ' + Me.tbMapLow.Location = New System.Drawing.Point(6, 144) + Me.tbMapLow.Name = "tbMapLow" + Me.tbMapLow.Size = New System.Drawing.Size(406, 20) + Me.tbMapLow.TabIndex = 40 + ' + 'lblPowerMapLow + ' + Me.lblPowerMapLow.AutoSize = true + Me.lblPowerMapLow.Location = New System.Drawing.Point(6, 128) + Me.lblPowerMapLow.Name = "lblPowerMapLow" + Me.lblPowerMapLow.Size = New System.Drawing.Size(163, 13) + Me.lblPowerMapLow.TabIndex = 43 + Me.lblPowerMapLow.Text = "Electric Power Consumption Map" + ' + 'btnBrowseEmMapLow + ' + Me.btnBrowseEmMapLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseEmMapLow.Location = New System.Drawing.Point(420, 141) + Me.btnBrowseEmMapLow.Name = "btnBrowseEmMapLow" + Me.btnBrowseEmMapLow.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseEmMapLow.TabIndex = 41 + Me.btnBrowseEmMapLow.TabStop = false + Me.btnBrowseEmMapLow.UseVisualStyleBackColor = true + ' + 'btnEmMapOpenLow + ' + Me.btnEmMapOpenLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnEmMapOpenLow.Location = New System.Drawing.Point(443, 141) + Me.btnEmMapOpenLow.Name = "btnEmMapOpenLow" + Me.btnEmMapOpenLow.Size = New System.Drawing.Size(24, 24) + Me.btnEmMapOpenLow.TabIndex = 42 + Me.btnEmMapOpenLow.TabStop = false + Me.btnEmMapOpenLow.UseVisualStyleBackColor = true + ' + 'tbMaxTorqueLow + ' + Me.tbMaxTorqueLow.Location = New System.Drawing.Point(6, 62) + Me.tbMaxTorqueLow.Name = "tbMaxTorqueLow" + Me.tbMaxTorqueLow.Size = New System.Drawing.Size(406, 20) + Me.tbMaxTorqueLow.TabIndex = 44 + ' + 'btnMaxTorqueCurveOpenLow + ' + Me.btnMaxTorqueCurveOpenLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btnMaxTorqueCurveOpenLow.Location = New System.Drawing.Point(443, 60) + Me.btnMaxTorqueCurveOpenLow.Name = "btnMaxTorqueCurveOpenLow" + Me.btnMaxTorqueCurveOpenLow.Size = New System.Drawing.Size(24, 24) + Me.btnMaxTorqueCurveOpenLow.TabIndex = 46 + Me.btnMaxTorqueCurveOpenLow.TabStop = false + Me.btnMaxTorqueCurveOpenLow.UseVisualStyleBackColor = true + ' + 'btnBrowseMaxTorqueLow + ' + Me.btnBrowseMaxTorqueLow.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btnBrowseMaxTorqueLow.Location = New System.Drawing.Point(420, 60) + Me.btnBrowseMaxTorqueLow.Name = "btnBrowseMaxTorqueLow" + Me.btnBrowseMaxTorqueLow.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseMaxTorqueLow.TabIndex = 45 + Me.btnBrowseMaxTorqueLow.TabStop = false + Me.btnBrowseMaxTorqueLow.UseVisualStyleBackColor = true + ' 'ElectricMotorForm ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(898, 390) + Me.ClientSize = New System.Drawing.Size(898, 621) + Me.Controls.Add(Me.gbVoltageLevelLow) + Me.Controls.Add(Me.gbVoltageLevelHi) Me.Controls.Add(Me.Panel6) Me.Controls.Add(Me.pnOverloadTq) Me.Controls.Add(Me.Panel4) @@ -665,23 +895,11 @@ Partial Class ElectricMotorForm Me.Controls.Add(Me.Panel1) Me.Controls.Add(Me.PicBox) Me.Controls.Add(Me.lblTitle) - Me.Controls.Add(Me.btnMaxTorqueCurveOpen) - Me.Controls.Add(Me.btnBrowseMaxTorque) - Me.Controls.Add(Me.lblMaxTorque) - Me.Controls.Add(Me.tbMaxTorque) - Me.Controls.Add(Me.btnEmMapOpen) - Me.Controls.Add(Me.btnBrowseEmMap) - Me.Controls.Add(Me.lblEmMap) - Me.Controls.Add(Me.tbMap) Me.Controls.Add(Me.pnInertia) - Me.Controls.Add(Me.btnDragCurveOpen) Me.Controls.Add(Me.PictureBox1) - Me.Controls.Add(Me.btnBrowseDragCurve) - Me.Controls.Add(Me.lblDragTorque) Me.Controls.Add(Me.StatusStrip1) Me.Controls.Add(Me.ToolStrip1) Me.Controls.Add(Me.ButCancel) - Me.Controls.Add(Me.tbDragTorque) Me.Controls.Add(Me.ButOK) Me.Controls.Add(Me.lblMakeModel) Me.Controls.Add(Me.tbMakeModel) @@ -713,6 +931,10 @@ Partial Class ElectricMotorForm Me.pnOverloadTq.PerformLayout Me.Panel6.ResumeLayout(false) Me.Panel6.PerformLayout + Me.gbVoltageLevelHi.ResumeLayout(false) + Me.gbVoltageLevelHi.PerformLayout + Me.gbVoltageLevelLow.ResumeLayout(false) + Me.gbVoltageLevelLow.PerformLayout Me.ResumeLayout(false) Me.PerformLayout @@ -740,18 +962,18 @@ End Sub Friend WithEvents OpenWithToolStripMenuItem As ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As ToolStripMenuItem Friend WithEvents pnInertia As Panel - Friend WithEvents tbDragTorque As TextBox - Friend WithEvents lblDragTorque As Label - Friend WithEvents btnBrowseDragCurve As Button - Friend WithEvents btnDragCurveOpen As Button - Friend WithEvents btnEmMapOpen As Button - Friend WithEvents btnBrowseEmMap As Button - Friend WithEvents lblEmMap As Label - Friend WithEvents tbMap As TextBox - Friend WithEvents btnMaxTorqueCurveOpen As Button - Friend WithEvents btnBrowseMaxTorque As Button - Friend WithEvents lblMaxTorque As Label - Friend WithEvents tbMaxTorque As TextBox + Friend WithEvents tbDragTorqueHi As TextBox + Friend WithEvents lblDragTorqueHi As Label + Friend WithEvents btnBrowseDragCurveHi As Button + Friend WithEvents btnDragCurveOpenHi As Button + Friend WithEvents btnEmMapOpenHi As Button + Friend WithEvents btnBrowseEmMapHi As Button + Friend WithEvents lblPowerMapHi As Label + Friend WithEvents tbMapHi As TextBox + Friend WithEvents btnMaxTorqueCurveOpenHi As Button + Friend WithEvents btnBrowseMaxTorqueHi As Button + Friend WithEvents lblMaxTorqueHi As Label + Friend WithEvents tbMaxTorqueHi As TextBox Friend WithEvents lblTitle As Label Friend WithEvents PicBox As PictureBox Friend WithEvents Panel1 As Panel @@ -778,4 +1000,24 @@ End Sub Friend WithEvents lblOverloadSpeed As Label Friend WithEvents lblOverloadSpeedUnit As Label Friend WithEvents tbOvlSpeed As TextBox + Friend WithEvents gbVoltageLevelHi As GroupBox + Friend WithEvents lblVoltageHi As Label + Friend WithEvents lblVoltageHiUnit As Label + Friend WithEvents tbVoltageHi As TextBox + Friend WithEvents gbVoltageLevelLow As GroupBox + Friend WithEvents lblVoltageLow As Label + Friend WithEvents lblVoltageLowUnit As Label + Friend WithEvents tbVoltageLow As TextBox + Friend WithEvents lblMaxTorqueLow As Label + Friend WithEvents tbDragTorqueLow As TextBox + Friend WithEvents lblDragTorqueLow As Label + Friend WithEvents btnBrowseDragCurveLow As Button + Friend WithEvents btnDragCurveOpenLow As Button + Friend WithEvents tbMapLow As TextBox + Friend WithEvents lblPowerMapLow As Label + Friend WithEvents btnBrowseEmMapLow As Button + Friend WithEvents btnEmMapOpenLow As Button + Friend WithEvents tbMaxTorqueLow As TextBox + Friend WithEvents btnMaxTorqueCurveOpenLow As Button + Friend WithEvents btnBrowseMaxTorqueLow As Button End Class diff --git a/VECTO/GUI/ElectricMotorForm.vb b/VECTO/GUI/ElectricMotorForm.vb index ece27531a9..4873dd8eb5 100644 --- a/VECTO/GUI/ElectricMotorForm.vb +++ b/VECTO/GUI/ElectricMotorForm.vb @@ -133,9 +133,9 @@ Public Class ElectricMotorForm tbMakeModel.Text = "" tbInertia.Text = "" - tbMap.Text = "" - tbDragTorque.Text = "" - tbMaxTorque.Text = "" + tbMapHi.Text = "" + tbDragTorqueHi.Text = "" + tbMaxTorqueHi.Text = "" DeclInit() @@ -181,9 +181,18 @@ Public Class ElectricMotorForm tbRatedSpeed.Text = engine.ContinuousTorqueSpeed.AsRPM.ToGUIFormat() tbOverloadRecoveryFactor.Text = engine.OverloadRecoveryFactor.ToGUIFormat() - tbDragTorque.Text = GetRelativePath(engine.DragCurve.Source, basePath) - tbMaxTorque.Text = GetRelativePath(engine.FullLoadCurve.Source, basePath) - tbMap.Text = GetRelativePath(engine.EfficiencyMap.Source, basePath) + Dim voltageLevelHigh As IElectricMotorVoltageLevel = engine.VoltageLevels.MaxBy(function(level) level.VoltageLevel.Value()) + + tbDragTorqueHi.Text = GetRelativePath(voltageLevelHigh.DragCurve.Source, basePath) + tbMaxTorqueHi.Text = GetRelativePath(voltageLevelHigh.FullLoadCurve.Source, basePath) + tbMapHi.Text = GetRelativePath(voltageLevelHigh.EfficiencyMap.Source, basePath) + + Dim voltageLevelLow As IElectricMotorVoltageLevel = engine.VoltageLevels.MinBy(function(level) level.VoltageLevel.Value()) + + tbDragTorqueLow.Text = GetRelativePath(voltageLevelLow.DragCurve.Source, basePath) + tbMaxTorqueLow.Text = GetRelativePath(voltageLevelLow.FullLoadCurve.Source, basePath) + tbMapLow.Text = GetRelativePath(voltageLevelLow.EfficiencyMap.Source, basePath) + DeclInit() ElectricMotorFileBrowser.UpdateHistory(file) @@ -225,9 +234,9 @@ Public Class ElectricMotorForm em.ContTq = tbContTq.Text.ToDouble(0) em.OverloadRecoveryFactor = tbOverloadRecoveryFactor.Text.ToDouble(0) - em.PathMaxTorque = tbMaxTorque.Text - em.PathDrag = tbDragTorque.Text - em.PathMap = tbMap.Text + em.PathMaxTorqueHi = tbMaxTorqueHi.Text + em.PathDragHi = tbDragTorqueHi.Text + em.PathMapHi = tbMapHi.Text If Not em.SaveFile Then MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) @@ -303,7 +312,7 @@ Public Class ElectricMotorForm End Sub Private Sub TbMAP_TextChanged(sender As Object, e As EventArgs) _ - Handles tbDragTorque.TextChanged + Handles tbDragTorqueHi.TextChanged UpdatePic() Change() End Sub @@ -328,12 +337,12 @@ Public Class ElectricMotorForm Private Sub BtMAPopen_Click(sender As Object, e As EventArgs) Dim fldfile As String - fldfile = FileRepl(tbDragTorque.Text, GetPath(_emFile)) + fldfile = FileRepl(tbDragTorqueHi.Text, GetPath(_emFile)) If fldfile <> NoFile AndAlso File.Exists(fldfile) Then - OpenFiles(FileRepl(tbMap.Text, GetPath(_emFile)), fldfile) + OpenFiles(FileRepl(tbMapHi.Text, GetPath(_emFile)), fldfile) Else - OpenFiles(FileRepl(tbMap.Text, GetPath(_emFile))) + OpenFiles(FileRepl(tbMapHi.Text, GetPath(_emFile))) End If End Sub @@ -361,7 +370,7 @@ Public Class ElectricMotorForm Try Dim fldFile As String = - If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbMaxTorque.Text), tbDragTorque.Text) + If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbMaxTorqueHi.Text), tbDragTorqueHi.Text) If File.Exists(fldFile) Then _ fullLoadCurve = ElectricFullLoadCurveReader.Create(VectoCSVFile.Read(fldFile), 1) Catch ex As Exception @@ -369,14 +378,14 @@ Public Class ElectricMotorForm Try Dim fcFile As String = - If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbMap.Text), tbMap.Text) + If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbMapHi.Text), tbMapHi.Text) If File.Exists(fcFile) Then fcMap = ElectricMotorMapReader.Create(VectoCSVFile.Read(fcFile), 1) Catch ex As Exception End Try Try Dim dragFile As String = - If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbDragTorque.Text), tbMap.Text) + If(Not String.IsNullOrWhiteSpace(_emFile), Path.Combine(Path.GetDirectoryName(_emFile), tbDragTorqueHi.Text), tbMapHi.Text) If File.Exists(dragFile) Then dragCurve = ElectricMotorDragCurveReader.Create(VectoCSVFile.Read(dragFile), 1) Catch ex As Exception End Try @@ -397,7 +406,7 @@ Public Class ElectricMotorForm series.ChartType = SeriesChartType.FastLine series.BorderWidth = 2 series.Color = Color.DarkBlue - series.Name = "Max drive torque (" & tbDragTorque.Text & ")" + series.Name = "Max drive torque (" & tbDragTorqueHi.Text & ")" chart.Series.Add(series) series = New Series @@ -406,7 +415,7 @@ Public Class ElectricMotorForm series.ChartType = SeriesChartType.FastLine series.BorderWidth = 2 series.Color = Color.Blue - series.Name = "Max generation torque (" & Path.GetFileNameWithoutExtension(tbMap.Text) & ")" + series.Name = "Max generation torque (" & Path.GetFileNameWithoutExtension(tbMapHi.Text) & ")" chart.Series.Add(series) 'engineCharacteristics += @@ -504,54 +513,54 @@ Public Class ElectricMotorForm #End Region - Private Sub btnMaxTorqueCurveOpen_Click(sender As Object, e As EventArgs) Handles btnMaxTorqueCurveOpen.Click + Private Sub btnMaxTorqueCurveOpen_Click(sender As Object, e As EventArgs) Handles btnMaxTorqueCurveOpenHi.Click Dim theFile As String - theFile = FileRepl(tbMaxTorque.Text, GetPath(_emFile)) + theFile = FileRepl(tbMaxTorqueHi.Text, GetPath(_emFile)) If theFile <> NoFile AndAlso File.Exists(theFile) Then - OpenFiles(FileRepl(tbMaxTorque.Text, GetPath(_emFile)), theFile) + OpenFiles(FileRepl(tbMaxTorqueHi.Text, GetPath(_emFile)), theFile) Else - OpenFiles(FileRepl(tbMaxTorque.Text, GetPath(_emFile))) + OpenFiles(FileRepl(tbMaxTorqueHi.Text, GetPath(_emFile))) End If End Sub - Private Sub btnDragCurveOpen_Click(sender As Object, e As EventArgs) Handles btnDragCurveOpen.Click + Private Sub btnDragCurveOpen_Click(sender As Object, e As EventArgs) Handles btnDragCurveOpenHi.Click Dim theFile As String - theFile = FileRepl(tbDragTorque.Text, GetPath(_emFile)) + theFile = FileRepl(tbDragTorqueHi.Text, GetPath(_emFile)) If theFile <> NoFile AndAlso File.Exists(theFile) Then - OpenFiles(FileRepl(tbDragTorque.Text, GetPath(_emFile)), theFile) + OpenFiles(FileRepl(tbDragTorqueHi.Text, GetPath(_emFile)), theFile) Else - OpenFiles(FileRepl(tbDragTorque.Text, GetPath(_emFile))) + OpenFiles(FileRepl(tbDragTorqueHi.Text, GetPath(_emFile))) End If End Sub - Private Sub btnEmMapOpen_Click(sender As Object, e As EventArgs) Handles btnEmMapOpen.Click + Private Sub btnEmMapOpen_Click(sender As Object, e As EventArgs) Handles btnEmMapOpenHi.Click Dim theFile As String - theFile = FileRepl(tbMap.Text, GetPath(_emFile)) + theFile = FileRepl(tbMapHi.Text, GetPath(_emFile)) If theFile <> NoFile AndAlso File.Exists(theFile) Then - OpenFiles(FileRepl(tbMap.Text, GetPath(_emFile)), theFile) + OpenFiles(FileRepl(tbMapHi.Text, GetPath(_emFile)), theFile) Else - OpenFiles(FileRepl(tbMap.Text, GetPath(_emFile))) + OpenFiles(FileRepl(tbMapHi.Text, GetPath(_emFile))) End If End Sub - Private Sub btnBrowseMaxTorque_Click(sender As Object, e As EventArgs) Handles btnBrowseMaxTorque.Click - If ElectricMachineMaxTorqueFileBrowser.OpenDialog(FileRepl(tbMaxTorque.Text, GetPath(_emFile))) Then _ - tbMaxTorque.Text = GetFilenameWithoutDirectory(ElectricMachineMaxTorqueFileBrowser.Files(0), GetPath(_emFile)) + Private Sub btnBrowseMaxTorque_Click(sender As Object, e As EventArgs) Handles btnBrowseMaxTorqueHi.Click + If ElectricMachineMaxTorqueFileBrowser.OpenDialog(FileRepl(tbMaxTorqueHi.Text, GetPath(_emFile))) Then _ + tbMaxTorqueHi.Text = GetFilenameWithoutDirectory(ElectricMachineMaxTorqueFileBrowser.Files(0), GetPath(_emFile)) End Sub - Private Sub btnBrowseDragCurve_Click(sender As Object, e As EventArgs) Handles btnBrowseDragCurve.Click - If ElectricMachineDragTorqueFileBrowser.OpenDialog(FileRepl(tbDragTorque.Text, GetPath(_emFile))) Then _ - tbDragTorque.Text = GetFilenameWithoutDirectory(ElectricMachineDragTorqueFileBrowser.Files(0), GetPath(_emFile)) + Private Sub btnBrowseDragCurve_Click(sender As Object, e As EventArgs) Handles btnBrowseDragCurveHi.Click + If ElectricMachineDragTorqueFileBrowser.OpenDialog(FileRepl(tbDragTorqueHi.Text, GetPath(_emFile))) Then _ + tbDragTorqueHi.Text = GetFilenameWithoutDirectory(ElectricMachineDragTorqueFileBrowser.Files(0), GetPath(_emFile)) End Sub - Private Sub btnBrowseEmMap_Click(sender As Object, e As EventArgs) Handles btnBrowseEmMap.Click - If ElectricMachineEfficiencyMapFileBrowser.OpenDialog(FileRepl(tbMap.Text, GetPath(_emFile))) Then _ - tbMap.Text = GetFilenameWithoutDirectory(ElectricMachineEfficiencyMapFileBrowser.Files(0), GetPath(_emFile)) + Private Sub btnBrowseEmMap_Click(sender As Object, e As EventArgs) Handles btnBrowseEmMapHi.Click + If ElectricMachineEfficiencyMapFileBrowser.OpenDialog(FileRepl(tbMapHi.Text, GetPath(_emFile))) Then _ + tbMapHi.Text = GetFilenameWithoutDirectory(ElectricMachineEfficiencyMapFileBrowser.Files(0), GetPath(_emFile)) End Sub End Class diff --git a/VECTO/Input Files/ElectricMachine.vb b/VECTO/Input Files/ElectricMachine.vb index e67059c6e8..0c43daf68b 100644 --- a/VECTO/Input Files/ElectricMachine.vb +++ b/VECTO/Input Files/ElectricMachine.vb @@ -7,6 +7,7 @@ Imports TUGraz.VectoCommon.Exceptions Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Utils @@ -14,9 +15,15 @@ Imports TUGraz.VectoCore.Utils Public Class ElectricMachine Implements IElectricMotorEngineeringInputData - Private ReadOnly _fullLoadCurvePath As SubPath - Private ReadOnly _dragCurvePath As SubPath - Private ReadOnly _efficiencyMap As SubPath + public VoltageLevelLow As Double + Private ReadOnly _fullLoadCurvePathLow As SubPath + Private ReadOnly _dragCurvePathLow As SubPath + Private ReadOnly _efficiencyMapLow As SubPath + + public VoltageLevelHigh as Double + Private ReadOnly _fullLoadCurvePathHi As SubPath + Private ReadOnly _dragCurvePathHi As SubPath + Private ReadOnly _efficiencyMapHi As SubPath ''' <summary> ''' Directory of engine file. Defined in FilePath property (Set) @@ -46,10 +53,13 @@ Public Class ElectricMachine _myPath = "" _filePath = "" - _fullLoadCurvePath = New SubPath - _dragCurvePath = New SubPath() - _efficiencyMap = New SubPath() + _fullLoadCurvePathLow = New SubPath + _dragCurvePathLow = New SubPath() + _efficiencyMapLow = New SubPath() + _fullLoadCurvePathHi = New SubPath + _dragCurvePathHi = New SubPath() + _efficiencyMapHi = New SubPath() SetDefault() End Sub @@ -59,7 +69,8 @@ Public Class ElectricMachine MotorInertia = 0 - _fullLoadCurvePath.Clear() + _fullLoadCurvePathLow.Clear() + _fullLoadCurvePathHi.Clear() End Sub @@ -195,27 +206,66 @@ Public Class ElectricMachine End Get End Property - Public ReadOnly Property FullLoadCurve As TableData Implements IElectricMotorDeclarationInputData.FullLoadCurve + protected ReadOnly Property FullLoadCurveLow As TableData Get - If Not File.Exists(_fullLoadCurvePath.FullPath) Then _ + If Not File.Exists(_fullLoadCurvePathLow.FullPath) Then _ Throw New VectoException("Full-Load Curve is missing or invalid") - Return VectoCSVFile.Read(_fullLoadCurvePath.FullPath) + Return VectoCSVFile.Read(_fullLoadCurvePathLow.FullPath) + End Get + End Property + protected ReadOnly Property DragCurvLow As TableData + Get + If Not File.Exists(_dragCurvePathLow.FullPath) Then _ + Throw New VectoException("Drag Curve is missing or invalid") + Return VectoCSVFile.Read(_dragCurvePathLow.FullPath) End Get End Property - Public ReadOnly Property DragCurve As TableData Implements IElectricMotorDeclarationInputData.DragCurve + protected ReadOnly Property EfficiencyMapLow As TableData + Get + If Not File.Exists(_efficiencyMapLow.FullPath) Then _ + Throw New VectoException("Drag Curve is missing or invalid") + Return VectoCSVFile.Read(_efficiencyMapLow.FullPath) + End Get + End Property + protected ReadOnly Property FullLoadCurveHi As TableData + Get + If Not File.Exists(_fullLoadCurvePathHi.FullPath) Then _ + Throw New VectoException("Full-Load Curve is missing or invalid") + Return VectoCSVFile.Read(_fullLoadCurvePathHi.FullPath) + End Get + End Property + protected ReadOnly Property DragCurvHi As TableData Get - If Not File.Exists(_dragCurvePath.FullPath) Then _ + If Not File.Exists(_dragCurvePathHi.FullPath) Then _ Throw New VectoException("Drag Curve is missing or invalid") - Return VectoCSVFile.Read(_dragCurvePath.FullPath) + Return VectoCSVFile.Read(_dragCurvePathHi.FullPath) End Get End Property - Public ReadOnly Property EfficiencyMap As TableData Implements IElectricMotorDeclarationInputData.EfficiencyMap + protected ReadOnly Property EfficiencyMapHi As TableData Get - If Not File.Exists(_efficiencyMap.FullPath) Then _ + If Not File.Exists(_efficiencyMapHi.FullPath) Then _ Throw New VectoException("Drag Curve is missing or invalid") - Return VectoCSVFile.Read(_efficiencyMap.FullPath) + Return VectoCSVFile.Read(_efficiencyMapHi.FullPath) End Get End Property + + Public ReadOnly Property VoltageLevels As IList(Of IElectricMotorVoltageLevel) Implements IElectricMotorDeclarationInputData.VoltageLevels + get + Return New List(Of IElectricMotorVoltageLevel) From{ + New ElectricMotorVoltageLevel() With { + .VoltageLevel = VoltageLevelLow.SI(of Volt), + .EfficiencyMap = EfficiencyMapLow, + .DragCurve = DragCurvLow, + .FullLoadCurve = FullLoadCurveLow}, + New ElectricMotorVoltageLevel() With { + .VoltageLevel = VoltageLevelHigh.SI(of Volt), + .EfficiencyMap = EfficiencyMapHi, + .DragCurve = DragCurvHi, + .FullLoadCurve = FullLoadCurveHi} + } + End Get + End Property + Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia Get Return MotorInertia.SI(Of KilogramSquareMeter) @@ -254,42 +304,81 @@ Public Class ElectricMachine End Get End Property - Public Property PathMaxTorque(Optional ByVal original As Boolean = False) As String + Public Property PathMaxTorqueLow(Optional ByVal original As Boolean = False) As String + Get + If original Then + Return _fullLoadCurvePathLow.OriginalPath + Else + Return _fullLoadCurvePathLow.FullPath + End If + End Get + Set(ByVal value As String) + _fullLoadCurvePathLow.Init(_myPath, value) + End Set + End Property + + Public Property PathDragLow(Optional ByVal original As Boolean = False) As String + Get + If original Then + Return _dragCurvePathLow.OriginalPath + Else + Return _dragCurvePathLow.FullPath + End If + End Get + Set(ByVal value As String) + _dragCurvePathLow.Init(_myPath, value) + End Set + End Property + + Public Property PathMapLow(Optional ByVal original As Boolean = False) As String + Get + If original Then + Return _efficiencyMapLow.OriginalPath + Else + Return _efficiencyMapLow.FullPath + End If + End Get + Set(ByVal value As String) + _efficiencyMapLow.Init(_myPath, value) + End Set + End Property + + Public Property PathMaxTorqueHi(Optional ByVal original As Boolean = False) As String Get If original Then - Return _fullLoadCurvePath.OriginalPath + Return _fullLoadCurvePathHi.OriginalPath Else - Return _fullLoadCurvePath.FullPath + Return _fullLoadCurvePathHi.FullPath End If End Get Set(ByVal value As String) - _fullLoadCurvePath.Init(_myPath, value) + _fullLoadCurvePathHi.Init(_myPath, value) End Set End Property - Public Property PathDrag(Optional ByVal original As Boolean = False) As String + Public Property PathDragHi(Optional ByVal original As Boolean = False) As String Get If original Then - Return _dragCurvePath.OriginalPath + Return _dragCurvePathHi.OriginalPath Else - Return _dragCurvePath.FullPath + Return _dragCurvePathHi.FullPath End If End Get Set(ByVal value As String) - _dragCurvePath.Init(_myPath, value) + _dragCurvePathHi.Init(_myPath, value) End Set End Property - Public Property PathMap(Optional ByVal original As Boolean = False) As String + Public Property PathMapHi(Optional ByVal original As Boolean = False) As String Get If original Then - Return _efficiencyMap.OriginalPath + Return _efficiencyMapHi.OriginalPath Else - Return _efficiencyMap.FullPath + Return _efficiencyMapHi.FullPath End If End Get Set(ByVal value As String) - _efficiencyMap.Init(_myPath, value) + _efficiencyMapHi.Init(_myPath, value) End Set End Property diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 630b36b625..e96c5022ac 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -1016,10 +1016,9 @@ Public Class ElectricMachineWrapper Public ReadOnly Property CertificationMethod As CertificationMethod Implements IComponentInputData.CertificationMethod Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Public ReadOnly Property DigestValue As DigestData Implements IComponentInputData.DigestValue - Public ReadOnly Property FullLoadCurve As TableData Implements IElectricMotorDeclarationInputData.FullLoadCurve - Public ReadOnly Property DragCurve As TableData Implements IElectricMotorDeclarationInputData.DragCurve - Public ReadOnly Property EfficiencyMap As TableData Implements IElectricMotorDeclarationInputData.EfficiencyMap - Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia + + Public ReadOnly Property VoltageLevels As IList(Of IElectricMotorVoltageLevel) Implements IElectricMotorDeclarationInputData.VoltageLevels + Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia Public ReadOnly Property OverloadTime As Second Implements IElectricMotorDeclarationInputData.OverloadTime Public ReadOnly Property ContinuousTorqueSpeed As PerSecond Implements IElectricMotorDeclarationInputData.ContinuousTorqueSpeed Public ReadOnly Property OverloadTorque As NewtonMeter Implements IElectricMotorDeclarationInputData.OverloadTorque diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 72ef3e502e..304adf995e 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -711,11 +711,7 @@ namespace TUGraz.VectoCommon.InputData public interface IElectricMotorDeclarationInputData : IComponentInputData { - TableData FullLoadCurve { get; } - - TableData DragCurve { get; } - - TableData EfficiencyMap { get; } + IList<IElectricMotorVoltageLevel> VoltageLevels { get; } KilogramSquareMeter Inertia { get; } @@ -732,6 +728,17 @@ namespace TUGraz.VectoCommon.InputData PerSecond OverloadTestSpeed { get; } } + public interface IElectricMotorVoltageLevel + { + Volt VoltageLevel { get; } + + TableData FullLoadCurve { get; } + + TableData DragCurve { get; } + + TableData EfficiencyMap { get; } + } + public interface IElectricMachinesDeclarationInputData { IList<ElectricMachineEntry<IElectricMotorDeclarationInputData>> Entries { get; } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs index c843414f17..cb3c2f1f69 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs @@ -1,11 +1,34 @@ using System; +using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json.Linq; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Impl; -namespace TUGraz.VectoCore.InputData.FileIO.JSON { +namespace TUGraz.VectoCore.InputData.FileIO.JSON +{ + + public class JSONElectricMotorV3 : JSONElectricMotorV2 + { + public JSONElectricMotorV3(JObject data, string filename, bool tolerateMissing = false) : base(data, filename, tolerateMissing) { } + + #region Overrides of JSONElectricMotorV1 + + protected override IList<IElectricMotorVoltageLevel> ReadVoltageLevels() + { + return Body["VoltageLevels"].Select(entry => new ElectricMotorVoltageLevel() { + VoltageLevel = entry.GetEx<double>("Voltage").SI<Volt>(), + EfficiencyMap = ReadTableData(entry.GetEx<string>("EfficiencyMap"), "ElectricMotor Map"), + DragCurve = ReadTableData(entry.GetEx<string>("DragCurve"), "ElectricMotor DragCurve"), + FullLoadCurve = ReadTableData(entry.GetEx<string>("FullLoadCurve"), "ElectricMotor FullLoadCurve") + }).Cast<IElectricMotorVoltageLevel>().ToList(); + } + + #endregion + } public class JSONElectricMotorV2 : JSONElectricMotorV1 { @@ -23,15 +46,35 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { public class JSONElectricMotorV1 : JSONFile, IElectricMotorEngineeringInputData { + private IList<IElectricMotorVoltageLevel> _voltageLevels; public JSONElectricMotorV1(JObject data, string filename, bool tolerateMissing = false) : base(data, filename, tolerateMissing) { } public virtual string Manufacturer => Constants.NOT_AVAILABLE; public virtual string Model => Body.GetEx<string>("Model"); + public virtual IList<IElectricMotorVoltageLevel> VoltageLevels public virtual DateTime Date => DateTime.MinValue; - - public virtual CertificationMethod CertificationMethod => CertificationMethod.NotCertified; + get + { + return _voltageLevels ?? (_voltageLevels = ReadVoltageLevels()); + } public string CertificationNumber => Constants.NOT_AVAILABLE; + protected virtual IList<IElectricMotorVoltageLevel> ReadVoltageLevels() + { + return new List<IElectricMotorVoltageLevel>() { + new ElectricMotorVoltageLevel() { + VoltageLevel = 0.SI<Volt>(), + EfficiencyMap = ReadTableData(Body.GetEx<string>("EfficiencyMap"), "ElectricMotor Map"), + DragCurve = ReadTableData(Body.GetEx<string>("DragCurve"), "ElectricMotor DragCurve"), + FullLoadCurve = ReadTableData(Body.GetEx<string>("FullLoadCurve"), "ElectricMotor FullLoadCurve") + }, + new ElectricMotorVoltageLevel() { + VoltageLevel = 1e9.SI<Volt>(), + EfficiencyMap = ReadTableData(Body.GetEx<string>("EfficiencyMap"), "ElectricMotor Map"), + DragCurve = ReadTableData(Body.GetEx<string>("DragCurve"), "ElectricMotor DragCurve"), + FullLoadCurve = ReadTableData(Body.GetEx<string>("FullLoadCurve"), "ElectricMotor FullLoadCurve") + }, + }; public DigestData DigestValue => null; diff --git a/VectoCore/VectoCore/InputData/Impl/InputData.cs b/VectoCore/VectoCore/InputData/Impl/InputData.cs index 8150668f0a..2468d3d0bd 100644 --- a/VectoCore/VectoCore/InputData/Impl/InputData.cs +++ b/VectoCore/VectoCore/InputData/Impl/InputData.cs @@ -292,4 +292,16 @@ namespace TUGraz.VectoCore.InputData.Impl public string SimulationToolVersion { get; internal set; } public DateTime Date { get; internal set; } } + + public class ElectricMotorVoltageLevel : IElectricMotorVoltageLevel + { + #region Implementation of IElectricMotorVoltageLevel + + public Volt VoltageLevel { get; internal set; } + public TableData FullLoadCurve { get; internal set; } + public TableData DragCurve { get; internal set; } + public TableData EfficiencyMap { get; internal set; } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 69f78b39bc..e17f347199 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -758,19 +758,29 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter private ElectricMotorData CreateElectricMachine(IElectricMotorEngineeringInputData motorData, int count, double ratio, double[] ratioPerGear, double efficiency, TableData adcLossMap, TableData torqueLimits) { - var fullLoadCurve = ElectricFullLoadCurveReader.Create(motorData.FullLoadCurve, count); - var maxTorqueCurve = torqueLimits == null ? null : ElectricFullLoadCurveReader.Create(torqueLimits, count); + var voltageLevels = new List<ElectricMotorVoltageLevelData>(); + + foreach (var entry in motorData.VoltageLevels.OrderBy(x => x.VoltageLevel)) { + var fullLoadCurve = ElectricFullLoadCurveReader.Create(entry.FullLoadCurve, count); + var maxTorqueCurve = torqueLimits == null ? null : ElectricFullLoadCurveReader.Create(torqueLimits, count); + + var fullLoadCurveCombined = IntersectEMFullLoadCurves(fullLoadCurve, maxTorqueCurve); + + voltageLevels.Add(new ElectricMotorVoltageLevelData() { + Voltage = entry.VoltageLevel, + FullLoadCurve = fullLoadCurveCombined, + DragCurve = ElectricMotorDragCurveReader.Create(entry.DragCurve, count), + EfficiencyMap = ElectricMotorMapReader.Create(entry.EfficiencyMap, count), + }); + } - var fullLoadCurveCombined = IntersectEMFullLoadCurves(fullLoadCurve, maxTorqueCurve); var lossMap = adcLossMap != null ? TransmissionLossMapReader.CreateEmADCLossMap(adcLossMap, ratio, "EM ADC LossMap") : TransmissionLossMapReader.CreateEmADCLossMap(efficiency, ratio, "EM ADC LossMap Eff"); return new ElectricMotorData() { - FullLoadCurve = fullLoadCurveCombined, - DragCurve = ElectricMotorDragCurveReader.Create(motorData.DragCurve, count), - EfficiencyMap = ElectricMotorMapReader.Create(motorData.EfficiencyMap, count), + EfficiencyData = new VoltageLevelData() { VoltageLevels = voltageLevels}, Inertia = motorData.Inertia, ContinuousTorque = motorData.ContinuousTorque * count, ContinuousTorqueSpeed = motorData.ContinuousTorqueSpeed, diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IElectricMotorInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IElectricMotorInfo.cs index 1980ad7b06..6da7564229 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IElectricMotorInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IElectricMotorInfo.cs @@ -10,8 +10,8 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus PerSecond ElectricMotorSpeed { get; } PowertrainPosition Position { get; } PerSecond MaxSpeed { get; } - Watt DragPower(PerSecond electricMotorSpeed); - Watt MaxPowerDrive(PerSecond inAngularVelocity); - NewtonMeter GetTorqueForElectricPower(Watt electricPower, PerSecond avgEmSpeed, Second dt); + Watt DragPower(Volt volt, PerSecond electricMotorSpeed); + Watt MaxPowerDrive(Volt volt, PerSecond inAngularVelocity); + NewtonMeter GetTorqueForElectricPower(Volt volt, Watt electricPower, PerSecond avgEmSpeed, Second dt); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs index e22a0db1f5..ac22dd9ba8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs @@ -1,4 +1,6 @@ -using TUGraz.VectoCommon.Utils; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Models.SimulationComponent.Impl; @@ -7,25 +9,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { public class ElectricMotorData { - [ValidateObject] - public EfficiencyMap EfficiencyMap { get; internal set; } - - [ValidateObject] - public ElectricMotorFullLoadCurve FullLoadCurve { get; internal set; } - [SIRange(double.MinValue, double.MaxValue)] public KilogramSquareMeter Inertia { get; internal set; } - [ValidateObject] - public DragCurve DragCurve { get; internal set; } - [SIRange(double.MinValue, double.MaxValue)] public NewtonMeter ContinuousTorque { get; internal set; } [SIRange(0, double.MaxValue)] public PerSecond ContinuousTorqueSpeed { get; internal set; } - [SIRange(double.MinValue, double.MaxValue)] public NewtonMeter OverloadTorque { get; set; } @@ -44,5 +36,67 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data public TransmissionLossMap TransmissionLossMap { get; internal set; } public double[] RatioPerGear { get; set; } + + [ValidateObject] + public VoltageLevelData EfficiencyData { get; internal set; } + } + + public class VoltageLevelData + { + private PerSecond _maxSpeed; + + public IList<ElectricMotorVoltageLevelData> VoltageLevels { get; internal set; } + + + public PerSecond MaxSpeed + { + get + { + return _maxSpeed ?? (_maxSpeed = VoltageLevels + .Min(v => v.FullLoadCurve.FullLoadEntries.MaxBy(x => x.MotorSpeed).MotorSpeed)); + } + } + + public NewtonMeter LookupDragTorque(Volt voltage, PerSecond avgSpeed) + { + return null; + } + + public NewtonMeter EfficiencyMapLookupTorque(Volt voltage, Watt electricPower, PerSecond avgSpeed, NewtonMeter maxEmTorque) + { + return null; + } + + public EfficiencyMap.EfficiencyResult LookupElectricPower(Volt voltage, PerSecond avgSpeed, NewtonMeter maxTorque, bool allowExtrapolation = false) + { + return null; + } + + public NewtonMeter FullGenerationTorque(Volt voltage, PerSecond avgSpeed) + { + return null; + } + + public NewtonMeter FullLoadDriveTorque(Volt voltage, PerSecond avgSpeed) + { + return null; + } + } + + public class ElectricMotorVoltageLevelData + { + [SIRange(0, double.MaxValue)] + public Volt Voltage { get; internal set; } + + [ValidateObject] + public ElectricMotorFullLoadCurve FullLoadCurve { get; internal set; } + + [ValidateObject] + public DragCurve DragCurve { get; internal set; } + + [ValidateObject] + public EfficiencyMap EfficiencyMap { get; internal set; } + + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 147ff66a56..e28d251266 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -707,7 +707,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl : 0.SI<Watt>(); var emDragLoss = Driver.DataBus.PowertrainInfo.HasElectricMotor - ? Driver.DataBus.PowertrainInfo.ElectricMotorPositions.Select(x => Driver.DataBus.ElectricMotorInfo(x).DragPower(Driver.DataBus.ElectricMotorInfo(x).ElectricMotorSpeed)).Sum() // Driver.DataBus.ElectricMotorInfo() + ? Driver.DataBus.PowertrainInfo.ElectricMotorPositions.Select(x => + Driver.DataBus.ElectricMotorInfo(x).DragPower(Driver.DataBus.BatteryInfo.InternalVoltage, Driver.DataBus.ElectricMotorInfo(x).ElectricMotorSpeed)).Sum() // Driver.DataBus.ElectricMotorInfo() : 0.SI<Watt>(); var gearboxLoss = Driver.DataBus.GearboxInfo?.GearboxLoss() ?? 0.SI<Watt>(); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs index b54e9f0bf7..71a401ef71 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs @@ -53,12 +53,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container.AddComponent(this); // We have to do this again because in the base class the position is unknown! ContinuousTorque = ModelData.ContinuousTorque; + var voltage = ModelData.EfficiencyData.VoltageLevels.First().Voltage; var contElPwr = - ModelData.EfficiencyMap.LookupElectricPower(ModelData.ContinuousTorqueSpeed, -ContinuousTorque).ElectricalPower ?? - ModelData.EfficiencyMap.LookupElectricPower(ModelData.ContinuousTorqueSpeed, ModelData.FullLoadCurve.FullLoadDriveTorque(ModelData.ContinuousTorqueSpeed), true).ElectricalPower; + ModelData.EfficiencyData.LookupElectricPower(voltage, ModelData.ContinuousTorqueSpeed, -ContinuousTorque).ElectricalPower ?? + ModelData.EfficiencyData.LookupElectricPower(voltage, ModelData.ContinuousTorqueSpeed, ModelData.EfficiencyData.FullLoadDriveTorque(voltage, ModelData.ContinuousTorqueSpeed), true).ElectricalPower; ContinuousPowerLoss = -contElPwr - ContinuousTorque * ModelData.ContinuousTorqueSpeed; // loss needs to be positive - var peakElPwr = ModelData.EfficiencyMap.LookupElectricPower(ModelData.OverloadTestSpeed, -ModelData.OverloadTorque, true) + var peakElPwr = ModelData.EfficiencyData.LookupElectricPower(voltage, ModelData.OverloadTestSpeed, -ModelData.OverloadTorque, true) .ElectricalPower; var peakPwrLoss = -peakElPwr + ModelData.OverloadTorque * ModelData.OverloadTestSpeed; // losses need to be positive @@ -71,27 +72,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public double[] TransmissionRatioPerGear { get; set; } public PowertrainPosition Position { get; } - public PerSecond MaxSpeed - { - get { return _maxSpeed ?? (_maxSpeed = (ModelData.FullLoadCurve.FullLoadEntries.MaxBy(x => x.MotorSpeed).MotorSpeed) / ModelData.RatioADC); } + public PerSecond MaxSpeed { + get { return _maxSpeed ?? (_maxSpeed = (ModelData.EfficiencyData.MaxSpeed) / ModelData.RatioADC); } } - public Watt DragPower(PerSecond electricMotorSpeed) + public Watt DragPower(Volt volt, PerSecond electricMotorSpeed) { - return ModelData.DragCurve.Lookup(electricMotorSpeed) * electricMotorSpeed; + return ModelData.EfficiencyData.LookupDragTorque(volt, electricMotorSpeed) * electricMotorSpeed; } - public Watt MaxPowerDrive(PerSecond electricMotorSpeed) + public Watt MaxPowerDrive(Volt volt, PerSecond electricMotorSpeed) { - return ModelData.FullLoadCurve.FullLoadDriveTorque(electricMotorSpeed) * electricMotorSpeed; + return ModelData.EfficiencyData.FullLoadDriveTorque(volt, electricMotorSpeed) * electricMotorSpeed; } - public NewtonMeter GetTorqueForElectricPower(Watt electricPower, PerSecond avgEmSpeed, Second dt) + public NewtonMeter GetTorqueForElectricPower(Volt volt, Watt electricPower, PerSecond avgEmSpeed, Second dt) { var maxTorque = electricPower > 0 - ? GetMaxRecuperationTorque(dt, avgEmSpeed) - : GetMaxDriveTorque(dt, avgEmSpeed); - var tqEmMap = ModelData.EfficiencyMap.LookupTorque(electricPower, avgEmSpeed, maxTorque); + ? GetMaxRecuperationTorque(volt, dt, avgEmSpeed) + : GetMaxDriveTorque(volt, dt, avgEmSpeed); + var tqEmMap = ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, electricPower, avgEmSpeed, maxTorque); if (tqEmMap == null) { return null; } @@ -160,6 +160,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public IResponse DoHandleRequest(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun, double ratio) { + var voltage = DataBus.BatteryInfo.InternalVoltage; + var avgDtSpeed = (PreviousState.DrivetrainSpeed + outAngularVelocity) / 2; var emSpeed = outAngularVelocity * ModelData.RatioADC; @@ -168,8 +170,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ? 0.SI<NewtonMeter>() : Formulas.InertiaPower(avgEmSpeed, PreviousState.EMSpeed, ModelData.Inertia, dt) / avgEmSpeed; - var maxDriveTorqueEmMap = GetMaxDriveTorque(dt, avgEmSpeed); - var maxRecuperationTorqueEmMap = GetMaxRecuperationTorque(dt, avgEmSpeed); + var maxDriveTorqueEmMap = GetMaxDriveTorque(voltage, dt, avgEmSpeed); + var maxRecuperationTorqueEmMap = GetMaxRecuperationTorque(voltage, dt, avgEmSpeed); // inertia has to be added here. drive torque is negative, when accelerating inertia is positive and thus 'reduces' drive torque, i.e 'less negative' var maxDriveTorqueEm = maxDriveTorqueEmMap == null ? null : maxDriveTorqueEmMap + inertiaTorqueEm; @@ -248,7 +250,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // no electric system or EM shall be off - apply drag only // if EM is off, calculate EM drag torque 'forward' to be applied on drivetrain // add inertia, drag is positive - emTorque = ModelData.DragCurve.Lookup(avgEmSpeed) + inertiaTorqueEm; + emTorque = ModelData.EfficiencyData.LookupDragTorque(voltage, avgEmSpeed) + inertiaTorqueEm; emTorqueDt = ConvertEmTorqueToDrivetrain(avgEmSpeed, emTorque); emOff = true; } @@ -262,10 +264,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl emTorqueMap = null; } - var electricPower = emOff || (ModelData.DragCurve.Lookup(avgEmSpeed) + inertiaTorqueEm).IsEqual(emTorque, 1e-3.SI<NewtonMeter>()) + var electricPower = emOff || (ModelData.EfficiencyData.LookupDragTorque(voltage, avgEmSpeed) + inertiaTorqueEm).IsEqual(emTorque, 1e-3.SI<NewtonMeter>()) ? 0.SI<Watt>() - : ModelData.EfficiencyMap - .LookupElectricPower(avgEmSpeed, emTorqueMap, DataBus.ExecutionMode != ExecutionMode.Declaration) + : ModelData.EfficiencyData + .LookupElectricPower(voltage, avgEmSpeed, emTorqueMap, DataBus.ExecutionMode != ExecutionMode.Declaration) .ElectricalPower; var electricSupplyResponse = @@ -366,13 +368,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return retVal; } - private NewtonMeter GetMaxRecuperationTorque(Second dt, PerSecond avgSpeed) + private NewtonMeter GetMaxRecuperationTorque(Volt volt, Second dt, PerSecond avgSpeed) { var tqContinuousPwr = DeRatingActive ? ContinuousTorque : null; - //if (!avgSpeed.IsEqual(0)) { - // tqContinuousPwr = DeRatingActive ? ModelData.ContinuousTorque / avgSpeed : null; - //} - var maxEmTorque = VectoMath.Min(tqContinuousPwr, ModelData.FullLoadCurve.FullGenerationTorque(avgSpeed)); + + var maxEmTorque = VectoMath.Min(tqContinuousPwr, ModelData.EfficiencyData.FullGenerationTorque(volt, avgSpeed)); var electricSystemResponse = ElectricPower.Request(0.SI<Second>(), dt, 0.SI<Watt>(), true); var maxBatPower = electricSystemResponse.MaxPowerDrag; @@ -382,27 +382,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } var maxBatRecuperationTorque = maxBatPower.IsEqual(0, 1e-3) - ? ModelData.DragCurve.Lookup(avgSpeed) - : ModelData.EfficiencyMap.LookupTorque(maxBatPower, avgSpeed, maxEmTorque); + ? ModelData.EfficiencyData.LookupDragTorque(volt, avgSpeed) + : ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, maxBatPower, avgSpeed, maxEmTorque); var maxTorqueRecuperate = VectoMath.Min(maxEmTorque, maxBatRecuperationTorque); if (maxTorqueRecuperate < 0) { return null; } - var elPower = ModelData.EfficiencyMap.LookupElectricPower(avgSpeed, maxTorqueRecuperate); + var elPower = ModelData.EfficiencyData.LookupElectricPower(volt, avgSpeed, maxTorqueRecuperate); if (elPower.ElectricalPower?.IsSmallerOrEqual(0) ?? true) { return null; } return maxTorqueRecuperate; } - private NewtonMeter GetMaxDriveTorque(Second dt, PerSecond avgSpeed) + private NewtonMeter GetMaxDriveTorque(Volt volt, Second dt, PerSecond avgSpeed) { var tqContinuousPwr = DeRatingActive ? -ContinuousTorque : null; - //if (!avgSpeed.IsEqual(0)) { - // tqContinuousPwr = DeRatingActive ? -ModelData.ContinuousTorque / avgSpeed : null; - //} - var maxEmTorque = VectoMath.Max(tqContinuousPwr ,ModelData.FullLoadCurve.FullLoadDriveTorque(avgSpeed)); + + var maxEmTorque = VectoMath.Max(tqContinuousPwr ,ModelData.EfficiencyData.FullLoadDriveTorque(volt, avgSpeed)); var electricSystemResponse = ElectricPower.Request(0.SI<Second>(), dt, 0.SI<Watt>(), true); var maxBatPower = electricSystemResponse.MaxPowerDrive; @@ -412,11 +410,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } var maxBatDriveTorque = maxBatPower.IsEqual(0, 1e-3) - ? ModelData.DragCurve.Lookup(avgSpeed) - : ModelData.EfficiencyMap.LookupTorque(maxBatPower, avgSpeed, maxEmTorque); - //if (maxBatDriveTorque == null) { - // return ModelData.DragCurve.Lookup(avgSpeed); - //} + ? ModelData.EfficiencyData.LookupDragTorque(volt, avgSpeed) + : ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, maxBatPower, avgSpeed, maxEmTorque); + var maxTorqueDrive = VectoMath.Max(maxEmTorque, maxBatDriveTorque); return maxTorqueDrive > 0 ? null : maxTorqueDrive; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index e1eb6819e6..322b3a16d9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -592,7 +592,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl NextComponent.Request(absTime, Constants.SimulationSettings.TargetTimeInterval, inTorque, inAngularVelocity, true); //NextComponent.Initialize(inTorque, inAngularVelocity); - var fullLoad = -DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricE2).MaxPowerDrive(inAngularVelocity); + var fullLoad = -DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricE2).MaxPowerDrive(DataBus.BatteryInfo.InternalVoltage, inAngularVelocity); Gear = oldGear; return new ResponseDryRun(this, response) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index a5f0127cdb..15fff78cee 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -34,8 +34,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private SimplePowertrainContainer TestContainer; private Gearbox TestContainerGbx; private Kilogram vehicleMass; - private EfficiencyMap PowerMap; - private ElectricMotorFullLoadCurve FullLoadCurve; + private VoltageLevelData VoltageLevels; private SI TransmissionRatio; private ShiftStrategyParameters GearshiftParams; private GearList GearList; @@ -58,10 +57,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl GearList = GearboxModelData.GearList; MaxStartGear = GearList.Reverse().First(); - PowerMap = dataBus.RunData.ElectricMachinesData - .FirstOrDefault(x => x.Item1 == PowertrainPosition.BatteryElectricE2)?.Item2.EfficiencyMap; - FullLoadCurve = dataBus.RunData.ElectricMachinesData - .FirstOrDefault(x => x.Item1 == PowertrainPosition.BatteryElectricE2)?.Item2.FullLoadCurve; + VoltageLevels = dataBus.RunData.ElectricMachinesData + .FirstOrDefault(x => x.Item1 == PowertrainPosition.BatteryElectricE2)?.Item2.EfficiencyData; + DataBus = dataBus; EarlyShiftUp = true; @@ -354,7 +352,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var engineSpeed = response.ElectricMotor.AngularVelocity; - var fcCurRes = PowerMap.LookupElectricPower(engineSpeed, tqCurrent, true); + var fcCurRes = VoltageLevels.LookupElectricPower(DataBus.BatteryInfo.InternalVoltage, engineSpeed, tqCurrent, true); if (fcCurRes.Extrapolated) { Log.Warn( "EffShift Strategy: Extrapolation of power consumption for current gear! n: {0}, Tq: {1}", @@ -389,7 +387,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var vehicleSpeed = DataBus.VehicleInfo.VehicleSpeed; var nextEngineSpeed = gbxAngularVelocityOut * GearboxModelData.Gears[gear.Gear].Ratio; - var maxEnginePower = -(FullLoadCurve.FullLoadDriveTorque(nextEngineSpeed) * nextEngineSpeed); + var maxEnginePower = -(VoltageLevels.FullLoadDriveTorque(DataBus.BatteryInfo.InternalVoltage, nextEngineSpeed) * nextEngineSpeed); var avgSlope = ((DataBus.DrivingCycleInfo.CycleLookAhead(Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Altitude - @@ -565,7 +563,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //for (var gear = (uint)GearboxModelData.Gears.Count; gear >= 1; gear--) { var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear.Gear].Ratio; - var ratedSpeed = FullLoadCurve.MaxSpeed * 0.9; + var ratedSpeed = VoltageLevels.MaxSpeed * 0.9; if (inAngularSpeed > ratedSpeed || inAngularSpeed.IsEqual(0)) { continue; } @@ -662,7 +660,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public ShiftPolygon ComputeDeclarationShiftPolygon(GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve, IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius, ElectricMotorData electricMotorData) { - return DeclarationData.Gearbox.ComputeElectricMotorShiftPolygon(i, electricMotorData.FullLoadCurve, electricMotorData.RatioADC, gearboxGears, axlegearRatio, dynamicTyreRadius); + return DeclarationData.Gearbox.ComputeElectricMotorShiftPolygon(i, electricMotorData.EfficiencyData.VoltageLevels.First().FullLoadCurve, electricMotorData.RatioADC, gearboxGears, axlegearRatio, dynamicTyreRadius); } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs index cc71009281..060fe97d65 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs @@ -216,7 +216,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (em == null) { throw new VectoException("E2 EM required for PEV E2 GearshiftPreprocessing"); } - return 0.5 * em.Item2.FullLoadCurve + return 0.5 * em.Item2.EfficiencyData.VoltageLevels.First().FullLoadCurve .MaxSpeed / em.Item2.RatioADC; } @@ -227,7 +227,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (em == null) { throw new VectoException("E2 EM required for PEV E2 GearshiftPreprocessing"); } - return em.Item2.FullLoadCurve.MaxSpeed / em.Item2.RatioADC; + return em.Item2.EfficiencyData.VoltageLevels.First().FullLoadCurve.MaxSpeed / em.Item2.RatioADC; } } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index a7f2c150aa..4e9109d40f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -1798,6 +1798,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (DataBus.DriverInfo.DrivingAction == DrivingAction.Brake) { maxU = 0; } + + var voltage = DataBus.BatteryInfo.InternalVoltage; if (firstResponse.ElectricMotor.MaxDriveTorque != null && (ElectricMotorCanPropellDuringTractionInterruption || firstResponse.Gearbox.Gear.Engaged)) { for (var u = -stepSize; u >= maxU; u -= stepSize * (u < -10 ? 100 :(u < -4 ? 10 : (u < -2 ? 5 : 1)))) { var emTorque = emTqReq.Abs() * u; @@ -1835,9 +1837,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies //var emDriveTorque = ModelData.ElectricMachinesData.Where(x => x.Item1 == emPos).First().Item2.EfficiencyMap // .LookupTorque(emDrivePower, firstResponse.ElectricMotor.AngularVelocity, maxEmTorque); - var emDriveTorque = DataBus.ElectricMotorInfo(emPos).GetTorqueForElectricPower(emDrivePower, firstResponse.ElectricMotor.AngularVelocity, dt); + var emDriveTorque = DataBus.ElectricMotorInfo(emPos).GetTorqueForElectricPower(voltage, emDrivePower, firstResponse.ElectricMotor.AngularVelocity, dt); var emDragTorque = ModelData.ElectricMachinesData.Where(x => x.Item1 == emPos).First().Item2 - .DragCurve.Lookup(firstResponse.ElectricMotor.AngularVelocity); + .EfficiencyData.LookupDragTorque(voltage, firstResponse.ElectricMotor.AngularVelocity); if (emDriveTorque != null && emDriveTorque.IsBetween( firstResponse.ElectricMotor.MaxRecuperationTorque, firstResponse.ElectricMotor.MaxDriveTorque) && diff --git a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs index f44fe10656..5aafdf197f 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs @@ -34,7 +34,7 @@ public class JSONFileWriter : IOutputFileWriter private const int VectoVTPJobFormatVersion = 4; - private const int ElectricMotorFormatVersion = 2; + private const int ElectricMotorFormatVersion = 3; private const int REESSFormatVersion = 1; @@ -79,9 +79,9 @@ public class JSONFileWriter : IOutputFileWriter body.Add("SavedInDeclMode", declMode); body.Add("Model", electricMachine.Model); - body.Add("FullLoadCurve", GetRelativePath(electricMachine.FullLoadCurve.Source, Path.GetDirectoryName(filename))); - body.Add("DragCurve", GetRelativePath(electricMachine.DragCurve.Source, Path.GetDirectoryName(filename))); - body.Add("EfficiencyMap", GetRelativePath(electricMachine.EfficiencyMap.Source, Path.GetDirectoryName(filename))); + //body.Add("FullLoadCurve", GetRelativePath(electricMachine.FullLoadCurve.Source, Path.GetDirectoryName(filename))); + //body.Add("DragCurve", GetRelativePath(electricMachine.DragCurve.Source, Path.GetDirectoryName(filename))); + //body.Add("EfficiencyMap", GetRelativePath(electricMachine.EfficiencyMap.Source, Path.GetDirectoryName(filename))); body.Add("Inertia", electricMachine.Inertia.Value()); body.Add("ContinuousTorque", electricMachine.ContinuousTorque.Value()); body.Add("ContinuousTorqueSpeed", electricMachine.ContinuousTorqueSpeed.AsRPM); @@ -89,6 +89,18 @@ public class JSONFileWriter : IOutputFileWriter body.Add("OverloadTorqueSpeed", electricMachine.OverloadTestSpeed.AsRPM); body.Add("OverloadTime", electricMachine.OverloadTime.Value()); body.Add("ThermalOverloadRecoveryFactor", electricMachine.OverloadRecoveryFactor); + + var vlevels = new List<Dictionary<string, object>>(); + foreach (var entry in electricMachine.VoltageLevels) { + var vlevel = new Dictionary<string, object>(); + vlevel.Add("Voltage", entry.VoltageLevel.Value()); + vlevel.Add("FullLoadCurve", GetRelativePath(entry.FullLoadCurve.Source, Path.GetDirectoryName(filename))); + vlevel.Add("DragCurve", GetRelativePath(entry.DragCurve.Source, Path.GetDirectoryName(filename))); + vlevel.Add("EfficiencyMap", GetRelativePath(entry.EfficiencyMap.Source, Path.GetDirectoryName(filename))); + vlevels.Add(vlevel); + } + + body.Add("VoltageLevels", vlevels); WriteFile(header, body, filename); } diff --git a/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs index a9c6fab0bb..6658c7cb48 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs @@ -59,7 +59,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(0.15, inputProvider.Inertia.Value(), 1e-6); - var fld = inputProvider.FullLoadCurve; + var fld = inputProvider.VoltageLevels.First().FullLoadCurve; Assert.AreEqual("0", fld.Rows[0][ElectricFullLoadCurveReader.Fields.MotorSpeed]); Assert.AreEqual("401.07", fld.Rows[0][ElectricFullLoadCurveReader.Fields.DrivingTorque]); Assert.AreEqual("-401.07", fld.Rows[0][ElectricFullLoadCurveReader.Fields.GenerationTorque]); @@ -68,7 +68,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(-401.07, fldMap.FullLoadDriveTorque(0.RPMtoRad()).Value()); Assert.AreEqual(401.07, fldMap.FullGenerationTorque(0.RPMtoRad()).Value()); - var pwr = inputProvider.EfficiencyMap; + var pwr = inputProvider.VoltageLevels.First().EfficiencyMap; Assert.AreEqual("0", pwr.Rows[0][ElectricMotorMapReader.Fields.MotorSpeed]); Assert.AreEqual("-800", pwr.Rows[0][ElectricMotorMapReader.Fields.Torque]); Assert.AreEqual("9.8449", pwr.Rows[0][ElectricMotorMapReader.Fields.PowerElectrical]); @@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(0.15, inputProvider.Inertia.Value(), 1e-6); - var fld = inputProvider.FullLoadCurve; + var fld = inputProvider.VoltageLevels.First().FullLoadCurve; Assert.AreEqual("0", fld.Rows[0][ElectricFullLoadCurveReader.Fields.MotorSpeed]); Assert.AreEqual("401.07", fld.Rows[0][ElectricFullLoadCurveReader.Fields.DrivingTorque]); Assert.AreEqual("-401.07", fld.Rows[0][ElectricFullLoadCurveReader.Fields.GenerationTorque]); @@ -100,7 +100,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(-802.14, fldMap.FullLoadDriveTorque(50.RPMtoRad()).Value(), 1e-3); Assert.AreEqual(802.14, fldMap.FullGenerationTorque(50.RPMtoRad()).Value(), 1e-3); - var pwr = inputProvider.EfficiencyMap; + var pwr = inputProvider.VoltageLevels.First().EfficiencyMap; Assert.AreEqual("0", pwr.Rows[0][ElectricMotorMapReader.Fields.MotorSpeed]); Assert.AreEqual("-800", pwr.Rows[0][ElectricMotorMapReader.Fields.Torque]); Assert.AreEqual("9.8449", pwr.Rows[0][ElectricMotorMapReader.Fields.PowerElectrical]); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs index 7e59adc7ea..c20be385c2 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs @@ -267,7 +267,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = motor.Request(absTime, dt, torque.SI<NewtonMeter>(), speed.RPMtoRad()); Assert.IsInstanceOf<ResponseSuccess>(response); - var dragTorque = data.First().Item2.DragCurve.Lookup(speed.RPMtoRad()); + var dragTorque = data.First().Item2.EfficiencyData.VoltageLevels.First().DragCurve.Lookup(speed.RPMtoRad()); var enginePower = speed.RPMtoRad() * (torque.SI<NewtonMeter>() + dragTorque); var motorMechPower = dragTorque * speed.RPMtoRad(); Assert.AreEqual(enginePower.Value(), response.Engine.PowerRequest.Value(), 1e-6); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ElectricMotorEfficienyMapTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ElectricMotorEfficienyMapTest.cs index b8b8a666a4..a861e21b08 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ElectricMotorEfficienyMapTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ElectricMotorEfficienyMapTest.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Linq; using NUnit.Framework; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.JSON; @@ -25,10 +26,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { var inputProvider = JSONInputDataFactory.ReadElectricMotorData(@"TestData\Hybrids\ElectricMotor\GenericEMotor.vem", false); - var fld = inputProvider.FullLoadCurve; + var fld = inputProvider.VoltageLevels.First().FullLoadCurve; var fldMap = ElectricFullLoadCurveReader.Create(fld, 1); - var pwr = inputProvider.EfficiencyMap; + var pwr = inputProvider.VoltageLevels.First().EfficiencyMap; var pwrMap = ElectricMotorMapReader.Create(pwr, 1); var maxEmPwr = batPwr < 0 @@ -50,10 +51,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData { var inputProvider = JSONInputDataFactory.ReadElectricMotorData(@"TestData\Hybrids\ElectricMotor\GenericEMotor.vem", false); - var fld = inputProvider.FullLoadCurve; + var fld = inputProvider.VoltageLevels.First().FullLoadCurve; var fldMap = ElectricFullLoadCurveReader.Create(fld, 1); - var pwr = inputProvider.EfficiencyMap; + var pwr = inputProvider.VoltageLevels.First().EfficiencyMap; var pwrMap = ElectricMotorMapReader.Create(pwr, 1); var maxEmPwr = batPwr < 0 -- GitLab