diff --git a/VectoCommon/VectoCommon/Utils/SI.cs b/VectoCommon/VectoCommon/Utils/SI.cs index 7f6dfade09ed92f89527c9851690ef6f1f741174..dbafb57387d288c95f4654230569e5c7c9fe7256 100644 --- a/VectoCommon/VectoCommon/Utils/SI.cs +++ b/VectoCommon/VectoCommon/Utils/SI.cs @@ -636,6 +636,11 @@ namespace TUGraz.VectoCommon.Utils { } public override string UnitString { get { return "W/m^3"; } } + + public static Watt operator *(WattPerCubicMeter wpcm, CubicMeter cm) + { + return SIBase<Watt>.Create(wpcm.Val * cm.Value()); + } } /// <summary> diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/ActuationsMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/ActuationsMapReader.cs index 147ac6e20aec4fb5b0285cdca25e7895ca7d02ba..3980bf5dd47b12562e61299fe20861c4e754bea4 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/ActuationsMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/ActuationsMapReader.cs @@ -39,7 +39,7 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData foreach (DataRow row in data.Rows) { var key = row.Field<string>(Fields.CycleName).ParseEnum<MissionType>(); if (retVal.ContainsKey(key)) { - throw new VectoException("Duplicate entries in actuations map! {0} / {1}", key.ToXMLFormat()); + throw new VectoException("Duplicate entries in actuations map! {0} / {1}", key.GetLabel()); } var entry = new Actuations() { diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/ElectricConsumerReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/ElectricConsumerReader.cs index 64ad19447340d56fe3342e3b3236224dcd6a9590..9608a14054374caa544451f831db0ab5b7816882 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/ElectricConsumerReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/ElectricConsumerReader.cs @@ -44,8 +44,8 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData NumberInActualVehicle = row.Field<string>(Fields.NuminVehicle) }; foreach (var mission in EnumHelper.GetValues<MissionType>()) { - if (data.Columns.Contains(mission.ToXMLFormat())) { - consumer[mission] = row.ParseDouble(mission.ToXMLFormat()).SI<Ampere>(); + if (data.Columns.Contains(mission.GetLabel())) { + consumer[mission] = row.ParseDouble(mission.GetLabel()).SI<Ampere>(); } } retVal.Add(consumer); diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs index fa73af94aa86284f108bddaf63b99d55046c100f..45212559c592ecf90d12e0e81cbda005b534e40d 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterPrimaryBus.cs @@ -255,8 +255,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter //LowVentilation = Constants.BusAuxiliaries.SteadyStateModel.LowVentilation, SpecificVentilationPower = Constants.BusAuxiliaries.SteadyStateModel.SpecificVentilationPower, - // TODO! MQ 2019-19-29 Compressor Type and CompressorCapacity from input data? - HVACMaxCoolingPower = 18.SI(Unit.SI.Kilo.Watt).Cast<Watt>(), + HVACMaxCoolingPower = CalculateMaxCoolingPower(vehicleData, mission), HVACCompressorType = mission.BusParameter.HVACCompressorType, AuxHeaterEfficiency = Constants.BusAuxiliaries.SteadyStateModel.AuxHeaterEfficiency, @@ -281,6 +280,26 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return retVal; } + private Watt CalculateMaxCoolingPower(IVehicleData vehicleData, Mission mission) + { + var busParams = mission.BusParameter; + + var length = DeclarationData.BusAuxiliaries.CalculateInternalLength( + busParams.VehicleLength, busParams.DoubleDecker, busParams.FloorType, + busParams.NumberPassengersLowerDeck); + var height = DeclarationData.BusAuxiliaries.CalculateInternalHeight(mission.VehicleHeight); + var volume = length * height * busParams.VehicleWidth; + + // todo: subtract driver compartment from passenger compartment for certain configurations. + + var driver = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.DriverMaxCoolingPower( + busParams.HVACConfiguration, mission.MissionType); + var passenger = DeclarationData.BusAuxiliaries.HVACMaxCoolingPower.PassengerMaxCoolingPower( + busParams.HVACConfiguration, mission.MissionType, volume); + + return driver + passenger; + } + public virtual IPneumaticsConsumersDemand CreatePneumaticAuxConfig(RetarderType retarderType) { return new PneumaticsConsumersDemand() { diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index a1d3c7f1dc47dfbe729a59f0874cb91697d30327..24ed580c94553dbaece2f6983017cecf98481100 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -157,6 +157,7 @@ namespace TUGraz.VectoCore.Models.Declaration //} public static BusAlternatorTechnologies AlternatorTechnologies = new BusAlternatorTechnologies(); + private static HVACCoolingPower hvacMaxCoolingPower; public static ISSMTechnologies SSMTechnologyList { @@ -191,6 +192,11 @@ namespace TUGraz.VectoCore.Models.Declaration } } + public static HVACCoolingPower HVACMaxCoolingPower + { + get { return hvacMaxCoolingPower ?? (hvacMaxCoolingPower = new HVACCoolingPower()); } + } + public static void SetHVACParameters(SSMInputs ssmInputs, BusHVACSystemConfiguration hvacSystemConfig) { switch (hvacSystemConfig) { @@ -212,8 +218,14 @@ namespace TUGraz.VectoCore.Models.Declaration } } - public static Meter CalculateLengthInteriorLights(Meter vehicleLength, bool doubleDecker, FloorType floorType, double numPassLowFloor) + public static Meter CalculateLengthInteriorLights( + Meter vehicleLength, bool doubleDecker, FloorType floorType, double numPassLowFloor) { + return CalculateInternalLength(vehicleLength, doubleDecker, floorType, numPassLowFloor); + } + + public static Meter CalculateInternalLength(Meter vehicleLength, bool doubleDecker, FloorType floorType, double numPassLowFloor) + { if (floorType == FloorType.LowFloor) { return doubleDecker ? 2 * vehicleLength : vehicleLength; } @@ -227,6 +239,12 @@ namespace TUGraz.VectoCore.Models.Declaration } throw new VectoException("Internal Length for floorType {0} {1} not defined", floorType.ToString(), doubleDecker ? "DD" : "SD"); } + + public static Meter CalculateInternalHeight(Meter vehicleHeight) + { + // MQ: 2020-01-23 TODO! how to calculate? + return 1.8.SI<Meter>(); + } } public static class Driver diff --git a/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs b/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs new file mode 100644 index 0000000000000000000000000000000000000000..a2157103e49598d866d99290d0af1a52849453c0 --- /dev/null +++ b/VectoCore/VectoCore/Models/Declaration/HVACCoolingPower.cs @@ -0,0 +1,51 @@ +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.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"); + + public Watt DriverMaxCoolingPower(BusHVACSystemConfiguration configuration, MissionType mission) + { + return DriverCoolingPower.Lookup(configuration, mission).SI<Watt>(); + } + + public Watt PassengerMaxCoolingPower(BusHVACSystemConfiguration configuration, MissionType mission, CubicMeter volume) + { + return PassengerCoolingPower.Lookup(configuration, mission).SI<WattPerCubicMeter>() * volume; + } + + + private class HVACLookup : LookupData<BusHVACSystemConfiguration, MissionType, double>{ + public HVACLookup(string resource) + { + ResourceId = DeclarationData.DeclarationDataResourcePrefix + resource; + } + + #region Overrides of LookupData + + protected override string ResourceId { get; } + protected override string ErrorMessage { get { return "No entry found for configuration {0}, mission {1}"; } } + protected override void ParseData(DataTable table) + { + var missionTypes = Enum.GetValues(typeof(MissionType)).Cast<MissionType>().Where( + m => m.IsDeclarationMission() && m != MissionType.ExemptedMission && + table.Columns.Contains(m.ToString())).ToList(); + 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); + } + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/MissionType.cs b/VectoCore/VectoCore/Models/Declaration/MissionType.cs index c3ac435c95e97d8ffd217061d23cad9a718f07f0..37332bbcf717f6e2b7717b9665eff48dc5425c2f 100644 --- a/VectoCore/VectoCore/Models/Declaration/MissionType.cs +++ b/VectoCore/VectoCore/Models/Declaration/MissionType.cs @@ -64,6 +64,11 @@ namespace TUGraz.VectoCore.Models.Declaration return self; } + public static string GetLabel(this MissionType self) + { + return self.ToXMLFormat(); + } + public static string ToXMLFormat(this MissionType self) { switch (self) { diff --git a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerDriver.csv b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerDriver.csv new file mode 100644 index 0000000000000000000000000000000000000000..9929dbde0496044393d1bbd9243e74da77139707 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerDriver.csv @@ -0,0 +1,10 @@ +Configuration , Heavy Urban , Urban , Suburban , Interurban , Coach +1 , 0.00 , 0.00 , 0.00 , 0.00 , 0.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 +5 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 +6 , 3.50 , 3.50 , 3.50 , 3.00 , 2.50 +7 , 5.00 , 5.00 , 5.00 , 5.00 , 4.00 +8 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 +9 , 5.00 , 5.00 , 5.00 , 5.00 , 4.00 diff --git a/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerPassenger.csv b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerPassenger.csv new file mode 100644 index 0000000000000000000000000000000000000000..31de4b7e4c2e3e07a33a7b36b65a7c21e3e7106e --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/Buses/HVACCoolingPowerPassenger.csv @@ -0,0 +1,10 @@ +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 +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 +8 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 +9 , 0.25 , 0.25 , 0.25 , 0.35 , 0.55 \ No newline at end of file diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 53dd9058c4d22b1d51e992eff65e86498def2337..52a852ad975d5527b3fccbb39bc66d417fd14775 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -352,6 +352,7 @@ <Compile Include="Models\BusAuxiliaries\Util\FilePathUtils.cs" /> <Compile Include="Models\Declaration\BusAlternatorTechnologies.cs" /> <Compile Include="Models\Declaration\BusSegments.cs" /> + <Compile Include="Models\Declaration\HVACCoolingPower.cs" /> <Compile Include="Models\Declaration\SteeringPumpBus.cs" /> <Compile Include="Models\SimulationComponent\Data\Engine\WHRPowerMap.cs" /> <Compile Include="InputData\Reader\ComponentData\WHRPowerReader.cs" /> @@ -871,6 +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" /> <None Include="Utils\VectoVersionCore.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>VectoVersionCore.cs</LastGenOutput>