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

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

VectoJob.vb: Added Validation that Vehicle File has to be in same JobType than...

VectoJob.vb: Added Validation that Vehicle File has to be in same JobType than jobFile, that cycles must be defined in engineering mode, and that ElectricMachines must be defined for HEVs and BEVs.
parent a2c0258f
No related branches found
Tags Release/v3.1.2.796
No related merge requests found
......@@ -506,12 +506,21 @@ Public Class VectoJob
Dim result As IList(Of ValidationResult) = New List(Of ValidationResult)
Dim vehicleInputData As IVehicleEngineeringInputData = vectoJob.JobInputData.Vehicle
If vehicleInputData Is Nothing Then
result.Add(New ValidationResult("Vehicle File is missing or invalid"))
Return New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList())
End If
Dim engineInputData As IEngineDeclarationInputData = vectoJob.JobInputData.Vehicle.Components.EngineInputData
Dim gearboxInputData As IGearboxDeclarationInputData = vectoJob.Vehicle.Components.GearboxInputData
Dim gearshiftInputData As IGearshiftEngineeringInputData = vectoJob.DriverInputData.GearshiftInputData
If vehicleInputData Is Nothing Then _
result.Add(New ValidationResult("Vehicle File is missing or invalid"))
If (vehicleInputData.VehicleType <> vectoJob.JobType) Then
result.Add(New ValidationResult($"Vehicle type ""{vehicleInputData.VehicleType}"" differs from job type ""{vectoJob.JobType}""."))
End If
If vectoJob.JobType.IsOneOf(VectoSimulationJobType.BatteryElectricVehicle, VectoSimulationJobType.ParallelHybridVehicle, VectoSimulationJobType.SerialHybridVehicle) _
AndAlso (vehicleInputData.Components.ElectricMachines Is Nothing OrElse vehicleInputData.Components.ElectricMachines.Entries.Count = 0) Then _
result.Add(New ValidationResult("Electric machine is missing in vehicle"))
If Not vectoJob.JobType = VectoSimulationJobType.BatteryElectricVehicle AndAlso engineInputData Is Nothing Then _
result.Add(New ValidationResult("Engine File is missing or invalid"))
If (vectoJob.JobType = VectoSimulationJobType.ConventionalVehicle OrElse vectoJob.JobType = VectoSimulationJobType.ParallelHybridVehicle) _
......@@ -555,6 +564,9 @@ Public Class VectoJob
AndAlso gearboxInputData IsNot Nothing AndAlso gearboxInputData.SavedInDeclarationMode Then
result.Add(New ValidationResult("Gearbox File is not in Engineering Mode"))
End If
If vectoJob.CycleFiles.Count = 0 Then
result.Add(New ValidationResult("At least one cycle must be defined."))
End If
If result.Any() Then
Return _
New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList())
......
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