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

Skip to content
Snippets Groups Projects
Commit 7987f2e0 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Merge branch 'pto'

parents 0255e46f 294a9480
No related branches found
No related tags found
No related merge requests found
......@@ -190,3 +190,6 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
*.orig
Generic Vehicles/**/*.vmod
Generic Vehicles/**/*.vsum
Generic Vehicles/**/*.pdf
\ No newline at end of file
File added
File added
......@@ -27,7 +27,7 @@ Imports TUGraz.VectoCore.Utils
<CustomValidation(GetType(Vehicle), "ValidateVehicle")>
Public Class Vehicle
Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData,
Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData,
IAngledriveInputData
'V2 MassMax is now saved in [t] instead of [kg]
......@@ -97,7 +97,7 @@ Public Class Vehicle
Dim ptoData As PTOData = Nothing
Dim angledriveData As AngledriveData
Dim modeService As ExecutionModeServiceContainer = TryCast(validationContext.GetService(GetType(ExecutionMode)),
Dim modeService As ExecutionModeServiceContainer = TryCast(validationContext.GetService(GetType(ExecutionMode)),
ExecutionModeServiceContainer)
Dim mode As ExecutionMode = If(modeService Is Nothing, ExecutionMode.Declaration, modeService.Mode)
......@@ -310,34 +310,34 @@ Public Class Vehicle
Public ReadOnly Property CurbWeightChassis As Kilogram Implements IVehicleDeclarationInputData.CurbWeightChassis
Get
Return Mass.SI(Of Kilogram)()
Return Mass.SI (Of Kilogram)()
End Get
End Property
Public ReadOnly Property GrossVehicleMassRating As Kilogram _
Implements IVehicleDeclarationInputData.GrossVehicleMassRating
Get
Return MassMax.SI().Ton.Cast(Of Kilogram)()
Return MassMax.SI().Ton.Cast (Of Kilogram)()
End Get
End Property
Public ReadOnly Property AirDragArea As SquareMeter Implements IVehicleDeclarationInputData.AirDragArea
Get
Return CdA0.SI(Of SquareMeter)()
Return CdA0.SI (Of SquareMeter)()
End Get
End Property
Public ReadOnly Property IVehicleEngineeringInputData_Axles As IList(Of IAxleEngineeringInputData) _
Implements IVehicleEngineeringInputData.Axles
Get
Return AxleWheels().Cast(Of IAxleEngineeringInputData)().ToList()
Return AxleWheels().Cast (Of IAxleEngineeringInputData)().ToList()
End Get
End Property
Public ReadOnly Property IVehicleDeclarationInputData_Axles As IList(Of IAxleDeclarationInputData) _
Implements IVehicleDeclarationInputData.Axles
Get
Return AxleWheels().Cast(Of IAxleDeclarationInputData)().ToList()
Return AxleWheels().Cast (Of IAxleDeclarationInputData)().ToList()
End Get
End Property
......@@ -345,18 +345,18 @@ Public Class Vehicle
Return Axles.Select(Function(axle) New AxleInputData With {
.SourceType = DataSourceType.JSONFile,
.Source = FilePath,
.Inertia = axle.Inertia.SI(Of KilogramSquareMeter)(),
.Inertia = axle.Inertia.SI (Of KilogramSquareMeter)(),
.Wheels = axle.Wheels,
.AxleWeightShare = axle.Share,
.TwinTyres = axle.TwinTire,
.RollResistanceCoefficient = axle.RRC,
.TyreTestLoad = axle.FzISO.SI(Of Newton)()
.TyreTestLoad = axle.FzISO.SI (Of Newton)()
})
End Function
Public ReadOnly Property CurbWeightExtra As Kilogram Implements IVehicleEngineeringInputData.CurbWeightExtra
Get
Return MassExtra.SI(Of Kilogram)()
Return MassExtra.SI (Of Kilogram)()
End Get
End Property
......@@ -377,14 +377,14 @@ Public Class Vehicle
Public ReadOnly Property IVehicleEngineeringInputData_DynamicTyreRadius As Meter _
Implements IVehicleEngineeringInputData.DynamicTyreRadius
Get
Return DynamicTyreRadius.SI().Milli.Meter.Cast(Of Meter)()
Return DynamicTyreRadius.SI().Milli.Meter.Cast (Of Meter)()
End Get
End Property
Public ReadOnly Property IVehicleEngineeringInputData_Loading As Kilogram _
Implements IVehicleEngineeringInputData.Loading
Get
Return Loading.SI(Of Kilogram)()
Return Loading.SI (Of Kilogram)()
End Get
End Property
......@@ -431,7 +431,7 @@ Public Class Vehicle
Public ReadOnly Property Efficiency As Double Implements IAngledriveInputData.Efficiency
Get
Return If(IsNumeric(AngledriveLossMapFile.OriginalPath), AngledriveLossMapFile.OriginalPath.ToDouble(), -1.0)
Return If(IsNumeric(AngledriveLossMapFile.OriginalPath), AngledriveLossMapFile.OriginalPath.ToDouble(), - 1.0)
End Get
End Property
......@@ -445,6 +445,9 @@ Public Class Vehicle
Public ReadOnly Property IPTOTransmissionInputData_PTOCycle As TableData Implements IPTOTransmissionInputData.PTOCycle
Get
If String.IsNullOrWhiteSpace(PtoCycle.FullPath) Then
Return Nothing
End If
Return VectoCSVFile.Read(PtoCycle.FullPath)
End Get
End Property
......
......@@ -318,11 +318,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
public PTOData CreatePTOTransmissionData(IPTOTransmissionInputData pto)
{
if (pto.PTOTransmissionType != "None") {
return new PTOData {
var ptoData = new PTOData {
TransmissionType = pto.PTOTransmissionType,
LossMap = PTOIdleLossMapReader.Create(pto.PTOLossMap),
PTOCycle = DrivingCycleDataReader.ReadFromDataTable(pto.PTOCycle, CycleType.PTO, "PTO", false)
};
if (pto.PTOCycle != null)
ptoData.PTOCycle = DrivingCycleDataReader.ReadFromDataTable(pto.PTOCycle, CycleType.PTO, "PTO", false);
return ptoData;
}
return null;
......
......@@ -31,6 +31,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
......@@ -182,8 +183,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
return
new ValidationResult(
string.Format(
"Interpolation of AxleGear-LossMap failed with torque={0} and angularSpeed={1} (gear={2}, velocity={3})",
axlegearTorque, axleAngularVelocity.ConvertTo().Rounds.Per.Minute, gear.Key, velocity));
"Interpolation of AxleGear-LossMap failed with torque={0} and angularSpeed={1} (gear={2}, velocity={3})",
axlegearTorque, axleAngularVelocity.ConvertTo().Rounds.Per.Minute, gear.Key, velocity));
}
}
}
......@@ -191,6 +192,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
}
}
if (runData.Cycle.Entries.Any(e => e.PTOActive)) {
if (runData.PTO == null || runData.PTO.PTOCycle == null)
return new ValidationResult("PTOCycle is used in DrivingCycle, but is not defined in Vehicle-Data.");
}
return ValidationResult.Success;
}
}
......
......@@ -478,8 +478,14 @@ namespace TUGraz.VectoCore.OutputData
public static WattSecond AuxiliaryWork(this IModalDataContainer data, DataColumn auxCol)
{
var simulationIntervals = data.GetValues<Second>(ModalResultField.simulationInterval);
return data.GetValues<Watt>(auxCol).Zip(simulationIntervals, (value, dt) => value * dt).Sum().Cast<WattSecond>();
var simulationIntervals = data.GetValues<Second>(ModalResultField.simulationInterval).ToArray();
var auxValues = data.GetValues<Watt>(auxCol).ToArray();
var sum = 0.SI<WattSecond>();
for (var i = 0; i < simulationIntervals.Length; i++) {
if (auxValues[i] != null && simulationIntervals[i] != null)
sum += auxValues[i] * simulationIntervals[i];
}
return sum;
}
public static MeterPerSquareSecond[] AccelerationPer3Seconds(this IModalDataContainer data)
......
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