Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit e92a35f6 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

first version to calculate max cooling power (adding lookup tables for driver...

first version to calculate max cooling power (adding lookup tables for driver compartment / passenger compartmend depending on configuration and mission)
parent 11438029
No related branches found
No related tags found
No related merge requests found
Showing
with 127 additions and 6 deletions
......@@ -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>
......
......@@ -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() {
......
......@@ -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);
......
......@@ -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() {
......
......@@ -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
......
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
......@@ -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) {
......
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
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
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment