diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M14Tests.vb index b65ffb715e095ebdae45b97215b54a153f8fed2d..1d3b914c26a779d1017bd17c2ed917c06aa71e26 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 cb59edffc02f97bf1decda29fe52069d5269b37e..05dbbecd69e892917a8bf79523af0472659a039e 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 c5deca2da0549d0704d3926e611882884d11c54b..48eaa43c81247dd5815f43ce02ac4eb82800e440 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 0f2dacc660a7ba1941ce99e51c3256143641d8c9..bfde1bd5b394a47467ed91320e7152a02141bd6d 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 6c842a9a15d4e0d226f6b92acb328a100e40296d..72c5553d500a67cc8e553b9256ff681fb7477691 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 a29e1f34535b23dfdb9b497097531fcba020648a..dbcbc9f780e62522996cf1e3b959a43fc7838f34 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 edf382359f3d39a8458c90f7b8f7aecc48740659..54478acb9f50e4845e41f747a71a5a3e401c9dbc 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 5ee3ce92781118e6df949b5152168d3cd92943f9..cb47d70f88c36f0cdae30ce66ed83cbac23c66f5 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 b1449abff180fb3a273e8b06b08cbfcbf56d1b76..c5b8e491b9502fb82a30624dd355d8b6179ad044 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 6c056d9cc817956e7c77e1c3efa3aa2fb2b84c0a..36b098a170036e03e8dae5498b8db97f0165dec7 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 06f5011640e525944135b1941665758fbf80241c..ab9b6d26317462424941a16f7622771c773ba925 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 18b372ff43cd6dc33ff19ada791e0fc1b3dfeb80..b301c184a8515290d5bb3c7d43587227440588b5 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 367b4dda94400309922c0ec4498137fb45fa9221..bd1f13e64a0090070dce76ca166df4790727af1d 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