From 5a69be31b9984cb04af8e68b9eda9abbcd62a11c Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <quaritsch@ivt.tugraz.at> Date: Tue, 7 Feb 2023 13:36:34 +0100 Subject: [PATCH] GUI: load and store rated power of electric motors --- VECTO/GUI/ElectricMotorForm.vb | 4 +++ VECTO/GUI/IEPCForm.vb | 2 ++ VECTO/GUI/IHPCForm.vb | 2 ++ VECTO/GUI/VectoJobForm.vb | 19 +++++++------- VECTO/GUI/VehicleForm.Designer.vb | 25 ++++++++++++++----- VECTO/Input Files/ElectricMachine.vb | 2 +- VECTO/Input Files/IEPCInputData.vb | 7 ++---- VECTO/Input Files/IHPCInputData.vb | 6 +---- .../FileIO/JSON/JSONElectricMotor.cs | 2 +- .../InputData/FileIO/JSON/JSONIEPCData.cs | 2 +- 10 files changed, 42 insertions(+), 29 deletions(-) diff --git a/VECTO/GUI/ElectricMotorForm.vb b/VECTO/GUI/ElectricMotorForm.vb index 23184ba425..4c882c3420 100644 --- a/VECTO/GUI/ElectricMotorForm.vb +++ b/VECTO/GUI/ElectricMotorForm.vb @@ -203,6 +203,8 @@ Public Class ElectricMotorForm tbMapLow.Text = GetRelativePath(voltageLevelLow.PowerMap.First().PowerMap.Source, basePath) tbVoltageLow.Text = voltageLevelLow.VoltageLevel.Value().ToGUIFormat() + tbRatedPower.Text = engine.R85RatedPower.ConvertToKiloWatt().Value.ToGUIFormat() + DeclInit() ElectricMotorFileBrowser.UpdateHistory(file) @@ -261,6 +263,8 @@ Public Class ElectricMotorForm em.PathMapHi = tbMapHi.Text em.VoltageLevelHigh = tbVoltageHi.Text.ToDouble(0) + em.R85RatedPower = tbRatedPower.Text.ToDouble(0).SI(unit.SI.Kilo.Watt).Cast(of Watt)() + If Not em.SaveFile Then MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) Return False diff --git a/VECTO/GUI/IEPCForm.vb b/VECTO/GUI/IEPCForm.vb index cc644dfb0b..c6c20f7b2e 100644 --- a/VECTO/GUI/IEPCForm.vb +++ b/VECTO/GUI/IEPCForm.vb @@ -38,6 +38,7 @@ Public Class IEPCForm cbDesignTypeWheelMotor.Checked = inputData.DesignTypeWheelMotor tbNumberOfDesignTypeWheelMotor.Text = inputData.NrOfDesignTypeWheelMotorMeasured.Value.ToGUIFormat() tbThermalOverload.Text = inputData.OverloadRecoveryFactor.ToGUIFormat() + tbRatedPower.Text = inputData.R85RatedPower.ConvertToKiloWatt().Value.ToGUIFormat() Dim voltageLevel = inputData.VoltageLevels.First() SetFirstVoltageLevel(voltageLevel) @@ -410,6 +411,7 @@ Public Class IEPCForm iepc.SetCommonEntries(tbModel.Text, tbInertia.Text, cbDesignTypeWheelMotor.Checked, tbNumberOfDesignTypeWheelMotor.Text, cbDifferentialIncluded.Checked, tbThermalOverload.Text) + iepc.R85RatedPower = tbRatedPower.Text.ToDouble(0).SI(Unit.SI.Kilo.Watt).Cast(of Watt) iepc.SetVoltageLevelEntries(tbVoltage1.Text, tbContinousTorque1.Text, tbContinousTorqueSpeed1.Text, tbOverloadTime1.Text, tbOverloadTorque1.Text, tboverloadTorqueSpeed1.Text, diff --git a/VECTO/GUI/IHPCForm.vb b/VECTO/GUI/IHPCForm.vb index 9bbd730b56..a6b464447f 100644 --- a/VECTO/GUI/IHPCForm.vb +++ b/VECTO/GUI/IHPCForm.vb @@ -26,6 +26,7 @@ Public Class IHPCForm tbInertia.Text = ihpcData.Inertia.ToGUIFormat() tbThermalOverload.Text = ihpcData.OverloadRecoveryFactor.ToGUIFormat() tbDragCurve.Text = GetRelativePath(ihpcData.DragCurve.Source, Path.GetDirectoryName(_ihpcFilePath)) + tbRatedPower.Text = ihpcData.R85RatedPower.ConvertToKiloWatt().Value.ToGUIFormat() SetVoltageLevelLow(ihpcData.VoltageLevels.First()) SetVoltageLevelHigh(ihpcData.VoltageLevels.Last()) @@ -291,6 +292,7 @@ Public Class IHPCForm Dim ihpcInputData = New IHPCInputData(ihpcFilePath) ihpcInputData.SetCommonEntries(tbModel.Text, tbInertia.Text, tbDragCurve.Text, tbThermalOverload.Text) + ihpcInputData.R85RatedPower = tbRatedPower.Text.ToDouble(0).SI(unit.SI.Kilo.Watt).Cast(of Watt) ihpcInputData.SetVoltageLevelEntries(tbVoltage1.Text, tbContinuousTorque1.Text, tbContinuousTorqueSpeed1.Text, tbOverloadTime1.Text, tbOverloadTorque1.Text, tbOverloadTorqueSpeed1.Text, tbFLCurve1.Text, lvPowerMap1) diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index ef55202ec7..be6b659bff 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -1029,15 +1029,14 @@ Public Class VectoJobForm pnVehicle.Enabled = True pnGearbox.Enabled = True - pnShiftParams.Enabled = True + pnShiftParams.Enabled = not Cfg.DeclMode TabPgADAS.Enabled = True tpAuxiliaries.Enabled = True gbElectricAux.Enabled = True GrAuxMech.Enabled = True pnEngine.Enabled = True - pnShiftParams.Enabled = True - pnHybridStrategy.Enabled = False - gbEngineStopStart.Visible = True + pnHybridStrategy.Enabled = not Cfg.DeclMode + gbEngineStopStart.Visible = not Cfg.DeclMode lblESSUtilityFactorDriving.Visible = True tbESSUtilityFactorDriving.Visible = True lblESSUtilityFactorDrivingUnit.Visible = True @@ -1064,28 +1063,28 @@ Public Class VectoJobForm pnEngine.Enabled = False pnGearbox.Enabled = True GrAuxMech.Enabled = False - pnShiftParams.Enabled = True + pnShiftParams.Enabled = not Cfg.DeclMode gbEngineStopStart.Visible = False Case VectoSimulationJobType.IHPC pnEngine.Enabled = True pnGearbox.Enabled = True GrAuxMech.Enabled = True - pnShiftParams.Enabled = True + pnShiftParams.Enabled = not Cfg.DeclMode gbEngineStopStart.Visible = False - pnHybridStrategy.Enabled = true + pnHybridStrategy.Enabled = not cfg.DeclMode Case VectoSimulationJobType.IEPC_E pnEngine.Enabled = False pnGearbox.Enabled = True GrAuxMech.Enabled = False - pnShiftParams.Enabled = True + pnShiftParams.Enabled = not Cfg.DeclMode gbEngineStopStart.Visible = False Case VectoSimulationJobType.IEPC_S pnEngine.Enabled = True pnGearbox.Enabled = True GrAuxMech.Enabled = False - pnShiftParams.Enabled = True + pnShiftParams.Enabled = not Cfg.DeclMode gbEngineStopStart.Visible = False - pnHybridStrategy.Enabled = true + pnHybridStrategy.Enabled = not Cfg.DeclMode End Select End Sub diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb index 1f544cf63c..2415948423 100644 --- a/VECTO/GUI/VehicleForm.Designer.vb +++ b/VECTO/GUI/VehicleForm.Designer.vb @@ -250,6 +250,7 @@ Partial Class VehicleForm Me.cbLegislativeClass = New System.Windows.Forms.ComboBox() Me.Label21 = New System.Windows.Forms.Label() Me.lblTitle = New System.Windows.Forms.Label() + Me.pnInitialSoC = New System.Windows.Forms.Panel() Me.GroupBox6.SuspendLayout Me.ToolStrip1.SuspendLayout Me.gbRetarderLosses.SuspendLayout @@ -306,6 +307,7 @@ Partial Class VehicleForm Me.gbPTOLossmap.SuspendLayout Me.gbEPTO.SuspendLayout Me.GroupBox5.SuspendLayout + Me.pnInitialSoC.SuspendLayout Me.SuspendLayout ' 'Label1 @@ -1766,13 +1768,11 @@ Partial Class VehicleForm ' 'gbBattery ' + Me.gbBattery.Controls.Add(Me.pnInitialSoC) Me.gbBattery.Controls.Add(Me.lvREESSPacks) Me.gbBattery.Controls.Add(Me.btnAddReessPack) Me.gbBattery.Controls.Add(Me.lblEditReessPack) Me.gbBattery.Controls.Add(Me.btnRemoveReessPack) - Me.gbBattery.Controls.Add(Me.lblInitialSoCUnit) - Me.gbBattery.Controls.Add(Me.tbInitialSoC) - Me.gbBattery.Controls.Add(Me.lblInitialSoC) Me.gbBattery.Location = New System.Drawing.Point(7, 7) Me.gbBattery.Margin = New System.Windows.Forms.Padding(4, 3, 4, 3) Me.gbBattery.Name = "gbBattery" @@ -1847,7 +1847,7 @@ Partial Class VehicleForm 'lblInitialSoCUnit ' Me.lblInitialSoCUnit.AutoSize = true - Me.lblInitialSoCUnit.Location = New System.Drawing.Point(309, 24) + Me.lblInitialSoCUnit.Location = New System.Drawing.Point(304, 5) Me.lblInitialSoCUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblInitialSoCUnit.Name = "lblInitialSoCUnit" Me.lblInitialSoCUnit.Size = New System.Drawing.Size(25, 15) @@ -1856,7 +1856,7 @@ Partial Class VehicleForm ' 'tbInitialSoC ' - Me.tbInitialSoC.Location = New System.Drawing.Point(238, 22) + Me.tbInitialSoC.Location = New System.Drawing.Point(233, 3) Me.tbInitialSoC.Margin = New System.Windows.Forms.Padding(4, 3, 4, 3) Me.tbInitialSoC.Name = "tbInitialSoC" Me.tbInitialSoC.Size = New System.Drawing.Size(68, 23) @@ -1865,7 +1865,7 @@ Partial Class VehicleForm 'lblInitialSoC ' Me.lblInitialSoC.AutoSize = true - Me.lblInitialSoC.Location = New System.Drawing.Point(8, 25) + Me.lblInitialSoC.Location = New System.Drawing.Point(3, 6) Me.lblInitialSoC.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblInitialSoC.Name = "lblInitialSoC" Me.lblInitialSoC.RightToLeft = System.Windows.Forms.RightToLeft.Yes @@ -2641,6 +2641,16 @@ Partial Class VehicleForm Me.lblTitle.TabIndex = 43 Me.lblTitle.Text = "Vehicle TITLE" ' + 'pnInitialSoC + ' + Me.pnInitialSoC.Controls.Add(Me.tbInitialSoC) + Me.pnInitialSoC.Controls.Add(Me.lblInitialSoC) + Me.pnInitialSoC.Controls.Add(Me.lblInitialSoCUnit) + Me.pnInitialSoC.Location = New System.Drawing.Point(7, 22) + Me.pnInitialSoC.Name = "pnInitialSoC" + Me.pnInitialSoC.Size = New System.Drawing.Size(351, 28) + Me.pnInitialSoC.TabIndex = 4 + ' 'VehicleForm ' Me.AcceptButton = Me.ButOK @@ -2760,6 +2770,8 @@ Partial Class VehicleForm Me.gbEPTO.ResumeLayout(false) Me.GroupBox5.ResumeLayout(false) Me.GroupBox5.PerformLayout + Me.pnInitialSoC.ResumeLayout(false) + Me.pnInitialSoC.PerformLayout Me.ResumeLayout(false) Me.PerformLayout @@ -2996,5 +3008,6 @@ End Sub Friend WithEvents gbPTOICEGroupBox As GroupBox Friend WithEvents cbPTOStandstillCycleType As ComboBox Friend WithEvents FlowLayoutPanel4 As FlowLayoutPanel + Friend WithEvents pnInitialSoC As Panel '>>>>>>> VECTO_CERT/master End Class diff --git a/VECTO/Input Files/ElectricMachine.vb b/VECTO/Input Files/ElectricMachine.vb index 14bf115c32..47d06ba7e9 100644 --- a/VECTO/Input Files/ElectricMachine.vb +++ b/VECTO/Input Files/ElectricMachine.vb @@ -274,7 +274,7 @@ Public Class ElectricMachine End Property Public ReadOnly Property ElectricMachineType As ElectricMachineType Implements IElectricMotorDeclarationInputData.ElectricMachineType - Public ReadOnly Property R85RatedPower As Watt Implements IElectricMotorDeclarationInputData.R85RatedPower + Public Property R85RatedPower As Watt Implements IElectricMotorDeclarationInputData.R85RatedPower Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia Get diff --git a/VECTO/Input Files/IEPCInputData.vb b/VECTO/Input Files/IEPCInputData.vb index f135608ae9..6f3782364b 100644 --- a/VECTO/Input Files/IEPCInputData.vb +++ b/VECTO/Input Files/IEPCInputData.vb @@ -195,11 +195,8 @@ Public Class IEPCInputData End Get End Property - Public ReadOnly Property R85RatedPower As Watt Implements IIEPCDeclarationInputData.R85RatedPower - Get - Return Nothing - End Get - End Property + Public Property R85RatedPower As Watt Implements IIEPCDeclarationInputData.R85RatedPower + Public ReadOnly Property Inertia As KilogramSquareMeter Implements IIEPCDeclarationInputData.Inertia Get diff --git a/VECTO/Input Files/IHPCInputData.vb b/VECTO/Input Files/IHPCInputData.vb index 69f24a0f61..308a942db2 100644 --- a/VECTO/Input Files/IHPCInputData.vb +++ b/VECTO/Input Files/IHPCInputData.vb @@ -158,11 +158,7 @@ Public Class IHPCInputData End Get End Property - Public ReadOnly Property R85RatedPower As Watt Implements IElectricMotorDeclarationInputData.R85RatedPower - Get - Return Nothing - End Get - End Property + Public Property R85RatedPower As Watt Implements IElectricMotorDeclarationInputData.R85RatedPower Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia Get diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs index d31536374c..ee01b6436e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs @@ -220,7 +220,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public ElectricMachineType ElectricMachineType { get; } - public Watt R85RatedPower => !SavedInDeclarationMode ? null : Body.GetEx<double>("R85RatedPower").SI<Watt>(); + public Watt R85RatedPower => Body.ContainsKey("R85RatedPower") ? Body.GetEx<double>("R85RatedPower").SI<Watt>() : 0.SI<Watt>(); public virtual KilogramSquareMeter Inertia => Body.GetEx<double>("Inertia").SI<KilogramSquareMeter>(); //public virtual Joule OverloadBuffer => Body.GetValueOrDefault<double>("ThermalOverloadBuffer")?.SI(Unit.SI.Mega.Joule).Cast<Joule>() ?? 1e18.SI<Joule>(); diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs index 8dfbb6da4f..53698fbbb3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONIEPCData.cs @@ -43,7 +43,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region Implementation of IIEPCDeclarationInputData public ElectricMachineType ElectricMachineType { get; } - public Watt R85RatedPower => null; + public Watt R85RatedPower => Body.ContainsKey("R85RatedPower") ? Body.GetEx<double>("R85RatedPower").SI<Watt>() : 0.SI<Watt>(); public KilogramSquareMeter Inertia => Body.GetEx<double>(JsonKeys.IEPC_Inertia).SI<KilogramSquareMeter>(); public bool DifferentialIncluded => Body.GetEx<bool>(JsonKeys.IEPC_DifferentialIncluded); public bool DesignTypeWheelMotor => Body.GetEx<bool>(JsonKeys.IEPC_DesignTypeWheelMotor); -- GitLab