From 785b23f008b4547b8e5518f3f9d94ac343fb3922 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Mon, 27 Jan 2020 09:01:15 +0100 Subject: [PATCH] fill more hvac parameters, add ssm technology benefits, cleanup, refactoring --- VECTO/BusAuxiliaries/UI/frmHVACTool.vb | 6 +-- .../TestFiles/TechBenefits.csv | 6 ++- .../M1_AverageHVACLoadDemandTests.vb | 4 +- .../UnitTests/SSMTOOLTests.vb | 53 ++++++++++--------- .../VectoCommon/BusAuxiliaries/ISSMInputs.cs | 2 +- .../BusAuxiliaries/ISSMTechnology.cs | 30 +++++------ .../InputData/DeclarationInputData.cs | 7 +-- VectoConsole/VectoConsole.csproj | 20 +++---- .../InputData/FileIO/JSON/JSONVehicleData.cs | 7 +-- ...MLDeclarationBusAuxiliariesDataProvider.cs | 19 ++++++- .../DeclarationDataAdapterPrimaryBus.cs | 40 ++++++++++---- .../Impl/HVAC/SSMTechnology.cs | 2 +- .../Models/Declaration/BusSegments.cs | 2 +- .../Models/Declaration/DeclarationData.cs | 3 ++ .../Models/Declaration/HVACCoolingPower.cs | 8 +-- .../Models/Declaration/LookupData.cs | 5 ++ .../OutputData/FileIO/BusAuxWriter.cs | 2 +- VectoCore/VectoCore/VectoCore.csproj | 4 +- 18 files changed, 137 insertions(+), 83 deletions(-) diff --git a/VECTO/BusAuxiliaries/UI/frmHVACTool.vb b/VECTO/BusAuxiliaries/UI/frmHVACTool.vb index 1f4dd3b53a..dc3d4e501a 100644 --- a/VECTO/BusAuxiliaries/UI/frmHVACTool.vb +++ b/VECTO/BusAuxiliaries/UI/frmHVACTool.vb @@ -1354,12 +1354,12 @@ Public Class frmHVACTool chkActiveVH.Checked = techline.ActiveVH chkActiveVV.Checked = techline.ActiveVV chkActiveVC.Checked = techline.ActiveVC - chkOnVehicle.Checked = techline.OnVehicle + 'chkOnVehicle.Checked = techline.OnVehicle End Sub Private Function GetTechLineFromPanel() As ISSMTechnology - Dim tl As ISSMTechnology = New SSMTechnology() + Dim tl As SSMTechnology = New SSMTechnology() tl.BusFloorType = ssmTOOL.SSMInputs.BusParameters.BusFloorType tl.Category = StrConv(cboCategory.Text, vbProperCase) @@ -1377,7 +1377,7 @@ Public Class frmHVACTool tl.ActiveVH = chkActiveVH.Checked tl.ActiveVV = chkActiveVV.Checked tl.ActiveVC = chkActiveVC.Checked - tl.OnVehicle = chkOnVehicle.Checked + 'tl.OnVehicle = chkOnVehicle.Checked Return tl diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/TechBenefits.csv b/VECTOAux/VectoAuxiliariesTests/TestFiles/TechBenefits.csv index f1d9e0453f..3ddfd6abcd 100644 --- a/VECTOAux/VectoAuxiliariesTests/TestFiles/TechBenefits.csv +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/TechBenefits.csv @@ -1,6 +1,9 @@ Category , BenefitName , LowFloorH , LowFloorV , LowFloorC , SemiLowFloorH , SemiLowFloorV , SemiLowFloorC , RaisedFloorH , RaisedFloorV , RaisedFloorC , OnVehicle , ActiveVH , ActiveVV , ActiveVC , LineType , H , VH , VV , VC , C -Insulation , Foils (g-value reduction) , 0.01 , 0.0 , 0.01 , 0.01 , 0.0 , 0.01 , 0.01 , 0.0 , 0.01 , 1 , 0 , 0 , 0 , 0 , 0.01 , 0.0 , 0.0 , 0.0 , 0.01 Insulation , Double-glazing (g-value reduction- u-value reduction) , 0.0 , 0.0 , 0.0 , 0.02 , 0.0 , 0.012 , 0.02 , 0.0 , 0.025 , 1 , 0 , 0 , 0 , 0 , 0.02 , 0.0 , 0.0 , 0.0 , 0.025 +Heating , Heat pump systems (increase heating efficiency) , 0.01 , 0.0 , 0.0 , 0.02 , 0.0 , 0.0 , 0.005 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.005 , 0.0 , 0.0 , 0.0 , 0.0 + + +Insulation , Foils (g-value reduction) , 0.01 , 0.0 , 0.01 , 0.01 , 0.0 , 0.01 , 0.01 , 0.0 , 0.01 , 1 , 0 , 0 , 0 , 0 , 0.01 , 0.0 , 0.0 , 0.0 , 0.01 Insulation , Heat insulation glazing (u-value reduction) , 0.005 , 0.0 , 0.01 , 0.01 , 0.0 , 0.028 , 0.01 , 0.0 , 0.024 , 1 , 0 , 0 , 0 , 0 , 0.01 , 0.0 , 0.0 , 0.0 , 0.024 Insulation , Roof insulation (u-value reduction) , 0.02 , 0.0 , -0.01 , -0.01 , 0.0 , -0.012 , -0.01 , 0.0 , -0.032 , 1 , 0 , 0 , 0 , 0 , -0.01 , 0.0 , 0.0 , 0.0 , -0.032 Insulation , Wall insulation (u-value reduction) , 0.01 , 0.0 , 0.02 , 0.02 , 0.0 , 0.019 , 0.02 , 0.0 , 0.05 , 1 , 0 , 0 , 0 , 0 , 0.02 , 0.0 , 0.0 , 0.0 , 0.05 @@ -18,7 +21,6 @@ Ventilation , Partial air recirculation Ventilation , Variable fresh air rate (influence on heating / cooling demand) , 0.0 , 0.0 , 0.0 , -0.01 , 0.0 , -0.012 , -0.01 , 0.0 , -0.032 , 1 , 0 , 0 , 0 , 0 , -0.01 , 0.0 , 0.0 , 0.0 , -0.032 Heating , Engine waste heat recovery (reduces heating demand for auxillary heater) ALREADY IMPLEMENTED , 0.014 , 0.0 , 0.0 , 0.024 , 0.0 , 0.0 , 0.01 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.01 , 0.0 , 0.0 , 0.0 , 0.0 Heating , Heat storage (increase heating efficiency) , 0.012 , 0.0 , 0.0 , 0.028 , 0.0 , 0.0 , 0.005 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.005 , 0.0 , 0.0 , 0.0 , 0.0 -Heating , Heat pump systems (increase heating efficiency) , 0.01 , 0.0 , 0.0 , 0.02 , 0.0 , 0.0 , 0.005 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.005 , 0.0 , 0.0 , 0.0 , 0.0 Heating , Position of heatexchangers in-cabin room (air flow towards walls / windows) , 0.02 , 0.0 , 0.0 , 0.019 , 0.0 , 0.0 , 0.03 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.03 , 0.0 , 0.0 , 0.0 , 0.0 Heating , Heated surfaces , -0.01 , 0.0 , 0.0 , -0.012 , 0.0 , 0.0 , -0.032 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , -0.032 , 0.0 , 0.0 , 0.0 , 0.0 Heating , Heated seats , 0.01 , 0.0 , 0.0 , 0.01 , 0.0 , 0.0 , 0.01 , 0.0 , 0.0 , 1 , 0 , 0 , 0 , 0 , 0.01 , 0.0 , 0.0 , 0.0 , 0.0 diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb index 3757debf09..a4b9228496 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb @@ -56,7 +56,7 @@ Namespace UnitTests 'ssm.Load(_SSMMAP) For Each entry As ISSMTechnology In ssm.TechList.TechLines - entry.OnVehicle = True + 'entry.OnVehicle = True Next CType(auxConfig.ElectricalUserInputsConfig, ElectricsUserInputsConfig).PowerNetVoltage = powernetVoltage CType(auxConfig.ElectricalUserInputsConfig, ElectricsUserInputsConfig).AlternatorMap =alternatorMap @@ -69,7 +69,7 @@ Namespace UnitTests 'ssm.Load(_SSMMAP) For Each entry As ISSMTechnology In ssm.TechList.TechLines - entry.OnVehicle = true + 'entry.OnVehicle = true next Return New M01Impl(m0, alternatorGearEfficiency, diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index e8db0c7361..bb4df027bf 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -1,6 +1,7 @@ Imports System.IO Imports NUnit.Framework Imports TUGraz.VectoCommon.BusAuxiliaries +Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Reader.ComponentData @@ -25,7 +26,7 @@ Namespace UnitTests Dim src As SSMTOOL = DirectCast(source, SSMTOOL) - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = src.SSMInputs.BusParameters.BusFloorType @@ -45,7 +46,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -79,8 +80,10 @@ Namespace UnitTests } } + Dim auxInput as IBusAuxiliariesDeclarationData = nothing + Dim dao = New DeclarationDataAdapterPrimaryBus() - Dim target As ISSMInputs = dao.CreateSSMModelParameters(Utils.GetDefaultVehicleData(), mission, FuelData.Diesel) + Dim target As ISSMInputs = dao.CreateSSMModelParameters(auxInput, Utils.GetDefaultVehicleData(), mission, FuelData.Diesel) If section = "BusParameterisation" Then 'BUS Parameterisation @@ -187,7 +190,7 @@ Namespace UnitTests target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListALLON).Items For Each entry As ISSMTechnology In target.TechLines - entry.OnVehicle = True + 'entry.OnVehicle = True Next Assert.IsTrue(target.TechLines.Count > 0) @@ -228,7 +231,7 @@ Namespace UnitTests Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -247,7 +250,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -269,7 +272,7 @@ Namespace UnitTests Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -288,7 +291,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -311,7 +314,7 @@ Namespace UnitTests Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -330,7 +333,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -353,7 +356,7 @@ Namespace UnitTests Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -372,7 +375,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -392,10 +395,10 @@ Namespace UnitTests Dim gen As ISSMInputs = New SSMInputs(Nothing) - Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) + Dim target As SSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -414,7 +417,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -432,10 +435,10 @@ Namespace UnitTests Dim gen As ISSMInputs = New SSMInputs(Nothing) - Dim target As ISSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) + Dim target As SSMTechList = New SSMTechList(gen.BusParameters.BusFloorType) target.TechLines = SSMTechnologiesReader.ReadFromFile(GOODTechListEMPTYLIST).Items - Dim newItem As ISSMTechnology = New SSMTechnology() + Dim newItem As SSMTechnology = New SSMTechnology() newItem.BusFloorType = gen.BusParameters.BusFloorType 'newItem.Units = "fraction" @@ -454,7 +457,7 @@ Namespace UnitTests newItem.RaisedFloorV = 0.1 newItem.RaisedFloorC = 0.1 - newItem.OnVehicle = True + 'newItem.OnVehicle = True newItem.ActiveVH = True newItem.ActiveVV = True newItem.ActiveVC = True @@ -511,10 +514,10 @@ Namespace UnitTests Dim gen As ISSMInputs = New SSMInputs(Nothing) - Dim ttl1 As ISSMTechnology = New SSMTechnology() + Dim ttl1 As SSMTechnology = New SSMTechnology() ttl1.BusFloorType = gen.BusParameters.BusFloorType - Dim ttl2 As ISSMTechnology = New SSMTechnology() + Dim ttl2 As SSMTechnology = New SSMTechnology() ttl2.BusFloorType = gen.BusParameters.BusFloorType Select Case prop @@ -553,7 +556,7 @@ Namespace UnitTests 'Case "Units" ' ttl2.Units = "NONE" Case "OnVehicle" - ttl2.OnVehicle = True + 'ttl2.OnVehicle = True End Select @@ -577,8 +580,10 @@ Namespace UnitTests } } + Dim auxInput as IBusAuxiliariesDeclarationData = nothing + Dim dao = New DeclarationDataAdapterPrimaryBus() - Dim target As SSMTOOL = New SSMTOOL(dao.CreateSSMModelParameters(Utils.GetDefaultVehicleData(), mission, + Dim target As SSMTOOL = New SSMTOOL(dao.CreateSSMModelParameters(auxInput, Utils.GetDefaultVehicleData(), mission, FuelData.Diesel)) success = BusAuxWriter.SaveSSMConfig(target.SSMInputs, filePath) @@ -749,7 +754,7 @@ Namespace UnitTests AddDefaultTechLine(ssmTool2) 'Make Unequal - ssmTool2.TechList.TechLines(0).BenefitName = "Doobie" + CType(ssmTool2.TechList.TechLines(0), SSMTechnology).BenefitName = "Doobie" Assert.IsFalse(ssmTool1.IsEqualTo(ssmTool2)) End Sub @@ -776,7 +781,7 @@ Namespace UnitTests AddDefaultTechLine(ssmTool2) 'Make Unequal - ssmTool2.TechList.TechLines(0).ActiveVV = False + CType(ssmTool2.TechList.TechLines(0), SSMTechnology).ActiveVV = False Assert.IsFalse(ssmTool1.IsEqualTo(ssmTool2)) End Sub diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs index 0c496274ec..945f390b21 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMInputs.cs @@ -99,7 +99,7 @@ namespace TUGraz.VectoCommon.BusAuxiliaries bool VentilationOnDuringHeating { get; } bool VentilationWhenBothHeatingAndACInactive { get; } - bool VentilationDuringAC { get; set; } + bool VentilationDuringAC { get; } //VentilationLevel VentilationFlowSettingWhenHeatingAndACInactive { get; } //VentilationLevel VentilationDuringHeating { get; } diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMTechnology.cs b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMTechnology.cs index c7501bad2a..b60d54351f 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMTechnology.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMTechnology.cs @@ -13,25 +13,25 @@ namespace TUGraz.VectoCommon.BusAuxiliaries { { FloorType BusFloorType { set; } - string Category { get; set; } - string BenefitName { get; set; } + string Category { get; } + string BenefitName { get; } - double LowFloorH { get; set; } - double LowFloorV { get; set; } - double LowFloorC { get; set; } + double LowFloorH { get; } + double LowFloorV { get; } + double LowFloorC { get; } - double SemiLowFloorH { get; set; } - double SemiLowFloorV { get; set; } - double SemiLowFloorC { get; set; } + double SemiLowFloorH { get; } + double SemiLowFloorV { get; } + double SemiLowFloorC { get; } - double RaisedFloorH { get; set; } - double RaisedFloorV { get; set; } - double RaisedFloorC { get; set; } + double RaisedFloorH { get; } + double RaisedFloorV { get; } + double RaisedFloorC { get; } - bool OnVehicle { get; set; } - bool ActiveVH { get; set; } - bool ActiveVV { get; set; } - bool ActiveVC { get; set; } + //bool OnVehicle { get; set; } + bool ActiveVH { get; } + bool ActiveVV { get; } + bool ActiveVC { get; } double H { get; } double VH { get; } diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 5ed766e5b1..b9e9b961e0 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -760,11 +760,12 @@ namespace TUGraz.VectoCommon.InputData public interface IHVACBusAuxiliariesDeclarationData { - int SystemConfiguration { get; } + BusHVACSystemConfiguration SystemConfiguration { get; } - ACCompressorType CompressorType { get; } + ACCompressorType CompressorTypeDriver { get; } + ACCompressorType CompressorTypePassenger { get; } - string AuxHeaterPower { get; } + Watt AuxHeaterPower { get; } bool DoubleGlasing { get; } diff --git a/VectoConsole/VectoConsole.csproj b/VectoConsole/VectoConsole.csproj index 09982f687c..9e6e0a4be7 100644 --- a/VectoConsole/VectoConsole.csproj +++ b/VectoConsole/VectoConsole.csproj @@ -117,16 +117,6 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj"> - <Project>{79a066ad-69a9-4223-90f6-6ed5d2d084f4}</Project> - <Name>VectoCommon</Name> - </ProjectReference> - <ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj"> - <Project>{cd36938a-add9-4c65-96da-b397cdeea90a}</Project> - <Name>VectoCore</Name> - </ProjectReference> - </ItemGroup> <ItemGroup> <None Include="Cycles\1-Gear-Test-dist.vdri"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> @@ -161,6 +151,16 @@ <ItemGroup> <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj"> + <Project>{79A066AD-69A9-4223-90F6-6ED5D2D084F4}</Project> + <Name>VectoCommon</Name> + </ProjectReference> + <ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj"> + <Project>{CD36938A-ADD9-4C65-96DA-B397CDEEA90A}</Project> + <Name>VectoCore</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index aa6f8914bf..e67fea80e0 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -172,9 +172,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region Implementation of IHVACBusAuxiliariesDeclarationData - public virtual int SystemConfiguration { get; set; } - public virtual ACCompressorType CompressorType { get { return ACCompressorType.Unknown; } } - public virtual string AuxHeaterPower { get { return null; } } + public virtual BusHVACSystemConfiguration SystemConfiguration { get; set; } + public virtual ACCompressorType CompressorTypeDriver { get { return ACCompressorType.Unknown; } } + public virtual ACCompressorType CompressorTypePassenger { get { return ACCompressorType.Unknown; } } + public virtual Watt AuxHeaterPower { get { return null; } } public virtual bool DoubleGlasing { get { return false; } } public virtual bool HeatPump { get { return false; } } public virtual bool AdjustableCoolantThermostat { get { return Body["Aux"]?["HVAC"]?.GetEx<bool>("AdjustableCoolantThermostat") ?? false; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs index 1b914e4dcd..2dacbc884d 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationBusAuxiliariesDataProvider.cs @@ -15,7 +15,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider { public class XMLDeclarationPrimaryBusAuxiliariesDataProviderV26 : AbstractXMLType, IXMLBusAuxiliariesDeclarationData, IElectricSupplyDeclarationData, IResultCardDeclarationInputData, IPneumaticConsumersDeclarationData, - IPneumaticSupplyDeclarationData + IPneumaticSupplyDeclarationData, IHVACBusAuxiliariesDeclarationData { public static XNamespace NAMESPACE_URI = XMLDefinitions.DECLARATION_DEFINITIONS_NAMESPACE_URI_V26; @@ -66,7 +66,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider get { return this; } } - public IHVACBusAuxiliariesDeclarationData HVACAux { get; } + public IHVACBusAuxiliariesDeclarationData HVACAux { get { return this; } } #endregion @@ -210,5 +210,20 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider } #endregion + + #region Implementation of IHVACBusAuxiliariesDeclarationData + + public BusHVACSystemConfiguration SystemConfiguration { get { return BusHVACSystemConfiguration.Unknown; } } + public ACCompressorType CompressorTypeDriver { get { return ACCompressorType.None; } } + public ACCompressorType CompressorTypePassenger { get { return ACCompressorType.None; } } + public Watt AuxHeaterPower { get { return 0.SI<Watt>(); } } + public bool DoubleGlasing { get { return false; } } + public bool HeatPump { get { return false; } } + public bool AdjustableCoolantThermostat { get { return GetBool(new[] { "HVAC", "AdjustableCoolantThermostat" }); } } + public bool AdjustableAuxiliaryHeater { get { return false; } } + public bool EngineWasteGasHeatExchanger { get { return GetBool(new[] { "HVAC", "EngineWasteGasHeatExchanger" }); } } + public bool SeparateAirDistributionDucts { get { return false; } } + + #endregion } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs index 14701bb6e6..eaf8717bd8 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs @@ -84,7 +84,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter PneumaticUserInputsConfig = GetPneumaticUserConfig(vehicleData, mission), PneumaticAuxillariesConfig = CreatePneumaticAuxConfig(runData.Retarder.Type), Actuations = actuations, - SSMInputs = CreateSSMModelParameters(runData.VehicleData, mission, FuelData.Diesel), + SSMInputs = CreateSSMModelParameters( + vehicleData.Components.BusAuxiliaries, runData.VehicleData, mission, FuelData.Diesel), VehicleData = runData.VehicleData, FuelMap = runData.EngineData.Fuels.First().ConsumptionMap }; @@ -237,20 +238,22 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } return CompressorMapReader.ReadStream( - RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".VAUXBuses." + resource)); + RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".VAUXBus." + resource)); } public virtual ISSMInputs CreateSSMModelParameters( - IVehicleData vehicleData, Mission mission, IFuelProperties heatingFuel) + IBusAuxiliariesDeclarationData busAuxInputData, IVehicleData vehicleData, Mission mission, + IFuelProperties heatingFuel) { var busParams = mission.BusParameter; var hvacBusLength = busParams.HVACConfiguration == BusHVACSystemConfiguration.Configuration2 ? 2 * Constants.BusParameters.DriverCompartmentLength : busParams.VehicleLength; + var hvacBusheight = DeclarationData.BusAuxiliaries.CalculateInternalHeight(mission.VehicleHeight); var coolingPower = CalculateMaxCoolingPower(vehicleData, mission); var retVal = new SSMInputs(null, heatingFuel) { - Technologies = DeclarationData.BusAuxiliaries.SSMTechnologyList, + Technologies = GetSSMTechnologyBenefits(busAuxInputData), DefaultConditions = new EnvironmentalConditionMapEntry( Constants.BusAuxiliaries.SteadyStateModel.DefaultTemperature, Constants.BusAuxiliaries.SteadyStateModel.DefaultSolar, @@ -259,8 +262,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter HeatingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.HeatingBoundaryTemperature, CoolingBoundaryTemperature = Constants.BusAuxiliaries.SteadyStateModel.CoolingBoundaryTemperature, - //HighVentilation = Constants.BusAuxiliaries.SteadyStateModel.HighVentilation, - //LowVentilation = Constants.BusAuxiliaries.SteadyStateModel.LowVentilation, SpecificVentilationPower = Constants.BusAuxiliaries.SteadyStateModel.SpecificVentilationPower, AuxHeaterEfficiency = Constants.BusAuxiliaries.SteadyStateModel.AuxHeaterEfficiency, @@ -268,13 +269,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter FuelEnergyToHeatToCoolant = Constants.BusAuxiliaries.Heater.FuelEnergyToHeatToCoolant, CoolantHeatTransferredToAirCabinHeater = Constants.BusAuxiliaries.Heater.CoolantHeatTransferredToAirCabinHeater, GFactor = Constants.BusAuxiliaries.SteadyStateModel.GFactor, + VentilationOnDuringHeating = true, VentilationWhenBothHeatingAndACInactive = true, VentilationDuringAC = true, - //VentilationDuringHeating = VentilationLevel.High, - //VentilationDuringCooling = VentilationLevel.High, - //VentilationFlowSettingWhenHeatingAndACInactive = VentilationLevel.High, MaxPossibleBenefitFromTechnologyList = Constants.BusAuxiliaries.SteadyStateModel.MaxPossibleBenefitFromTechnologyList, @@ -282,7 +281,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter DeclarationData.BusAuxiliaries.FrontAndRearWindowArea(busParams.DoubleDecker), BusSurfaceArea = 2 * (hvacBusLength * busParams.VehicleWidth + hvacBusLength * mission.VehicleHeight + busParams.VehicleWidth * mission.VehicleHeight), - BusVolume = hvacBusLength * busParams.VehicleWidth * mission.VehicleHeight, + BusVolume = hvacBusLength * busParams.VehicleWidth * hvacBusheight, UValue = DeclarationData.BusAuxiliaries.UValue(busParams.FloorType), NumberOfPassengers = @@ -302,6 +301,27 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return retVal; } + private ISSMTechnologies GetSSMTechnologyBenefits(IBusAuxiliariesDeclarationData inputData) + { + var benefits = DeclarationData.BusAuxiliaries.SSMTechnologyList; + + var onVehicle = new List<ISSMTechnology>(); + foreach (var item in benefits.Items) { + if (item.BenefitName.Equals("Adjustable coolant thermostat", StringComparison.InvariantCultureIgnoreCase) && + inputData.HVACAux.AdjustableCoolantThermostat) { + onVehicle.Add(item); + } + + if (item.BenefitName.Equals("Engine waste gas heat exchanger", StringComparison.InvariantCultureIgnoreCase) && + inputData.HVACAux.EngineWasteGasHeatExchanger) { + onVehicle.Add(item); + } + } + + return new TechBenefitLines(onVehicle, "DeclarationDefaults"); + } + + private Tuple<Watt, Watt> CalculateMaxCoolingPower(IVehicleData vehicleData, Mission mission) { var busParams = mission.BusParameter; diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechnology.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechnology.cs index c45b029246..e46b0eef41 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechnology.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTechnology.cs @@ -45,7 +45,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC public double RaisedFloorV { get; set; } public double RaisedFloorC { get; set; } - public bool OnVehicle { get; set; } + public bool OnVehicle { get { return true; } } public bool ActiveVH { get; set; } public bool ActiveVV { get; set; } public bool ActiveVC { get; set; } diff --git a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs b/VectoCore/VectoCore/Models/Declaration/BusSegments.cs index db3fbf901b..d4975e4900 100644 --- a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/BusSegments.cs @@ -129,7 +129,7 @@ namespace TUGraz.VectoCore.Models.Declaration PassengerDensity = passengerDensity, DoubleDecker = row.ParseBoolean("doubledecker"), FloorType = GetFloorType(row.Field<string>("floortype")), - HVACConfiguration = BusHVACSystemConfigurationHelper.Parse(row.Field<string>("hvaccompressortype")), + HVACConfiguration = BusHVACSystemConfigurationHelper.Parse(row.Field<string>("hvacsystemconfiguration")), HVACAuxHeaterPower = row.ParseDouble("hvacauxheater").SI(Unit.SI.Kilo.Watt).Cast<Watt>(), HVACCompressorType = ACCompressorTypeExtensions.ParseEnum(row.Field<string>("hvaccompressortype")), HVACDoubleGlasing = row.ParseBoolean("hvacdoubleglasing"), diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index d4f0076b5f..9a1569705a 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -283,6 +283,9 @@ namespace TUGraz.VectoCore.Models.Declaration public static double CalculateCOP(Watt coolingPwrDriver, ACCompressorType comprTypeDriver, Watt coolingPwrPass, ACCompressorType comprTypePass, FloorType floorType) { + if (coolingPwrDriver.IsGreater(0) && comprTypeDriver == ACCompressorType.None) { + comprTypeDriver = comprTypePass; + } return (coolingPwrDriver * comprTypeDriver.COP(floorType) + coolingPwrPass * comprTypePass.COP(floorType)) / (coolingPwrDriver + coolingPwrPass); } diff --git a/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs b/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs index a2157103e4..3ad906a673 100644 --- a/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs +++ b/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs @@ -4,12 +4,13 @@ using System.Linq; using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration { public class HVACCoolingPower { - private static HVACLookup DriverCoolingPower = new HVACLookup(".Buses.HVACCoolingPowerDriver"); - private static HVACLookup PassengerCoolingPower = new HVACLookup(".Buses.HVACCoolingPowerPassenger"); + private static HVACLookup DriverCoolingPower = new HVACLookup(".Buses.HVACCoolingPowerDriver.csv"); + private static HVACLookup PassengerCoolingPower = new HVACLookup(".Buses.HVACCoolingPowerPassenger.csv"); public Watt DriverMaxCoolingPower(BusHVACSystemConfiguration configuration, MissionType mission) { @@ -26,6 +27,7 @@ namespace TUGraz.VectoCore.Models.Declaration { public HVACLookup(string resource) { ResourceId = DeclarationData.DeclarationDataResourcePrefix + resource; + ReadData(); } #region Overrides of LookupData @@ -40,7 +42,7 @@ namespace TUGraz.VectoCore.Models.Declaration { foreach (DataRow row in table.Rows) { foreach (var missionType in missionTypes) { Data.Add(Tuple.Create(BusHVACSystemConfigurationHelper.Parse(row.Field<string>("configuration")), - missionType), row.Field<double>(missionType.GetLabel()) * 1000); + missionType), row.ParseDouble(missionType.ToString()) * 1000); } } } diff --git a/VectoCore/VectoCore/Models/Declaration/LookupData.cs b/VectoCore/VectoCore/Models/Declaration/LookupData.cs index 849fe7e61c..b3fd318be9 100644 --- a/VectoCore/VectoCore/Models/Declaration/LookupData.cs +++ b/VectoCore/VectoCore/Models/Declaration/LookupData.cs @@ -46,6 +46,11 @@ namespace TUGraz.VectoCore.Models.Declaration protected abstract void ParseData(DataTable table); protected LookupData() + { + ReadData(); + } + + protected void ReadData() { if (!string.IsNullOrWhiteSpace(ResourceId)) { var table = ReadCsvResource(ResourceId); diff --git a/VectoCore/VectoCore/OutputData/FileIO/BusAuxWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/BusAuxWriter.cs index bb20ac474f..2481db5247 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/BusAuxWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/BusAuxWriter.cs @@ -218,7 +218,7 @@ namespace TUGraz.VectoCore.OutputData.FileIO tmp["RaisedFloorH"] = line.RaisedFloorH; tmp["RaisedFloorV"] = line.RaisedFloorV; tmp["RaisedFloorC"] = line.RaisedFloorC; - tmp["OnVehicle"] = line.OnVehicle; + //tmp["OnVehicle"] = line.OnVehicle; tmp["ActiveVH"] = line.ActiveVH; tmp["ActiveVV"] = line.ActiveVV; tmp["ActiveVC"] = line.ActiveVC; diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 52a852ad97..79b58f8c99 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -872,8 +872,8 @@ <EmbeddedResource Include="Resources\XSD\VectoOutputDefinitions.xsd"> <SubType>Designer</SubType> </EmbeddedResource> - <None Include="Resources\Declaration\Buses\HVACCoolingPowerDriver.csv" /> - <None Include="Resources\Declaration\Buses\HVACCoolingPowerPassenger.csv" /> + <EmbeddedResource Include="Resources\Declaration\Buses\HVACCoolingPowerDriver.csv" /> + <EmbeddedResource Include="Resources\Declaration\Buses\HVACCoolingPowerPassenger.csv" /> <None Include="Utils\VectoVersionCore.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>VectoVersionCore.cs</LastGenOutput> -- GitLab