From d4eeb0674748555e7a4ba1c07adb4fef015e4c8f Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Fri, 18 Sep 2020 09:28:01 +0200 Subject: [PATCH] implementing supercap as storage type --- VECTO.sln.DotSettings | 4 +- VECTO/File Browser/FileBrowserModule.vb | 2 +- VECTO/GUI/BatteryForm.Designer.vb | 486 ++++++++++++++---- VECTO/GUI/BatteryForm.vb | 164 ++++-- VECTO/GUI/HybridStratebyParamsForm.vb | 2 +- VECTO/GUI/MainForm.vb | 4 +- VECTO/GUI/VehicleForm.vb | 6 +- VECTO/Input Files/Battery.vb | 11 +- VECTO/Input Files/SuperCap.vb | 153 ++++++ VECTO/Input Files/Vehicle.vb | 18 +- .../InputData/DeclarationInputData.cs | 28 +- .../InputData/EngineeringInputData.cs | 7 +- VectoCommon/VectoCommon/Models/IResponse.cs | 14 +- VectoCommon/VectoCommon/Utils/SI.cs | 28 + .../InputData/FileIO/JSON/JSONBattery.cs | 49 +- .../FileIO/JSON/JSONComponentInputData.cs | 4 +- .../FileIO/JSON/JSONElectricMotor.cs | 6 +- .../FileIO/JSON/JSONInputDataFactory.cs | 2 +- .../InputData/FileIO/JSON/JSONSubComponent.cs | 7 +- .../InputData/FileIO/JSON/JSONVehicleData.cs | 2 +- .../EngineeringDataAdapter.cs | 35 +- .../EngineeringModeVectoRunDataFactory.cs | 3 + ...yPort.cs => IElectricEnergyStoragePort.cs} | 16 +- .../Connector/Ports/Impl/BatteryResponse.cs | 36 +- .../Simulation/Data/ModalResultField.cs | 20 +- .../Models/Simulation/Data/VectoRunData.cs | 3 + .../Models/Simulation/DataBus/IDataBus.cs | 2 +- .../DataBus/{IBatteryInfo.cs => IRESSInfo.cs} | 4 +- .../Simulation/Impl/PowertrainBuilder.cs | 18 +- .../Simulation/Impl/VehicleContainer.cs | 4 +- .../Data/Battery/BatteryData.cs | 12 + .../Data/ElectricMotor/ElectricMotorData.cs | 7 + .../SimulationComponent/ElectricSystem.cs | 26 +- ...{IBattery.cs => IElectricEnergyStorage.cs} | 2 +- .../SimulationComponent/Impl/Battery.cs | 113 ++-- .../Impl/ElectricAuxiliary.cs | 4 +- .../SimulationComponent/Impl/SuperCap.cs | 199 +++++++ .../Strategies/HybridStrategy.cs | 99 ++-- .../OutputData/FileIO/JSONFileWriter.cs | 29 +- .../OutputData/IModalDataContainer.cs | 8 +- .../OutputData/ModalDataContainer.cs | 28 +- .../OutputData/SummaryDataContainer.cs | 2 +- VectoCore/VectoCore/VectoCore.csproj | 7 +- .../FileIO/JsonReadHybridTest.cs | 11 +- .../Models/SimulationComponent/BatteryTest.cs | 50 +- .../SimulationComponent/ElectricMotorTest.cs | 22 +- .../SimulationComponent/SuperCapTest.cs | 57 ++ .../Hybrids/ElectricMotor/GenericEMotor.vem | 2 +- VectoCore/VectoCoreTest/Utils/MockBattery.cs | 22 +- .../Utils/MockBatteryInputData.cs | 4 +- .../Utils/MockElectricConsumer.cs | 2 +- .../Utils/MockSimulationDataFactory.cs | 4 +- .../Utils/MockVehicleContainer.cs | 2 +- VectoCore/VectoCoreTest/VectoCoreTest.csproj | 1 + 54 files changed, 1416 insertions(+), 435 deletions(-) create mode 100644 VECTO/Input Files/SuperCap.vb rename VectoCore/VectoCore/Models/Connector/Ports/{IBatteryPort.cs => IElectricEnergyStoragePort.cs} (70%) rename VectoCore/VectoCore/Models/Simulation/DataBus/{IBatteryInfo.cs => IRESSInfo.cs} (80%) rename VectoCore/VectoCore/Models/SimulationComponent/{IBattery.cs => IElectricEnergyStorage.cs} (88%) create mode 100644 VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs create mode 100644 VectoCore/VectoCoreTest/Models/SimulationComponent/SuperCapTest.cs diff --git a/VECTO.sln.DotSettings b/VECTO.sln.DotSettings index cc03e9861f..f44930e081 100644 --- a/VECTO.sln.DotSettings +++ b/VECTO.sln.DotSettings @@ -43,6 +43,7 @@ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PT/@EntryIndexedValue">PT</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PTO/@EntryIndexedValue">PTO</s:String> + <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RESS/@EntryIndexedValue">RESS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RP/@EntryIndexedValue">RP</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SI/@EntryIndexedValue">SI</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VTP/@EntryIndexedValue">VTP</s:String> @@ -118,4 +119,5 @@ <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EFormat_002ESettingsUpgrade_002EAlignmentTabFillStyleMigration/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsParsFormattingSettingsUpgrader/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean> - <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> + <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=RESS/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> diff --git a/VECTO/File Browser/FileBrowserModule.vb b/VECTO/File Browser/FileBrowserModule.vb index 7109cce430..1b908b59c1 100644 --- a/VECTO/File Browser/FileBrowserModule.vb +++ b/VECTO/File Browser/FileBrowserModule.vb @@ -58,5 +58,5 @@ Public Module FileBrowserModule Public ModalResultsFileBrowser As FileBrowser Public ElectricMotorFileBrowser As FileBrowser - Public BatteryFileBrowser As FileBrowser + Public REESSFileBrowser As FileBrowser End Module diff --git a/VECTO/GUI/BatteryForm.Designer.vb b/VECTO/GUI/BatteryForm.Designer.vb index 20061845e6..8943d974cc 100644 --- a/VECTO/GUI/BatteryForm.Designer.vb +++ b/VECTO/GUI/BatteryForm.Designer.vb @@ -82,6 +82,27 @@ Partial Class BatteryForm Me.lblCFactor = New System.Windows.Forms.Label() Me.lblCFactorUnit = New System.Windows.Forms.Label() Me.tbCFactor = New System.Windows.Forms.TextBox() + Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel() + Me.pnBattery = New System.Windows.Forms.Panel() + Me.pnSuperCap = New System.Windows.Forms.Panel() + Me.pnSuperCapMaxV = New System.Windows.Forms.Panel() + Me.lblSuperCapMaxV = New System.Windows.Forms.Label() + Me.lblSuperCapMaxVUnit = New System.Windows.Forms.Label() + Me.tbSuperCapMaxV = New System.Windows.Forms.TextBox() + Me.pnSuperCapMinV = New System.Windows.Forms.Panel() + Me.lblSuperCapMinV = New System.Windows.Forms.Label() + Me.lblSuperCapMinVUnit = New System.Windows.Forms.Label() + Me.tbSuperCapMinV = New System.Windows.Forms.TextBox() + Me.pnSuperCapResistance = New System.Windows.Forms.Panel() + Me.lblSuperCapRi = New System.Windows.Forms.Label() + Me.lblSuperCapRiUnit = New System.Windows.Forms.Label() + Me.tbSuperCapRi = New System.Windows.Forms.TextBox() + Me.pnSuperCapCapacity = New System.Windows.Forms.Panel() + Me.lblSuperCapCapacity = New System.Windows.Forms.Label() + Me.lblSuperCapCapacityUnit = New System.Windows.Forms.Label() + Me.tbSuperCapCapacity = New System.Windows.Forms.TextBox() + Me.cbRESSType = New System.Windows.Forms.ComboBox() + Me.lblRessType = New System.Windows.Forms.Label() Me.ToolStrip1.SuspendLayout Me.StatusStrip1.SuspendLayout CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit @@ -91,30 +112,40 @@ Partial Class BatteryForm Me.Panel1.SuspendLayout Me.Panel2.SuspendLayout Me.Panel3.SuspendLayout + Me.FlowLayoutPanel1.SuspendLayout + Me.pnBattery.SuspendLayout + Me.pnSuperCap.SuspendLayout + Me.pnSuperCapMaxV.SuspendLayout + Me.pnSuperCapMinV.SuspendLayout + Me.pnSuperCapResistance.SuspendLayout + Me.pnSuperCapCapacity.SuspendLayout Me.SuspendLayout ' 'tbCapacity ' - Me.tbCapacity.Location = New System.Drawing.Point(90, 4) + Me.tbCapacity.Location = New System.Drawing.Point(135, 6) + Me.tbCapacity.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbCapacity.Name = "tbCapacity" - Me.tbCapacity.Size = New System.Drawing.Size(57, 20) + Me.tbCapacity.Size = New System.Drawing.Size(84, 26) Me.tbCapacity.TabIndex = 3 ' 'lblCapacityUnit ' Me.lblCapacityUnit.AutoSize = true - Me.lblCapacityUnit.Location = New System.Drawing.Point(153, 7) + Me.lblCapacityUnit.Location = New System.Drawing.Point(230, 11) + Me.lblCapacityUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblCapacityUnit.Name = "lblCapacityUnit" - Me.lblCapacityUnit.Size = New System.Drawing.Size(26, 13) + Me.lblCapacityUnit.Size = New System.Drawing.Size(37, 20) Me.lblCapacityUnit.TabIndex = 24 Me.lblCapacityUnit.Text = "[Ah]" ' 'lblCapacity ' Me.lblCapacity.AutoSize = true - Me.lblCapacity.Location = New System.Drawing.Point(3, 7) + Me.lblCapacity.Location = New System.Drawing.Point(4, 11) + Me.lblCapacity.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblCapacity.Name = "lblCapacity" - Me.lblCapacity.Size = New System.Drawing.Size(48, 13) + Me.lblCapacity.Size = New System.Drawing.Size(70, 20) Me.lblCapacity.TabIndex = 0 Me.lblCapacity.Text = "Capacity" ' @@ -122,9 +153,10 @@ Partial Class BatteryForm ' 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, 303) + Me.ButCancel.Location = New System.Drawing.Point(1216, 482) + Me.ButCancel.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ButCancel.Name = "ButCancel" - Me.ButCancel.Size = New System.Drawing.Size(75, 23) + Me.ButCancel.Size = New System.Drawing.Size(112, 35) Me.ButCancel.TabIndex = 13 Me.ButCancel.Text = "Cancel" Me.ButCancel.UseVisualStyleBackColor = true @@ -132,9 +164,10 @@ Partial Class BatteryForm '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, 303) + Me.ButOK.Location = New System.Drawing.Point(1095, 482) + Me.ButOK.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ButOK.Name = "ButOK" - Me.ButOK.Size = New System.Drawing.Size(75, 23) + Me.ButOK.Size = New System.Drawing.Size(112, 35) Me.ButOK.TabIndex = 12 Me.ButOK.Text = "Save" Me.ButOK.UseVisualStyleBackColor = true @@ -142,10 +175,12 @@ Partial Class BatteryForm 'ToolStrip1 ' Me.ToolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden + Me.ToolStrip1.ImageScalingSize = New System.Drawing.Size(24, 24) Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator3, Me.ToolStripBtSendTo, Me.ToolStripSeparator1, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(898, 25) + Me.ToolStrip1.Padding = New System.Windows.Forms.Padding(0, 0, 3, 0) + Me.ToolStrip1.Size = New System.Drawing.Size(1347, 33) Me.ToolStrip1.TabIndex = 30 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -155,7 +190,7 @@ Partial Class BatteryForm Me.ToolStripBtNew.Image = Global.TUGraz.VECTO.My.Resources.Resources.blue_document_icon Me.ToolStripBtNew.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtNew.Name = "ToolStripBtNew" - Me.ToolStripBtNew.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtNew.Size = New System.Drawing.Size(34, 28) Me.ToolStripBtNew.Text = "ToolStripButton1" Me.ToolStripBtNew.ToolTipText = "New" ' @@ -165,7 +200,7 @@ Partial Class BatteryForm Me.ToolStripBtOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon Me.ToolStripBtOpen.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtOpen.Name = "ToolStripBtOpen" - Me.ToolStripBtOpen.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtOpen.Size = New System.Drawing.Size(34, 28) Me.ToolStripBtOpen.Text = "ToolStripButton1" Me.ToolStripBtOpen.ToolTipText = "Open..." ' @@ -175,7 +210,7 @@ Partial Class BatteryForm Me.ToolStripBtSave.Image = Global.TUGraz.VECTO.My.Resources.Resources.Actions_document_save_icon Me.ToolStripBtSave.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSave.Name = "ToolStripBtSave" - Me.ToolStripBtSave.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtSave.Size = New System.Drawing.Size(34, 28) Me.ToolStripBtSave.Text = "ToolStripButton1" Me.ToolStripBtSave.ToolTipText = "Save" ' @@ -185,14 +220,14 @@ Partial Class BatteryForm Me.ToolStripBtSaveAs.Image = Global.TUGraz.VECTO.My.Resources.Resources.Actions_document_save_as_icon Me.ToolStripBtSaveAs.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSaveAs.Name = "ToolStripBtSaveAs" - Me.ToolStripBtSaveAs.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtSaveAs.Size = New System.Drawing.Size(34, 28) Me.ToolStripBtSaveAs.Text = "ToolStripButton1" Me.ToolStripBtSaveAs.ToolTipText = "Save As..." ' 'ToolStripSeparator3 ' Me.ToolStripSeparator3.Name = "ToolStripSeparator3" - Me.ToolStripSeparator3.Size = New System.Drawing.Size(6, 25) + Me.ToolStripSeparator3.Size = New System.Drawing.Size(6, 33) ' 'ToolStripBtSendTo ' @@ -200,14 +235,14 @@ Partial Class BatteryForm Me.ToolStripBtSendTo.Image = Global.TUGraz.VECTO.My.Resources.Resources.export_icon Me.ToolStripBtSendTo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSendTo.Name = "ToolStripBtSendTo" - Me.ToolStripBtSendTo.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtSendTo.Size = New System.Drawing.Size(34, 28) Me.ToolStripBtSendTo.Text = "Send to Job Editor" Me.ToolStripBtSendTo.ToolTipText = "Send to Job Editor" ' 'ToolStripSeparator1 ' Me.ToolStripSeparator1.Name = "ToolStripSeparator1" - Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 25) + Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 33) ' 'ToolStripButton1 ' @@ -215,15 +250,17 @@ Partial Class BatteryForm Me.ToolStripButton1.Image = Global.TUGraz.VECTO.My.Resources.Resources.Help_icon Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripButton1.Name = "ToolStripButton1" - Me.ToolStripButton1.Size = New System.Drawing.Size(23, 22) + Me.ToolStripButton1.Size = New System.Drawing.Size(34, 28) Me.ToolStripButton1.Text = "Help" ' 'StatusStrip1 ' + 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, 329) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 524) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(898, 22) + Me.StatusStrip1.Padding = New System.Windows.Forms.Padding(2, 0, 21, 0) + Me.StatusStrip1.Size = New System.Drawing.Size(1347, 32) Me.StatusStrip1.SizingGrip = false Me.StatusStrip1.TabIndex = 37 Me.StatusStrip1.Text = "StatusStrip1" @@ -231,22 +268,24 @@ Partial Class BatteryForm 'LbStatus ' Me.LbStatus.Name = "LbStatus" - Me.LbStatus.Size = New System.Drawing.Size(39, 17) + Me.LbStatus.Size = New System.Drawing.Size(60, 25) Me.LbStatus.Text = "Status" ' 'tbMakeModel ' - Me.tbMakeModel.Location = New System.Drawing.Point(109, 82) + Me.tbMakeModel.Location = New System.Drawing.Point(164, 126) + Me.tbMakeModel.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbMakeModel.Name = "tbMakeModel" - Me.tbMakeModel.Size = New System.Drawing.Size(370, 20) + Me.tbMakeModel.Size = New System.Drawing.Size(553, 26) Me.tbMakeModel.TabIndex = 0 ' 'lblMakeModel ' Me.lblMakeModel.AutoSize = true - Me.lblMakeModel.Location = New System.Drawing.Point(16, 85) + Me.lblMakeModel.Location = New System.Drawing.Point(24, 131) + Me.lblMakeModel.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblMakeModel.Name = "lblMakeModel" - Me.lblMakeModel.Size = New System.Drawing.Size(87, 13) + Me.lblMakeModel.Size = New System.Drawing.Size(126, 20) Me.lblMakeModel.TabIndex = 11 Me.lblMakeModel.Text = "Make and Model" ' @@ -254,28 +293,30 @@ Partial Class BatteryForm ' Me.PictureBox1.BackColor = System.Drawing.Color.White Me.PictureBox1.Image = Global.TUGraz.VECTO.My.Resources.Resources.VECTO_ENG - Me.PictureBox1.Location = New System.Drawing.Point(0, 28) + Me.PictureBox1.Location = New System.Drawing.Point(0, 43) + Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.PictureBox1.Name = "PictureBox1" - Me.PictureBox1.Size = New System.Drawing.Size(502, 40) + Me.PictureBox1.Size = New System.Drawing.Size(753, 62) Me.PictureBox1.TabIndex = 39 Me.PictureBox1.TabStop = false ' 'CmOpenFile ' + Me.CmOpenFile.ImageScalingSize = New System.Drawing.Size(24, 24) Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) + Me.CmOpenFile.Size = New System.Drawing.Size(203, 68) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(202, 32) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(202, 32) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' 'pnInertia @@ -283,33 +324,37 @@ Partial Class BatteryForm Me.pnInertia.Controls.Add(Me.lblCapacity) Me.pnInertia.Controls.Add(Me.lblCapacityUnit) Me.pnInertia.Controls.Add(Me.tbCapacity) - Me.pnInertia.Location = New System.Drawing.Point(12, 108) + Me.pnInertia.Location = New System.Drawing.Point(4, 5) + Me.pnInertia.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.pnInertia.Name = "pnInertia" - Me.pnInertia.Size = New System.Drawing.Size(212, 30) + Me.pnInertia.Size = New System.Drawing.Size(318, 46) Me.pnInertia.TabIndex = 3 ' 'tbSoCCurve ' - Me.tbSoCCurve.Location = New System.Drawing.Point(12, 219) + Me.tbSoCCurve.Location = New System.Drawing.Point(4, 176) + Me.tbSoCCurve.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbSoCCurve.Name = "tbSoCCurve" - Me.tbSoCCurve.Size = New System.Drawing.Size(434, 20) + Me.tbSoCCurve.Size = New System.Drawing.Size(649, 26) Me.tbSoCCurve.TabIndex = 5 ' 'lblSoCCurve ' Me.lblSoCCurve.AutoSize = true - Me.lblSoCCurve.Location = New System.Drawing.Point(12, 203) + Me.lblSoCCurve.Location = New System.Drawing.Point(4, 151) + Me.lblSoCCurve.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSoCCurve.Name = "lblSoCCurve" - Me.lblSoCCurve.Size = New System.Drawing.Size(58, 13) + Me.lblSoCCurve.Size = New System.Drawing.Size(85, 20) Me.lblSoCCurve.TabIndex = 38 Me.lblSoCCurve.Text = "SoC Curve" ' 'btnBrowseSoCCurve ' Me.btnBrowseSoCCurve.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.btnBrowseSoCCurve.Location = New System.Drawing.Point(446, 217) + Me.btnBrowseSoCCurve.Location = New System.Drawing.Point(655, 173) + Me.btnBrowseSoCCurve.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.btnBrowseSoCCurve.Name = "btnBrowseSoCCurve" - Me.btnBrowseSoCCurve.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseSoCCurve.Size = New System.Drawing.Size(36, 37) Me.btnBrowseSoCCurve.TabIndex = 6 Me.btnBrowseSoCCurve.TabStop = false Me.btnBrowseSoCCurve.UseVisualStyleBackColor = true @@ -317,9 +362,10 @@ Partial Class BatteryForm 'btnSoCCurveOpen ' Me.btnSoCCurveOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.btnSoCCurveOpen.Location = New System.Drawing.Point(469, 217) + Me.btnSoCCurveOpen.Location = New System.Drawing.Point(690, 173) + Me.btnSoCCurveOpen.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.btnSoCCurveOpen.Name = "btnSoCCurveOpen" - Me.btnSoCCurveOpen.Size = New System.Drawing.Size(24, 24) + Me.btnSoCCurveOpen.Size = New System.Drawing.Size(36, 37) Me.btnSoCCurveOpen.TabIndex = 7 Me.btnSoCCurveOpen.TabStop = false Me.btnSoCCurveOpen.UseVisualStyleBackColor = true @@ -327,9 +373,10 @@ Partial Class BatteryForm 'btnRiMapOpen ' Me.btnRiMapOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.btnRiMapOpen.Location = New System.Drawing.Point(469, 263) + Me.btnRiMapOpen.Location = New System.Drawing.Point(690, 244) + Me.btnRiMapOpen.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.btnRiMapOpen.Name = "btnRiMapOpen" - Me.btnRiMapOpen.Size = New System.Drawing.Size(24, 24) + Me.btnRiMapOpen.Size = New System.Drawing.Size(36, 37) Me.btnRiMapOpen.TabIndex = 42 Me.btnRiMapOpen.TabStop = false Me.btnRiMapOpen.UseVisualStyleBackColor = true @@ -337,9 +384,10 @@ Partial Class BatteryForm 'btnBrowseRiMap ' Me.btnBrowseRiMap.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.btnBrowseRiMap.Location = New System.Drawing.Point(446, 263) + Me.btnBrowseRiMap.Location = New System.Drawing.Point(655, 244) + Me.btnBrowseRiMap.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.btnBrowseRiMap.Name = "btnBrowseRiMap" - Me.btnBrowseRiMap.Size = New System.Drawing.Size(24, 24) + Me.btnBrowseRiMap.Size = New System.Drawing.Size(36, 37) Me.btnBrowseRiMap.TabIndex = 41 Me.btnBrowseRiMap.TabStop = false Me.btnBrowseRiMap.UseVisualStyleBackColor = true @@ -347,17 +395,19 @@ Partial Class BatteryForm 'lblRiMap ' Me.lblRiMap.AutoSize = true - Me.lblRiMap.Location = New System.Drawing.Point(12, 249) + Me.lblRiMap.Location = New System.Drawing.Point(4, 222) + Me.lblRiMap.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblRiMap.Name = "lblRiMap" - Me.lblRiMap.Size = New System.Drawing.Size(129, 13) + Me.lblRiMap.Size = New System.Drawing.Size(192, 20) Me.lblRiMap.TabIndex = 43 Me.lblRiMap.Text = "Internal Resistance Curve" ' 'tbRiCurve ' - Me.tbRiCurve.Location = New System.Drawing.Point(12, 265) + Me.tbRiCurve.Location = New System.Drawing.Point(4, 247) + Me.tbRiCurve.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbRiCurve.Name = "tbRiCurve" - Me.tbRiCurve.Size = New System.Drawing.Size(434, 20) + Me.tbRiCurve.Size = New System.Drawing.Size(649, 26) Me.tbRiCurve.TabIndex = 40 ' 'lblTitle @@ -365,9 +415,10 @@ Partial Class BatteryForm Me.lblTitle.AutoSize = true Me.lblTitle.BackColor = System.Drawing.Color.White Me.lblTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 18!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - Me.lblTitle.Location = New System.Drawing.Point(119, 35) + Me.lblTitle.Location = New System.Drawing.Point(178, 54) + Me.lblTitle.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblTitle.Name = "lblTitle" - Me.lblTitle.Size = New System.Drawing.Size(266, 29) + Me.lblTitle.Size = New System.Drawing.Size(395, 40) Me.lblTitle.TabIndex = 48 Me.lblTitle.Text = "Electric Energy Storage" ' @@ -375,9 +426,10 @@ Partial Class BatteryForm ' Me.PicBox.BackColor = System.Drawing.Color.LightGray Me.PicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PicBox.Location = New System.Drawing.Point(508, 28) + Me.PicBox.Location = New System.Drawing.Point(762, 43) + Me.PicBox.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.PicBox.Name = "PicBox" - Me.PicBox.Size = New System.Drawing.Size(382, 266) + Me.PicBox.Size = New System.Drawing.Size(572, 408) Me.PicBox.TabIndex = 49 Me.PicBox.TabStop = false ' @@ -386,34 +438,38 @@ Partial Class BatteryForm Me.Panel1.Controls.Add(Me.lblMinSoc) Me.Panel1.Controls.Add(Me.lblSoCMinUnit) Me.Panel1.Controls.Add(Me.tbSoCMin) - Me.Panel1.Location = New System.Drawing.Point(12, 144) + Me.Panel1.Location = New System.Drawing.Point(4, 61) + Me.Panel1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(212, 30) + Me.Panel1.Size = New System.Drawing.Size(318, 46) Me.Panel1.TabIndex = 25 ' 'lblMinSoc ' Me.lblMinSoc.AutoSize = true - Me.lblMinSoc.Location = New System.Drawing.Point(3, 7) + Me.lblMinSoc.Location = New System.Drawing.Point(4, 11) + Me.lblMinSoc.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblMinSoc.Name = "lblMinSoc" - Me.lblMinSoc.Size = New System.Drawing.Size(46, 13) + Me.lblMinSoc.Size = New System.Drawing.Size(69, 20) Me.lblMinSoc.TabIndex = 0 Me.lblMinSoc.Text = "SoC min" ' 'lblSoCMinUnit ' Me.lblSoCMinUnit.AutoSize = true - Me.lblSoCMinUnit.Location = New System.Drawing.Point(153, 7) + Me.lblSoCMinUnit.Location = New System.Drawing.Point(230, 11) + Me.lblSoCMinUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSoCMinUnit.Name = "lblSoCMinUnit" - Me.lblSoCMinUnit.Size = New System.Drawing.Size(21, 13) + Me.lblSoCMinUnit.Size = New System.Drawing.Size(31, 20) Me.lblSoCMinUnit.TabIndex = 24 Me.lblSoCMinUnit.Text = "[%]" ' 'tbSoCMin ' - Me.tbSoCMin.Location = New System.Drawing.Point(90, 4) + Me.tbSoCMin.Location = New System.Drawing.Point(135, 6) + Me.tbSoCMin.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbSoCMin.Name = "tbSoCMin" - Me.tbSoCMin.Size = New System.Drawing.Size(57, 20) + Me.tbSoCMin.Size = New System.Drawing.Size(84, 26) Me.tbSoCMin.TabIndex = 3 ' 'Panel2 @@ -421,34 +477,38 @@ Partial Class BatteryForm Me.Panel2.Controls.Add(Me.lblSoCMax) Me.Panel2.Controls.Add(Me.lblSoCMaxUnit) Me.Panel2.Controls.Add(Me.tbSoCMax) - Me.Panel2.Location = New System.Drawing.Point(234, 144) + Me.Panel2.Location = New System.Drawing.Point(337, 61) + Me.Panel2.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(212, 30) + Me.Panel2.Size = New System.Drawing.Size(318, 46) Me.Panel2.TabIndex = 25 ' 'lblSoCMax ' Me.lblSoCMax.AutoSize = true - Me.lblSoCMax.Location = New System.Drawing.Point(3, 7) + Me.lblSoCMax.Location = New System.Drawing.Point(4, 11) + Me.lblSoCMax.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSoCMax.Name = "lblSoCMax" - Me.lblSoCMax.Size = New System.Drawing.Size(49, 13) + Me.lblSoCMax.Size = New System.Drawing.Size(73, 20) Me.lblSoCMax.TabIndex = 0 Me.lblSoCMax.Text = "SoC max" ' 'lblSoCMaxUnit ' Me.lblSoCMaxUnit.AutoSize = true - Me.lblSoCMaxUnit.Location = New System.Drawing.Point(153, 7) + Me.lblSoCMaxUnit.Location = New System.Drawing.Point(230, 11) + Me.lblSoCMaxUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSoCMaxUnit.Name = "lblSoCMaxUnit" - Me.lblSoCMaxUnit.Size = New System.Drawing.Size(21, 13) + Me.lblSoCMaxUnit.Size = New System.Drawing.Size(31, 20) Me.lblSoCMaxUnit.TabIndex = 24 Me.lblSoCMaxUnit.Text = "[%]" ' 'tbSoCMax ' - Me.tbSoCMax.Location = New System.Drawing.Point(90, 4) + Me.tbSoCMax.Location = New System.Drawing.Point(135, 6) + Me.tbSoCMax.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbSoCMax.Name = "tbSoCMax" - Me.tbSoCMax.Size = New System.Drawing.Size(57, 20) + Me.tbSoCMax.Size = New System.Drawing.Size(84, 26) Me.tbSoCMax.TabIndex = 3 ' 'Panel3 @@ -456,66 +516,275 @@ Partial Class BatteryForm Me.Panel3.Controls.Add(Me.lblCFactor) Me.Panel3.Controls.Add(Me.lblCFactorUnit) Me.Panel3.Controls.Add(Me.tbCFactor) - Me.Panel3.Location = New System.Drawing.Point(234, 108) + Me.Panel3.Location = New System.Drawing.Point(337, 5) + Me.Panel3.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.Panel3.Name = "Panel3" - Me.Panel3.Size = New System.Drawing.Size(212, 30) + Me.Panel3.Size = New System.Drawing.Size(318, 46) Me.Panel3.TabIndex = 25 ' 'lblCFactor ' Me.lblCFactor.AutoSize = true - Me.lblCFactor.Location = New System.Drawing.Point(3, 7) + Me.lblCFactor.Location = New System.Drawing.Point(4, 11) + Me.lblCFactor.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblCFactor.Name = "lblCFactor" - Me.lblCFactor.Size = New System.Drawing.Size(47, 13) + Me.lblCFactor.Size = New System.Drawing.Size(71, 20) Me.lblCFactor.TabIndex = 0 Me.lblCFactor.Text = "C-Factor" ' 'lblCFactorUnit ' Me.lblCFactorUnit.AutoSize = true - Me.lblCFactorUnit.Location = New System.Drawing.Point(153, 7) + Me.lblCFactorUnit.Location = New System.Drawing.Point(230, 11) + Me.lblCFactorUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblCFactorUnit.Name = "lblCFactorUnit" - Me.lblCFactorUnit.Size = New System.Drawing.Size(16, 13) + Me.lblCFactorUnit.Size = New System.Drawing.Size(39, 20) Me.lblCFactorUnit.TabIndex = 24 - Me.lblCFactorUnit.Text = "[-]" + Me.lblCFactorUnit.Text = "[1/h]" ' 'tbCFactor ' - Me.tbCFactor.Location = New System.Drawing.Point(90, 4) + Me.tbCFactor.Location = New System.Drawing.Point(135, 6) + Me.tbCFactor.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.tbCFactor.Name = "tbCFactor" - Me.tbCFactor.Size = New System.Drawing.Size(57, 20) + Me.tbCFactor.Size = New System.Drawing.Size(84, 26) Me.tbCFactor.TabIndex = 3 ' + 'FlowLayoutPanel1 + ' + Me.FlowLayoutPanel1.Controls.Add(Me.pnBattery) + Me.FlowLayoutPanel1.Controls.Add(Me.pnSuperCap) + Me.FlowLayoutPanel1.Location = New System.Drawing.Point(12, 210) + Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1" + Me.FlowLayoutPanel1.Size = New System.Drawing.Size(743, 309) + Me.FlowLayoutPanel1.TabIndex = 50 + ' + 'pnBattery + ' + Me.pnBattery.Controls.Add(Me.pnInertia) + Me.pnBattery.Controls.Add(Me.tbSoCCurve) + Me.pnBattery.Controls.Add(Me.Panel3) + Me.pnBattery.Controls.Add(Me.lblSoCCurve) + Me.pnBattery.Controls.Add(Me.Panel2) + Me.pnBattery.Controls.Add(Me.btnBrowseSoCCurve) + Me.pnBattery.Controls.Add(Me.Panel1) + Me.pnBattery.Controls.Add(Me.btnSoCCurveOpen) + Me.pnBattery.Controls.Add(Me.tbRiCurve) + Me.pnBattery.Controls.Add(Me.lblRiMap) + Me.pnBattery.Controls.Add(Me.btnRiMapOpen) + Me.pnBattery.Controls.Add(Me.btnBrowseRiMap) + Me.pnBattery.Location = New System.Drawing.Point(3, 3) + Me.pnBattery.Name = "pnBattery" + Me.pnBattery.Size = New System.Drawing.Size(734, 290) + Me.pnBattery.TabIndex = 0 + ' + 'pnSuperCap + ' + Me.pnSuperCap.Controls.Add(Me.pnSuperCapMaxV) + Me.pnSuperCap.Controls.Add(Me.pnSuperCapMinV) + Me.pnSuperCap.Controls.Add(Me.pnSuperCapResistance) + Me.pnSuperCap.Controls.Add(Me.pnSuperCapCapacity) + Me.pnSuperCap.Location = New System.Drawing.Point(3, 299) + Me.pnSuperCap.Name = "pnSuperCap" + Me.pnSuperCap.Size = New System.Drawing.Size(734, 118) + Me.pnSuperCap.TabIndex = 1 + ' + 'pnSuperCapMaxV + ' + Me.pnSuperCapMaxV.Controls.Add(Me.lblSuperCapMaxV) + Me.pnSuperCapMaxV.Controls.Add(Me.lblSuperCapMaxVUnit) + Me.pnSuperCapMaxV.Controls.Add(Me.tbSuperCapMaxV) + Me.pnSuperCapMaxV.Location = New System.Drawing.Point(337, 61) + Me.pnSuperCapMaxV.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.pnSuperCapMaxV.Name = "pnSuperCapMaxV" + Me.pnSuperCapMaxV.Size = New System.Drawing.Size(318, 46) + Me.pnSuperCapMaxV.TabIndex = 26 + ' + 'lblSuperCapMaxV + ' + Me.lblSuperCapMaxV.AutoSize = true + Me.lblSuperCapMaxV.Location = New System.Drawing.Point(4, 11) + Me.lblSuperCapMaxV.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapMaxV.Name = "lblSuperCapMaxV" + Me.lblSuperCapMaxV.Size = New System.Drawing.Size(97, 20) + Me.lblSuperCapMaxV.TabIndex = 0 + Me.lblSuperCapMaxV.Text = "Max Voltage" + ' + 'lblSuperCapMaxVUnit + ' + Me.lblSuperCapMaxVUnit.AutoSize = true + Me.lblSuperCapMaxVUnit.Location = New System.Drawing.Point(257, 13) + Me.lblSuperCapMaxVUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapMaxVUnit.Name = "lblSuperCapMaxVUnit" + Me.lblSuperCapMaxVUnit.Size = New System.Drawing.Size(28, 20) + Me.lblSuperCapMaxVUnit.TabIndex = 24 + Me.lblSuperCapMaxVUnit.Text = "[V]" + ' + 'tbSuperCapMaxV + ' + Me.tbSuperCapMaxV.Location = New System.Drawing.Point(162, 8) + Me.tbSuperCapMaxV.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.tbSuperCapMaxV.Name = "tbSuperCapMaxV" + Me.tbSuperCapMaxV.Size = New System.Drawing.Size(84, 26) + Me.tbSuperCapMaxV.TabIndex = 3 + ' + 'pnSuperCapMinV + ' + Me.pnSuperCapMinV.Controls.Add(Me.lblSuperCapMinV) + Me.pnSuperCapMinV.Controls.Add(Me.lblSuperCapMinVUnit) + Me.pnSuperCapMinV.Controls.Add(Me.tbSuperCapMinV) + Me.pnSuperCapMinV.Location = New System.Drawing.Point(4, 61) + Me.pnSuperCapMinV.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.pnSuperCapMinV.Name = "pnSuperCapMinV" + Me.pnSuperCapMinV.Size = New System.Drawing.Size(318, 46) + Me.pnSuperCapMinV.TabIndex = 25 + ' + 'lblSuperCapMinV + ' + Me.lblSuperCapMinV.AutoSize = true + Me.lblSuperCapMinV.Location = New System.Drawing.Point(4, 11) + Me.lblSuperCapMinV.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapMinV.Name = "lblSuperCapMinV" + Me.lblSuperCapMinV.Size = New System.Drawing.Size(93, 20) + Me.lblSuperCapMinV.TabIndex = 0 + Me.lblSuperCapMinV.Text = "Min Voltage" + ' + 'lblSuperCapMinVUnit + ' + Me.lblSuperCapMinVUnit.AutoSize = true + Me.lblSuperCapMinVUnit.Location = New System.Drawing.Point(230, 11) + Me.lblSuperCapMinVUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapMinVUnit.Name = "lblSuperCapMinVUnit" + Me.lblSuperCapMinVUnit.Size = New System.Drawing.Size(28, 20) + Me.lblSuperCapMinVUnit.TabIndex = 24 + Me.lblSuperCapMinVUnit.Text = "[V]" + ' + 'tbSuperCapMinV + ' + Me.tbSuperCapMinV.Location = New System.Drawing.Point(135, 6) + Me.tbSuperCapMinV.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.tbSuperCapMinV.Name = "tbSuperCapMinV" + Me.tbSuperCapMinV.Size = New System.Drawing.Size(84, 26) + Me.tbSuperCapMinV.TabIndex = 3 + ' + 'pnSuperCapResistance + ' + Me.pnSuperCapResistance.Controls.Add(Me.lblSuperCapRi) + Me.pnSuperCapResistance.Controls.Add(Me.lblSuperCapRiUnit) + Me.pnSuperCapResistance.Controls.Add(Me.tbSuperCapRi) + Me.pnSuperCapResistance.Location = New System.Drawing.Point(337, 5) + Me.pnSuperCapResistance.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.pnSuperCapResistance.Name = "pnSuperCapResistance" + Me.pnSuperCapResistance.Size = New System.Drawing.Size(318, 46) + Me.pnSuperCapResistance.TabIndex = 25 + ' + 'lblSuperCapRi + ' + Me.lblSuperCapRi.AutoSize = true + Me.lblSuperCapRi.Location = New System.Drawing.Point(4, 11) + Me.lblSuperCapRi.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapRi.Name = "lblSuperCapRi" + Me.lblSuperCapRi.Size = New System.Drawing.Size(147, 20) + Me.lblSuperCapRi.TabIndex = 0 + Me.lblSuperCapRi.Text = "Internal Resistance" + ' + 'lblSuperCapRiUnit + ' + Me.lblSuperCapRiUnit.AutoSize = true + Me.lblSuperCapRiUnit.Location = New System.Drawing.Point(257, 13) + Me.lblSuperCapRiUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapRiUnit.Name = "lblSuperCapRiUnit" + Me.lblSuperCapRiUnit.Size = New System.Drawing.Size(29, 20) + Me.lblSuperCapRiUnit.TabIndex = 24 + Me.lblSuperCapRiUnit.Text = "[Ω]" + ' + 'tbSuperCapRi + ' + Me.tbSuperCapRi.Location = New System.Drawing.Point(162, 8) + Me.tbSuperCapRi.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.tbSuperCapRi.Name = "tbSuperCapRi" + Me.tbSuperCapRi.Size = New System.Drawing.Size(84, 26) + Me.tbSuperCapRi.TabIndex = 3 + ' + 'pnSuperCapCapacity + ' + Me.pnSuperCapCapacity.Controls.Add(Me.lblSuperCapCapacity) + Me.pnSuperCapCapacity.Controls.Add(Me.lblSuperCapCapacityUnit) + Me.pnSuperCapCapacity.Controls.Add(Me.tbSuperCapCapacity) + Me.pnSuperCapCapacity.Location = New System.Drawing.Point(4, 5) + Me.pnSuperCapCapacity.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.pnSuperCapCapacity.Name = "pnSuperCapCapacity" + Me.pnSuperCapCapacity.Size = New System.Drawing.Size(318, 46) + Me.pnSuperCapCapacity.TabIndex = 4 + ' + 'lblSuperCapCapacity + ' + Me.lblSuperCapCapacity.AutoSize = true + Me.lblSuperCapCapacity.Location = New System.Drawing.Point(4, 11) + Me.lblSuperCapCapacity.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapCapacity.Name = "lblSuperCapCapacity" + Me.lblSuperCapCapacity.Size = New System.Drawing.Size(70, 20) + Me.lblSuperCapCapacity.TabIndex = 0 + Me.lblSuperCapCapacity.Text = "Capacity" + ' + 'lblSuperCapCapacityUnit + ' + Me.lblSuperCapCapacityUnit.AutoSize = true + Me.lblSuperCapCapacityUnit.Location = New System.Drawing.Point(230, 11) + Me.lblSuperCapCapacityUnit.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSuperCapCapacityUnit.Name = "lblSuperCapCapacityUnit" + Me.lblSuperCapCapacityUnit.Size = New System.Drawing.Size(27, 20) + Me.lblSuperCapCapacityUnit.TabIndex = 24 + Me.lblSuperCapCapacityUnit.Text = "[F]" + ' + 'tbSuperCapCapacity + ' + Me.tbSuperCapCapacity.Location = New System.Drawing.Point(135, 6) + Me.tbSuperCapCapacity.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.tbSuperCapCapacity.Name = "tbSuperCapCapacity" + Me.tbSuperCapCapacity.Size = New System.Drawing.Size(84, 26) + Me.tbSuperCapCapacity.TabIndex = 3 + ' + 'cbRESSType + ' + Me.cbRESSType.FormattingEnabled = true + Me.cbRESSType.Location = New System.Drawing.Point(166, 165) + Me.cbRESSType.Name = "cbRESSType" + Me.cbRESSType.Size = New System.Drawing.Size(211, 28) + Me.cbRESSType.TabIndex = 51 + ' + 'lblRessType + ' + Me.lblRessType.AutoSize = true + Me.lblRessType.Location = New System.Drawing.Point(24, 168) + Me.lblRessType.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblRessType.Name = "lblRessType" + Me.lblRessType.Size = New System.Drawing.Size(103, 20) + Me.lblRessType.TabIndex = 52 + Me.lblRessType.Text = "REESS Type" + ' 'BatteryForm ' Me.AcceptButton = Me.ButOK - Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(9!, 20!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(898, 351) - Me.Controls.Add(Me.Panel3) - Me.Controls.Add(Me.Panel2) - Me.Controls.Add(Me.Panel1) + Me.ClientSize = New System.Drawing.Size(1347, 556) + Me.Controls.Add(Me.lblRessType) + Me.Controls.Add(Me.cbRESSType) + Me.Controls.Add(Me.FlowLayoutPanel1) Me.Controls.Add(Me.PicBox) Me.Controls.Add(Me.lblTitle) - Me.Controls.Add(Me.btnRiMapOpen) - Me.Controls.Add(Me.btnBrowseRiMap) - Me.Controls.Add(Me.lblRiMap) - Me.Controls.Add(Me.tbRiCurve) - Me.Controls.Add(Me.pnInertia) - Me.Controls.Add(Me.btnSoCCurveOpen) Me.Controls.Add(Me.PictureBox1) - Me.Controls.Add(Me.btnBrowseSoCCurve) - Me.Controls.Add(Me.lblSoCCurve) Me.Controls.Add(Me.StatusStrip1) Me.Controls.Add(Me.ToolStrip1) Me.Controls.Add(Me.ButCancel) - Me.Controls.Add(Me.tbSoCCurve) Me.Controls.Add(Me.ButOK) Me.Controls.Add(Me.lblMakeModel) Me.Controls.Add(Me.tbMakeModel) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"),System.Drawing.Icon) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.MaximizeBox = false Me.Name = "BatteryForm" Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide @@ -536,6 +805,18 @@ Partial Class BatteryForm Me.Panel2.PerformLayout Me.Panel3.ResumeLayout(false) Me.Panel3.PerformLayout + Me.FlowLayoutPanel1.ResumeLayout(false) + Me.pnBattery.ResumeLayout(false) + Me.pnBattery.PerformLayout + Me.pnSuperCap.ResumeLayout(false) + Me.pnSuperCapMaxV.ResumeLayout(false) + Me.pnSuperCapMaxV.PerformLayout + Me.pnSuperCapMinV.ResumeLayout(false) + Me.pnSuperCapMinV.PerformLayout + Me.pnSuperCapResistance.ResumeLayout(false) + Me.pnSuperCapResistance.PerformLayout + Me.pnSuperCapCapacity.ResumeLayout(false) + Me.pnSuperCapCapacity.PerformLayout Me.ResumeLayout(false) Me.PerformLayout @@ -585,4 +866,25 @@ End Sub Friend WithEvents lblCFactor As Label Friend WithEvents lblCFactorUnit As Label Friend WithEvents tbCFactor As TextBox + Friend WithEvents FlowLayoutPanel1 As FlowLayoutPanel + Friend WithEvents pnBattery As Panel + Friend WithEvents pnSuperCap As Panel + Friend WithEvents cbRESSType As ComboBox + Friend WithEvents lblRessType As Label + Friend WithEvents pnSuperCapMaxV As Panel + Friend WithEvents lblSuperCapMaxV As Label + Friend WithEvents lblSuperCapMaxVUnit As Label + Friend WithEvents tbSuperCapMaxV As TextBox + Friend WithEvents pnSuperCapMinV As Panel + Friend WithEvents lblSuperCapMinV As Label + Friend WithEvents lblSuperCapMinVUnit As Label + Friend WithEvents tbSuperCapMinV As TextBox + Friend WithEvents pnSuperCapResistance As Panel + Friend WithEvents lblSuperCapRi As Label + Friend WithEvents lblSuperCapRiUnit As Label + Friend WithEvents tbSuperCapRi As TextBox + Friend WithEvents pnSuperCapCapacity As Panel + Friend WithEvents lblSuperCapCapacity As Label + Friend WithEvents lblSuperCapCapacityUnit As Label + Friend WithEvents tbSuperCapCapacity As TextBox End Class diff --git a/VECTO/GUI/BatteryForm.vb b/VECTO/GUI/BatteryForm.vb index b7902b750e..6a40017def 100644 --- a/VECTO/GUI/BatteryForm.vb +++ b/VECTO/GUI/BatteryForm.vb @@ -1,4 +1,5 @@  +Imports System.Collections.Generic Imports System.Drawing.Imaging Imports System.IO Imports System.Linq @@ -34,6 +35,8 @@ Public Class BatteryForm Public JobDir As String = "" Private _changed As Boolean = False + Private ressType as REESSType + Private _contextMenuFiles As String() @@ -56,6 +59,12 @@ Public Class BatteryForm _changed = False + cbRESSType.DataSource = New List(Of object)() from{ + New With {Key .Value = REESSType.Battery, .Label = "Battery"}, + New With {Key .Value = REESSType.SuperCap, .Label = "SuperCap"} + } + cbRESSType.ValueMember = "Value" + cbRESSType.DisplayMember = "Label" NewBattery() End Sub @@ -77,9 +86,9 @@ Public Class BatteryForm End Sub Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click - If BatteryFileBrowser.OpenDialog(_batteryFile) Then + If REESSFileBrowser.OpenDialog(_batteryFile) Then Try - OpenBatteryFile(BatteryFileBrowser.Files(0)) + OpenBatteryFile(REESSFileBrowser.Files(0)) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error loading Battery File") End Try @@ -152,16 +161,15 @@ Public Class BatteryForm 'Open VENG file Public Sub OpenBatteryFile(file As String) - Dim battery As IBatteryPackEngineeringInputData - + If ChangeCheckCancel() Then Exit Sub Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), IEngineeringInputDataProvider) - battery = inputData.JobInputData.Vehicle.Components.ElectricStorage.BatteryPack + Dim reess as IREESSPackInputData = inputData.JobInputData.Vehicle.Components.ElectricStorage.REESSPack - If Cfg.DeclMode <> battery.SavedInDeclarationMode Then + If Cfg.DeclMode <> reess.SavedInDeclarationMode Then Select Case WrongMode() Case 1 Close() @@ -173,18 +181,51 @@ Public Class BatteryForm End If Dim basePath As String = Path.GetDirectoryName(file) - tbMakeModel.Text = battery.Model - tbCapacity.Text = battery.Capacity.AsAmpHour.ToGUIFormat() + tbMakeModel.Text = reess.Model + + if (reess.StorageType = REESSType.Battery) then + pnBattery.Visible = True + pnSuperCap.Visible = False + cbRESSType.SelectedValue = REESSType.Battery + Dim battery As IBatteryPackEngineeringInputData = ctype(reess, IBatteryPackEngineeringInputData) + tbCapacity.Text = battery.Capacity.AsAmpHour.ToGUIFormat() + + tbCFactor.Text = battery.MaxCurrentFactor.ConvertToPerHour().Value.ToGUIFormat() + tbSoCMin.Text = (battery.MinSOC * 100).ToGUIFormat() + tbSoCMax.Text = (battery.MaxSOC * 100).ToGUIFormat() + + tbSoCCurve.Text = GetRelativePath(battery.VoltageCurve.Source, basePath) + tbRiCurve.Text = GetRelativePath(battery.InternalResistanceCurve.Source, basePath) + + tbSuperCapCapacity.Text = String.Empty + tbSuperCapMaxV.Text = string.Empty + tbSuperCapMinV.Text= string.Empty + tbSuperCapRi.Text= string.Empty + + Elseif reess.StorageType = REESSType.SuperCap + pnBattery.Visible = False + pnSuperCap.Visible = True + cbRESSType.SelectedValue = REESSType.SuperCap + Dim superCap As ISuperCapEngineeringInputData = ctype(reess, ISuperCapEngineeringInputData) + tbCapacity.Text = String.Empty + + tbCFactor.Text = String.Empty + tbSoCMin.Text = String.Empty + tbSoCMax.Text = String.Empty - tbCFactor.Text = battery.MaxCurrentFactor.ToGUIFormat() - tbSoCMin.Text = (battery.MinSOC * 100).ToGUIFormat() - tbSoCMax.Text = (battery.MaxSOC * 100).ToGUIFormat() + tbSoCCurve.Text = String.Empty + tbRiCurve.Text = String.Empty + + tbSuperCapCapacity.Text = superCap.Capacity.ToGUIFormat() + tbSuperCapMaxV.Text = superCap.MaxVoltage.ToGUIFormat() + tbSuperCapMinV.Text= superCap.MinVoltage.ToGUIFormat() + tbSuperCapRi.Text= superCap.InternalResistance.ToGUIFormat() + + end if - tbSoCCurve.Text = GetRelativePath(battery.VoltageCurve.Source, basePath) - tbRiCurve.Text = GetRelativePath(battery.InternalResistanceCurve.Source, basePath) DeclInit() - BatteryFileBrowser.UpdateHistory(file) + REESSFileBrowser.UpdateHistory(file) Text = GetFilenameWithoutPath(file, True) LbStatus.Text = "" _batteryFile = file @@ -197,8 +238,8 @@ Public Class BatteryForm 'Save or Save As function = true if file is saved Private Function SaveOrSaveAs(ByVal saveAs As Boolean) As Boolean If _batteryFile = "" Or saveAs Then - If BatteryFileBrowser.SaveDialog(_batteryFile) Then - _batteryFile = BatteryFileBrowser.Files(0) + If REESSFileBrowser.SaveDialog(_batteryFile) Then + _batteryFile = REESSFileBrowser.Files(0) Else Return False End If @@ -209,25 +250,22 @@ Public Class BatteryForm 'Save VENG file to given filepath. Called by SaveOrSaveAs. Private Function SaveBatteryToFile(ByVal file As String) As Boolean - Dim battery As Battery = New Battery - battery.FilePath = file + - battery.ModelName = tbMakeModel.Text - If Trim(battery.ModelName) = "" Then battery.ModelName = "Undefined" - battery.BatCapacity = tbCapacity.Text.ToDouble(0) - - battery.PathSoCCurve = tbSoCCurve.Text - battery.PathRiCurve = tbRiCurve.Text - - battery.BatMinSoc = tbSoCMin.Text.ToDouble(0) - battery.BatMaxSoc = tbSoCMax.Text.ToDouble(0) - - battery.BatCFactor = tbCFactor.Text.ToDouble(0) - - If Not battery.SaveFile Then - MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) - Return False - End If + Select Case cbRESSType.SelectedValue.ToString() + Case "Battery" + dim battery As Battery = FillBattery(file) + If Not battery.SaveFile Then + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False + End If + Case "SuperCap" + dim superCap As SuperCap = FillSuperCap(file) + If Not superCap.SaveFile Then + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False + End If + End Select If AutoSendTo Then If VehicleForm.Visible Then @@ -237,7 +275,7 @@ Public Class BatteryForm End If End If - BatteryFileBrowser.UpdateHistory(file) + REESSFileBrowser.UpdateHistory(file) Text = GetFilenameWithoutPath(file, True) LbStatus.Text = "" @@ -246,6 +284,42 @@ Public Class BatteryForm Return True End Function + Private Function FillSuperCap(file As String) As SuperCap + Dim superCap As SuperCap = New SuperCap() + superCap.FilePath = file + + superCap.ModelName = tbMakeModel.Text + If Trim(superCap.ModelName) = "" Then superCap.ModelName = "Undefined" + + + superCap.Cap = tbSuperCapCapacity.Text.ToDouble(0) + superCap.Ri = _tbSuperCapRi.Text.ToDouble(0) + + superCap.MinV = _tbSuperCapMinV.Text.ToDouble(0) + superCap.MaxV = tbSuperCapMaxV.Text.ToDouble(0) + + Return superCap + End Function + + Private Function FillBattery(file As string) As Battery + Dim battery As Battery = New Battery + battery.FilePath = file + + battery.ModelName = tbMakeModel.Text + If Trim(battery.ModelName) = "" Then battery.ModelName = "Undefined" + + battery.BatCapacity = tbCapacity.Text.ToDouble(0) + + battery.PathSoCCurve = tbSoCCurve.Text + battery.PathRiCurve = tbRiCurve.Text + + battery.BatMinSoc = tbSoCMin.Text.ToDouble(0) + battery.BatMaxSoc = tbSoCMax.Text.ToDouble(0) + + battery.BatCFactor = tbCFactor.Text.ToDouble(0) + Return battery + End Function + #Region "Track changes" @@ -336,6 +410,10 @@ Public Class BatteryForm 'If Not File.Exists(_engFile) Then Exit Sub + if (ressType <> REESSType.Battery) then + Return + end if + Try Dim socFile As String = If(Not String.IsNullOrWhiteSpace(_batteryFile), Path.Combine(Path.GetDirectoryName(_batteryFile), tbSoCCurve.Text), tbSoCCurve.Text) @@ -496,4 +574,20 @@ Public Class BatteryForm UpdatePic() Change() End Sub + + Private Sub lblRessType_Click(sender As Object, e As EventArgs) Handles lblRessType.Click + + End Sub + + Private Sub cbRESSType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRESSType.SelectedIndexChanged + If (cbRESSType.SelectedValue.Equals(REESSType.Battery)) Then + pnBattery.Visible = True + pnSuperCap.Visible = False + ressType = REESSType.Battery + Else + pnBattery.Visible = False + pnSuperCap.Visible = True + ressType = REESSType.SuperCap + End If + End Sub End Class diff --git a/VECTO/GUI/HybridStratebyParamsForm.vb b/VECTO/GUI/HybridStratebyParamsForm.vb index ca2c06d3d7..105d60891b 100644 --- a/VECTO/GUI/HybridStratebyParamsForm.vb +++ b/VECTO/GUI/HybridStratebyParamsForm.vb @@ -188,7 +188,7 @@ Public Class HybridStrategyParamsForm DeclInit() - BatteryFileBrowser.UpdateHistory(file) + REESSFileBrowser.UpdateHistory(file) Text = GetFilenameWithoutPath(file, True) LbStatus.Text = "" _strategyParamsFile = file diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index 4e88de67cf..554b785c16 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -140,7 +140,7 @@ Imports TUGraz.VectoCore.Utils TorqueConverterShiftPolygonFileBrowser = New FileBrowser("vgbs") CrossWindCorrectionFileBrowser = New FileBrowser("vcdx") ElectricMotorFileBrowser = New FileBrowser("vem") - BatteryFileBrowser = New FileBrowser("vbat") + REESSFileBrowser = New FileBrowser("vreess") DriverDecisionFactorVelocityDropFileBrowser = New FileBrowser("DfVelocityDrop") DriverDecisionFactorTargetSpeedFileBrowser = New FileBrowser("DfTargetSpeed") DriverDecisionFactorVelocityDropFileBrowser.Extensions = New String() {"csv"} @@ -180,7 +180,7 @@ Imports TUGraz.VectoCore.Utils TorqueConverterShiftPolygonFileBrowser.Extensions = New String() {"vgbs"} CrossWindCorrectionFileBrowser.Extensions = New String() {"vcdv", "vcdb"} ElectricMotorFileBrowser.Extensions = New String() {"vem"} - BatteryFileBrowser.Extensions = New String() {"vbat"} + REESSFileBrowser.Extensions = New String() {"vreess"} ElectricMachineDragTorqueFileBrowser.Extensions = New String() {"vemd"} ElectricMachineMaxTorqueFileBrowser.Extensions = New String() {"vemp"} diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index f15a78ce97..2fc3a0bf9c 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -460,7 +460,7 @@ Public Class VehicleForm If(angledrive.LossMap Is Nothing, "", GetRelativePath(angledrive.LossMap.Source, basePath)) If (vehicle.VehicleType = VectoSimulationJobType.BatteryElectricVehicle OrElse vehicle.VehicleType = VectoSimulationJobType.ParallelHybridVehicle) Then - tbBattery.Text = GetRelativePath(vehicle.Components.ElectricStorage.BatteryPack.DataSource.SourceFile, basePath) + tbBattery.Text = GetRelativePath(vehicle.Components.ElectricStorage.REESSPack.DataSource.SourceFile, basePath) tbBatteryPackCnt.Text = vehicle.Components.ElectricStorage.Count.ToGUIFormat() tbInitialSoC.Text = (vehicle.InitialSOC * 100).ToGUIFormat() @@ -1060,8 +1060,8 @@ Public Class VehicleForm End Sub Private Sub btnBrowseBattery_Click(sender As Object, e As EventArgs) Handles btnBrowseBattery.Click - If BatteryFileBrowser.OpenDialog(FileRepl(tbBattery.Text, GetPath(_vehFile))) Then - tbBattery.Text = GetFilenameWithoutDirectory(BatteryFileBrowser.Files(0), GetPath(_vehFile)) + If REESSFileBrowser.OpenDialog(FileRepl(tbBattery.Text, GetPath(_vehFile))) Then + tbBattery.Text = GetFilenameWithoutDirectory(REESSFileBrowser.Files(0), GetPath(_vehFile)) End If End Sub diff --git a/VECTO/Input Files/Battery.vb b/VECTO/Input Files/Battery.vb index 2e72a647b5..9a965c0a17 100644 --- a/VECTO/Input Files/Battery.vb +++ b/VECTO/Input Files/Battery.vb @@ -25,7 +25,7 @@ Public Class Battery Public BatMinSoc As Double Public BatMaxSoc As Double Public BatCFactor As Double - + Public Sub New() _myPath = "" _filePath = "" @@ -233,11 +233,16 @@ Public Class Battery End Get End Property - Public ReadOnly Property MaxCurrentFactor As Double Implements IBatteryPackDeclarationInputData.MaxCurrentFactor + Public ReadOnly Property MaxCurrentFactor As PerSecond Implements IBatteryPackDeclarationInputData.MaxCurrentFactor Get - Return BatCFactor + Return BatCFactor.SI(Unit.SI.Per.Hour).Cast(Of PerSecond) End Get End Property + Public ReadOnly Property StorageType As REESSType Implements IREESSPackInputData.StorageType + get + Return REESSType.Battery + End Get + End Property End Class \ No newline at end of file diff --git a/VECTO/Input Files/SuperCap.vb b/VECTO/Input Files/SuperCap.vb new file mode 100644 index 0000000000..91ac993462 --- /dev/null +++ b/VECTO/Input Files/SuperCap.vb @@ -0,0 +1,153 @@ +Imports System.Collections.Generic +Imports System.ComponentModel.DataAnnotations +Imports System.IO +Imports System.Linq +Imports TUGraz.VectoCommon.InputData +Imports TUGraz.VectoCommon.Models +Imports TUGraz.VectoCommon.Utils + +Public Class SuperCap + Implements ISuperCapEngineeringInputData + + Private _filePath As String + Private _myPath As String + Public ModelName As String + Public Cap As Double + Public Ri As Double + Public MinV As Double + Public MaxV As Double + + Public Sub New() + _myPath = "" + _filePath = "" + + SetDefault() + End Sub + + Private Sub SetDefault() + ModelName = "Undefined" + Cap = 0 + Ri = 0 + MinV = 0 + MaxV = 0 + End Sub + + Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource + Get + Dim retVal As DataSource = New DataSource() + retVal.SourceType = DataSourceType.JSONFile + retVal.SourceFile = FilePath + Return retVal + End Get + End Property + + Public ReadOnly Property SavedInDeclarationMode As Boolean Implements IComponentInputData.SavedInDeclarationMode + Get + Return Cfg.DeclMode + End Get + End Property + + Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer + Get + + End Get + End Property + + Public ReadOnly Property Model As String Implements IComponentInputData.Model + Get + Return ModelName + End Get + End Property + + Public ReadOnly Property [Date] As Date Implements IComponentInputData.[Date] + Get + Return Now.ToUniversalTime() + End Get + End Property + + Public ReadOnly Property AppVersion As String Implements IComponentInputData.AppVersion + Get + Return "VECTO-GUI" + End Get + End Property + + Public ReadOnly Property CertificationMethod As CertificationMethod Implements IComponentInputData.CertificationMethod + Get + Return CertificationMethod.NotCertified + End Get + End Property + Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber + Get + Return TUGraz.VectoCore.Configuration.Constants.NOT_AVailABLE + End Get + End Property + Public ReadOnly Property DigestValue As DigestData Implements IComponentInputData.DigestValue + Get + Return Nothing + End Get + End Property + Public ReadOnly Property Capacity As Farad Implements ISuperCapDeclarationInputData.Capacity + get + Return cap.SI(of Farad) + End Get + End Property + Public ReadOnly Property InternalResistance As Ohm Implements ISuperCapDeclarationInputData.InternalResistance + get + Return ri.SI(of Ohm) + End Get + End Property + Public ReadOnly Property MinVoltage As Volt Implements ISuperCapDeclarationInputData.MinVoltage + get + Return minv.SI(of Volt) + End Get + End Property + Public ReadOnly Property MaxVoltage As Volt Implements ISuperCapDeclarationInputData.MaxVoltage + get + Return MaxV.SI(of Volt) + End Get + End Property + + Public Property FilePath() As String + Get + Return _filePath + End Get + Set(ByVal value As String) + _filePath = value + If _filePath = "" Then + _myPath = "" + Else + _myPath = Path.GetDirectoryName(_filePath) & "\" + End If + End Set + End Property + + Public Function SaveFile() As Boolean + + Dim validationResults As IList(Of ValidationResult) = + Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering), Nothing, False) + + If validationResults.Count > 0 Then + Dim messages As IEnumerable(Of String) = + validationResults.Select(Function(r) r.ErrorMessage + String.Join(", ", r.MemberNames.Distinct())) + MsgBox("Invalid input." + Environment.NewLine + String.Join(Environment.NewLine, messages), MsgBoxStyle.OkOnly, + "Failed to save battery") + Return False + End If + + Try + Dim writer As JSONFileWriter = New JSONFileWriter() + writer.SaveSuperCap(Me, _filePath, Cfg.DeclMode) + + Catch ex As Exception + MsgBox("Faled to write Battery file: " + ex.Message) + Return False + End Try + Return True + End Function + + Public ReadOnly Property StorageType As REESSType Implements IREESSPackInputData.StorageType + get + Return REESSType.SuperCap + End Get + End Property +End Class \ No newline at end of file diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index d5c951b621..29dfe1600e 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -864,23 +864,14 @@ Public Class ElectricStorageWrapper Vehicle = veh End Sub - Public ReadOnly Property BatteryPack As IBatteryPackDeclarationInputData Implements IElectricStorageDeclarationInputData.BatteryPack - Get - Return Me - End Get - End Property - Public ReadOnly Property IElectricStorageEngineeringInputData_Count As Integer Implements IElectricStorageEngineeringInputData.Count - Get - Return Vehicle.NumBatteryPacks - End Get - End Property - Public ReadOnly Property IElectricStorageEngineeringInputData_BatteryPack As IBatteryPackEngineeringInputData Implements IElectricStorageEngineeringInputData.BatteryPack + + Public ReadOnly Property REESSPack As IREESSPackInputData Implements IElectricStorageEngineeringInputData.REESSPack Get return Me End Get End Property - Public ReadOnly Property Count As Integer Implements IElectricStorageDeclarationInputData.Count + Public ReadOnly Property Count As Integer Implements IElectricStorageEngineeringInputData.Count Get Return Vehicle.NumBatteryPacks End Get @@ -907,7 +898,8 @@ Public Class ElectricStorageWrapper Public ReadOnly Property Capacity As AmpereSecond Implements IBatteryPackDeclarationInputData.Capacity Public ReadOnly Property InternalResistanceCurve As TableData Implements IBatteryPackDeclarationInputData.InternalResistanceCurve Public ReadOnly Property VoltageCurve As TableData Implements IBatteryPackDeclarationInputData.VoltageCurve - Public ReadOnly Property MaxCurrentFactor As Double Implements IBatteryPackDeclarationInputData.MaxCurrentFactor + Public ReadOnly Property MaxCurrentFactor As PerSecond Implements IBatteryPackDeclarationInputData.MaxCurrentFactor + Public ReadOnly Property StorageType As REESSType Implements IREESSPackInputData.StorageType End Class Public Class ElectricMachineWrapper diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index d30668f1eb..20236534aa 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -723,12 +723,23 @@ namespace TUGraz.VectoCommon.InputData public interface IElectricStorageDeclarationInputData { - IBatteryPackDeclarationInputData BatteryPack { get; } + IREESSPackInputData REESSPack { get; } int Count { get; } } - public interface IBatteryPackDeclarationInputData : IComponentInputData + public enum REESSType + { + Battery, + SuperCap + } + + public interface IREESSPackInputData : IComponentInputData + { + REESSType StorageType { get; } + } + + public interface IBatteryPackDeclarationInputData : IREESSPackInputData { double MinSOC { get; } @@ -741,7 +752,18 @@ namespace TUGraz.VectoCommon.InputData TableData VoltageCurve { get; } - double MaxCurrentFactor { get; } + PerSecond MaxCurrentFactor { get; } + } + + public interface ISuperCapDeclarationInputData : IREESSPackInputData + { + Farad Capacity { get; } + + Ohm InternalResistance { get; } + + Volt MinVoltage { get; } + + Volt MaxVoltage { get; } } diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index f8ca10c55d..ca4cb8c817 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -419,9 +419,7 @@ namespace TUGraz.VectoCommon.InputData public interface IElectricStorageEngineeringInputData : IElectricStorageDeclarationInputData { - new IBatteryPackEngineeringInputData BatteryPack { get; } - int Count { get; } } public interface IBatteryPackEngineeringInputData : IBatteryPackDeclarationInputData @@ -429,6 +427,11 @@ namespace TUGraz.VectoCommon.InputData } + public interface ISuperCapEngineeringInputData : ISuperCapDeclarationInputData + { + + } + public interface IDriverModelData { } public interface IDriverAccelerationData : IDriverModelData diff --git a/VectoCommon/VectoCommon/Models/IResponse.cs b/VectoCommon/VectoCommon/Models/IResponse.cs index b27f1c6e7f..e6485da4f8 100644 --- a/VectoCommon/VectoCommon/Models/IResponse.cs +++ b/VectoCommon/VectoCommon/Models/IResponse.cs @@ -186,19 +186,19 @@ namespace TUGraz.VectoCommon.Models public HybridStrategyResponse StrategySettings { get; set; } } - public interface IBatteryResponse + public interface IRESSResponse { Second AbsTime { get; set; } Second SimulationInterval { get; set; } - Watt MaxBatteryLoadCharge { get; set; } + Watt MaxChargePower { get; set; } - Watt MaxBatteryLoadDischarge { get; set; } + Watt MaxDischargePower { get; set; } - Watt BatteryPower { get; set; } + Watt PowerDemand { get; set; } - Watt BatteryLoss { get; set; } + Watt LossPower { get; set; } double StateOfCharge { get; set; } @@ -207,7 +207,7 @@ namespace TUGraz.VectoCommon.Models public interface IElectricSystemResponse { - IBatteryResponse BatteryResponse { get; set; } + IRESSResponse RESSResponse { get; set; } Watt AuxPower { get; set; } @@ -219,7 +219,7 @@ namespace TUGraz.VectoCommon.Models Watt MaxPowerDrag { get; } - Watt BatteryPowerDemand { get; set; } + Watt RESSPowerDemand { get; set; } object Source { get; } } diff --git a/VectoCommon/VectoCommon/Utils/SI.cs b/VectoCommon/VectoCommon/Utils/SI.cs index c91a7d77ed..6a66126612 100644 --- a/VectoCommon/VectoCommon/Utils/SI.cs +++ b/VectoCommon/VectoCommon/Utils/SI.cs @@ -1064,6 +1064,8 @@ namespace TUGraz.VectoCommon.Utils { return SIBase<AmpereSecond>.Create(i.Value() * t.Value()); } + + } public class AmpereSecond : SIBase<AmpereSecond> @@ -1087,6 +1089,10 @@ namespace TUGraz.VectoCommon.Utils { return SIBase<WattSecond>.Create(ampereSeconds.Val * v.Value()); } + public static Ampere operator *(AmpereSecond i, PerSecond ps) + { + return SIBase<Ampere>.Create(i.Value() * ps.Value()); + } } /// <summary> @@ -1130,6 +1136,28 @@ namespace TUGraz.VectoCommon.Utils public override string UnitString { get { return "Ω"; } } } + public class Farad : SIBase<Farad> + { + private static readonly int[] Units = { -1, -2, 4, 2, 0, 0, 0 }; + + private Farad(double val) : base(val, Units) {} + + public override string UnitString + { + get { return "F"; } + } + + public static Volt operator /(AmpereSecond charge, Farad capacity) + { + return SIBase<Volt>.Create(charge.Value() / capacity.Val); + } + + public static AmpereSecond operator *(Farad capacity, Volt v) + { + return SIBase<AmpereSecond>.Create(capacity.Val * v.Value()); + } + } + public class VolumePerMeter : SIBase<VolumePerMeter> { private static readonly int[] Units = { 0, 2, 0, 0, 0, 0, 0 }; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONBattery.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONBattery.cs index caae949b18..ebf4c67988 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONBattery.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONBattery.cs @@ -9,7 +9,7 @@ using TUGraz.VectoCore.InputData.Reader.ComponentData; namespace TUGraz.VectoCore.InputData.FileIO.JSON { - public class JSONBatteryV1 : JSONFile, IBatteryPackEngineeringInputData + public class JSONBatteryV1 : JSONFile, IBatteryPackEngineeringInputData, ISuperCapEngineeringInputData { public JSONBatteryV1(JObject data, string filename, bool tolerateMissing = false) : base(data, filename, tolerateMissing) { } @@ -54,11 +54,43 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>("SOC_max") / 100.0; } } - public AmpereSecond Capacity + AmpereSecond IBatteryPackDeclarationInputData.Capacity { get { return Body.GetEx<double>("Capacity").SI(Unit.SI.Ampere.Hour).Cast<AmpereSecond>(); } } + Farad ISuperCapDeclarationInputData.Capacity + { + get + { + return Body.GetEx<double>("Capacity").SI<Farad>(); + } + } + + public Ohm InternalResistance + { + get + { + return Body.GetEx<double>("InternalResistance").SI<Ohm>(); + } + } + + public Volt MinVoltage + { + get + { + return Body.GetEx<double>("U_min").SI<Volt>(); + } + } + + public Volt MaxVoltage + { + get + { + return Body.GetEx<double>("U_max").SI<Volt>(); + } + } + public TableData InternalResistanceCurve { get @@ -97,9 +129,18 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } } - public double MaxCurrentFactor + public PerSecond MaxCurrentFactor { - get { return Body.GetEx<double>("MaxCurrentFactor"); } + get { return Body.GetEx<double>("MaxCurrentFactor").SI(Unit.SI.Per.Hour).Cast<PerSecond>(); } + } + + + public REESSType StorageType + { + get + { + return Body["REESSType"] == null ? REESSType.Battery : Body.GetEx<string>("REESSType").ParseEnum<REESSType>(); + } } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 75729550ae..9efb878274 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -84,7 +84,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON tmp = JSONInputDataFactory.ReadShiftParameters(filename, tolerateMissing); break; case Constants.FileExtensions.BatteryFile: - tmp = JSONInputDataFactory.ReadBatteryData(filename, tolerateMissing); + tmp = JSONInputDataFactory.ReadREESSData(filename, tolerateMissing); break; case Constants.FileExtensions.ElectricMotorFile: tmp = JSONInputDataFactory.ReadElectricMotorData(filename, tolerateMissing); @@ -251,7 +251,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return new JSONElectricStorageEngineeringInputData { - BatteryPack = Battery, + REESSPack = Battery, Count = 1 }; } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs index 540372aca5..efa188219f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONElectricMotor.cs @@ -53,20 +53,20 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { public Joule OverloadBuffer { - get { return Body.GetEx<double>("ThermalOverloadBuffer").SI(Unit.SI.Mega.Joule).Cast<Joule>(); } + get { return Body.GetValueOrDefault<double>("ThermalOverloadBuffer")?.SI(Unit.SI.Mega.Joule).Cast<Joule>() ?? 0.SI<Joule>(); } } public double OverloadRecoveryFactor { get { - return Body.GetEx<double>("ThermalOverloadRecoveryFactor"); + return Body.GetValueOrDefault<double>("ThermalOverloadRecoveryFactor") ?? 0.9; } } public Watt ContinuousPower { - get { return Body.GetEx<double>("ContinuousPower").SI<Watt>(); } + get { return Body.GetValueOrDefault<double>("ContinuousPower")?.SI<Watt>() ?? 0.SI<Watt>(); } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index 7488df94be..c1620f1812 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -188,7 +188,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } - public static IBatteryPackEngineeringInputData ReadBatteryData(string filename, bool tolerateMissing) + public static IREESSPackInputData ReadREESSData(string filename, bool tolerateMissing) { var json = ReadFile(filename); var version = ReadVersion(json); diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs index 71c7561e9c..5595b8fd1a 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONSubComponent.cs @@ -673,12 +673,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public class JSONElectricStorageEngineeringInputData : IElectricStorageEngineeringInputData { - IBatteryPackDeclarationInputData IElectricStorageDeclarationInputData.BatteryPack - { - get { return BatteryPack; } - } + public IREESSPackInputData REESSPack { get; set; } - public IBatteryPackEngineeringInputData BatteryPack { get; internal set; } + public int Count { get; internal set; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 3dda59e7a8..ee1803a843 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -136,7 +136,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { return new JSONElectricStorageEngineeringInputData() { Count = Body["Battery"].GetEx<int>("NumPacks"), - BatteryPack = JSONInputDataFactory.ReadBatteryData(Path.Combine(BasePath, Body["Battery"].GetEx<string>("BatteryFile")), false) + REESSPack = JSONInputDataFactory.ReadREESSData(Path.Combine(BasePath, Body["Battery"].GetEx<string>("BatteryFile")), false) }; } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index ec99dc5e86..ed209466b5 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -620,17 +620,38 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter public BatteryData CreateBatteryData(IElectricStorageEngineeringInputData batteryInputData, double initialSOC) { - if (batteryInputData == null) { + if (batteryInputData == null || batteryInputData.REESSPack.StorageType != REESSType.Battery) { return null; } + var bat = batteryInputData.REESSPack as IBatteryPackEngineeringInputData; + return new BatteryData() { - MinSOC = batteryInputData.BatteryPack.MinSOC, - MaxSOC = batteryInputData.BatteryPack.MaxSOC, - MaxCurrent = (batteryInputData.BatteryPack.Capacity.AsAmpHour * batteryInputData.BatteryPack.MaxCurrentFactor * batteryInputData.Count).SI<Ampere>(), - Capacity = batteryInputData.Count * batteryInputData.BatteryPack.Capacity, - InternalResistance = BatteryInternalResistanceReader.Create(batteryInputData.BatteryPack.InternalResistanceCurve, batteryInputData.Count), - SOCMap = BatterySOCReader.Create(batteryInputData.BatteryPack.VoltageCurve), + MinSOC = bat.MinSOC, + MaxSOC = bat.MaxSOC, + MaxCurrent = bat.Capacity * bat.MaxCurrentFactor * batteryInputData.Count, + Capacity = batteryInputData.Count * bat.Capacity, + InternalResistance = BatteryInternalResistanceReader.Create(bat.InternalResistanceCurve, batteryInputData.Count), + SOCMap = BatterySOCReader.Create(bat.VoltageCurve), + InitialSoC = initialSOC + }; + } + + public SuperCapData CreateSuperCapData(IElectricStorageEngineeringInputData reessInputData, double initialSOC) + { + if (reessInputData == null || reessInputData.REESSPack.StorageType != REESSType.SuperCap) + { + return null; + } + + var superCap = reessInputData.REESSPack as ISuperCapEngineeringInputData; + + return new SuperCapData() + { + Capacity = reessInputData.Count * superCap.Capacity, + InternalResistance = superCap.InternalResistance / reessInputData.Count, + MinVoltage = superCap.MinVoltage, + MaxVoltage = superCap.MaxVoltage, InitialSoC = initialSOC }; } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs index 6c30a9ff7d..9b11e0748d 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs @@ -132,6 +132,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl ElectricMachinesData = dao.CreateElectricMachines(vehicle.Components.ElectricMachines), //HybridStrategyParameters = dao.CreateHybridStrategyParameters(InputDataProvider.JobInputData.HybridStrategyParameters), BatteryData = dao.CreateBatteryData(vehicle.Components.ElectricStorage, vehicle.InitialSOC), + SuperCapData = dao.CreateSuperCapData(vehicle.Components.ElectricStorage, vehicle.InitialSOC), SimulationType = SimulationType.DistanceCycle | SimulationType.MeasuredSpeedCycle | SimulationType.PWheel, //GearshiftParameters = dao.CreateGearshiftData( // gearboxData.Type, InputDataProvider.DriverInputData.GearshiftInputData, @@ -184,6 +185,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl var electricMachines = dao.CreateElectricMachines(vehicle.Components.ElectricMachines) ?? new List<Tuple<PowertrainPosition, ElectricMotorData>>(); var battery = dao.CreateBatteryData(vehicle.Components.ElectricStorage, vehicle.InitialSOC); + var superCap = dao.CreateSuperCapData(vehicle.Components.ElectricStorage, vehicle.InitialSOC); var jobType = electricMachines.Count > 0 && battery != null ? VectoSimulationJobType.ParallelHybridVehicle @@ -211,6 +213,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl ElectricMachinesData = electricMachines, HybridStrategyParameters = hybridParameters, BatteryData = battery, + SuperCapData = superCap, SimulationType = SimulationType.DistanceCycle | SimulationType.MeasuredSpeedCycle | SimulationType.PWheel, GearshiftParameters = dao.CreateGearshiftData( gearboxData.Type, InputDataProvider.DriverInputData.GearshiftInputData, diff --git a/VectoCore/VectoCore/Models/Connector/Ports/IBatteryPort.cs b/VectoCore/VectoCore/Models/Connector/Ports/IElectricEnergyStoragePort.cs similarity index 70% rename from VectoCore/VectoCore/Models/Connector/Ports/IBatteryPort.cs rename to VectoCore/VectoCore/Models/Connector/Ports/IElectricEnergyStoragePort.cs index c6bc9e87e2..ebad9f4e94 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/IBatteryPort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/IElectricEnergyStoragePort.cs @@ -6,10 +6,10 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl { public interface IBatteryProvider { - IBatteryPort MainBatteryPort { get; } + IElectricEnergyStoragePort MainBatteryPort { get; } } - public interface IBatteryPort + public interface IElectricEnergyStoragePort { void Initialize(double initialSoC); @@ -23,33 +23,33 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl /// <param name="powerDemand"></param> /// <param name="dryRun"></param> /// <returns></returns> - IBatteryResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun); + IRESSResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun); } public interface IElectricAuxConnecor { - void Connect(IBatteryAuxPort aux); + void Connect(IElectricAuxPort aux); } public interface IElectricChargerConnector { - void Connect(IBatteryChargePort charger); + void Connect(IElectricChargerPort charger); } public interface IBatteryConnector { - void Connect(IBattery battery); + void Connect(IElectricEnergyStorage battery); } - public interface IBatteryAuxPort + public interface IElectricAuxPort { Watt Initialize(); Watt PowerDemand(Second absTime, Second dt, bool dryRun); } - public interface IBatteryChargePort + public interface IElectricChargerPort { Watt Initialize(); diff --git a/VectoCore/VectoCore/Models/Connector/Ports/Impl/BatteryResponse.cs b/VectoCore/VectoCore/Models/Connector/Ports/Impl/BatteryResponse.cs index fedde47a01..06023c3d86 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/Impl/BatteryResponse.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/Impl/BatteryResponse.cs @@ -4,9 +4,9 @@ using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Models.Connector.Ports.Impl { - public abstract class AbstractBatteryResponse : IBatteryResponse + public abstract class AbstractRESSResponse : IRESSResponse { - protected AbstractBatteryResponse(object source) + protected AbstractRESSResponse(object source) { Source = source; } @@ -15,13 +15,13 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public Second SimulationInterval { get; set; } - public Watt MaxBatteryLoadCharge { get; set; } + public Watt MaxChargePower { get; set; } - public Watt MaxBatteryLoadDischarge { get; set; } + public Watt MaxDischargePower { get; set; } - public Watt BatteryPower { get; set; } + public Watt PowerDemand { get; set; } - public Watt BatteryLoss { get; set; } + public Watt LossPower { get; set; } public double StateOfCharge { get; set; } @@ -29,26 +29,26 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl } - public class BatteryResponseSuccess : AbstractBatteryResponse + public class RESSResponseSuccess : AbstractRESSResponse { - public BatteryResponseSuccess(object source) : base(source) { } + public RESSResponseSuccess(object source) : base(source) { } } - public class BatteryOverloadResponse : AbstractBatteryResponse + public class RESSOverloadResponse : AbstractRESSResponse { - public BatteryOverloadResponse(object source) : base(source) { } + public RESSOverloadResponse(object source) : base(source) { } } - public class BatteryUnderloadResponse : AbstractBatteryResponse + public class RESSUnderloadResponse : AbstractRESSResponse { - public BatteryUnderloadResponse(object source) : base(source) { } + public RESSUnderloadResponse(object source) : base(source) { } } - public class BatteryDryRunResponse : AbstractBatteryResponse + public class RESSDryRunResponse : AbstractRESSResponse { - public BatteryDryRunResponse(object source) : base(source) { } + public RESSDryRunResponse(object source) : base(source) { } } @@ -70,13 +70,13 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public Watt ChargingPower { get; set; } - public IBatteryResponse BatteryResponse { get; set; } + public IRESSResponse RESSResponse { get; set; } public Watt MaxPowerDrive { get { - return (BatteryResponse != null && BatteryResponse.MaxBatteryLoadDischarge != null ? BatteryResponse.MaxBatteryLoadDischarge : 0.SI<Watt>()) - + return (RESSResponse != null && RESSResponse.MaxDischargePower != null ? RESSResponse.MaxDischargePower : 0.SI<Watt>()) - (ChargingPower != null ? ChargingPower : 0.SI<Watt>()) + (AuxPower != null ? AuxPower : 0.SI<Watt>()); } @@ -86,13 +86,13 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl { get { - return (BatteryResponse != null && BatteryResponse.MaxBatteryLoadCharge != null ? BatteryResponse.MaxBatteryLoadCharge : 0.SI<Watt>()) - + return (RESSResponse != null && RESSResponse.MaxChargePower != null ? RESSResponse.MaxChargePower : 0.SI<Watt>()) - (ChargingPower != null ? ChargingPower : 0.SI<Watt>()) + (AuxPower != null ? AuxPower : 0.SI<Watt>()); } } - public Watt BatteryPowerDemand { get; set; } + public Watt RESSPowerDemand { get; set; } public object Source { get; } diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs index 840fc8114f..4d73a002e6 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs @@ -408,17 +408,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Data P_electricMotor_mech_B3, // --> - [ModalResultField(typeof(SI), caption: "P_bat_T [kW]", outputFactor: 1e-3)] P_battery_terminal, - [ModalResultField(typeof(SI), caption: "P_bat_int [kW]", outputFactor: 1e-3)] P_battery_int, - [ModalResultField(typeof(SI), caption: "P_bat_loss [kW]", outputFactor: 1e-3)] P_battery_loss, - [ModalResultField(typeof(SI), caption: "Battery SOC [%]", outputFactor: 100)] BatteryStateOfCharge, - [ModalResultField(typeof(SI), caption: "P_bat charge max [kW]", outputFactor: 1e-3)] P_battery_charge_max, - [ModalResultField(typeof(SI), caption: "P_bat discharge max [kW]", outputFactor: 1e-3)] P_battery_discharge_max, - [ModalResultField(typeof(SI), caption: "U_bat_terminal [V]")] U_bat_terminal, - [ModalResultField(typeof(SI), caption: "U_0_bat [V]")] U0_bat, - [ModalResultField(typeof(SI), caption: "I_bat [kW]")] I_bat, + [ModalResultField(typeof(SI), caption: "P_reess_T [kW]", outputFactor: 1e-3)] P_reess_terminal, + [ModalResultField(typeof(SI), caption: "P_reess_int [kW]", outputFactor: 1e-3)] P_reess_int, + [ModalResultField(typeof(SI), caption: "P_reess_loss [kW]", outputFactor: 1e-3)] P_reess_loss, + [ModalResultField(typeof(SI), caption: "REESS SOC [%]", outputFactor: 100)] REESSStateOfCharge, + [ModalResultField(typeof(SI), caption: "P_reess charge max [kW]", outputFactor: 1e-3)] P_reess_charge_max, + [ModalResultField(typeof(SI), caption: "P_reess discharge max [kW]", outputFactor: 1e-3)] P_reess_discharge_max, + [ModalResultField(typeof(SI), caption: "U_reess_terminal [V]")] U_reess_terminal, + [ModalResultField(typeof(SI), caption: "U_0_reess [V]")] U0_reess, + [ModalResultField(typeof(SI), caption: "I_reess [kW]")] I_reess, - [ModalResultField(typeof(SI), caption: "E_Batt [kWh]", outputFactor: 1/3600e3)] E_Bat, + [ModalResultField(typeof(SI), caption: "E_reess [kWh]", outputFactor: 1/3600e3)] E_RESS, } [AttributeUsage(AttributeTargets.Field)] diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index dd9a2c48cb..db520fb99f 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -128,6 +128,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Data public BatteryData BatteryData { get; internal set; } + public SuperCapData SuperCapData { get; internal set; } + + public SimulationType SimulationType { get; set; } public VTPData VTPData { get; set; } diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs index d590da8402..e9ebd5d051 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs @@ -74,7 +74,7 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus IElectricMotorInfo ElectricMotorInfo(PowertrainPosition pos); - IBatteryInfo BatteryInfo { get; } + IRESSInfo BatteryInfo { get; } ITorqueConverterControl TorqueConverterCtl { get; } IPowertainInfo PowertrainInfo { get; } diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IBatteryInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs similarity index 80% rename from VectoCore/VectoCore/Models/Simulation/DataBus/IBatteryInfo.cs rename to VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs index 26b8155839..ab6b431e21 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IBatteryInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs @@ -2,9 +2,9 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus { - public interface IBatteryInfo + public interface IRESSInfo { - Volt InternalCellVoltage { get; } + Volt InternalVoltage { get; } double StateOfCharge { get; } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index ede11954b9..a1b87fb023 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -436,11 +436,23 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; - var battery = new Battery(container, data.BatteryData); - battery.Initialize(data.BatteryData.InitialSoC); + if (data.BatteryData != null && data.SuperCapData != null) { + throw new VectoException("Only one REESS is supported."); + } var es = new ElectricSystem(container); - es.Connect(battery); + + if (data.BatteryData != null) { + var battery = new Battery(container, data.BatteryData); + battery.Initialize(data.BatteryData.InitialSoC); + es.Connect(battery); + } + + if (data.SuperCapData != null) { + var superCap = new SuperCap(container, data.SuperCapData); + superCap.Initialize(data.SuperCapData.InitialSoC); + es.Connect(superCap); + } var ctl = new BatteryElectricMotorController(container, es); diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index 112c9aefd9..5b6ef17b29 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public virtual IDrivingCycleInfo DrivingCycleInfo { get; protected set; } - public IBatteryInfo BatteryInfo { get; protected set; } + public IRESSInfo BatteryInfo { get; protected set; } internal ISimulationOutPort Cycle; @@ -171,7 +171,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl HasElectricMotor = true; }) .If<IHybridController>(c => { HybridController = c; }) - .If<IBatteryInfo>(c => BatteryInfo = c); + .If<IRESSInfo>(c => BatteryInfo = c); if (ignoreComponent) { return; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs index 638096c5ee..320db461a9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs @@ -28,6 +28,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Battery { //public double TargetSoC { get; internal set; } } + public class SuperCapData + { + public Farad Capacity { get; internal set; } + + public Ohm InternalResistance { get; internal set; } + + public Volt MinVoltage { get; internal set; } + + public Volt MaxVoltage { get; internal set; } + public double InitialSoC { get; internal set; } + } + public class SOCMap { protected internal SOCMapEntry[] Entries; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs index acda8f0b37..8feb001df2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/ElectricMotorData.cs @@ -7,15 +7,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data [ValidateObject] public EfficiencyMap EfficiencyMap { get; internal set; } + [ValidateObject] public ElectricFullLoadCurve 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 Watt ContinuousPower { get; internal set; } + [SIRange(0, double.MaxValue)] public Joule OverloadBuffer { get; internal set; } + + [SIRange(0, 1)] public double OverloadRegenerationFactor { get; internal set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs index e8c6c9eb05..6b6e389c05 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs @@ -12,11 +12,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent public class ElectricSystem : StatefulVectoSimulationComponent<ElectricSystem.State>, IElectricSystem, IElectricAuxConnecor, IElectricChargerConnector, IBatteryConnector { - protected readonly List<IBatteryAuxPort> Consumers = new List<IBatteryAuxPort>(); + protected readonly List<IElectricAuxPort> Consumers = new List<IElectricAuxPort>(); - protected IBatteryChargePort Charger; + protected IElectricChargerPort Charger; - protected IBattery Battery; + protected IElectricEnergyStorage Battery; public ElectricSystem(IVehicleContainer container) : base(container) { } @@ -32,24 +32,24 @@ namespace TUGraz.VectoCore.Models.SimulationComponent ? (AbstractElectricSystemResponse)new ElectricSystemDryRunResponse(this) : new ElectricSystemResponseSuccess(this); - if (batResponse is BatteryOverloadResponse) + if (batResponse is RESSOverloadResponse) { response = new ElectricSystemOverloadResponse(this); } - if (batResponse is BatteryUnderloadResponse) + if (batResponse is RESSUnderloadResponse) { response = new ElectricSystemUnderloadResponse(this); } if (!dryRun) { - CurrentState.SetState(powerDemand, auxDemand, chargePower, batResponse.BatteryPower); + CurrentState.SetState(powerDemand, auxDemand, chargePower, batResponse.PowerDemand); } response.AbsTime = absTime; response.SimulationInterval = dt; - response.BatteryResponse = batResponse; - response.BatteryPowerDemand = totalPowerDemand; + response.RESSResponse = batResponse; + response.RESSPowerDemand = totalPowerDemand; response.ConsumerPower = powerDemand; response.AuxPower = auxDemand; response.ChargingPower = chargePower; @@ -74,7 +74,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent #region Implementation of IBatteryChargeProvider - public void Connect(IBatteryChargePort charger) + public void Connect(IElectricChargerPort charger) { Charger = charger; } @@ -83,7 +83,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent #region Implementation of IBatteryAuxOutProvider - public void Connect(IBatteryAuxPort aux) + public void Connect(IElectricAuxPort aux) { if (Consumers.Contains(aux)) { return; } Consumers.Add(aux); @@ -93,7 +93,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent #region Implementation of IBatteryConnector - public void Connect(IBattery battery) + public void Connect(IElectricEnergyStorage battery) { if (Battery != null) { @@ -104,11 +104,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent #endregion - #region Implementation of IBatteryInfo + #region Implementation of IRESSInfo public Volt InternalCellVoltage { - get { return Battery.InternalCellVoltage; } + get { return Battery.InternalVoltage; } } public double StateOfCharge diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IBattery.cs b/VectoCore/VectoCore/Models/SimulationComponent/IElectricEnergyStorage.cs similarity index 88% rename from VectoCore/VectoCore/Models/SimulationComponent/IBattery.cs rename to VectoCore/VectoCore/Models/SimulationComponent/IElectricEnergyStorage.cs index ffc18e5481..d3b35cbfb0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IBattery.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IElectricEnergyStorage.cs @@ -23,7 +23,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent IElectricSystemResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun = false); } - public interface IBattery : IBatteryProvider, IBatteryInfo + public interface IElectricEnergyStorage : IBatteryProvider, IRESSInfo { } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs index e591eba6eb..217d83b7b4 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs @@ -13,7 +13,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class Battery : StatefulVectoSimulationComponent<Battery.State>, IBattery, IBatteryPort + public class Battery : StatefulVectoSimulationComponent<Battery.State>, IElectricEnergyStorage, IElectricEnergyStoragePort { protected readonly BatteryData ModelData; @@ -23,7 +23,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } #region Implementation of IBatteryProvider - public IBatteryPort MainBatteryPort + public IElectricEnergyStoragePort MainBatteryPort { get { return this; } } @@ -31,7 +31,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion - #region Implementation of IBatteryPort + #region Implementation of IElectricEnergyStoragePort public void Initialize(double initialSoC) { @@ -42,7 +42,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PreviousState.StateOfCharge = initialSoC; } - public IBatteryResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun = false) + public IRESSResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun = false) { var maxChargePower = MaxChargePower(dt); var maxDischargePower = MaxDischargePower(dt); @@ -57,23 +57,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var current = 0.SI<Ampere>(); if (!powerDemand.IsEqual(0)) { - var solutions = VectoMath.QuadraticEquationSolver(internalResistance.Value(), InternalCellVoltage.Value(), + var solutions = VectoMath.QuadraticEquationSolver(internalResistance.Value(), InternalVoltage.Value(), -powerDemand.Value()); current = SelectSolution(solutions, powerDemand.Value()); } var batteryLoss = current * internalResistance * current; var currentCharge = ModelData.Capacity * PreviousState.StateOfCharge; - if (dryRun) - { - return new BatteryDryRunResponse(this) - { + if (dryRun) { + return new RESSDryRunResponse(this) { AbsTime = absTime, SimulationInterval = dt, - MaxBatteryLoadCharge = maxChargePower, - MaxBatteryLoadDischarge = maxDischargePower, - BatteryPower = powerDemand, - BatteryLoss = batteryLoss, + MaxChargePower = maxChargePower, + MaxDischargePower = maxDischargePower, + PowerDemand = powerDemand, + LossPower = batteryLoss, StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity }; @@ -87,14 +85,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity; CurrentState.MaxChargePower = maxChargePower; CurrentState.MaxDischargePower = maxDischargePower; - return new BatteryResponseSuccess(this) - { + return new RESSResponseSuccess(this) { AbsTime = absTime, SimulationInterval = dt, - MaxBatteryLoadCharge = maxChargePower, - MaxBatteryLoadDischarge = maxDischargePower, - BatteryPower = powerDemand, - BatteryLoss = batteryLoss, + MaxChargePower = maxChargePower, + MaxDischargePower = maxDischargePower, + PowerDemand = powerDemand, + LossPower = batteryLoss, StateOfCharge = (currentCharge + current * dt) / ModelData.Capacity }; } @@ -104,7 +101,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return solutions.Where(x => Math.Sign(sign) == Math.Sign(x) && Math.Abs(x).IsSmallerOrEqual(ModelData.MaxCurrent.Value(), 1e-3)).Min().SI<Ampere>(); } - private IBatteryResponse PowerDemandExceeded(Second absTime, Second dt, Watt powerDemand, Watt maxDischargePower, + private IRESSResponse PowerDemandExceeded(Second absTime, Second dt, Watt powerDemand, Watt maxDischargePower, Watt maxChargePower, bool dryRun) { var maxPower = powerDemand < 0 ? maxDischargePower : maxChargePower; @@ -117,28 +114,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var batteryLoss = current * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge) * current; - AbstractBatteryResponse response; - if (dryRun) - { - response = new BatteryDryRunResponse(this); - } - else - { - if (powerDemand > maxPower) - { - response = new BatteryOverloadResponse(this); - } - else - { - response = new BatteryUnderloadResponse(this); + AbstractRESSResponse response; + if (dryRun) { + response = new RESSDryRunResponse(this); + } else { + if (powerDemand > maxPower) { + response = new RESSOverloadResponse(this); + } else { + response = new RESSUnderloadResponse(this); } } response.AbsTime = absTime; response.SimulationInterval = dt; - response.MaxBatteryLoadCharge = maxChargePower; - response.MaxBatteryLoadDischarge = maxDischargePower; - response.BatteryPower = powerDemand; - response.BatteryLoss = batteryLoss; + response.MaxChargePower = maxChargePower; + response.MaxDischargePower = maxDischargePower; + response.PowerDemand = powerDemand; + response.LossPower = batteryLoss; return response; } @@ -151,20 +142,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override void DoWriteModalResults(Second absTime, Second dt, IModalDataContainer container) { var cellVoltage = ModelData.SOCMap.Lookup(PreviousState.StateOfCharge); - container[ModalResultField.U0_bat] = cellVoltage; - container[ModalResultField.U_bat_terminal] = + container[ModalResultField.U0_reess] = cellVoltage; + container[ModalResultField.U_reess_terminal] = cellVoltage + CurrentState.TotalCurrent * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge); // adding both terms because pos. current charges the battery! - container[ModalResultField.I_bat] = CurrentState.TotalCurrent; - container[ModalResultField.BatteryStateOfCharge] = CurrentState.StateOfCharge.SI(); - container[ModalResultField.P_battery_terminal] = CurrentState.PowerDemand; - container[ModalResultField.P_battery_int] = cellVoltage * CurrentState.TotalCurrent; - container[ModalResultField.P_battery_loss] = CurrentState.BatteryLoss; - container[ModalResultField.P_battery_charge_max] = CurrentState.MaxChargePower; - container[ModalResultField.P_battery_discharge_max] = CurrentState.MaxDischargePower; + container[ModalResultField.I_reess] = CurrentState.TotalCurrent; + container[ModalResultField.REESSStateOfCharge] = CurrentState.StateOfCharge.SI(); + container[ModalResultField.P_reess_terminal] = CurrentState.PowerDemand; + container[ModalResultField.P_reess_int] = cellVoltage * CurrentState.TotalCurrent; + container[ModalResultField.P_reess_loss] = CurrentState.BatteryLoss; + container[ModalResultField.P_reess_charge_max] = CurrentState.MaxChargePower; + container[ModalResultField.P_reess_discharge_max] = CurrentState.MaxDischargePower; - container[ModalResultField.E_Bat] = CurrentState.StateOfCharge * cellVoltage * ModelData.Capacity; + container[ModalResultField.E_RESS] = CurrentState.StateOfCharge * cellVoltage * ModelData.Capacity; } @@ -176,9 +167,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion - #region Implementation of IBatteryInfo + #region Implementation of IRESSInfo - public Volt InternalCellVoltage + public Volt InternalVoltage { get { return ModelData.SOCMap.Lookup(PreviousState.StateOfCharge); } } @@ -200,7 +191,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var maxChargeCurrent = VectoMath.Min((ModelData.MaxSOC - PreviousState.StateOfCharge) * ModelData.Capacity / dt, ModelData.MaxCurrent); - return InternalCellVoltage * maxChargeCurrent + + return InternalVoltage * maxChargeCurrent + maxChargeCurrent * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge) * maxChargeCurrent; } @@ -209,21 +200,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var maxDischargeCurrent = VectoMath.Max( ((ModelData.MinSOC - PreviousState.StateOfCharge) * ModelData.Capacity / dt).LimitTo(-ModelData.MaxCurrent, 0.SI<Ampere>()), -ModelData.MaxCurrent); - var cellVoltage = InternalCellVoltage; - var maxDischargePower = InternalCellVoltage * maxDischargeCurrent + + var cellVoltage = InternalVoltage; + var maxDischargePower = InternalVoltage * maxDischargeCurrent + maxDischargeCurrent * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge) * maxDischargeCurrent; var maxPower = -cellVoltage / (4 * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge)) * cellVoltage; return VectoMath.Max(maxDischargePower, maxPower); } - public Ampere MaxCurrent - { - get - { - var cellVoltage = ModelData.SOCMap.Lookup(PreviousState.StateOfCharge); - return VectoMath.Max(-ModelData.MaxCurrent, -cellVoltage / (4 * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge))); - } - } + //public Ampere MaxCurrent + //{ + // get + // { + // var cellVoltage = ModelData.SOCMap.Lookup(PreviousState.StateOfCharge); + // return VectoMath.Max(-ModelData.MaxCurrent, -cellVoltage / (4 * ModelData.InternalResistance.Lookup(PreviousState.StateOfCharge))); + // } + //} #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliary.cs index 26d86e811f..0502961dfa 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricAuxiliary.cs @@ -8,7 +8,7 @@ using TUGraz.VectoCore.Models.Simulation.Impl; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - internal class ElectricAuxiliary : IBatteryAuxPort + internal class ElectricAuxiliary : IElectricAuxPort { protected readonly Dictionary<string, Func<Watt>> Auxiliaries = new Dictionary<string, Func<Watt>>(); @@ -19,7 +19,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DataBus = container; } - #region Implementation of IBatteryAuxPort + #region Implementation of IElectricAuxPort public Watt Initialize() { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs new file mode 100644 index 0000000000..f3bdc360ed --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs @@ -0,0 +1,199 @@ +using System; +using System.Linq; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Battery; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class SuperCap : StatefulVectoSimulationComponent<SuperCap.State>, IElectricEnergyStorage, IElectricEnergyStoragePort + { + private SuperCapData ModelData; + + public SuperCap(IVehicleContainer container, SuperCapData modelData) : base(container) + { + ModelData = modelData; + } + + public IElectricEnergyStoragePort MainBatteryPort + { + get { return this; } + } + public Volt InternalVoltage + { + get { return PreviousState.Charge / ModelData.Capacity; } + } + + public double StateOfCharge + { + get { return PreviousState.Charge / (ModelData.Capacity * ModelData.MaxVoltage); } + } + + public WattSecond StoredEnergy + { + get { return PreviousState.Charge * InternalVoltage; } + } + + public Watt MaxChargePower(Second dt) + { + var maxChargeCurrent = (ModelData.Capacity * ModelData.MaxVoltage - PreviousState.Charge) / dt; + return InternalVoltage * maxChargeCurrent + maxChargeCurrent * ModelData.InternalResistance * maxChargeCurrent; + } + + public Watt MaxDischargePower(Second dt) + { + var maxDischargeCurrent = (ModelData.Capacity * ModelData.MinVoltage - PreviousState.Charge) / dt; + var maxDischargePower = InternalVoltage * maxDischargeCurrent + + maxDischargeCurrent * ModelData.InternalResistance * maxDischargeCurrent; + var maxPower = -InternalVoltage / (4 * ModelData.InternalResistance) * InternalVoltage; + return VectoMath.Max(maxDischargePower > 0 ? -double.MaxValue.SI<Watt>():maxDischargePower, maxPower); + } + + public void Initialize(double initialSoC) + { + PreviousState.Charge = ModelData.Capacity * ((ModelData.MaxVoltage - ModelData.MinVoltage) * initialSoC + + ModelData.MinVoltage); + + } + + public IRESSResponse Request(Second absTime, Second dt, Watt powerDemand, bool dryRun) + { + var maxChargePower = MaxChargePower(dt); + var maxDischargePower = MaxDischargePower(dt); + + if (powerDemand.IsGreater(maxChargePower, Constants.SimulationSettings.InterpolateSearchTolerance) || + powerDemand.IsSmaller(maxDischargePower, Constants.SimulationSettings.InterpolateSearchTolerance)) + { + return PowerDemandExceeded(absTime, dt, powerDemand, maxDischargePower, maxChargePower, dryRun); + } + + var internalResistance = ModelData.InternalResistance; + var current = 0.SI<Ampere>(); + if (!powerDemand.IsEqual(0)) + { + var solutions = VectoMath.QuadraticEquationSolver(internalResistance.Value(), InternalVoltage.Value(), + -powerDemand.Value()); + current = SelectSolution(solutions, powerDemand.Value()); + } + var internalLoss = current * internalResistance * current; + var currentCharge = PreviousState.Charge; + + if (dryRun) + { + return new RESSDryRunResponse(this) + { + AbsTime = absTime, + SimulationInterval = dt, + MaxChargePower = maxChargePower, + MaxDischargePower = maxDischargePower, + PowerDemand = powerDemand, + LossPower = internalLoss, + StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage) + + }; + } + CurrentState.SimulationInterval = dt; + CurrentState.PowerDemand = powerDemand; + CurrentState.TotalCurrent = current; + CurrentState.InternalLoss = internalLoss; + + + CurrentState.Charge = (currentCharge + current * dt); + CurrentState.MaxChargePower = maxChargePower; + CurrentState.MaxDischargePower = maxDischargePower; + return new RESSResponseSuccess(this) + { + AbsTime = absTime, + SimulationInterval = dt, + MaxChargePower = maxChargePower, + MaxDischargePower = maxDischargePower, + PowerDemand = powerDemand, + LossPower = internalLoss, + StateOfCharge = (currentCharge + current * dt) / (ModelData.Capacity * ModelData.MaxVoltage) + }; + } + + private Ampere SelectSolution(double[] solutions, double sign) + { + return solutions.FirstOrDefault().SI<Ampere>(); + + //return solutions.Where(x => Math.Sign(sign) == Math.Sign(x) /*&& Math.Abs(x).IsSmallerOrEqual(ModelData.MaxCurrent.Value(), 1e-3)*/).MinBy(x => Math.Abs(x)).SI<Ampere>(); + } + + + private IRESSResponse PowerDemandExceeded(Second absTime, Second dt, Watt powerDemand, Watt maxDischargePower, + Watt maxChargePower, bool dryRun) + { + var maxPower = powerDemand < 0 ? maxDischargePower : maxChargePower; + + var maxChargeCurrent = (ModelData.Capacity * ModelData.MaxVoltage - PreviousState.Charge) / dt; + var maxDischargeCurrent = (ModelData.Capacity * ModelData.MinVoltage - PreviousState.Charge) / dt; + var current = powerDemand < 0 ? maxDischargeCurrent : maxChargeCurrent; + + var batteryLoss = current * ModelData.InternalResistance * current; + + AbstractRESSResponse response; + if (dryRun) { + response = new RESSDryRunResponse(this); + } else { + if (powerDemand > maxPower) { + response = new RESSOverloadResponse(this); + } else { + response = new RESSUnderloadResponse(this); + } + } + response.AbsTime = absTime; + response.SimulationInterval = dt; + response.MaxChargePower = maxChargePower; + response.MaxDischargePower = maxDischargePower; + response.PowerDemand = powerDemand; + response.LossPower = batteryLoss; + + return response; + } + + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + var internalVoltage = PreviousState.Charge / ModelData.Capacity; + container[ModalResultField.U0_reess] = internalVoltage; + container[ModalResultField.U_reess_terminal] = + internalVoltage + + CurrentState.TotalCurrent * ModelData.InternalResistance; // adding both terms because pos. current charges the battery! + container[ModalResultField.I_reess] = CurrentState.TotalCurrent; + container[ModalResultField.REESSStateOfCharge] = CurrentState.Charge / (ModelData.Capacity * ModelData.MaxVoltage); + container[ModalResultField.P_reess_terminal] = CurrentState.PowerDemand; + container[ModalResultField.P_reess_int] = internalVoltage * CurrentState.TotalCurrent; + container[ModalResultField.P_reess_loss] = CurrentState.InternalLoss; + container[ModalResultField.P_reess_charge_max] = CurrentState.MaxChargePower; + container[ModalResultField.P_reess_discharge_max] = CurrentState.MaxDischargePower; + + container[ModalResultField.E_RESS] = CurrentState.Charge * internalVoltage * ModelData.Capacity; + } + + protected override void DoCommitSimulationStep(Second time, Second simulationInterval) + { + AdvanceState(); + } + + public class State + { + public AmpereSecond Charge; + + public Second SimulationInterval; + + public Watt PowerDemand; + + public Ampere TotalCurrent; + public Watt MaxChargePower; + public Watt MaxDischargePower; + public Watt InternalLoss; + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index da75dd5c10..f95f02c007 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -161,7 +161,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (DataBus.DriverInfo.DrivingAction == DrivingAction.Brake && (eval.Count == 0 )) { - eval.Add(MaxRecuperationSetting(absTime, dt, outTorque, outAngularVelocity)); + eval.Add(MaxRecuperationSetting(absTime, dt, outTorque, outAngularVelocity, dryRun)); } var origBest = SelectBestOption_ORIG(eval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); @@ -182,8 +182,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies CurrentState.Evaluations = eval; CurrentState.GearboxEngaged = DataBus.GearboxInfo.GearEngaged(absTime); if (!DataBus.EngineCtl.CombustionEngineOn && !best.ICEOff && !retVal.ShiftRequired) { - CurrentState.ICEStartTStmp = absTime; - } + CurrentState.ICEStartTStmp = absTime; + } } if (retVal.ShiftRequired) { @@ -197,6 +197,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public IResponse AmendResponse(IResponse response, Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) { + if (response is ResponseSuccess) { + if (!DataBus.EngineInfo.EngineOn && !CurrentState.Solution.ICEOff) { + //CurrentState.ICEStartTStmp = absTime; + } + } if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && (outTorque * outAngularVelocity).IsEqual(StrategyParameters.MaxDrivetrainPower, Constants.SimulationSettings.LineSearchTolerance.SI<Watt>())) { @@ -312,7 +317,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (tmp.CombustionEngineOn) { var firstEntry = new HybridResultEntry(); - CalcualteCosts(firstResponse, dt, firstEntry, AllowICEOff(absTime)); + CalcualteCosts(firstResponse, dt, firstEntry, AllowICEOff(absTime), dryRun); if (DataBus.GearboxInfo.GearEngaged(absTime) && (firstEntry.IgnoreReason & (HybridConfigurationIgnoreReason.EngineSpeedTooLow | HybridConfigurationIgnoreReason.EngineSpeedBelowDownshift)) != 0) { @@ -331,7 +336,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies eval.AddRange(FindSolution(absTime, dt, outTorque, outAngularVelocity, dryRun)); } else { EvaluateConfigsForGear( - absTime, dt, outTorque, outAngularVelocity, currentGear, AllowICEOff(absTime), eval, emPos); + absTime, dt, outTorque, outAngularVelocity, currentGear, AllowICEOff(absTime), eval, emPos, dryRun); } }else if (DataBus.GearboxInfo.GearEngaged(absTime)) { eval.AddRange(FindSolution(absTime, dt, outTorque, outAngularVelocity, dryRun)); @@ -363,7 +368,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies absTime, dt, outTorque, outAngularVelocity, currentGear, maxRecuperation); if (maxRecuperationResponse.DeltaDragLoad.IsSmaller(0) && - maxRecuperationResponse.ElectricSystem.BatteryPowerDemand.IsBetween(maxRecuperationResponse.ElectricSystem.MaxPowerDrag, maxRecuperationResponse.ElectricSystem.MaxPowerDrive)) { + maxRecuperationResponse.ElectricSystem.RESSPowerDemand.IsBetween(maxRecuperationResponse.ElectricSystem.MaxPowerDrag, maxRecuperationResponse.ElectricSystem.MaxPowerDrive)) { // even with full recuperation (and no braking) the operating point is below the drag curve (and the battery can handle it) - use full recuperation eval.Add( new HybridResultEntry() { @@ -495,7 +500,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var newEval = new List<HybridResultEntry>(); EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear + 1, AllowICEOff(absTime), newEval, - best.Setting.MechanicalAssistPower.First().Key); + best.Setting.MechanicalAssistPower.First().Key, dryRun); if (newEval.Count > 0) { best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); } @@ -505,7 +510,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var newEval = new List<HybridResultEntry>(); EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear - 1, AllowICEOff(absTime), newEval, - best.Setting.MechanicalAssistPower.First().Key); + best.Setting.MechanicalAssistPower.First().Key, dryRun); if (newEval.Count > 0) { best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); } @@ -560,7 +565,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } best = eval.Where(x => !x.IgnoreReason.BatteryDemandExceeded()) .OrderBy(x => Math.Abs((int)currentGear - x.Gear)) - .ThenBy(x => -x.Response.ElectricSystem.BatteryPowerDemand.Value()).First(); + .ThenBy(x => -x.Response.ElectricSystem.RESSPowerDemand.Value()).First(); return best; } } @@ -650,7 +655,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies best = eval.Where( x => !x.IgnoreReason.BatteryDemandExceeded()) .OrderBy(x => Math.Abs((int)currentGear - x.Gear)) - .ThenBy(x => -x.Response.ElectricSystem.BatteryPowerDemand.Value()).First(); + .ThenBy(x => -x.Response.ElectricSystem.RESSPowerDemand.Value()).First(); } else { best = filtered.MinBy( x => x.Setting.MechanicalAssistPower.Sum(e => e.Value ?? 0.SI<NewtonMeter>())); @@ -680,7 +685,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var newEval = new List<HybridResultEntry>(); EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear + 1, AllowICEOff(absTime), newEval, - best.Setting.MechanicalAssistPower.First().Key); + best.Setting.MechanicalAssistPower.First().Key, dryRun); best = SelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); } if ((best.IgnoreReason & HybridConfigurationIgnoreReason.EngineSpeedBelowDownshift) != 0) { @@ -688,7 +693,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var newEval = new List<HybridResultEntry>(); EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear - 1, AllowICEOff(absTime), newEval, - best.Setting.MechanicalAssistPower.First().Key); + best.Setting.MechanicalAssistPower.First().Key, dryRun); best = SelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); } } @@ -718,7 +723,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } - private HybridResultEntry MaxRecuperationSetting(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) + private HybridResultEntry MaxRecuperationSetting(Second absTime, Second dt, NewtonMeter outTorque, + PerSecond outAngularVelocity, bool dryRun) { var first = new HybridStrategyResponse() { CombustionEngineOn = DataBus.EngineInfo.EngineOn, // AllowICEOff(absTime), @@ -731,7 +737,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var emPos = ModelData.ElectricMachinesData.First().Item1; var emTorque = !ElectricMotorCanPropellDuringTractionInterruption && (firstResponse.Gearbox.Gear == 0 || !DataBus.GearboxInfo.GearEngaged(absTime)) ? null : firstResponse.ElectricMotor.MaxRecuperationTorque; - return TryConfiguration(absTime, dt, outTorque, outAngularVelocity, currentGear, emPos, emTorque, double.NaN, AllowICEOff(absTime)); + return TryConfiguration(absTime, dt, outTorque, outAngularVelocity, currentGear, emPos, emTorque, double.NaN, AllowICEOff(absTime), dryRun); } private List<HybridResultEntry> FindSolution(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) @@ -762,7 +768,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies nextGear <= Math.Min(numGears, gear + gearRangeUpshift); nextGear++) { - var emOffEntry = EvaluateConfigsForGear(absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos); + var emOffEntry = EvaluateConfigsForGear(absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos, dryRun); if (emOffEntry == null) { continue; @@ -779,7 +785,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (allowEmergencyUpshift && tmpBest != null && !tmpBest.ICEOff) { var nextGear = gear + 1; var emOffEntry = EvaluateConfigsForGear( - absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos); + absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos, dryRun); // GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, nextGear); //if (emOffEntry != null) { @@ -798,7 +804,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (allowEmergencyDownshift && tmpBest != null && !tmpBest.ICEOff) { var nextGear = gear - 1; var emOffEntry = EvaluateConfigsForGear( - absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos); + absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, responses, emPos, dryRun); // GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, nextGear); //if (emOffEntry != null) { @@ -818,23 +824,23 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return responses; } - private HybridResultEntry EvaluateConfigsForGear( - Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, uint nextGear, bool allowICEOff, - List<HybridResultEntry> responses, PowertrainPosition emPos) + private HybridResultEntry EvaluateConfigsForGear(Second absTime, Second dt, NewtonMeter outTorque, + PerSecond outAngularVelocity, uint nextGear, bool allowICEOff, + List<HybridResultEntry> responses, PowertrainPosition emPos, bool dryRun) { var emOffEntry = GetEmOffResultEntry(absTime, dt, outTorque, outAngularVelocity, nextGear); if (emOffEntry == null) { return null; } - CalcualteCosts(emOffEntry.Response, dt, emOffEntry, allowICEOff); + CalcualteCosts(emOffEntry.Response, dt, emOffEntry, allowICEOff, dryRun); responses.Add(emOffEntry); var emTqReq = (emOffEntry.Response.ElectricMotor.PowerRequest + emOffEntry.Response.ElectricMotor.InertiaPowerDemand) / emOffEntry.Response.ElectricMotor.AngularVelocity; IterateEMTorque( - absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, emOffEntry.Response, emTqReq, emPos, responses); + absTime, dt, outTorque, outAngularVelocity, nextGear, allowICEOff, emOffEntry.Response, emTqReq, emPos, responses, dryRun); return emOffEntry; } @@ -861,7 +867,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return entry; } - private void IterateEMTorque(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, uint nextGear, bool allowIceOff, IResponse firstResponse, NewtonMeter emTqReq, PowertrainPosition emPos, List<HybridResultEntry> responses) + private void IterateEMTorque(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + uint nextGear, bool allowIceOff, IResponse firstResponse, NewtonMeter emTqReq, PowertrainPosition emPos, + List<HybridResultEntry> responses, bool dryRun) { const double stepSize = 0.1; @@ -881,7 +889,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies continue; } - var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorque, u, allowIceOff); + var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorque, u, allowIceOff, dryRun); responses.Add(tmp); } @@ -891,11 +899,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var emTorqueM = emTqReq * maxU; if (!responses.Any(x => x.Gear == nextGear && x.U.IsEqual(maxU)) && emTorqueM.IsBetween( 0.SI<NewtonMeter>(), firstResponse.ElectricMotor.MaxDriveTorque)) { - var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorqueM, maxU, allowIceOff); + var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorqueM, maxU, allowIceOff, dryRun); responses.Add(tmp); } if (maxEmTorque.IsSmaller(0) && emTqReq.IsGreater(-maxEmTorque)) { - var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, maxEmTorque, maxEmTorque / emTqReq, allowIceOff); + var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, maxEmTorque, maxEmTorque / emTqReq, allowIceOff, dryRun); if (!tmp.Response.ElectricSystem.ConsumerPower.IsSmaller(emDrivePower)) { responses.Add(tmp); } @@ -915,7 +923,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies !emDriveTorque.IsEqual(emDragTorque, 1.SI<NewtonMeter>())) { var tmp = TryConfiguration( absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emDriveTorque, emDriveTorque / emTqReq, - allowIceOff); + allowIceOff, dryRun); responses.Add(tmp); } } @@ -951,7 +959,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // only consider when within allowed EM torque range var tmp = TryConfiguration( absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorqueICEOff, emTorqueICEOff / emTqReq, - allowIceOff); + allowIceOff, dryRun); responses.Add(tmp); } } catch (Exception ) { @@ -969,7 +977,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies continue; } - var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorque, u, allowIceOff); + var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorque, u, allowIceOff, dryRun); responses.Add(tmp); } var maxEmTorqueRecuperate = firstResponse.ElectricMotor.MaxRecuperationTorque ?? 0.SI<NewtonMeter>(); @@ -1006,7 +1014,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var tmp = TryConfiguration( absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, emTorqueICEOff, emTorqueICEOff / maxEmTorqueRecuperate, - allowIceOff); + allowIceOff, dryRun); responses.Add(tmp); } } catch (Exception) { @@ -1014,7 +1022,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } } else { if (maxEmTorqueRecuperate.IsGreater(0) && (-emTqReq).IsBetween(maxEmTorqueRecuperate, 0.SI<NewtonMeter>())) { - var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, -emTqReq, -emTqReq / maxEmTorqueRecuperate, allowIceOff); + var tmp = TryConfiguration(absTime, dt, outTorque, outAngularVelocity, nextGear, emPos, + -emTqReq, -emTqReq / maxEmTorqueRecuperate, allowIceOff, dryRun); responses.Add(tmp); } } @@ -1022,7 +1031,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } } - private HybridResultEntry TryConfiguration(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, uint nextGear, PowertrainPosition emPos, NewtonMeter emTorque, double u, bool allowIceOff) + private HybridResultEntry TryConfiguration(Second absTime, Second dt, NewtonMeter outTorque, + PerSecond outAngularVelocity, uint nextGear, PowertrainPosition emPos, NewtonMeter emTorque, double u, + bool allowIceOff, bool dryRun) { var cfg = new HybridStrategyResponse() { CombustionEngineOn = true, @@ -1039,7 +1050,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies Response = resp, Gear = nextGear, }; - CalcualteCosts(resp, dt, tmp, allowIceOff); + CalcualteCosts(resp, dt, tmp, allowIceOff, dryRun); return tmp; } @@ -1123,7 +1134,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return retVal as ResponseDryRun; } - private void CalcualteCosts(IResponse resp, Second dt, HybridResultEntry tmp, bool allowIceOff) + private void CalcualteCosts(IResponse resp, Second dt, HybridResultEntry tmp, bool allowIceOff, bool dryRun) { tmp.IgnoreReason = 0; if (resp == null) { @@ -1132,7 +1143,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return; } - if (!resp.Engine.TotalTorqueDemand.IsBetween( + var iceOff = allowIceOff && resp.Engine.TorqueOutDemand.IsEqual(0, 1e-3); + if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && dryRun) { + // this means we search for an acceleration the vehicle is capable to do - so treat ICE overload regularly + iceOff = false; + } + + if (!iceOff && !resp.Engine.TotalTorqueDemand.IsBetween( resp.Engine.DragTorque, resp.Engine.DynamicFullLoadTorque)) { tmp.FuelCosts = double.NaN; tmp.IgnoreReason |= resp.Engine.TotalTorqueDemand.IsGreater(resp.Engine.DynamicFullLoadTorque) @@ -1167,7 +1184,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var absTime = DataBus.AbsTime; // todo! if (DataBus.GearboxInfo.GearEngaged(absTime)) { - if (allowIceOff && resp.Engine.TorqueOutDemand.IsEqual(0)) { + if (iceOff) { // no torque from ICE requested, ICE could be turned off tmp.FuelCosts = 0; tmp.ICEOff = true; @@ -1188,7 +1205,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ? HybridConfigurationIgnoreReason.EngineTorqueDemandTooHigh : HybridConfigurationIgnoreReason.EngineTorqueDemandTooLow; } - if (allowIceOff && resp.Engine.TorqueOutDemand.IsEqual(0, 1e-3)) { + if (iceOff) { // no torque from ICE requested, ICE could be turned off tmp.FuelCosts = 0; tmp.ICEOff = true; @@ -1234,14 +1251,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies private void SetBatteryCosts(IResponse resp, Second dt, HybridResultEntry tmp) { var batEnergyStored = DataBus.BatteryInfo.StoredEnergy; - var batEnergy = resp.ElectricSystem.BatteryPowerDemand * dt; - var batPower = resp.ElectricSystem.BatteryResponse.BatteryPower; + var batEnergy = resp.ElectricSystem.RESSPowerDemand * dt; + var batPower = resp.ElectricSystem.RESSResponse.PowerDemand; - if (batPower.IsSmaller(resp.ElectricSystem.BatteryResponse.MaxBatteryLoadDischarge) || batPower.IsGreater(resp.ElectricSystem.BatteryResponse.MaxBatteryLoadCharge)) { + if (batPower.IsSmaller(resp.ElectricSystem.RESSResponse.MaxDischargePower) || batPower.IsGreater(resp.ElectricSystem.RESSResponse.MaxChargePower)) { // battery power demand too high - would discharge below min SoC / charge above max SoC tmp.BatCosts = double.NaN; tmp.IgnoreReason |= batPower.IsSmaller( - resp.ElectricSystem.BatteryResponse.MaxBatteryLoadDischarge) + resp.ElectricSystem.RESSResponse.MaxDischargePower) ? HybridConfigurationIgnoreReason.BatteryBelowMinSoC : HybridConfigurationIgnoreReason.BatteryAboveMaxSoc; } diff --git a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs index 4be69b825f..9a8daf9561 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs @@ -36,6 +36,8 @@ public class JSONFileWriter : IOutputFileWriter private const int ElectricMotorFormatVersion = 1; + private const int REESSFormatVersion = 1; + private const int HybridStrategyParamsVersion = 1; private static JSONFileWriter _instance; @@ -89,17 +91,17 @@ public class JSONFileWriter : IOutputFileWriter public void SaveBattery(IBatteryPackEngineeringInputData battery, string filename, bool declMode) { - var header = GetHeader(ElectricMotorFormatVersion); + var header = GetHeader(REESSFormatVersion); var body = new Dictionary<string, object>(); body.Add("SavedInDeclMode", declMode); - + body.Add("REESSType", "Battery"); body.Add("Model", battery.Model); body.Add("Capacity", battery.Capacity.AsAmpHour); body.Add("SOC_min", battery.MinSOC * 100.0); body.Add("SOC_max",battery.MaxSOC * 100.0); - body.Add("MaxCurrentFactor", battery.MaxCurrentFactor); + body.Add("MaxCurrentFactor", battery.MaxCurrentFactor.ConvertToPerHour().Value); body.Add("InternalResistanceCurve", GetRelativePath(battery.InternalResistanceCurve.Source, Path.GetDirectoryName(filename))); body.Add("SoCCurve", GetRelativePath(battery.VoltageCurve.Source, Path.GetDirectoryName(filename))); @@ -107,7 +109,24 @@ public class JSONFileWriter : IOutputFileWriter WriteFile(header, body, filename); } - public void SaveEngine(IEngineEngineeringInputData eng, string filename, bool DeclMode) + public void SaveSuperCap(ISuperCapEngineeringInputData superCap, string filename, bool declMode) + { + var header = GetHeader(REESSFormatVersion); + + var body = new Dictionary<string, object>(); + + body.Add("SavedInDeclMode", declMode); + body.Add("REESSType", "SuperCap"); + body.Add("Model", superCap.Model); + body.Add("Capacity", superCap.Capacity.Value()); + body.Add("InternalResistance", superCap.InternalResistance.Value()); + body.Add("U_min", superCap.MinVoltage.Value()); + body.Add("U_max", superCap.MaxVoltage.Value()); + + WriteFile(header, body, filename); + } + + public void SaveEngine(IEngineEngineeringInputData eng, string filename, bool DeclMode) { // Header var header = GetHeader(EngineFormatVersion); @@ -528,7 +547,7 @@ public class JSONFileWriter : IOutputFileWriter var retVal = new Dictionary<string, object>() { {"NumPacks", vehicle.Components.ElectricStorage.Count}, - {"BatteryFile", GetRelativePath(vehicle.Components.ElectricStorage.BatteryPack.DataSource.SourceFile, basePath)} + {"BatteryFile", GetRelativePath(vehicle.Components.ElectricStorage.REESSPack.DataSource.SourceFile, basePath)} }; return retVal; } diff --git a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs index 5e30bbd75a..480279985e 100644 --- a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs @@ -355,23 +355,23 @@ namespace TUGraz.VectoCore.OutputData public static WattSecond WorkBatteryChargeTerminal(this IModalDataContainer data) { - return data.TimeIntegral<WattSecond>(ModalResultField.P_battery_terminal, x => x.IsGreater(0)); + return data.TimeIntegral<WattSecond>(ModalResultField.P_reess_terminal, x => x.IsGreater(0)); } public static WattSecond WorkBatteryDischargeTerminal(this IModalDataContainer data) { - return -data.TimeIntegral<WattSecond>(ModalResultField.P_battery_terminal, x => x.IsSmaller(0)); + return -data.TimeIntegral<WattSecond>(ModalResultField.P_reess_terminal, x => x.IsSmaller(0)); } public static WattSecond WorkBatteryChargeInternal(this IModalDataContainer data) { - return data.TimeIntegral<WattSecond>(ModalResultField.P_battery_int, x => x.IsGreater(0)); + return data.TimeIntegral<WattSecond>(ModalResultField.P_reess_int, x => x.IsGreater(0)); } public static WattSecond WorkBatteryDischargeInternal(this IModalDataContainer data) { - return -data.TimeIntegral<WattSecond>(ModalResultField.P_battery_int, x => x.IsSmaller(0)); + return -data.TimeIntegral<WattSecond>(ModalResultField.P_reess_int, x => x.IsSmaller(0)); } public static KilogramPerSecond FuelConsumptionPerSecond(this IModalDataContainer data, ModalResultField mrf, IFuelProperties fuelData) diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index 36a3389046..9018f746c6 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -360,22 +360,22 @@ namespace TUGraz.VectoCore.OutputData public double BatteryStartSoC() { - return Data.AsEnumerable().Cast<DataRow>().First().Field<SI>(ModalResultField.BatteryStateOfCharge.GetName()).Value() * 100; + return Data.AsEnumerable().Cast<DataRow>().First().Field<SI>(ModalResultField.REESSStateOfCharge.GetName()).Value() * 100; } public double BatteryEndSoC() { - return Data.AsEnumerable().Cast<DataRow>().Last().Field<SI>(ModalResultField.BatteryStateOfCharge.GetName()).Value() * 100; + return Data.AsEnumerable().Cast<DataRow>().Last().Field<SI>(ModalResultField.REESSStateOfCharge.GetName()).Value() * 100; } public WattSecond BatteryLoss() { - return TimeIntegral<WattSecond>(ModalResultField.P_battery_loss); + return TimeIntegral<WattSecond>(ModalResultField.P_reess_loss); } public WattSecond BatteryEnergyEnd() { - return Data.AsEnumerable().Cast<DataRow>().Last().Field<SI>(ModalResultField.E_Bat.GetName()) + return Data.AsEnumerable().Cast<DataRow>().Last().Field<SI>(ModalResultField.E_RESS.GetName()) .Cast<WattSecond>(); } @@ -574,16 +574,16 @@ namespace TUGraz.VectoCore.OutputData }.Select(x => x.GetName())); if (ElectricMotors.Count > 0) { dataColumns.AddRange(new[] { - ModalResultField.P_battery_terminal, - ModalResultField.P_battery_int, - ModalResultField.P_battery_loss, - ModalResultField.P_battery_charge_max, - ModalResultField.P_battery_discharge_max, - ModalResultField.BatteryStateOfCharge, - ModalResultField.U_bat_terminal, - ModalResultField.U0_bat, - ModalResultField.I_bat, - ModalResultField.E_Bat + ModalResultField.P_reess_terminal, + ModalResultField.P_reess_int, + ModalResultField.P_reess_loss, + ModalResultField.P_reess_charge_max, + ModalResultField.P_reess_discharge_max, + ModalResultField.REESSStateOfCharge, + ModalResultField.U_reess_terminal, + ModalResultField.U0_reess, + ModalResultField.I_reess, + ModalResultField.E_RESS }.Select(x => x.GetName())); foreach (var em in ElectricMotors.OrderBy(x => x).Reverse()) { dataColumns.AddRange(_electricMotorColumns.Select(emCol => diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index 25abe7a75e..aabcfd8380 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -331,7 +331,7 @@ namespace TUGraz.VectoCore.OutputData } row[Fields.ElectricEnergyConsumptionPerKm] = - (-modData.TimeIntegral<WattSecond>(ModalResultField.P_battery_terminal) / modData.Distance).Cast<JoulePerMeter>().ConvertToKiloWattHourPerKiloMeter(); + (-modData.TimeIntegral<WattSecond>(ModalResultField.P_reess_terminal) / modData.Distance).Cast<JoulePerMeter>().ConvertToKiloWattHourPerKiloMeter(); } } diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index ca8ad1fb51..3657c30c2d 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -285,7 +285,7 @@ <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterPrimaryBus.cs" /> <Compile Include="InputData\Reader\ComponentData\ElectricFullLoadCurveReader.cs" /> <Compile Include="Models\Connector\Ports\Impl\BatteryResponse.cs" /> - <Compile Include="Models\Connector\Ports\IBatteryPort.cs" /> + <Compile Include="Models\Connector\Ports\IElectricEnergyStoragePort.cs" /> <Compile Include="Models\SimulationComponent\Data\Battery\BatteryData.cs" /> <Compile Include="InputData\Reader\ComponentData\BatterySOCReader.cs" /> <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterSingleBus.cs" /> @@ -395,7 +395,7 @@ <Compile Include="InputData\Reader\ComponentData\WHRPowerReader.cs" /> <Compile Include="Models\SimulationComponent\Data\HybridStrategyParameters.cs" /> <Compile Include="Models\SimulationComponent\ElectricSystem.cs" /> - <Compile Include="Models\SimulationComponent\IBattery.cs" /> + <Compile Include="Models\SimulationComponent\IElectricEnergyStorage.cs" /> <Compile Include="Models\SimulationComponent\IElectricMotor.cs" /> <Compile Include="Models\SimulationComponent\IElectricMotorControl.cs" /> <Compile Include="Models\SimulationComponent\IHybridControlledGearbox.cs" /> @@ -409,11 +409,12 @@ <Compile Include="Models\SimulationComponent\IHybridController.cs" /> <Compile Include="Models\SimulationComponent\Impl\SimpleHybridController.cs" /> <Compile Include="Models\SimulationComponent\Impl\StopStartCombustionEngine.cs" /> + <Compile Include="Models\SimulationComponent\Impl\SuperCap.cs" /> <Compile Include="Models\SimulationComponent\Strategies\DelegateParallelHybridStrategy.cs" /> <Compile Include="Models\SimulationComponent\Strategies\HybridStrategy.cs" /> <Compile Include="Models\SimulationComponent\Strategies\TestPowertrain.cs" /> <Compile Include="Models\SimulationComponent\SwitchableClutch.cs" /> - <Compile Include="Models\Simulation\DataBus\IBatteryInfo.cs" /> + <Compile Include="Models\Simulation\DataBus\IRESSInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IElectricMotorInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IEngineControl.cs" /> <Compile Include="InputData\Reader\Impl\DeclarationModeSingleBusVectoRunDataFactory.cs" /> diff --git a/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs index 77b360af34..094f128d4c 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonReadHybridTest.cs @@ -28,7 +28,7 @@ namespace TUGraz.VectoCore.Tests.FileIO [TestCase()] public void TestReadBatteryPack() { - var inputProvider = JSONInputDataFactory.ReadBatteryData(@"TestData\Hybrids\Battery\GenericBattery.vbat", false); + var inputProvider = JSONInputDataFactory.ReadREESSData(@"TestData\Hybrids\Battery\GenericBattery.vbat", false) as IBatteryPackEngineeringInputData; Assert.AreEqual(7.5.SI(Unit.SI.Ampere.Hour), inputProvider.Capacity); @@ -120,12 +120,13 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.NotNull(engineering); Assert.AreEqual(0.8, engineering.JobInputData.Vehicle.InitialSOC); - var bat = engineering.JobInputData.Vehicle.Components.ElectricStorage; + var bat = engineering.JobInputData.Vehicle.Components.ElectricStorage.REESSPack as IBatteryPackEngineeringInputData; - var ri = BatteryInternalResistanceReader.Create(bat.BatteryPack.InternalResistanceCurve, 1); + + var ri = BatteryInternalResistanceReader.Create(bat.InternalResistanceCurve, 1); Assert.NotNull(bat); - Assert.AreEqual(2, bat.Count); - Assert.AreEqual(50, bat.BatteryPack.MaxCurrentFactor); + Assert.AreEqual(2, engineering.JobInputData.Vehicle.Components.ElectricStorage.Count); + Assert.AreEqual(50, bat.MaxCurrentFactor); Assert.AreEqual(0.04, ri.Lookup(0.5).Value()); var em = engineering.JobInputData.Vehicle.Components.ElectricMachines; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/BatteryTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/BatteryTest.cs index 228ed6c197..e4c7ea4929 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/BatteryTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/BatteryTest.cs @@ -34,13 +34,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent public void BatteryRequestTest(double initialSoC, double simInterval, double powerDemand, double expectedSoC) { - var inputData = JSONInputDataFactory.ReadBatteryData(componentFile, false); + var inputData = JSONInputDataFactory.ReadREESSData(componentFile, false) ; Assert.NotNull(inputData); var dao = new EngineeringDataAdapter(); var tmp = new MockBatteryInputData() { - BatteryPack = inputData, + REESSPack = inputData, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -55,7 +55,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var absTime = 0.SI<Second>(); var dt = simInterval.SI<Second>(); var response = bat.Request(absTime, dt, powerDemand.SI<Watt>()); - Assert.IsInstanceOf<BatteryResponseSuccess>(response); + Assert.IsInstanceOf<RESSResponseSuccess>(response); bat.CommitSimulationStep(absTime, dt, modData); Assert.AreEqual(expectedSoC, bat.StateOfCharge, 1e-9); @@ -70,13 +70,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent double maxPowerDischarge, double battLoss) { - var inputData = JSONInputDataFactory.ReadBatteryData(componentFile, false); + var inputData = JSONInputDataFactory.ReadREESSData(componentFile, false); Assert.NotNull(inputData); var dao = new EngineeringDataAdapter(); var tmp = new MockBatteryInputData() { - BatteryPack = inputData, + REESSPack = inputData, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -87,11 +87,11 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent bat.Initialize(initialSoC); var response = bat.Request(0.SI<Second>(), dt.SI<Second>(), powerDemand.SI<Watt>()); - Assert.IsInstanceOf<BatteryUnderloadResponse>(response); + Assert.IsInstanceOf<RESSUnderloadResponse>(response); - Assert.AreEqual(maxPowerDischarge, response.MaxBatteryLoadDischarge.Value(), 1e-2); - Assert.AreEqual(battLoss, response.BatteryLoss.Value(), 1e-2); - Assert.AreEqual(powerDemand, response.BatteryPower.Value(), 1e-2); + Assert.AreEqual(maxPowerDischarge, response.MaxDischargePower.Value(), 1e-2); + Assert.AreEqual(battLoss, response.LossPower.Value(), 1e-2); + Assert.AreEqual(powerDemand, response.PowerDemand.Value(), 1e-2); } [TestCase(0.5, 0.5, -500000, 10000, -169875, 70125), @@ -103,13 +103,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent double maxPowerDischarge, double battLoss) { - var inputData = JSONInputDataFactory.ReadBatteryData(componentFile, false); + var inputData = JSONInputDataFactory.ReadREESSData(componentFile, false); Assert.NotNull(inputData); var dao = new EngineeringDataAdapter(); var tmp = new MockBatteryInputData() { - BatteryPack = inputData, + REESSPack = inputData, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -124,10 +124,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = es.Request(0.SI<Second>(), dt.SI<Second>(), powerDemand.SI<Watt>()); Assert.IsInstanceOf<ElectricSystemUnderloadResponse>(response); - Assert.AreEqual(maxPowerDischarge, response.BatteryResponse.MaxBatteryLoadDischarge.Value(), 1e-2); - Assert.AreEqual(battLoss, response.BatteryResponse.BatteryLoss.Value(), 1e-2); + Assert.AreEqual(maxPowerDischarge, response.RESSResponse.MaxDischargePower.Value(), 1e-2); + Assert.AreEqual(battLoss, response.RESSResponse.LossPower.Value(), 1e-2); Assert.AreEqual(auxPower, response.AuxPower.Value(), 1e-2); - Assert.AreEqual(powerDemand - auxPower, response.BatteryResponse.BatteryPower.Value(), 1e-2); + Assert.AreEqual(powerDemand - auxPower, response.RESSResponse.PowerDemand.Value(), 1e-2); } [TestCase(0.5, 0.5, 500000, 310125, 70125), @@ -140,13 +140,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent double maxPowerDischarge, double battLoss) { - var inputData = JSONInputDataFactory.ReadBatteryData(componentFile, false); + var inputData = JSONInputDataFactory.ReadREESSData(componentFile, false); Assert.NotNull(inputData); var dao = new EngineeringDataAdapter(); var tmp = new MockBatteryInputData() { - BatteryPack = inputData, + REESSPack = inputData, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -157,11 +157,11 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent bat.Initialize(initialSoC); var response = bat.Request(0.SI<Second>(), dt.SI<Second>(), powerDemand.SI<Watt>()); - Assert.IsInstanceOf<BatteryOverloadResponse>(response); + Assert.IsInstanceOf<RESSOverloadResponse>(response); - Assert.AreEqual(maxPowerDischarge, response.MaxBatteryLoadCharge.Value(), 1e-2); - Assert.AreEqual(battLoss, response.BatteryLoss.Value(), 1e-2); - Assert.AreEqual(powerDemand, response.BatteryPower.Value(), 1e-2); + Assert.AreEqual(maxPowerDischarge, response.MaxChargePower.Value(), 1e-2); + Assert.AreEqual(battLoss, response.LossPower.Value(), 1e-2); + Assert.AreEqual(powerDemand, response.PowerDemand.Value(), 1e-2); } [TestCase(0.5, 0.5, 500000, 10000, 310125, 70125), @@ -174,13 +174,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent double maxPowerDischarge, double battLoss) { - var inputData = JSONInputDataFactory.ReadBatteryData(componentFile, false); + var inputData = JSONInputDataFactory.ReadREESSData(componentFile, false); Assert.NotNull(inputData); var dao = new EngineeringDataAdapter(); var tmp = new MockBatteryInputData() { - BatteryPack = inputData, + REESSPack = inputData, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -195,10 +195,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var response = es.Request(0.SI<Second>(), dt.SI<Second>(), powerDemand.SI<Watt>()); Assert.IsInstanceOf<ElectricSystemOverloadResponse>(response); - Assert.AreEqual(maxPowerDischarge, response.BatteryResponse.MaxBatteryLoadCharge.Value(), 1e-2); - Assert.AreEqual(battLoss, response.BatteryResponse.BatteryLoss.Value(), 1e-2); + Assert.AreEqual(maxPowerDischarge, response.RESSResponse.MaxChargePower.Value(), 1e-2); + Assert.AreEqual(battLoss, response.RESSResponse.LossPower.Value(), 1e-2); Assert.AreEqual(auxPower, response.AuxPower.Value(), 1e-2); - Assert.AreEqual(powerDemand - auxPower, response.BatteryResponse.BatteryPower.Value(), 1e-2); + Assert.AreEqual(powerDemand - auxPower, response.RESSResponse.PowerDemand.Value(), 1e-2); } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs index d72248c085..df8d547091 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/ElectricMotorTest.cs @@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(0, response.Engine.PowerRequest.Value(), 1e-6); Assert.AreEqual(enginePower.Value(), response.ElectricMotor.ElectricMotorPowerMech.Value(), 1e-6); Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.ConsumerPower.Value(), 1e-6); - Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.BatteryResponse.BatteryPower.Value(), 1e-6); + Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.RESSResponse.PowerDemand.Value(), 1e-6); Assert.IsTrue(response.ElectricSystem.ConsumerPower.Value() < enginePower.Value()); } @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(enginePower.Value(), response.Engine.PowerRequest.Value(), 1e-6); Assert.AreEqual(motorMechPower, response.ElectricMotor.ElectricMotorPowerMech); Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.ConsumerPower.Value(), 1e-6); - Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.BatteryResponse.BatteryPower.Value(), 1e-6); + Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.RESSResponse.PowerDemand.Value(), 1e-6); Assert.IsTrue(response.ElectricSystem.ConsumerPower.Value() < response.ElectricMotor.ElectricMotorPowerMech.Value()); } @@ -147,9 +147,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var data = dao.CreateElectricMachines(electricMachine); var strategy = new MockHybridControl(); - var batInput = JSONInputDataFactory.ReadBatteryData(BatFile, false); + var batInput = JSONInputDataFactory.ReadREESSData(BatFile, false); var tmp = new MockBatteryInputData() { - BatteryPack = batInput, + REESSPack = batInput, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -176,7 +176,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(enginePower.Value(), response.Engine.PowerRequest.Value(), 1e-6); Assert.AreEqual(motorMechPower, response.ElectricMotor.ElectricMotorPowerMech); Assert.AreEqual(0, response.ElectricSystem.ConsumerPower.Value(), 1e-6); - Assert.AreEqual(0, response.ElectricSystem.BatteryResponse.BatteryPower.Value(), 1e-6); + Assert.AreEqual(0, response.ElectricSystem.RESSResponse.PowerDemand.Value(), 1e-6); var modData = new MockModalDataContainer(); battery.CommitSimulationStep(absTime, dt, modData); } @@ -193,7 +193,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var container = new MockVehicleContainer(); var inputData = JSONInputDataFactory.ReadElectricMotorData(MotorFile, false); - var batInput = JSONInputDataFactory.ReadBatteryData(BatFile, false); + var batInput = JSONInputDataFactory.ReadREESSData(BatFile, false); var dao = new EngineeringDataAdapter(); var electricMachine = new MockElectricMachinesInputData() { @@ -211,7 +211,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var tmp = new MockBatteryInputData() { - BatteryPack = batInput, + REESSPack = batInput, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); @@ -232,9 +232,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.AreEqual(0, response.Engine.PowerRequest.Value(), 1e-6); Assert.AreEqual(enginePower.Value(), response.ElectricMotor.ElectricMotorPowerMech.Value(), 1e-6); Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.ConsumerPower.Value(), 1e-6); - Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.BatteryResponse.BatteryPower.Value(), 1e-6); + Assert.AreEqual(expectedBatteryPower, response.ElectricSystem.RESSResponse.PowerDemand.Value(), 1e-6); Assert.IsTrue(response.ElectricSystem.ConsumerPower.Value() < enginePower.Value()); - Assert.AreEqual(expectedBatteryLoss, response.ElectricSystem.BatteryResponse.BatteryLoss.Value(), 1e-4); + Assert.AreEqual(expectedBatteryLoss, response.ElectricSystem.RESSResponse.LossPower.Value(), 1e-4); } @@ -248,7 +248,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var inputData = JSONInputDataFactory.ReadElectricMotorData(MotorFile, false); - var batInput = JSONInputDataFactory.ReadBatteryData(BatFile, false); + var batInput = JSONInputDataFactory.ReadREESSData(BatFile, false); var dao = new EngineeringDataAdapter(); var electricMachine = new MockElectricMachinesInputData() { @@ -267,7 +267,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var tmp = new MockBatteryInputData() { - BatteryPack = batInput, + REESSPack = batInput, Count = 1 }; var batteryData = dao.CreateBatteryData(tmp, 0.8); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/SuperCapTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/SuperCapTest.cs new file mode 100644 index 0000000000..a8d02f0bb6 --- /dev/null +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/SuperCapTest.cs @@ -0,0 +1,57 @@ +using System.IO; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Battery; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponent +{ + [TestFixture] + public class SuperCapTest + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + + [ + TestCase(0.5, 0.5, -500, 0.499875863), + TestCase(0.5, 1, -14000, 0.4929779240), + TestCase(0.5, 1, 7000, 0.503456863), + TestCase(0.35, 0.5, -200, 0.3499290696), + TestCase(0.35, 0.5, -16000, 0.3441842440), + TestCase(0.75, 0.5, -300, 0.7499503587), + TestCase(0.75, 0.5, -14500, 0.74758944005), + ] + + public void SuperCapRequestTest(double initialSoC, double simInterval, double powerDemand, double expectedSoC) + { + var batteryData = new SuperCapData() { + Capacity = 37.SI<Farad>(), + InternalResistance = 0.02.SI<Ohm>(), + MinVoltage = 0.SI<Volt>(), + MaxVoltage = 330.SI<Volt>(), + }; + + var container = new MockVehicleContainer(); + var superCap = new SuperCap(container, batteryData); + var modData = new MockModalDataContainer(); + superCap.Initialize(initialSoC); + + //Assert.AreEqual(3.2*200, bat.Voltage.Value()); + + var absTime = 0.SI<Second>(); + var dt = simInterval.SI<Second>(); + var response = superCap.Request(absTime, dt, powerDemand.SI<Watt>(), false); + Assert.IsInstanceOf<RESSResponseSuccess>(response); + superCap.CommitSimulationStep(absTime, dt, modData); + + Assert.AreEqual(expectedSoC, superCap.StateOfCharge, 1e-9); + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/ElectricMotor/GenericEMotor.vem b/VectoCore/VectoCoreTest/TestData/Hybrids/ElectricMotor/GenericEMotor.vem index 9a134823a3..63b5fcce6f 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/ElectricMotor/GenericEMotor.vem +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/ElectricMotor/GenericEMotor.vem @@ -14,6 +14,6 @@ "Inertia": 0.15, "ContinuousPower": 50000, "ThermalOverloadBuffer": 0.6, - "ThermalOverloadRecoveryFactor": 0.9, + "ThermalOverloadRecoveryFactor": 0.9 } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockBattery.cs b/VectoCore/VectoCoreTest/Utils/MockBattery.cs index e7bbf09023..9d8147a115 100644 --- a/VectoCore/VectoCoreTest/Utils/MockBattery.cs +++ b/VectoCore/VectoCoreTest/Utils/MockBattery.cs @@ -4,22 +4,22 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Tests.Utils { - public class MockBattery : IBattery, IBatteryPort, IElectricAuxConnecor + public class MockBattery : IElectricEnergyStorage, IElectricEnergyStoragePort, IElectricAuxConnecor { - public Volt InternalCellVoltage + public Volt InternalVoltage { get { return 640.SI<Volt>(); } } - public IBatteryResponse Request(Second absTime, Second dt, Watt powerdemand, bool dryRun = false) + public IRESSResponse Request(Second absTime, Second dt, Watt powerdemand, bool dryRun = false) { - return new BatteryResponseSuccess(this) + return new RESSResponseSuccess(this) { - MaxBatteryLoadDischarge = -InternalCellVoltage * MaxCurrent, + MaxDischargePower = -InternalVoltage * MaxCurrent, AbsTime = absTime, - BatteryLoss = 0.SI<Watt>(), - MaxBatteryLoadCharge = InternalCellVoltage * MaxCurrent, - BatteryPower = powerdemand, + LossPower = 0.SI<Watt>(), + MaxChargePower = InternalVoltage * MaxCurrent, + PowerDemand = powerdemand, SimulationInterval = dt, }; } @@ -46,7 +46,7 @@ namespace TUGraz.VectoCore.Tests.Utils { throw new System.NotImplementedException(); } - public IBatteryPort MainBatteryPort + public IElectricEnergyStoragePort MainBatteryPort { get { return this; } } @@ -61,14 +61,14 @@ namespace TUGraz.VectoCore.Tests.Utils { StateOfCharge = initialSoC; } - public void Connect(IBatteryAuxPort aux) + public void Connect(IElectricAuxPort aux) { throw new System.NotImplementedException(); } #region Implementation of IBatteryChargeProvider - public void Connect(IBatteryChargePort charger) + public void Connect(IElectricChargerPort charger) { throw new System.NotImplementedException(); } diff --git a/VectoCore/VectoCoreTest/Utils/MockBatteryInputData.cs b/VectoCore/VectoCoreTest/Utils/MockBatteryInputData.cs index da4e71a9bd..a300b4f5a2 100644 --- a/VectoCore/VectoCoreTest/Utils/MockBatteryInputData.cs +++ b/VectoCore/VectoCoreTest/Utils/MockBatteryInputData.cs @@ -3,9 +3,7 @@ namespace TUGraz.VectoCore.Tests.Utils { public class MockBatteryInputData : IElectricStorageEngineeringInputData { - IBatteryPackDeclarationInputData IElectricStorageDeclarationInputData.BatteryPack => BatteryPack; - - public IBatteryPackEngineeringInputData BatteryPack { get; set; } + public IREESSPackInputData REESSPack { get; set; } public int Count { get; set; } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockElectricConsumer.cs b/VectoCore/VectoCoreTest/Utils/MockElectricConsumer.cs index b7dad2e022..010de0dde3 100644 --- a/VectoCore/VectoCoreTest/Utils/MockElectricConsumer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockElectricConsumer.cs @@ -2,7 +2,7 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl; namespace TUGraz.VectoCore.Tests.Utils { - public class MockElectricConsumer : IBatteryAuxPort + public class MockElectricConsumer : IElectricAuxPort { private Watt PowwerDemand; diff --git a/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs b/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs index 8f469782f3..e0517dcfbb 100644 --- a/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs +++ b/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs @@ -194,8 +194,8 @@ namespace TUGraz.VectoCore.Tests.Utils public static BatteryData CreateBatteryData(string file, double initialSoC, int cnt = 1) { - var inputData = JSONInputDataFactory.ReadBatteryData(file, false); - return new EngineeringDataAdapter().CreateBatteryData(new MockBatteryInputData() {Count = cnt, BatteryPack = inputData}, initialSoC); + var inputData = JSONInputDataFactory.ReadREESSData(file, false); + return new EngineeringDataAdapter().CreateBatteryData(new MockBatteryInputData() {Count = cnt, REESSPack = inputData}, initialSoC); } } } diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs index 3db922ff62..5053a93eed 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs @@ -144,7 +144,7 @@ namespace TUGraz.VectoCore.Tests.Utils return null; } - public IBatteryInfo BatteryInfo + public IRESSInfo BatteryInfo { get { throw new NotImplementedException(); } } diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 4d3c82a708..7a5aa65458 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -146,6 +146,7 @@ <Compile Include="Models\SimulationComponent\ElectricMotorTest.cs" /> <Compile Include="Models\SimulationComponent\EngineFanAuxTest.cs" /> <Compile Include="Models\SimulationComponent\GearboxShiftLossesTest.cs" /> + <Compile Include="Models\SimulationComponent\SuperCapTest.cs" /> <Compile Include="Utils\MockElectricConsumer.cs" /> <Compile Include="Utils\MockHybridControl.cs" /> <Compile Include="Utils\MockBattery.cs" /> -- GitLab