Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

Merge pull request #487 in VECTO/vecto-sim from...

Merge pull request #487 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-550-allow-custom-settings-for-airdensity to master

* commit '6f091d62':
  add attributes to air density property: required
  adapt testcases related to airdrag: pass along air density; set air density in model data in testcases
  add air density (and gravity acceleration) as constant to declaration data. add air density to vehicle data, use air density from model data for air drag computation declaration data adapter: use declaration data; engineering data adapter: use physics constant to fill model data GUI: set air density (physical constant) in declaration mode
parents da858420 6f091d62
No related branches found
No related tags found
No related merge requests found
Showing
with 1191 additions and 1147 deletions
......@@ -50,6 +50,7 @@ Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration
Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering
Imports TUGraz.VectoCore.OutputData
Imports TUGraz.VectoCore.OutputData.FileIO
Imports TUGraz.VectoCore.Utils
''' <summary>
''' Main application form. Loads at application start. Closing form ends application.
......@@ -930,6 +931,7 @@ Imports TUGraz.VectoCore.OutputData.FileIO
mode = ExecutionMode.Declaration
Else
mode = ExecutionMode.Engineering
Physics.AirDensity = Cfg.AirDensity.SI(Of KilogramPerCubicMeter)()
End If
'dictionary of run-identifiers to fileWriters (used for output directory of modfile)
......
......@@ -50,6 +50,7 @@ Partial Class Settings
Me.Label2 = New System.Windows.Forms.Label()
Me.ButReset = New System.Windows.Forms.Button()
Me.BtHelp = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.GroupBox3.SuspendLayout()
Me.GroupBox5.SuspendLayout()
Me.TabControl1.SuspendLayout()
......@@ -177,6 +178,7 @@ Partial Class Settings
'
'GrCalc
'
Me.GrCalc.Controls.Add(Me.Label1)
Me.GrCalc.Controls.Add(Me.Label11)
Me.GrCalc.Controls.Add(Me.Label9)
Me.GrCalc.Controls.Add(Me.Label3)
......@@ -192,7 +194,6 @@ Partial Class Settings
Me.GrCalc.TabIndex = 1
Me.GrCalc.TabStop = False
Me.GrCalc.Text = "Calculation"
Me.GrCalc.Visible = False
'
'Label11
'
......@@ -202,6 +203,7 @@ Partial Class Settings
Me.Label11.Size = New System.Drawing.Size(77, 13)
Me.Label11.TabIndex = 16
Me.Label11.Text = "[kgCO2/KgFC]"
Me.Label11.Visible = False
'
'Label9
'
......@@ -211,6 +213,7 @@ Partial Class Settings
Me.Label9.Size = New System.Drawing.Size(41, 13)
Me.Label9.TabIndex = 16
Me.Label9.Text = "[kg/m³]"
Me.Label9.Visible = False
'
'Label3
'
......@@ -227,6 +230,7 @@ Partial Class Settings
Me.TbCO2toFC.Name = "TbCO2toFC"
Me.TbCO2toFC.Size = New System.Drawing.Size(50, 20)
Me.TbCO2toFC.TabIndex = 2
Me.TbCO2toFC.Visible = False
'
'Label10
'
......@@ -236,6 +240,7 @@ Partial Class Settings
Me.Label10.Size = New System.Drawing.Size(91, 13)
Me.Label10.TabIndex = 14
Me.Label10.Text = "CO2-to-Fuel Ratio"
Me.Label10.Visible = False
'
'TbFuelDens
'
......@@ -243,6 +248,7 @@ Partial Class Settings
Me.TbFuelDens.Name = "TbFuelDens"
Me.TbFuelDens.Size = New System.Drawing.Size(50, 20)
Me.TbFuelDens.TabIndex = 1
Me.TbFuelDens.Visible = False
'
'Label8
'
......@@ -252,6 +258,7 @@ Partial Class Settings
Me.Label8.Size = New System.Drawing.Size(63, 13)
Me.Label8.TabIndex = 14
Me.Label8.Text = "Fuel density"
Me.Label8.Visible = False
'
'TbAirDensity
'
......@@ -289,6 +296,15 @@ Partial Class Settings
Me.BtHelp.TabIndex = 0
Me.BtHelp.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(206, 25)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(65, 13)
Me.Label1.TabIndex = 17
Me.Label1.Text = "(Eng, Mode)"
'
'Settings
'
Me.AcceptButton = Me.ButtonOK
......@@ -342,4 +358,5 @@ Partial Class Settings
Friend WithEvents GroupBox5 As GroupBox
Friend WithEvents TbOpenCmdName As TextBox
Friend WithEvents Label12 As Label
Friend WithEvents Label1 As System.Windows.Forms.Label
End Class
......@@ -32,7 +32,7 @@ Public Class Settings
TbFuelDens.Text = Cfg.FuelDens.ToString
TbCO2toFC.Text = Cfg.CO2perFC.ToString
GrCalc.Enabled = Not Cfg.DeclMode
'GrCalc.Enabled = Not Cfg.DeclMode
End Sub
......
......@@ -40,6 +40,7 @@ using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
{
......@@ -60,6 +61,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
AxleConfiguration = data.AxleConfiguration,
CurbWeight = data.CurbMassChassis,
GrossVehicleWeight = data.GrossVehicleMassRating,
AirDensity = Physics.AirDensity,
};
return retVal;
......
......@@ -88,6 +88,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
}
var retVal = SetCommonVehicleData(data);
retVal.AirDensity = DeclarationData.AirDensity;
retVal.VIN = data.VIN;
retVal.ManufacturerAddress = data.ManufacturerAddress;
retVal.LegislativeClass = data.LegislativeClass;
......
......@@ -53,7 +53,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
if (data.SavedInDeclarationMode) {
WarnEngineeringMode("VehicleData");
}
var retVal = SetCommonVehicleData(data);
retVal.BodyAndTrailerWeight = data.CurbMassExtra;
//retVal.CurbWeight += data.CurbMassExtra;
......
......@@ -47,6 +47,15 @@ namespace TUGraz.VectoCore.Models.Declaration
{
public static class DeclarationData
{
/// <summary>
/// The standard acceleration for gravity on earth.
/// http://physics.nist.gov/Pubs/SP330/sp330.pdf (page 52)
/// </summary>
public static readonly MeterPerSquareSecond GravityAccelleration = 9.80665.SI<MeterPerSquareSecond>();
public static readonly KilogramPerCubicMeter AirDensity = 1.188.SI<KilogramPerCubicMeter>();
public const string DeclarationDataResourcePrefix = "TUGraz.VectoCore.Resources.Declaration";
public static readonly Watt MinEnginePowerForEMS = 300e3.SI<Watt>();
......@@ -69,6 +78,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public static readonly Payloads Payloads = new Payloads();
public static readonly PTOTransmission PTOTransmission = new PTOTransmission();
/// <summary>
/// Formula for calculating the payload for a given gross vehicle weight.
/// (so called "pc-formula", Whitebook Apr 2016, Part 1, p.187)
......@@ -89,7 +99,9 @@ namespace TUGraz.VectoCore.Models.Declaration
/// </summary>
public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight, bool lowLoading)
{
return (Math.Round((Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo(0.SI<Kilogram>(),
return
(Math.Round(
(Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo(0.SI<Kilogram>(),
grossVehicleWeight - curbWeight).Value() / 100, 0) * 100).SI<Kilogram>();
}
......
......@@ -58,7 +58,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public void SetDataBus(IDataBus dataBus) {}
public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2)
public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2, KilogramPerCubicMeter airDensity)
{
var vAverage = (v1 + v2) / 2;
var cdA = EffectiveAirDragArea(vAverage);
......@@ -67,7 +67,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
// P(t) = k * CdA * v(t)^3 , v(t) = v0 + a * t // P_avg = 1/T * Integral P(t) dt
// => P_avg = (CdA * rho/2)/(4*a * dt) * (v2^4 - v1^4) // a = (v2-v1)/dt
// -> P_avg = (CdA * rho/2) * (v2^4 - v1^4) / (v2 - v1) = (CdA * rho/2) * (v1 + v2) * (v1^2 + v2^2)
return (Physics.AirDensity / (2.0 * 4) * cdA * (v1 + v2) * (v1 * v1 + v2 * v2)).Cast<Watt>();
return (airDensity / (2.0 * 4) * cdA * (v1 + v2) * (v1 * v1 + v2 * v2)).Cast<Watt>();
}
protected internal SquareMeter EffectiveAirDragArea(MeterPerSecond x)
......
......@@ -65,7 +65,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
get { return CrossWindCorrectionMode.VAirBetaLookupTable; }
}
public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2)
public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2, KilogramPerCubicMeter airDensity)
{
if (DataBus == null) {
throw new VectoException("Databus is not set - can't access vAir, beta!");
......
......@@ -45,6 +45,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
SquareMeter AirDragArea { get; }
Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2);
Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2, KilogramPerCubicMeter airDensity);
}
}
\ No newline at end of file
......@@ -138,9 +138,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
SIRange(0, 60000, emsMission: true)]
public Kilogram TrailerGrossVehicleWeight { get; internal set; }
[Required, SIRange(0.1, 0.7)]
[Required, SIRange(0.1, 2)]
public Meter DynamicTyreRadius { get; internal set; }
[Required, SIRange(0.1, 100)]
public KilogramPerCubicMeter AirDensity { get; internal set; }
public KilogramSquareMeter WheelsInertia
{
get {
......
......@@ -192,7 +192,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
private Watt ComputeAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2)
{
return AirdragData.CrossWindCorrectionCurve.AverageAirDragPowerLoss(v1, v2);
return AirdragData.CrossWindCorrectionCurve.AverageAirDragPowerLoss(v1, v2, ModelData.AirDensity);
}
public Meter Distance
......
......@@ -30,6 +30,7 @@
*/
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.Declaration;
namespace TUGraz.VectoCore.Utils
{
......@@ -39,12 +40,12 @@ namespace TUGraz.VectoCore.Utils
/// The standard acceleration for gravity on earth.
/// http://physics.nist.gov/Pubs/SP330/sp330.pdf (page 52)
/// </summary>
public static readonly MeterPerSquareSecond GravityAccelleration = 9.80665.SI<MeterPerSquareSecond>();
public static MeterPerSquareSecond GravityAccelleration = DeclarationData.GravityAccelleration;
/// <summary>
/// Density of air.
/// </summary>
public static readonly KilogramPerCubicMeter AirDensity = 1.188.SI<KilogramPerCubicMeter>();
public static KilogramPerCubicMeter AirDensity = DeclarationData.AirDensity; // 1.188.SI<KilogramPerCubicMeter>();
public const double RollResistanceExponent = 0.9;
......
......@@ -204,6 +204,7 @@ namespace TUGraz.VectoCore.Tests.Integration
},
};
return new VehicleData {
AirDensity = DeclarationData.AirDensity,
AxleConfiguration = AxleConfiguration.AxleConfig_4x2,
CurbWeight = 11500.SI<Kilogram>(),
Loading = loading,
......
......@@ -187,6 +187,7 @@ namespace TUGraz.VectoCore.Tests.Integration
}
};
return new VehicleData {
AirDensity = DeclarationData.AirDensity,
AxleConfiguration = AxleConfiguration.AxleConfig_6x2,
CurbWeight = 15700.SI<Kilogram>(),
Loading = loading,
......
......@@ -81,7 +81,8 @@ namespace TUGraz.VectoCore.Tests.Integration
};
var gearboxData = CreateGearboxData();
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(engineHighPower ? EngineFileHigh : EngineFile, gearboxData.Gears.Count);
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(engineHighPower ? EngineFileHigh : EngineFile,
gearboxData.Gears.Count);
var axleGearData = CreateAxleGearData();
if (gearBoxInertia != null) {
gearboxData.Inertia = gearBoxInertia;
......@@ -189,6 +190,7 @@ namespace TUGraz.VectoCore.Tests.Integration
}
};
return new VehicleData {
AirDensity = DeclarationData.AirDensity,
AxleConfiguration = AxleConfiguration.AxleConfig_6x2,
//AerodynamicDragAera = 3.2634.SI<SquareMeter>(),
//CrossWindCorrectionMode = CrossWindCorrectionMode.NoCorrection,
......@@ -205,7 +207,8 @@ namespace TUGraz.VectoCore.Tests.Integration
{
return new AirdragData() {
CrossWindCorrectionCurve =
new CrosswindCorrectionCdxALookup(3.2634.SI<SquareMeter>(), CrossWindCorrectionCurveReader.GetNoCorrectionCurve(3.2634.SI<SquareMeter>()),
new CrosswindCorrectionCdxALookup(3.2634.SI<SquareMeter>(),
CrossWindCorrectionCurveReader.GetNoCorrectionCurve(3.2634.SI<SquareMeter>()),
CrossWindCorrectionMode.NoCorrection),
};
}
......
......@@ -405,7 +405,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
};
return new VehicleData {
AxleConfiguration = AxleConfiguration.AxleConfig_6x2,
AirDensity = DeclarationData.AirDensity,
CurbWeight = 15700.SI<Kilogram>(),
Loading = loading,
DynamicTyreRadius = 0.52.SI<Meter>(),
......@@ -420,7 +420,8 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
CrossWindCorrectionCurve =
new CrosswindCorrectionCdxALookup(3.2634.SI<SquareMeter>(),
CrossWindCorrectionCurveReader.GetNoCorrectionCurve(3.2634.SI<SquareMeter>()),
CrossWindCorrectionMode.NoCorrection),};
CrossWindCorrectionMode.NoCorrection),
};
}
private static DriverData CreateDriverData(string accelerationFile)
......
......@@ -275,7 +275,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
};
return new VehicleData {
AxleConfiguration = AxleConfiguration.AxleConfig_6x2,
AirDensity = DeclarationData.AirDensity,
CurbWeight = 15700.SI<Kilogram>(),
Loading = loading,
DynamicTyreRadius = 0.52.SI<Meter>(),
......
......@@ -222,6 +222,7 @@ namespace TUGraz.VectoCore.Tests.Integration
}
};
return new VehicleData {
AirDensity = DeclarationData.AirDensity,
AxleConfiguration = AxleConfiguration.AxleConfig_4x2,
CurbWeight = 7100.SI<Kilogram>() + massExtra,
Loading = loading,
......
......@@ -504,31 +504,31 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
dataBus.CycleData = new CycleData() { LeftSample = cycleEntry };
var pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(509.259, pAvg, 1e-3);
pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 21.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 21.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(521.990, pAvg, 1e-3);
pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 30.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 30.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(636.574, pAvg, 1e-3);
cycleEntry.WindYawAngle = 20;
pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(829.074, pAvg, 1e-3);
pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 30.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 30.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(1036.343, pAvg, 1e-3);
cycleEntry.WindYawAngle = -120;
pAvg =
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond()).Value();
vairbeta.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 20.KMPHtoMeterPerSecond(), Physics.AirDensity).Value();
Assert.AreEqual(-1019.5370, pAvg, 1e-3);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment