From ffb105ae0d1856e4de0c110ebb305f050547dd73 Mon Sep 17 00:00:00 2001 From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at> Date: Wed, 7 Sep 2022 15:23:05 +0200 Subject: [PATCH] use component data adapter for validations in VECTO GUI --- VECTO/GUI/VehicleForm.vb | 12 + VECTO/Input Files/Engine.vb | 3 +- VECTO/Input Files/Gearbox.vb | 28 +-- VECTO/Input Files/VectoJob.vb | 141 ++++++------ VECTO/Input Files/Vehicle.vb | 47 ++-- .../AveragePneumaticLoadDemandTests.vb | 33 +-- .../UnitTests/SSMTOOLTests.vb | 9 +- .../VectoCommon/Models/VehicleCategory.cs | 8 +- .../CompletedBusRunDataFactory.cs | 217 +++++++++--------- 9 files changed, 266 insertions(+), 232 deletions(-) diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index fc51649d2a..09ff4ac3ec 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -12,9 +12,11 @@ Imports System.IO Imports System.Linq +Imports Ninject Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.Models.Declaration @@ -65,6 +67,16 @@ Public Class VehicleForm Private _reessPackDlg As REESSPackDialog Friend VehicleType As VectoSimulationJobType + + Public Sub New() + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + + End Sub + 'Close - Check for unsaved changes Private Sub VehicleFormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index a1421cc170..a467b21ed2 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -20,6 +20,7 @@ Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Impl @@ -225,7 +226,7 @@ Public Class Engine .EngineInputData = engine, .TankSystem = TankSystem.Compressed } - engineData = doa.CreateEngineData(dummyVehicle, engine.EngineModes.First(), New Mission() With {.MissionType = MissionType.LongHaul}) + engineData = New CombustionEngineComponentDataAdapter().CreateEngineData(dummyVehicle, engine.EngineModes.First(), New Mission() With {.MissionType = MissionType.LongHaul}) Else Dim doa As EngineeringDataAdapter = New EngineeringDataAdapter() Dim dummyVehicle As IVehicleEngineeringInputData = New DummyVehicle() With { diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 1f55fd5e56..551ab29df5 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -22,6 +22,7 @@ Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.InputData.Reader.ComponentData Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.Models.Simulation.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Data @@ -198,8 +199,8 @@ Public Class Gearbox VectoValidationModeServiceContainer) Dim mode As ExecutionMode = If(modeService Is Nothing, ExecutionMode.Declaration, modeService.Mode) Dim emsCycle As Boolean = (modeService IsNot Nothing) AndAlso modeService.IsEMSCycle - Dim jobType as VectoSimulationJobType = If(modeService Is Nothing, VectoSimulationJobType.ConventionalVehicle, modeService.JobType) - Dim emPos as PowertrainPosition? = If(modeService Is Nothing, PowertrainPosition.HybridPositionNotSet, modeService.EMPowertrainPosition) + Dim jobType As VectoSimulationJobType = If(modeService Is Nothing, VectoSimulationJobType.ConventionalVehicle, modeService.JobType) + Dim emPos As PowertrainPosition? = If(modeService Is Nothing, PowertrainPosition.HybridPositionNotSet, modeService.EMPowertrainPosition) Dim axlegearData As AxleGearData @@ -214,37 +215,38 @@ Public Class Gearbox 'Dim vehicle As IVehicleEngineeringInputData = inputData.VehicleInputData Dim engine As CombustionEngineData Dim vehiclecategory As VehicleCategory - Dim rdyn As Meter = 0.5.SI (Of Meter)() + Dim rdyn As Meter = 0.5.SI(Of Meter)() Try vehiclecategory = inputData.JobInputData.Vehicle.VehicleCategory Catch ex As Exception - vehiclecategory = vehiclecategory.RigidTruck + vehiclecategory = VehicleCategory.RigidTruck End Try If mode = ExecutionMode.Declaration Then Dim doa As DeclarationDataAdapterHeavyLorry = New DeclarationDataAdapterHeavyLorry() Try - engine = doa.CreateEngineData(inputData.JobInputData.Vehicle, + engine = New CombustionEngineComponentDataAdapter().CreateEngineData(inputData.JobInputData.Vehicle, inputData.JobInputData.Vehicle.Components.EngineInputData.EngineModes. First(), New Mission() With {.MissionType = MissionType.LongHaul}) Catch engine = GetDefaultEngine(gearbox.Gears) End Try - axlegearData = doa.CreateAxleGearData(gearbox) - gearboxData = doa.CreateGearboxData( - new MockVehicleInputData() _ - With { _ + axlegearData = New AxleGearDataAdapter().CreateAxleGearData(gearbox) + gearboxData = New GearboxDataAdapter(New TorqueConverterDataAdapter()).CreateGearboxData( + New MockVehicleInputData() _ + With { .Components = New MockComponents() _ - With {.GearboxInputData = gearbox, - .TorqueConverterInputData = gearbox }}, + With {.GearboxInputData = gearbox, + .TorqueConverterInputData = gearbox}}, New VectoRunData() _ With {.AxleGearData = axlegearData, .EngineData = engine, .VehicleData = New VehicleData() _ - With { .DynamicTyreRadius = rdyn, - .VehicleCategory = vehiclecategory}}, Nothing) + With {.DynamicTyreRadius = rdyn, + .VehicleCategory = vehiclecategory}}, + Nothing, DeclarationDataAdapterHeavyLorry.Conventional.SupportedGearboxTypes) Else Dim doa As EngineeringDataAdapter = New EngineeringDataAdapter() diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index 8b54f3b752..20c263049d 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -16,11 +16,14 @@ Imports System.ComponentModel.DataAnnotations Imports System.IO Imports System.Linq Imports System.Xml.Linq +Imports Ninject Imports TUGraz.VECTO.Input_Files Imports TUGraz.VectoCommon.Exceptions Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore +Imports TUGraz.VectoCore.InputData Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.InputData.Reader.Impl @@ -35,7 +38,7 @@ Public Class VectoJob IAuxiliariesDeclarationInputData, IJSONVehicleComponents, IEngineStopStartEngineeringInputData, IEcoRollEngineeringInputData, IPCCEngineeringInputData - + Private _sFilePath As String Private _myPath As String @@ -48,13 +51,13 @@ Public Class VectoJob Private ReadOnly _busAuxFile As SubPath Private ReadOnly _lacDfTargetSpeedFile As SubPath - Private ReadOnly _lacDfVelocityDropFile as SubPath - Private ReadOnly _ptoCycleWhileDriveFile as SubPath + Private ReadOnly _lacDfVelocityDropFile As SubPath + Private ReadOnly _ptoCycleWhileDriveFile As SubPath Private _startStop As Boolean Public StartStopDelay As Double - public UseBusAux as Boolean + Public UseBusAux As Boolean Private ReadOnly _driverAccelerationFile As SubPath @@ -68,18 +71,18 @@ Public Class VectoJob Public LookAheadOn As Boolean Public OverSpeedOn As Boolean Public OverSpeed As Double - + Public LookAheadMinSpeed As Double Public EngineStopStartActivationThreshold As Double - public EngineOffTimeLimit As double - public EngineStStUtilityFactor As Double - public EngineStStUtilityFactorDriving as Double + Public EngineOffTimeLimit As Double + Public EngineStStUtilityFactor As Double + Public EngineStStUtilityFactorDriving As Double - Public EcoRollMinSpeed As double + Public EcoRollMinSpeed As Double Public EcoRollUnderspeedThreshold As Double - Public EcoRollActivationDelay as double - public EcoRollMaxAcceleration as Double + Public EcoRollActivationDelay As Double + Public EcoRollMaxAcceleration As Double Public PCCEnableSpeedVal As Double Public PCCMinSpeed As Double @@ -92,7 +95,8 @@ Public Class VectoJob Public AuxPwrDrivingICEOff As Double Public AuxPwrStandstillICEOff As Double - Public AuxEntries As Dictionary(Of String, AuxEntry ) + Public AuxEntries As Dictionary(Of String, AuxEntry) + Private Shared _kernel As Lazy(Of IKernel) = New Lazy(Of IKernel)(Function() New StandardKernel(New VectoNinjectModule)) 'Private _vehicleInputData As JSONComponentInputData 'Private _engineInputData As JSONComponentInputData @@ -119,25 +123,25 @@ Public Class VectoJob _gearboxFile = New SubPath _tcuFile = New SubPath _hcuFile = New SubPath() - _busAuxFile = new SubPath() + _busAuxFile = New SubPath() _lacDfTargetSpeedFile = New SubPath() _lacDfVelocityDropFile = New SubPath() - _ptoCycleWhileDriveFile = new SubPath() + _ptoCycleWhileDriveFile = New SubPath() _driverAccelerationFile = New SubPath CycleFiles = New List(Of SubPath) - AuxEntries = new Dictionary(Of String,AuxEntry) + AuxEntries = New Dictionary(Of String, AuxEntry) End Sub Public Function SaveFile() As Boolean - dim emPos As PowertrainPosition? = Nothing - if (IEngineeringJobInputData_Vehicle?.VehicleType <> VectoSimulationJobType.ConventionalVehicle) then - if (IEngineeringJobInputData_Vehicle.VehicleType <> VectoSimulationJobType.IEPC_E) Then - emPos = IEngineeringJobInputData_Vehicle?.Components.ElectricMachines?.Entries.FirstOrDefault()?.Position + Dim emPos As PowertrainPosition? = Nothing + If (IEngineeringJobInputData_Vehicle?.VehicleType <> VectoSimulationJobType.ConventionalVehicle) Then + If (IEngineeringJobInputData_Vehicle.VehicleType <> VectoSimulationJobType.IEPC_E) Then + emPos = IEngineeringJobInputData_Vehicle?.Components.ElectricMachines?.Entries.FirstOrDefault()?.Position End If - end if + End If Dim validationResults As IList(Of ValidationResult) = Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering), JobType, emPos, Nothing, False) @@ -152,7 +156,7 @@ Public Class VectoJob Try Dim writer As JSONFileWriter = JSONFileWriter.Instance - writer.SaveJob(Me, _sFilePath, cfg.DeclMode) + writer.SaveJob(Me, _sFilePath, Cfg.DeclMode) Catch ex As Exception MsgBox("Failed to save Job file: " + ex.Message) Return False @@ -279,7 +283,7 @@ Public Class VectoJob Public ReadOnly Property OverSpeedData As IOverSpeedEngineeringInputData _ Implements IDriverEngineeringInputData.OverSpeedData Get - Return New OverSpeedInputData() With { + Return New OverSpeedInputData() With { .Enabled = OverSpeedOn, .MinSpeed = VMin.KMPHtoMeterPerSecond(), .OverSpeed = OverSpeed.KMPHtoMeterPerSecond() @@ -297,7 +301,7 @@ Public Class VectoJob RessourceHelper.ReadStream( DeclarationData.DeclarationDataResourcePrefix + ".VACC." + _driverAccelerationFile.OriginalPath + VectoCore.Configuration.Constants.FileExtensions.DriverAccelerationCurve) - Return New DriverAccelerationInputData() With{ .AccelerationCurve = + Return New DriverAccelerationInputData() With {.AccelerationCurve = VectoCSVFile.ReadStream(cycleDataRes, source:=DeclarationData.DeclarationDataResourcePrefix + ".VACC." + _driverAccelerationFile.OriginalPath + VectoCore.Configuration.Constants.FileExtensions.DriverAccelerationCurve) @@ -306,7 +310,7 @@ Public Class VectoJob Return Nothing End Try End If - Return New DriverAccelerationInputData() With{ .AccelerationCurve = VectoCSVFile.Read(_driverAccelerationFile.FullPath) } + Return New DriverAccelerationInputData() With {.AccelerationCurve = VectoCSVFile.Read(_driverAccelerationFile.FullPath)} End Get End Property @@ -330,87 +334,87 @@ Public Class VectoJob Public ReadOnly Property IDriverEngineeringInputData_GearshiftInputData As IGearshiftEngineeringInputData Implements IDriverEngineeringInputData.GearshiftInputData Get - return new JSONComponentInputData(_tcuFile.FullPath, Me).DriverInputData.GearshiftInputData + Return New JSONComponentInputData(_tcuFile.FullPath, Me).DriverInputData.GearshiftInputData End Get End Property Public ReadOnly Property EngineStopStartData As IEngineStopStartEngineeringInputData Implements IDriverEngineeringInputData.EngineStopStartData Get - Return me + Return Me End Get End Property Public ReadOnly Property EcoRollData As IEcoRollEngineeringInputData Implements IDriverEngineeringInputData.EcoRollData - Get - Return me - End Get + Get + Return Me + End Get End Property Public ReadOnly Property PCCData As IPCCEngineeringInputData Implements IDriverEngineeringInputData.PCCData - get - return me - End Get + Get + Return Me + End Get End Property Public ReadOnly Property PCCEnabledSpeed As MeterPerSecond Implements IPCCEngineeringInputData.PCCEnabledSpeed - get - return PCCEnableSpeedVal.KMPHtoMeterPerSecond() - End Get + Get + Return PCCEnableSpeedVal.KMPHtoMeterPerSecond() + End Get End Property Public ReadOnly Property IPCCEngineeringInputData_MinSpeed As MeterPerSecond Implements IPCCEngineeringInputData.MinSpeed - get - return PCCMinSpeed.KMPHtoMeterPerSecond() - End Get + Get + Return PCCMinSpeed.KMPHtoMeterPerSecond() + End Get End Property Public ReadOnly Property MinSpeed As MeterPerSecond Implements IEcoRollEngineeringInputData.MinSpeed - get + Get Return EcoRollMinSpeed.KMPHtoMeterPerSecond() - End Get + End Get End Property Public ReadOnly Property PreviewDistanceUseCase1 As Meter Implements IPCCEngineeringInputData.PreviewDistanceUseCase1 - get - return PCCPrevewiDistance1.SI(of Meter) - End Get + Get + Return PCCPrevewiDistance1.SI(Of Meter) + End Get End Property Public ReadOnly Property PreviewDistanceUseCase2 As Meter Implements IPCCEngineeringInputData.PreviewDistanceUseCase2 - get - return PCCPreviewDistance2.SI(of Meter) - End Get + Get + Return PCCPreviewDistance2.SI(Of Meter) + End Get End Property Public ReadOnly Property Underspeed As MeterPerSecond Implements IPCCEngineeringInputData.Underspeed - get - return PCCUnderspeed.KMPHtoMeterPerSecond() - End Get + Get + Return PCCUnderspeed.KMPHtoMeterPerSecond() + End Get End Property Public ReadOnly Property OverspeedUseCase3 As MeterPerSecond Implements IPCCEngineeringInputData.OverspeedUseCase3 - get + Get Return PCCOverspeedUseCase3.KMPHtoMeterPerSecond() - End Get + End Get End Property Public ReadOnly Property IEcoRollEngineeringInputData_ActivationDelay As Second Implements IEcoRollEngineeringInputData.ActivationDelay - get + Get Return EcoRollActivationDelay.SI(Of Second)() - End Get + End Get End Property Public ReadOnly Property ActivationDelay As Second Implements IEngineStopStartEngineeringInputData.ActivationDelay Get - return EngineStopStartActivationThreshold.SI(Of Second)() + Return EngineStopStartActivationThreshold.SI(Of Second)() End Get End Property Public ReadOnly Property UnderspeedThreshold As MeterPerSecond Implements IEcoRollEngineeringInputData.UnderspeedThreshold - get + Get Return EcoRollUnderspeedThreshold.KMPHtoMeterPerSecond() - End Get + End Get End Property Public ReadOnly Property AccelerationUpperLimit As MeterPerSquareSecond Implements IEcoRollEngineeringInputData.AccelerationUpperLimit Get - Return EcoRollMaxAcceleration.SI(of MeterPerSquareSecond) + Return EcoRollMaxAcceleration.SI(Of MeterPerSquareSecond) End Get End Property @@ -427,9 +431,9 @@ Public Class VectoJob End Property Public ReadOnly Property UtilityFactorDriving As Double Implements IEngineStopStartEngineeringInputData.UtilityFactorDriving - get - Return EngineStStUtilityFactorDriving - End Get + Get + Return EngineStStUtilityFactorDriving + End Get End Property Public Property DesMaxFile(Optional ByVal original As Boolean = False) As String @@ -448,24 +452,24 @@ Public Class VectoJob Public Property LacPreviewFactor As Double Public Property LacDfOffset As Double Public Property LacDfScale As Double - Public Property LacDfTargetSpeedFile(Optional ByVal original As Boolean = false) As String + Public Property LacDfTargetSpeedFile(Optional ByVal original As Boolean = False) As String Get If original Then Return _lacDfTargetSpeedFile.OriginalPath - Else - return _lacDfTargetSpeedFile.FullPath + Else + Return _lacDfTargetSpeedFile.FullPath End If End Get Set(value As String) _lacDfTargetSpeedFile.Init(_myPath, value) End Set End Property - Public Property LacDfVelocityDropFile(optional ByVal original As Boolean = false) As String + Public Property LacDfVelocityDropFile(Optional ByVal original As Boolean = False) As String Get If original Then Return _lacDfVelocityDropFile.OriginalPath - Else - return _lacDfVelocityDropFile.FullPath + Else + Return _lacDfVelocityDropFile.FullPath End If End Get Set(value As String) @@ -533,7 +537,7 @@ Public Class VectoJob If (vectoJob.JobType = VectoSimulationJobType.ConventionalVehicle OrElse vectoJob.JobType = VectoSimulationJobType.ParallelHybridVehicle) _ AndAlso gearboxInputData Is Nothing Then _ result.Add(New ValidationResult("Gearbox File is missing or invalid")) - If (mode = ExecutionMode.Engineering andalso vectoJob.JobType = VectoSimulationJobType.ConventionalVehicle OrElse vectoJob.JobType = VectoSimulationJobType.ParallelHybridVehicle) _ + If (mode = ExecutionMode.Engineering AndAlso vectoJob.JobType = VectoSimulationJobType.ConventionalVehicle OrElse vectoJob.JobType = VectoSimulationJobType.ParallelHybridVehicle) _ AndAlso gearshiftInputData Is Nothing Then _ result.Add(New ValidationResult("Gearshift File is missing or invalid")) @@ -557,8 +561,9 @@ Public Class VectoJob New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList()) End If - Dim dataFactory As DeclarationModeTruckVectoRunDataFactory = New DeclarationModeTruckVectoRunDataFactory(vectoJob, Nothing) + 'Dim dataFactory As DeclarationModeTruckVectoRunDataFactory = New DeclarationModeTruckVectoRunDataFactory(vectoJob, Nothing) + Dim dataFactory = _kernel.Value.Get(Of IVectoRunDataFactoryFactory).CreateDeclarationRunDataFactory(vectoJob, Nothing, Nothing) jobData = dataFactory.NextRun().First() Else If vehicleInputData.SavedInDeclarationMode Then diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 3b892b018d..138a6db74d 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -15,22 +15,26 @@ Imports System.ComponentModel.DataAnnotations Imports System.IO Imports System.Linq Imports System.Xml +Imports Ninject Imports TUGraz.VECTO.Input_Files Imports TUGraz.VectoCommon.BusAuxiliaries Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Impl Imports TUGraz.VectoCore.Utils +Imports TUGraz.VectoCore.Utils.Ninject Imports DeclarationDataAdapterHeavyLorry = TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.HeavyLorry.DeclarationDataAdapterHeavyLorry <CustomValidation(GetType(Vehicle), "ValidateVehicle")> Public Class Vehicle - Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData, + Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData, IAngledriveInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData, IAdvancedDriverAssistantSystemsEngineering, IVehicleComponentsEngineering, IVehicleComponentsDeclaration, IAxlesEngineeringInputData, IAxlesDeclarationInputData @@ -49,7 +53,7 @@ Public Class Vehicle Public RetarderRatio As Double = 0 Public ReadOnly RetarderLossMapFile As SubPath Public ReadOnly EmTorqueLimitsFile As SubPath - public ReadOnly PropulsionTorqueFile as SubPath + Public ReadOnly PropulsionTorqueFile As SubPath Public DynamicTyreRadius As Double Public ReadOnly Axles As List(Of AxleInputData) @@ -74,16 +78,16 @@ Public Class Vehicle Public legClass As LegislativeClass Public VehicleHeight As Double - public EcoRolltype as EcoRollType - public PCC as PredictiveCruiseControlType - public EngineStop as Boolean + Public EcoRolltype As EcoRollType + Public PCC As PredictiveCruiseControlType + Public EngineStop As Boolean Public VehicleTankSystem As TankSystem? Public ReadOnly ElectricMotorFile As SubPath Public ReadOnly GenSetEMFile As SubPath - public ReadOnly ReessPacks As List(Of Tuple(Of String, Integer, Integer)) + Public ReadOnly ReessPacks As List(Of Tuple(Of String, Integer, Integer)) Public ElectricMotorPosition As PowertrainPosition Public ElectricMotorCount As Integer @@ -98,7 +102,7 @@ Public Class Vehicle 'Public ElectricMotorMechEff As Double Public GenSetLossMap As SubPath - public GearDuringPTODrive As UInteger? + Public GearDuringPTODrive As UInteger? Public EngineSpeedDuringPTODrive As PerSecond Public ElectricMotorPerGearRatios As Double() Public IEPCFile As SubPath @@ -110,20 +114,20 @@ Public Class Vehicle RetarderLossMapFile = New SubPath AngledriveLossMapFile = New SubPath() - EmTorqueLimitsFile = new SubPath() + EmTorqueLimitsFile = New SubPath() PropulsionTorqueFile = New SubPath() - IEPCFile = new SubPath() + IEPCFile = New SubPath() Axles = New List(Of AxleInputData) torqueLimitsList = New List(Of ITorqueLimitInputData) - ReessPacks = new List(Of Tuple(Of String,Integer,Integer)) + ReessPacks = New List(Of Tuple(Of String, Integer, Integer)) PtoLossMap = New SubPath() PtoCycleStandstill = New SubPath() - PtoCycleDriving = new SubPath() + PtoCycleDriving = New SubPath() ElectricMotorFile = New SubPath() - ElectricMotorMechLossMap = new SubPath() - GenSetEMFile = new SubPath() - GenSetMechLossMap = new SubPath() + ElectricMotorMechLossMap = New SubPath() + GenSetEMFile = New SubPath() + GenSetMechLossMap = New SubPath() SetDefault() End Sub @@ -149,15 +153,16 @@ Public Class Vehicle Try If mode = ExecutionMode.Declaration Then - Dim doa As DeclarationDataAdapterHeavyLorry = New DeclarationDataAdapterHeavyLorry() + + 'Dim doa As ILorryDeclarationDataAdapter = CType(_kernel.Value.Get(Of IDeclarationDataAdapterFactory).CreateDataAdapter(New VehicleTypeAndArchitectureStringHelperRundata.VehicleClassification(vehicle)), ILorryDeclarationDataAdapter) Dim segment As Segment = DeclarationData.TruckSegments.Lookup(vehicle.VehicleCategory, vehicle.AxleConfiguration, vehicle.GrossVehicleMassRating, vehicle.CurbMassChassis, False) - vehicleData = doa.CreateVehicleData(vehicle, segment, segment.Missions.First(), - segment.Missions.First().Loadings.First(), true) - airdragData = doa.CreateAirdragData(vehicle, segment.Missions.First(), segment) - retarderData = doa.CreateRetarderData(vehicle) - angledriveData = doa.CreateAngledriveData(vehicle) - ptoData = doa.CreatePTOTransmissionData(vehicle) + vehicleData = New LorryVehicleDataAdapter().CreateVehicleData(vehicle, segment, segment.Missions.First(), + segment.Missions.First().Loadings.First(), True) + airdragData = New AirdragDataAdapter().CreateAirdragData(vehicle, segment.Missions.First(), segment) + retarderData = New RetarderDataAdapter().CreateRetarderData(vehicle) + angledriveData = New AngledriveDataAdapter().CreateAngledriveData(vehicle) + ptoData = New PTODataAdapterLorry().CreatePTOTransmissionData(vehicle) Else Dim doa As EngineeringDataAdapter = New EngineeringDataAdapter() vehicleData = doa.CreateVehicleData(vehicle) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index a997f9f13f..56416cdd5f 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -6,6 +6,8 @@ Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.Reader.ComponentData Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.CompletedBus.Generic +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents Imports TUGraz.VectoCore.Models.BusAuxiliaries Imports TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics Imports TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces @@ -29,6 +31,8 @@ Namespace UnitTests Private _defaultInputConfig As PneumaticUserInputsConfig Private _Signals As ISignals = New Signals + + <OneTimeSetUp> Public Sub RunBeforeAnyTests() Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory) @@ -48,7 +52,7 @@ Namespace UnitTests _defaultInputConfig.CompressorGearEfficiency = 0.8 _defaultInputConfig.SmartRegeneration = True '_defaultInputConfig.RetarderBrake = True - _defaultInputConfig.KneelingHeight = 80.SI(Unit.SI.Milli.Meter).Cast (of Meter) + _defaultInputConfig.KneelingHeight = 80.SI(Unit.SI.Milli.Meter).Cast(Of Meter) _defaultInputConfig.AirSuspensionControl = ConsumerTechnology.Electrically ' "Electrically" _defaultInputConfig.AdBlueDosing = ConsumerTechnology.Pneumatically ' "Pneumatic" _defaultInputConfig.Doors = ConsumerTechnology.Pneumatically ' "Pneumatic" @@ -68,8 +72,9 @@ Namespace UnitTests psUserInputsConfig.Doors = ConsumerTechnology.Pneumatically '"Pneumatic" psUserInputsConfig.AdBlueDosing = ConsumerTechnology.Pneumatically ' "Pneumatic" - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) - + + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -89,7 +94,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -113,7 +118,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap =CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -140,7 +145,7 @@ Namespace UnitTests _defaultInputConfig.CompressorGearEfficiency = 0.8 - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -162,7 +167,7 @@ Namespace UnitTests initialise() - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -191,7 +196,7 @@ Namespace UnitTests _defaultInputConfig.SmartRegeneration = False - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -217,8 +222,8 @@ Namespace UnitTests initialise() '_defaultInputConfig.RetarderBrake = False - - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.None) + + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.None) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -246,7 +251,7 @@ Namespace UnitTests _defaultInputConfig.KneelingHeight = 100.SI(Unit.si.Milli.Meter).Cast (Of Meter) - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -271,7 +276,7 @@ Namespace UnitTests _defaultInputConfig.AirSuspensionControl = ConsumerTechnology.Mechanically - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -298,7 +303,7 @@ Namespace UnitTests _defaultInputConfig.AdBlueDosing = ConsumerTechnology.Pneumatically - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") @@ -325,7 +330,7 @@ Namespace UnitTests _defaultInputConfig.Doors = ConsumerTechnology.Electrically - Dim psAuxConfig = New DeclarationDataAdapterCompletedBusGeneric().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) + Dim psAuxConfig = New GenericCompletedBusAuxiliaryDataAdapter().CreatePneumaticAuxConfig(RetarderType.LossesIncludedInTransmission) Dim psCompressorMap = CompressorMapReader.ReadFile(_compressorMapPath, 1.0, "") Dim auxConfig As IAuxiliaryConfig = GetAuxConfig(psAuxConfig) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb index 6246be2f4e..d870204272 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/SSMTOOLTests.vb @@ -6,6 +6,7 @@ Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter +Imports TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents Imports TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC Imports TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.HVAC Imports TUGraz.VectoCore.Models.Declaration @@ -88,9 +89,9 @@ Namespace UnitTests .MissionType = MissionType.Urban } - Dim auxInput as IBusAuxiliariesDeclarationData = nothing + Dim auxInput as IBusAuxiliariesDeclarationData = Nothing - Dim dao = New DeclarationDataAdapterCompletedBusGeneric() + Dim dao = New GenericCompletedBusAuxiliaryDataAdapter() Dim target As ISSMDeclarationInputs = dao.CreateSSMModelParameters(auxInput, mission, FuelData.Diesel, LoadingType.ReferenceLoad) If section = "BusParameterisation" Then @@ -595,9 +596,9 @@ Namespace UnitTests } } - Dim auxInput as IBusAuxiliariesDeclarationData = nothing + Dim auxInput as IBusAuxiliariesDeclarationData = Nothing - Dim dao = New DeclarationDataAdapterCompletedBusGeneric() + Dim dao = New GenericCompletedBusAuxiliaryDataAdapter() Dim target As SSMTOOL = New SSMTOOL(dao.CreateSSMModelParameters(auxInput, mission, FuelData.Diesel, LoadingType.ReferenceLoad)) diff --git a/VectoCommon/VectoCommon/Models/VehicleCategory.cs b/VectoCommon/VectoCommon/Models/VehicleCategory.cs index db929cf9f5..7ebef4a669 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCategory.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCategory.cs @@ -53,10 +53,10 @@ namespace TUGraz.VectoCommon.Models { - public static string PrimaryBus = "PrimaryBus"; - public static string Lorry = "Lorry"; - public static string CompletedBus = "CompletedBus"; - public static string Van = "Van"; + public const string PrimaryBus = "PrimaryBus"; + public const string Lorry = "Lorry"; + public const string CompletedBus = "CompletedBus"; + public const string Van = "Van"; public static HashSet<string> SuperCategories { get; } = new HashSet<string>() { PrimaryBus, Lorry, diff --git a/VectoMockup/VectoMockup/Simulation/RundataFactories/CompletedBusRunDataFactory.cs b/VectoMockup/VectoMockup/Simulation/RundataFactories/CompletedBusRunDataFactory.cs index 3fd4107e1a..546c647b59 100644 --- a/VectoMockup/VectoMockup/Simulation/RundataFactories/CompletedBusRunDataFactory.cs +++ b/VectoMockup/VectoMockup/Simulation/RundataFactories/CompletedBusRunDataFactory.cs @@ -17,111 +17,114 @@ namespace TUGraz.VectoMockup.Simulation.RundataFactories { internal class MockupMultistageCompletedBusRunDataFactory { - // DeclarationModeCompletedMultistageBusVectoRunDataFactory - // { - //public MockupMultistageCompletedBusRunDataFactory(IMultistepBusInputDataProvider dataProvider, - // IDeclarationReport report) : base(dataProvider, report) - //{ - - //} - - - //#region Overrides of DeclarationModeCompletedMultistageBusVectoRunDataFactory - - //protected override void Initialize() - //{ - - // _segmentCompletedBus = GetCompletedSegment(CompletedVehicle, PrimaryVehicle.AxleConfiguration); - - // //base.Initialize(); - //} - - //protected override IEnumerable<VectoRunData> VectoRunDataHeavyBusCompleted() - //{ - - // return base.VectoRunDataHeavyBusCompleted(); - //} - - //protected override VectoRunData CreateVectoRunDataSpecific(Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, int modeIdx) - //{ - // var cycle = DeclarationData.CyclesCache.GetOrAdd(mission.MissionType, _ => DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false)); - - // var simulationRunData = new VectoRunData - // { - // Loading = loading.Key, - // VehicleData = DataAdapterSpecific.CreateVehicleData(PrimaryVehicle, CompletedVehicle, _segmentCompletedBus, - // mission, loading), - // Retarder = PrimaryBusMockupRunDataFactory.CreateMockupRetarder(PrimaryVehicle), - // AirdragData = PrimaryBusMockupRunDataFactory.CreateMockupAirdragData(CompletedVehicle), - // EngineData = PrimaryBusMockupRunDataFactory.CreateMockupEngineData(PrimaryVehicle, modeIdx, CompletedVehicle.TankSystem), - // //ElectricMachinesData = PrimaryBusMockupRunDataFactory.CreateMockupElectricMachineData() - // AngledriveData = PrimaryBusMockupRunDataFactory.CreateMockupAngleDriveData(PrimaryVehicle), - // AxleGearData = PrimaryBusMockupRunDataFactory.CreateMockupAxleGearData(PrimaryVehicle), - // Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), - // Mission = mission, - // GearboxData = PrimaryBusMockupRunDataFactory.CreateMockupGearboxData(PrimaryVehicle), - // InputData = InputDataProvider, - // SimulationType = SimulationType.DistanceCycle, - // ExecutionMode = ExecutionMode.Declaration, - // JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier, - // Report = Report, - // //Aux = PrimaryBusMockupRunDataFactory.CreateMockupBusAux(CompletedVehicle), - - // // //AirdragData = DataAdapterSpecific.CreateAirdragData(CompletedVehicle, mission), - // // //EngineData = DataAdapterSpecific.CreateEngineData(PrimaryVehicle, modeIdx, mission), - // // //ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(), - // // //GearboxData = _gearboxData, - // // //AxleGearData = _axlegearData, - // // //AngledriveData = _angledriveData, - // // Aux = DataAdapterSpecific.CreateAuxiliaryData(PrimaryVehicle.Components.AuxiliaryInputData, - // // PrimaryVehicle.Components.BusAuxiliaries, mission.MissionType, _segmentCompletedBus.VehicleClass, CompletedVehicle.Length, - // // PrimaryVehicle.Components.AxleWheels.NumSteeredAxles), - // //Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), - // //Retarder = _retarderData, - // ////DriverData = _driverData, - // //ExecutionMode = ExecutionMode.Declaration, - // //JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier,//?!? Jobname - // ModFileSuffix = $"_{_segmentCompletedBus.VehicleClass.GetClassNumber()}-Specific_{loading.Key}", - // //Report = Report, - // //Mission = mission, - // //InputDataHash = InputDataProvider.XMLHash,// right hash?!? - // //SimulationType = SimulationType.DistanceCycle, - // //VehicleDesignSpeed = _segmentCompletedBus.DesignSpeed, - // //GearshiftParameters = _gearshiftData, - // }; - // if (simulationRunData.EngineData != null) { - // simulationRunData.EngineData.FuelMode = 0; - // } - // simulationRunData.VehicleData.VehicleClass = _segmentCompletedBus.VehicleClass; - // simulationRunData.BusAuxiliaries = DataAdapterSpecific.CreateBusAuxiliariesData(mission, PrimaryVehicle, CompletedVehicle, simulationRunData); - - // return simulationRunData; - - // //return base.CreateVectoRunDataSpecific(mission, loading, modeIdx); - //} - - //protected override VectoRunData CreateVectoRunDataGeneric(Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, Segment primarySegment, int modeIdx) - //{ - // var cycle = DeclarationData.CyclesCache.GetOrAdd(mission.MissionType, _ => DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false)); - // return new VectoRunData() { - // Mission = mission, - // Loading = loading.Key, - // VehicleData = new VehicleData() { - // Loading = loading.Value.Item1, - - // }, - // EngineData = PrimaryBusMockupRunDataFactory.CreateMockupEngineData(PrimaryVehicle, modeIdx, CompletedVehicle.TankSystem), - // JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier, - // ExecutionMode = ExecutionMode.Declaration, - // SimulationType = SimulationType.DistanceCycle, - // Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), - // Report = Report, - // ModFileSuffix = $"_{_segmentCompletedBus.VehicleClass.GetClassNumber()}-Generic_{loading.Key}", - // }; - // return base.CreateVectoRunDataGeneric(mission, loading, primarySegment, modeIdx); - //} - - // //#endregion - //} - } + DeclarationModeCompletedMultistageBusVectoRunDataFactory + { + public MockupMultistageCompletedBusRunDataFactory(IMultistepBusInputDataProvider dataProvider, + IDeclarationReport report) : base(dataProvider, report) + { + + } + + + #region Overrides of DeclarationModeCompletedMultistageBusVectoRunDataFactory + + protected override void Initialize() + { + + _segmentCompletedBus = GetCompletedSegment(CompletedVehicle, PrimaryVehicle.AxleConfiguration); + + //base.Initialize(); + } + + protected override IEnumerable<VectoRunData> VectoRunDataHeavyBusCompleted() + { + + return base.VectoRunDataHeavyBusCompleted(); + } + + protected override VectoRunData CreateVectoRunDataSpecific(Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, int modeIdx) + { + var cycle = DeclarationData.CyclesCache.GetOrAdd(mission.MissionType, _ => DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false)); + + var simulationRunData = new VectoRunData + { + Loading = loading.Key, + VehicleData = DataAdapterSpecific.CreateVehicleData(PrimaryVehicle, CompletedVehicle, _segmentCompletedBus, + mission, loading), + Retarder = PrimaryBusMockupRunDataFactory.CreateMockupRetarder(PrimaryVehicle), + AirdragData = PrimaryBusMockupRunDataFactory.CreateMockupAirdragData(CompletedVehicle), + EngineData = PrimaryBusMockupRunDataFactory.CreateMockupEngineData(PrimaryVehicle, modeIdx, CompletedVehicle.TankSystem), + //ElectricMachinesData = PrimaryBusMockupRunDataFactory.CreateMockupElectricMachineData() + AngledriveData = PrimaryBusMockupRunDataFactory.CreateMockupAngleDriveData(PrimaryVehicle), + AxleGearData = PrimaryBusMockupRunDataFactory.CreateMockupAxleGearData(PrimaryVehicle), + Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + Mission = mission, + GearboxData = PrimaryBusMockupRunDataFactory.CreateMockupGearboxData(PrimaryVehicle), + InputData = InputDataProvider, + SimulationType = SimulationType.DistanceCycle, + ExecutionMode = ExecutionMode.Declaration, + JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier, + Report = Report, + //Aux = PrimaryBusMockupRunDataFactory.CreateMockupBusAux(CompletedVehicle), + + // //AirdragData = DataAdapterSpecific.CreateAirdragData(CompletedVehicle, mission), + // //EngineData = DataAdapterSpecific.CreateEngineData(PrimaryVehicle, modeIdx, mission), + // //ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(), + // //GearboxData = _gearboxData, + // //AxleGearData = _axlegearData, + // //AngledriveData = _angledriveData, + // Aux = DataAdapterSpecific.CreateAuxiliaryData(PrimaryVehicle.Components.AuxiliaryInputData, + // PrimaryVehicle.Components.BusAuxiliaries, mission.MissionType, _segmentCompletedBus.VehicleClass, CompletedVehicle.Length, + // PrimaryVehicle.Components.AxleWheels.NumSteeredAxles), + //Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + //Retarder = _retarderData, + ////DriverData = _driverData, + //ExecutionMode = ExecutionMode.Declaration, + //JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier,//?!? Jobname + ModFileSuffix = $"_{_segmentCompletedBus.VehicleClass.GetClassNumber()}-Specific_{loading.Key}", + //Report = Report, + //Mission = mission, + //InputDataHash = InputDataProvider.XMLHash,// right hash?!? + //SimulationType = SimulationType.DistanceCycle, + //VehicleDesignSpeed = _segmentCompletedBus.DesignSpeed, + //GearshiftParameters = _gearshiftData, + }; + if (simulationRunData.EngineData != null) + { + simulationRunData.EngineData.FuelMode = 0; + } + simulationRunData.VehicleData.VehicleClass = _segmentCompletedBus.VehicleClass; + simulationRunData.BusAuxiliaries = DataAdapterSpecific.CreateBusAuxiliariesData(mission, PrimaryVehicle, CompletedVehicle, simulationRunData); + + return simulationRunData; + + //return base.CreateVectoRunDataSpecific(mission, loading, modeIdx); + } + + protected override VectoRunData CreateVectoRunDataGeneric(Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, Segment primarySegment, int modeIdx) + { + var cycle = DeclarationData.CyclesCache.GetOrAdd(mission.MissionType, _ => DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false)); + return new VectoRunData() + { + Mission = mission, + Loading = loading.Key, + VehicleData = new VehicleData() + { + Loading = loading.Value.Item1, + + }, + EngineData = PrimaryBusMockupRunDataFactory.CreateMockupEngineData(PrimaryVehicle, modeIdx, CompletedVehicle.TankSystem), + JobName = InputDataProvider.JobInputData.ManufacturingStages.Last().Vehicle.Identifier, + ExecutionMode = ExecutionMode.Declaration, + SimulationType = SimulationType.DistanceCycle, + Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + Report = Report, + ModFileSuffix = $"_{_segmentCompletedBus.VehicleClass.GetClassNumber()}-Generic_{loading.Key}", + }; + return base.CreateVectoRunDataGeneric(mission, loading, primarySegment, modeIdx); + } + + //#endregion + } +} } -- GitLab