From b521f35d89d6be00263e5aea194b34ce5b50ffe9 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 16 Nov 2022 20:19:57 +0100 Subject: [PATCH] refactoring heating power calculation for different technologies --- .../UnitTests/M14Tests.vb | 2 +- .../BusAuxiliaries/HeatingDistributionCase.cs | 5 + .../BusAuxiliaries/ISSMDeclarationInputs.cs | 6 +- .../Impl/HVAC/SSMCalculate.cs | 292 +++++++----------- .../DownstreamModules/Impl/HVAC/SSMInputs.cs | 26 +- .../DownstreamModules/Impl/HVAC/SSMRun.cs | 50 +-- .../DownstreamModules/Impl/HVAC/SSMTOOL.cs | 19 +- .../DownstreamModules/HVAC/ISSMCalculate.cs | 13 +- .../DownstreamModules/HVAC/ISSMRun.cs | 2 +- .../DownstreamModules/HVAC/ISSMTOOL.cs | 11 +- .../Declaration/Buses/DefaultClimatic.aenv | 24 +- .../Buses/HVACHeatingPowerDriver.csv | 2 +- .../Buses/HVACHeatingPowerPassenger.csv | 8 +- 13 files changed, 227 insertions(+), 233 deletions(-) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb index b65ffb715e..1d3b914c26 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb @@ -44,7 +44,7 @@ Namespace UnitTests Public ReadOnly Property EngineWasteHeat As Watt Implements ISSMTOOL.EngineWasteHeat - Public Function AverageAuxHeaterPower(averageUseableEngineWasteHeat As Watt) As Watt Implements ISSMTOOL.AverageAuxHeaterPower + Public Function AverageAuxHeaterPower(averageUseableEngineWasteHeat As Watt) As Watt Implements ISSMPowerDemand.AverageHeaterPower Return (0.5*(averageUseableEngineWasteHeat.Value()*0.835).SI(Unit.SI.Liter.Per.Hour).Value()).SI (of Watt) End Function diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/HeatingDistributionCase.cs b/VectoCommon/VectoCommon/BusAuxiliaries/HeatingDistributionCase.cs index cb59edffc0..05dbbecd69 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/HeatingDistributionCase.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/HeatingDistributionCase.cs @@ -25,5 +25,10 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC { return parse.Replace("HD", "HeatingDistribution").ParseEnum<HeatingDistributionCase>(); } + + public static int GetID(this HeatingDistributionCase hd) + { + return hd.ToString().Replace("HeatingDistribution", "").ToInt(); + } } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMDeclarationInputs.cs b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMDeclarationInputs.cs index c5deca2da0..48eaa43c81 100644 --- a/VectoCommon/VectoCommon/BusAuxiliaries/ISSMDeclarationInputs.cs +++ b/VectoCommon/VectoCommon/BusAuxiliaries/ISSMDeclarationInputs.cs @@ -29,10 +29,12 @@ namespace TUGraz.VectoCommon.BusAuxiliaries string HVACTechnology { get; } - HeatingDistributionCase HeatingDistributionCase { get; } + HeatingDistributionCase HeatingDistributionCaseDriver { get; } + + HeatingDistributionCase HeatingDistributionCasePassenger { get; } //HeatPumpType HeatPumpTypeHeatingDriverCompartment { get; } - + HeatPumpType HeatPumpTypeDriverCompartment { get; } //HeatPumpType HeatPumpTypeHeatingPassengerCompartment { get; } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs index 0f2dacc660..bfde1bd5b3 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMCalculate.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Diagnostics.Eventing.Reader; using System.Text; using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.Utils; @@ -144,91 +146,127 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC } } - public Watt AverageAuxHeaterPower + public HeaterPower CalculateAverageHeatingDemand() { - get { - var averageAuxHeaterPower = 0.0.SI<Watt>(); - var gen = ssmTOOL.SSMInputs.EnvironmentalConditions; - var tl = ssmTOOL.TechList; - - - // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. - // Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average - if (!gen.BatchMode) - averageAuxHeaterPower = CalculateAverageAuxHeaterPower( - ssmTOOL.SSMInputs, tl, gen.DefaultConditions); - else { - foreach (var envCondition in gen.EnvironmentalConditionsMap.GetEnvironmentalConditions()) - averageAuxHeaterPower += CalculateAverageAuxHeaterPower( - ssmTOOL.SSMInputs, tl, envCondition); - - - } - - return averageAuxHeaterPower; + var heatingDemands = new List<HeaterPower>(); + var gen = ssmTOOL.SSMInputs.EnvironmentalConditions; + var tl = ssmTOOL.TechList; + if (!gen.BatchMode) + return CalculateHeatingPower( + ssmTOOL.SSMInputs, tl, gen.DefaultConditions); + else { + foreach (var envCondition in gen.EnvironmentalConditionsMap.GetEnvironmentalConditions()) + heatingDemands.Add(CalculateHeatingPower( + ssmTOOL.SSMInputs, tl, envCondition)); } + + return new HeaterPower() { + RequiredHeatingPower = heatingDemands.Sum(x => x.RequiredHeatingPower), + HeatPumpPowerMech = heatingDemands.Sum(x => x.HeatPumpPowerMech), + HeatPumpPowerEl = heatingDemands.Sum(x => x.HeatPumpPowerEl), + ElectricHeaterPowerEl = heatingDemands.Sum(x => x.ElectricHeaterPowerEl), + AuxHeaterPower = heatingDemands.Sum(x => x.AuxHeaterPower), + }; } - public Watt AverageHeatingPowerHeatPumpElectric + protected HeaterPower CalculateHeatingPower(ISSMDeclarationInputs genInputs, ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) { - get - { - var averagePower = 0.0.SI<Watt>(); - var gen = ssmTOOL.SSMInputs.EnvironmentalConditions; - var tl = ssmTOOL.TechList; + var heatingDemand = CalculateAverageHeatingPower(genInputs, tecList, env); + var heatingDemandDriver = heatingDemand * genInputs.ACSystem.DriverHVACContribution; + var heatingDemandPassenger = heatingDemand * genInputs.ACSystem.PassengerHVACContribution; + + var heatingPowerDriver = CalculateHeatingDistribution(genInputs.HeatingDistributionCaseDriver, + genInputs.HeatPumpTypeDriverCompartment, genInputs.ACSystem.ElectricHeater, env, heatingDemandDriver, genInputs.ACSystem.MaxHeatingPower * genInputs.ACSystem.DriverHVACContribution); + var heatingPowerPassenger = CalculateHeatingDistribution(genInputs.HeatingDistributionCasePassenger, + genInputs.HeatPumpTypePassengerCompartment, genInputs.ACSystem.ElectricHeater, env, heatingDemandPassenger, genInputs.ACSystem.MaxHeatingPower * genInputs.ACSystem.PassengerHVACContribution); + var techBenefitsFuelFiredHeater = 1 - TechListAdjustedHeatingW_FuelFiredHeating; + + var copDriver = env.HeatPumpCoP.ContainsKey(genInputs.HeatPumpTypeDriverCompartment) ? env.HeatPumpCoP[genInputs.HeatPumpTypeDriverCompartment] : double.NaN; + var copPassenger = env.HeatPumpCoP.ContainsKey(genInputs.HeatPumpTypePassengerCompartment) ? env.HeatPumpCoP[genInputs.HeatPumpTypePassengerCompartment] : double.NaN; + var elHeaterEff = GetElectricHeaterEfficiency(genInputs.ACSystem.ElectricHeater, env); + var fuelHeaterEff = env.HeaterEfficiency.ContainsKey(HeaterType.FuelHeater) + ? env.HeaterEfficiency[HeaterType.FuelHeater] + : double.NaN; + + var retVal = new HeaterPower() { + RequiredHeatingPower = heatingDemand * env.Weighting, + HeatPumpPowerMech = + ((double.IsNaN(copDriver) ? 0.SI<Watt>() : heatingPowerDriver.HeatPumpPowerMech / copDriver) + + (double.IsNaN(copPassenger) + ? 0.SI<Watt>() + : heatingPowerPassenger.HeatPumpPowerMech / copPassenger)) * env.Weighting, + HeatPumpPowerEl = + ((double.IsNaN(copDriver) ? 0.SI<Watt>() : heatingPowerDriver.HeatPumpPowerEl / copDriver) + + (double.IsNaN(copPassenger) + ? 0.SI<Watt>() + : heatingPowerPassenger.HeatPumpPowerEl / copPassenger)) * env.Weighting, + ElectricHeaterPowerEl = + double.IsNaN(elHeaterEff) + ? 0.SI<Watt>() + : (heatingPowerDriver.ElectricHeaterPowerEl + heatingPowerPassenger.ElectricHeaterPowerEl) / + elHeaterEff * env.Weighting, + AuxHeaterPower = double.IsNaN(fuelHeaterEff) ? 0.SI<Watt>() : VectoMath.Min(genInputs.AuxHeater.FuelFiredHeaterPower, + heatingPowerDriver.AuxHeaterPower + heatingPowerPassenger.AuxHeaterPower) / fuelHeaterEff * + techBenefitsFuelFiredHeater * env.Weighting, + }; + return retVal; + } - if (!gen.BatchMode) { - averagePower = - CalculateAverageHeatpumpHeatingPowerElectric(ssmTOOL.SSMInputs, tl, gen.DefaultConditions); - } else { - foreach (var envCondition in gen.EnvironmentalConditionsMap.GetEnvironmentalConditions()) - averagePower += CalculateAverageHeatpumpHeatingPowerElectric( - ssmTOOL.SSMInputs, tl, envCondition); - } + protected HeaterPower CalculateHeatingDistribution(HeatingDistributionCase hdCase, HeatPumpType heatPump, + HeaterType heater, IEnvironmentalConditionsMapEntry env, Watt heatingDemand, Watt maxHeatingPower) + { + var heatingDistribution = DeclarationData.BusAuxiliaries.HeatingDistribution.Lookup(hdCase, env.ID); - return averagePower; - } - } + var auxHeaterPower = heatingDemand * heatingDistribution.GetFuelHeaterContribution(); + var heatPumpPower = heatingDemand * heatingDistribution.GetHeatpumpContribution(heatPump); + var electricHeaterPower = heatingDemand * heatingDistribution.GetElectricHeaterContribution(heater); - public Watt AverageHeatingPowerHeatPumpMech { - get { - var averagePower = 0.0.SI<Watt>(); - var gen = ssmTOOL.SSMInputs.EnvironmentalConditions; - var tl = ssmTOOL.TechList; + var sumHeatingPower = VectoMath.Min(maxHeatingPower, heatPumpPower + electricHeaterPower); + var heatPumpPowerLtd = ((1-heatingDistribution.GetFuelHeaterContribution()).IsEqual(0) + ? sumHeatingPower + : sumHeatingPower / (1 - heatingDistribution.GetFuelHeaterContribution())) + * heatingDistribution.GetHeatpumpContribution(heatPump); + var electricHeaterPowerLtd = ((1-heatingDistribution.GetFuelHeaterContribution()).IsEqual(0) + ? sumHeatingPower + : sumHeatingPower / (1 - heatingDistribution.GetFuelHeaterContribution())) * + heatingDistribution.GetElectricHeaterContribution(heater); - if (!gen.BatchMode) { - averagePower = - CalculateAverageHeatpumpHeatingPowerMech(ssmTOOL.SSMInputs, tl, gen.DefaultConditions); - } else { - foreach (var envCondition in gen.EnvironmentalConditionsMap.GetEnvironmentalConditions()) - averagePower += CalculateAverageHeatpumpHeatingPowerMech( - ssmTOOL.SSMInputs, tl, envCondition); - } + return new HeaterPower() { + RequiredHeatingPower = heatingDemand, + HeatPumpPowerMech = heatPump.IsMechanical() ? heatPumpPowerLtd : 0.SI<Watt>(), + HeatPumpPowerEl = heatPump.IsElectrical() ? heatPumpPowerLtd : 0.SI<Watt>(), + ElectricHeaterPowerEl = electricHeaterPowerLtd, + AuxHeaterPower = auxHeaterPower, + }; - return averagePower; - } } - public Watt AverageHeatingPowerElectricHeater { - get { - var averagePower = 0.0.SI<Watt>(); + public Watt AverageHeatingPowerDemand + { + get + { + var averageHeatingPower = 0.0.SI<Watt>(); var gen = ssmTOOL.SSMInputs.EnvironmentalConditions; var tl = ssmTOOL.TechList; - if (!gen.BatchMode) { - averagePower = - CalculateAverageHeatingPowerElectricHeater(ssmTOOL.SSMInputs, tl, gen.DefaultConditions); - } else { + + // If batch mode is disabled use the EC_EnviromentalTemperature and EC_Solar variables. + // Else if batch is enable calculate the FuelLPerHBaseAdjusted for each input in the AENV file and then calculate the weighted average + if (!gen.BatchMode) + averageHeatingPower = CalculateAverageHeatingPower( + ssmTOOL.SSMInputs, tl, gen.DefaultConditions); + else { foreach (var envCondition in gen.EnvironmentalConditionsMap.GetEnvironmentalConditions()) - averagePower += CalculateAverageHeatingPowerElectricHeater( + averageHeatingPower += CalculateAverageHeatingPower( ssmTOOL.SSMInputs, tl, envCondition); + + } - return averagePower; + return averageHeatingPower; } } - // Base Values public Watt BaseHeatingW_ElectricalVentilation(Kelvin environmentalTemperature, WattPerSquareMeter solar) @@ -257,27 +295,6 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC } - //public Watt BaseHeatingW_FuelFiredHeating(Kelvin environmentalTemperature, WattPerSquareMeter solar) - //{ - - // // =IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:O90,3),0) - - // // Dim M89 = Me.Run1.TotalW - // // Dim M90 = Me.Run2.TotalW - // // VLOOKUP(MAX(M89:M90),M89:O90 => VLOOKUP ( lookupValue, tableArray, colIndex, rangeLookup ) - - // // If both Run TotalW values are >=0 then return FuelW from Run with largest TotalW value, else return 0 - // var run1TotalW = Run1.TotalW(environmentalTemperature, solar); - // var run2TotalW = Run2.TotalW(environmentalTemperature, solar); - - // if ((run1TotalW < 0 && run2TotalW < 0)) { - // return run1TotalW > run2TotalW ? Run1.PowerFuelHeater(environmentalTemperature, solar) : Run2.PowerFuelHeater(environmentalTemperature, solar); - // } - - // return 0.SI<Watt>(); - - //} - protected Watt BaseCoolingW_Mechanical(Kelvin environmentalTemperature, WattPerSquareMeter solar) { // =IF(C46<C28,0,IF(C53="electrical", 0, IF(AND(M89>0,M90>0),MIN(M89:M90),0))) @@ -705,97 +722,26 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC return MechanicalWBaseAdjusted * env.Weighting; } - private Watt CalculateAverageAuxHeaterPower( - ISSMDeclarationInputs genInputs, ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) - { - var heatingPower = CalculateAverageHeatingPower(genInputs, tecList, env); - var heatingDistributionCase = genInputs.HeatingDistributionCase; - var heatingDistribution = - DeclarationData.BusAuxiliaries.HeatingDistribution.Lookup(heatingDistributionCase, env.ID); - - var auxHeaterPower = heatingPower * (heatingDistribution?.GetFuelHeaterContribution() ?? 0); - var auxHeaterPowerLtd = VectoMath.Min(auxHeaterPower, genInputs.AuxHeater.FuelFiredHeaterPower) / - genInputs.BoundaryConditions.AuxHeaterEfficiency; - - return auxHeaterPowerLtd * env.Weighting; - } + private double GetElectricHeaterEfficiency(HeaterType electricHeater, IEnvironmentalConditionsMapEntry env) + { + var cnt = 0; + var sum = 0.0; + foreach (var heaterType in EnumHelper.GetValues<HeaterType>()) { + if ((electricHeater & heaterType) == 0) { + continue; + } - private Watt CalculateAverageHeatpumpHeatingPowerMech(ISSMDeclarationInputs genInputs, - ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) - { - var heatingPower = CalculateAverageHeatingPower(genInputs, tecList, env); - var heatingDistributionCase = genInputs.HeatingDistributionCase; - var heatingDistribution = - DeclarationData.BusAuxiliaries.HeatingDistribution.Lookup(heatingDistributionCase, env.ID); - - var heaterPower = heatingPower * (heatingDistribution?.GetHeatpumpContribution(genInputs.HeatPumpTypeDriverCompartment) ?? 0); - var cop = GetCoPHeating(genInputs, env); - var heaterPowerLtd = heaterPower.IsEqual(0) || double.IsNaN(cop) ? 0.SI<Watt>() : VectoMath.Min(heaterPower, genInputs.ACSystem.MaxHeatingPower) / cop; - - var driverContribution = heaterPowerLtd * genInputs.ACSystem.DriverHVACContribution; - var passengerContribution = heaterPowerLtd * genInputs.ACSystem.PassengerHVACContribution; - var retVal = (genInputs.HeatPumpTypeDriverCompartment.IsMechanical() ? driverContribution : 0.SI<Watt>()) + - (genInputs.HeatPumpTypePassengerCompartment.IsMechanical() ? passengerContribution : 0.SI<Watt>()); - - return retVal * env.Weighting; - } - - private Watt CalculateAverageHeatpumpHeatingPowerElectric(ISSMDeclarationInputs genInputs, - ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) - { - var heatingPower = CalculateAverageHeatingPower(genInputs, tecList, env); - var heatingDistributionCase = genInputs.HeatingDistributionCase; - var heatingDistribution = - DeclarationData.BusAuxiliaries.HeatingDistribution.Lookup(heatingDistributionCase, env.ID); - - var heaterPower = heatingPower * (heatingDistribution?.GetHeatpumpContribution(genInputs.HeatPumpTypeDriverCompartment) ?? 0); - var cop = GetCoPHeating(genInputs, env); - var heaterPowerLtd = heaterPower.IsEqual(0) || double.IsNaN(cop) ? 0.SI<Watt>() : VectoMath.Min(heaterPower, genInputs.ACSystem.MaxHeatingPower) / cop; - - var driverContribution = heaterPowerLtd * genInputs.ACSystem.DriverHVACContribution; - var passengerContribution = heaterPowerLtd * genInputs.ACSystem.PassengerHVACContribution; - var retVal = (genInputs.HeatPumpTypeDriverCompartment.IsElectrical() ? driverContribution : 0.SI<Watt>()) + - (genInputs.HeatPumpTypePassengerCompartment.IsElectrical() ? passengerContribution : 0.SI<Watt>()); - - return retVal * env.Weighting; - } - - private Watt CalculateAverageHeatingPowerElectricHeater(ISSMDeclarationInputs genInputs, - ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) - { - var heatingPower = CalculateAverageHeatingPower(genInputs, tecList, env); - var heatingDistributionCase = genInputs.HeatingDistributionCase; - var heatingDistribution = - DeclarationData.BusAuxiliaries.HeatingDistribution.Lookup(heatingDistributionCase, env.ID); - - var heaterPower = heatingPower * (heatingDistribution?.GetElectricHeaterContribution(genInputs.ACSystem.ElectricHeater) ?? 0); - var efficiency = GetElectricHeaterEfficiency(genInputs, env); - var heaterPowerLtd = heaterPower.IsEqual(0) || double.IsNaN(efficiency) ? 0.SI<Watt>() : VectoMath.Min(heaterPower, genInputs.ACSystem.MaxHeatingPower) / efficiency; - - var driverContribution = heaterPowerLtd * genInputs.ACSystem.DriverHVACContribution; - var passengerContribution = heaterPowerLtd * genInputs.ACSystem.PassengerHVACContribution; - var retVal = (genInputs.HeatPumpTypeDriverCompartment.IsElectrical() ? driverContribution : 0.SI<Watt>()) + - (genInputs.HeatPumpTypePassengerCompartment.IsElectrical() ? passengerContribution : 0.SI<Watt>()); - - return retVal * env.Weighting; - } - - private double GetElectricHeaterEfficiency(ISSMDeclarationInputs genInputs, IEnvironmentalConditionsMapEntry env) - { - var cnt = 0; - var sum = 0.0; - foreach (var heaterType in EnumHelper.GetValues<HeaterType>()) { - if ((genInputs.ACSystem.ElectricHeater & heaterType) == 0) { + if (!env.HeaterEfficiency.ContainsKey(heaterType)) { continue; } - cnt++; - sum += env.HeaterEfficiency[heaterType]; - } - return sum / cnt; - } + cnt++; + sum += env.HeaterEfficiency[heaterType]; + } + return sum / cnt; + } - private Watt CalculateAverageHeatingPower( + private Watt CalculateAverageHeatingPower( ISSMDeclarationInputs genInputs, ISSMTechnologyBenefits tecList, IEnvironmentalConditionsMapEntry env) { // =MIN(ABS(IF(AND(M89<0,M90<0),VLOOKUP(MAX(M89:M90),M89:P90,4),0)/1000),C71)/C37*(1/(C39*C38)) @@ -813,12 +759,14 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC var result = 0.SI<Watt>(); + if (run1TotalW < 0 && run2TotalW < 0) { result = VectoMath .Abs( run1TotalW > run2TotalW - ? Run1.TechListAmendedFuelHeater(env.Temperature, env.Solar) - : Run2.TechListAmendedFuelHeater(env.Temperature, env.Solar)).Value().SI<Watt>(); + ? run1TotalW //.TechListAmendedFuelHeater(env.Temperature, env.Solar) + : run2TotalW //.TechListAmendedFuelHeater(env.Temperature, env.Solar) + ) - ssmTOOL.EngineWasteHeat; } return result; diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs index 6c842a9a15..72c5553d50 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs @@ -13,7 +13,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC IAuxHeater, ISSMBusParameters { private readonly IFuelProperties HeatingFuel; - private HeatingDistributionCase? _heatingDistributionCase; + private HeatingDistributionCase? _heatingDistributionDriverCase; + private HeatingDistributionCase? _heatingDistributionPassengerCase; public SSMInputs(string source, IFuelProperties heatingFuel = null) { @@ -164,20 +165,31 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC public string HVACTechnology => $"{HVACSystemConfiguration.GetName()} " + $"({string.Join(", ", HeatPumpTypePassengerCompartment.GetName(), HeatPumpTypeDriverCompartment.GetName())})"; - public HeatingDistributionCase HeatingDistributionCase + public HeatingDistributionCase HeatingDistributionCaseDriver { get { - if (!_heatingDistributionCase.HasValue) { - _heatingDistributionCase = GetHeatingDistributionCase(); + if (!_heatingDistributionDriverCase.HasValue) { + _heatingDistributionDriverCase = GetHeatingDistributionCase(HeatPumpTypeDriverCompartment); } - return _heatingDistributionCase.Value; + return _heatingDistributionDriverCase.Value; } } - protected virtual HeatingDistributionCase GetHeatingDistributionCase() + + public HeatingDistributionCase HeatingDistributionCasePassenger { + get { + if (!_heatingDistributionPassengerCase.HasValue) { + _heatingDistributionPassengerCase = GetHeatingDistributionCase(HeatPumpTypePassengerCompartment); + } + + return _heatingDistributionPassengerCase.Value; + } + } + + protected virtual HeatingDistributionCase GetHeatingDistributionCase(HeatPumpType heatPump) { - return HeatingDistributions.GetHeatingDistributionCase(HeatPumpTypePassengerCompartment, ElectricHeater, + return HeatingDistributions.GetHeatingDistributionCase(heatPump, ElectricHeater, AuxHeater.FuelFiredHeaterPower.IsGreater(0)); } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs index a29e1f3453..dbcbc9f780 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMRun.cs @@ -79,29 +79,29 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC //} - public Watt TechListAmendedFuelHeater(Kelvin enviromentalTemperature, WattPerSquareMeter solarFactor) - { - // =IF(IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000<0,IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000,0) - - var TLFFH = ssmTOOL.Calculate.TechListAdjustedHeatingW_FuelFiredHeating; - - // Dim C60 As Double = gen.AH_EngineWasteHeatkW - // Dim N79 As Double = Me.TotalKW - //Return IF( IF(( (TotalKW * (1 - TLFFH)) < 0 AndAlso (TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)), _ - // (TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1), 0)*1000 < 0, _ - //IF(((TotalKW * (1 - TLFFH)) < 0 AndAlso(TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)),(TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1),0)*1000,0) - - var totalW = TotalW(enviromentalTemperature, solarFactor) * (1 - TLFFH); - return totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1 - ? totalW - ssmTOOL.EngineWasteHeat * -1 - : 0.SI<Watt>(); - - //return (totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1? - // totalW - ssmTOOL.EngineWasteHeat * -1: 0.SI<Watt>()) < 0 - // ? (totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1 - // ? totalW - ssmTOOL.EngineWasteHeat * -1 - // : 0.SI<Watt>()) - // : 0.SI<Watt>(); - } - } + //public Watt TechListAmendedFuelHeater(Kelvin enviromentalTemperature, WattPerSquareMeter solarFactor) + //{ + // // =IF(IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000<0,IF(AND((N79*(1-$J$89))<0,(N79*(1-$J$89))<(C60*-1)),(N79*(1-$J$89))-(C60*-1),0)*1000,0) + + // var TLFFH = ssmTOOL.Calculate.TechListAdjustedHeatingW_FuelFiredHeating; + + // // Dim C60 As Double = gen.AH_EngineWasteHeatkW + // // Dim N79 As Double = Me.TotalKW + // //Return IF( IF(( (TotalKW * (1 - TLFFH)) < 0 AndAlso (TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)), _ + // // (TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1), 0)*1000 < 0, _ + // //IF(((TotalKW * (1 - TLFFH)) < 0 AndAlso(TotalKW * (1 - TLFFH)) < (gen.AH_EngineWasteHeatkW * -1)),(TotalKW * (1 - TLFFH)) - (gen.AH_EngineWasteHeatkW * -1),0)*1000,0) + + // var totalW = TotalW(enviromentalTemperature, solarFactor) * (1 - TLFFH); + // //return totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1 + // // ? totalW - ssmTOOL.EngineWasteHeat * -1 + // // : 0.SI<Watt>(); + + // //return (totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1? + // // totalW - ssmTOOL.EngineWasteHeat * -1: 0.SI<Watt>()) < 0 + // // ? (totalW < 0 && totalW < ssmTOOL.EngineWasteHeat * -1 + // // ? totalW - ssmTOOL.EngineWasteHeat * -1 + // // : 0.SI<Watt>()) + // // : 0.SI<Watt>(); + // } + } } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs index edf382359f..54478acb9f 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMTOOL.cs @@ -30,8 +30,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC public Watt ElectricalWAdjusted => _ssmInput.ElectricPower; public Watt MechanicalWBaseAdjusted => _ssmInput.MechanicalPower; - - public Watt AverageAuxHeaterPower(Watt averageUseableEngineWasteHeat) + public HeaterPower AverageHeaterPower(Watt averageUseableEngineWasteHeat) { throw new System.NotImplementedException(); } @@ -111,13 +110,23 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC // Dynamicly Get Fuel having re-adjusted Engine Heat Waste, this was originally supposed to be Solid State. Late adjustment request 24/3/2015 - public Watt AverageAuxHeaterPower(Watt averageUseableEngineWasteHeat) + public HeaterPower AverageHeaterPower(Watt averageUseableEngineWasteHeat) { // Set Engine Waste Heat //SSMInputs.AuxHeater.EngineWasteHeatkW = AverageUseableEngineWasteHeatKW; EngineWasteHeat = averageUseableEngineWasteHeat; - var fba = Calculate.AverageAuxHeaterPower; + //var retVal = new HeaterPower() { + // RequiredHeatingPower = Calculate.AverageHeatingPowerDemand, + // AuxHeaterPower = Calculate.AverageAuxHeaterPower, + // ElectricHeaterPowerEl = Calculate.AverageHeatingPowerElectricHeater, + // HeatPumpPowerMech = Calculate.AverageHeatingPowerHeatPumpMech, + // HeatPumpPowerEl = Calculate.AverageHeatingPowerHeatPumpElectric, + //}; + + var retVal = Calculate.CalculateAverageHeatingDemand(); + + //var fba = Calculate.AverageAuxHeaterPower; // Dim FuelFiredWarning As Boolean = fba * SSMInputs.BC_AuxHeaterEfficiency * HVACConstants.FuelDensity * SSMInputs.BC_GCVDieselOrHeatingOil * 1000 > (AverageUseableEngineWasteHeatKW + SSMInputs.AH_FuelFiredHeaterkW) // If Not FuelFiredHeaterInsufficientWarned AndAlso FuelFiredWarning Then @@ -125,7 +134,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC // OnMessage(Me, " HVAC SSM : Fuel fired heater insufficient for heating requirements, run continues assuming it was sufficient.", AdvancedAuxiliaryMessageType.Warning) // End If - return fba; + return retVal; } } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs index 5ee3ce9278..cb47d70f88 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMCalculate.cs @@ -12,10 +12,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.HV Watt ElectricalWAdjusted { get; } Watt MechanicalWBaseAdjusted { get; } - Watt AverageAuxHeaterPower { get; } + //Watt AverageHeatingPowerDemand { get; } + //Watt AverageAuxHeaterPower { get; } - double TechListAdjustedHeatingW_FuelFiredHeating { get; } + //Watt AverageHeatingPowerHeatPumpElectric { get; } + + //Watt AverageHeatingPowerHeatPumpMech { get; } + + //Watt AverageHeatingPowerElectricHeater { get; } + + //double TechListAdjustedHeatingW_FuelFiredHeating { get; } + + HeaterPower CalculateAverageHeatingDemand(); } } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs index b1449abff1..c5b8e491b9 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMRun.cs @@ -7,6 +7,6 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.HV Watt TotalW(Kelvin environmentTemperature, WattPerSquareMeter solarFactor); //Watt PowerFuelHeater(Kelvin environmentTemperature, WattPerSquareMeter solarFactor); - Watt TechListAmendedFuelHeater(Kelvin environmentTemperature, WattPerSquareMeter solarFactor); + //Watt TechListAmendedFuelHeater(Kelvin environmentTemperature, WattPerSquareMeter solarFactor); } } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs index 6c056d9cc8..36b098a170 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/HVAC/ISSMTOOL.cs @@ -9,10 +9,19 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.HV Watt ElectricalWAdjusted { get; } // Watt Watt MechanicalWBaseAdjusted { get; } // Watt - Watt AverageAuxHeaterPower(Watt averageUseableEngineWasteHeat); + HeaterPower AverageHeaterPower(Watt averageUseableEngineWasteHeat); } + public struct HeaterPower + { + public Watt RequiredHeatingPower; + public Watt AuxHeaterPower; + public Watt ElectricHeaterPowerEl; + public Watt HeatPumpPowerEl; + public Watt HeatPumpPowerMech; + } + public interface ISSMTOOL : ISSMPowerDemand { ISSMDeclarationInputs SSMInputs { get; } diff --git a/VectoCore/VectoCore/Resources/Declaration/Buses/DefaultClimatic.aenv b/VectoCore/VectoCore/Resources/Declaration/Buses/DefaultClimatic.aenv index 06f5011640..ab9b6d2631 100644 --- a/VectoCore/VectoCore/Resources/Declaration/Buses/DefaultClimatic.aenv +++ b/VectoCore/VectoCore/Resources/Declaration/Buses/DefaultClimatic.aenv @@ -1,12 +1,12 @@ -ID , EnvTemp , Solar , WeightingFactor , heating/cooling , R-744 , non R-744 2-stage , non R-744 3-stage , non R-744 4-stage , non R-744 continuous , water electric heater , air electric heater , other electric heater , fuel heater -1 , -20 , 10 , 0.0053 , h , 1.80 , - , - , - , - , 0.93 , 0.93 , 0.93 , 0.80 -2 , -5 , 30 , 0.0826 , h , 2.04 , 1.54 , 1.64 , 1.68 , 1.78 , 0.93 , 0.93 , 0.93 , 0.80 -3 , 2 , 30 , 0.0826 , h , 2.50 , 2.00 , 2.10 , 2.10 , 2.22 , 0.93 , 0.93 , 0.93 , 0.80 -4 , 8 , 20 , 0.1661 , h , 2.98 , 2.70 , 2.80 , 2.82 , 2.94 , 0.93 , 0.93 , 0.93 , 0.80 -5 , 8 , 155 , 0.0826 , h , 2.98 , 2.70 , 2.80 , 2.82 , 2.94 , 0.93 , 0.93 , 0.93 , 0.80 -6 , 14 , 30 , 0.0826 , h , 3.38 , 3.24 , 3.34 , 3.36 , 3.50 , 0.93 , 0.93 , 0.93 , 0.80 -7 , 14 , 175 , 0.1243 , h , 3.38 , 3.24 , 3.34 , 3.36 , 3.50 , 0.93 , 0.93 , 0.93 , 0.80 -8 , 20.5 , 30 , 0.1243 , c , 3.80 , 3.62 , 3.74 , 3.74 , 3.88 , - , - , , - -9 , 20.5 , 200 , 0.1243 , c , 3.80 , 3.62 , 3.74 , 3.74 , 3.88 , - , - , , - -10 , 26 , 150 , 0.0826 , c , 2.82 , 3.12 , 3.22 , 3.24 , 3.36 , - , - , , - -11 , 33 , 150 , 0.0427 , c , 2.14 , 2.50 , 2.60 , 2.62 , 2.74 , - , - , , - +ID , EnvTemp , Solar , WeightingFactor , heating/cooling , R-744 , non R-744 2-stage , non R-744 3-stage , non R-744 4-stage , non R-744 continuous , water electric heater , air electric heater , other electric heating , fuel heater +1 , -20 , 10 , 0.0053 , h , 1.80 , - , - , - , - , 0.93 , 0.93 , 0.93 , 0.80 +2 , -5 , 30 , 0.0826 , h , 2.04 , 1.54 , 1.64 , 1.68 , 1.78 , 0.93 , 0.93 , 0.93 , 0.80 +3 , 2 , 30 , 0.0826 , h , 2.50 , 2.00 , 2.10 , 2.10 , 2.22 , 0.93 , 0.93 , 0.93 , 0.80 +4 , 8 , 20 , 0.1661 , h , 2.98 , 2.70 , 2.80 , 2.82 , 2.94 , 0.93 , 0.93 , 0.93 , 0.80 +5 , 8 , 155 , 0.0826 , h , 2.98 , 2.70 , 2.80 , 2.82 , 2.94 , 0.93 , 0.93 , 0.93 , 0.80 +6 , 14 , 30 , 0.0826 , h , 3.38 , 3.24 , 3.34 , 3.36 , 3.50 , 0.93 , 0.93 , 0.93 , 0.80 +7 , 14 , 175 , 0.1243 , h , 3.38 , 3.24 , 3.34 , 3.36 , 3.50 , 0.93 , 0.93 , 0.93 , 0.80 +8 , 20.5 , 30 , 0.1243 , c , 3.80 , 3.62 , 3.74 , 3.74 , 3.88 , - , - , , - +9 , 20.5 , 200 , 0.1243 , c , 3.80 , 3.62 , 3.74 , 3.74 , 3.88 , - , - , , - +10 , 26 , 150 , 0.0826 , c , 2.82 , 3.12 , 3.22 , 3.24 , 3.36 , - , - , , - +11 , 33 , 150 , 0.0427 , c , 2.14 , 2.50 , 2.60 , 2.62 , 2.74 , - , - , , - diff --git a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerDriver.csv b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerDriver.csv index 18b372ff43..b301c184a8 100644 --- a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerDriver.csv +++ b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerDriver.csv @@ -1,5 +1,5 @@ Configuration , Heavy Urban , Urban , Suburban , Interurban , Coach -1 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 +1 , 5.00 , 5.00 , 5.00 , 5.00 , 4.00 2 , 5.00 , 5.00 , 5.00 , 5.00 , 4.00 3 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 4 , 5.00 , 5.00 , 5.00 , 5.00 , 4.00 diff --git a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerPassenger.csv b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerPassenger.csv index 367b4dda94..bd1f13e64a 100644 --- a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerPassenger.csv +++ b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACHeatingPowerPassenger.csv @@ -1,8 +1,8 @@ Configuration , Heavy Urban , Urban , Suburban , Interurban , Coach -1 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 -2 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 -3 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 -4 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 +1 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 +2 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 +3 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 +4 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 5 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 6 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 7 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 -- GitLab