From 17e426be7ee448ac86c6630113fa4b4d3651e4b8 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Tue, 15 Jan 2019 14:57:57 +0100 Subject: [PATCH] engine form: read out gearbox type if available for computing engine inertia --- VECTO/GUI/EngineForm.vb | 15 ++++++++++++++- VECTO/GUI/GearboxForm.vb | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index a0161499b0..34e679d559 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -67,8 +67,21 @@ Public Class EngineForm If Not Cfg.DeclMode Then Exit Sub + Dim gbxType as GearboxType = GearboxType.AMT + + Dim jobFile As String = VectoJobForm.VectoFile + If Not jobFile Is Nothing AndAlso File.Exists(jobFile) Then + + Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadJsonJob(jobFile), + IEngineeringInputDataProvider) + If (not inputData Is Nothing) Then + Dim gbx as IGearboxDeclarationInputData = inputData.JobInputData.Vehicle.GearboxInputData + gbxType = gbx.Type + End If + End If + TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0)/1000.0/1000.0).SI (Of CubicMeter), - GearboxType.AMT).ToGUIFormat() + gbxType).ToGUIFormat() End Sub diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index c1a30f50dc..2e72d6382d 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -911,9 +911,9 @@ Public Class GearboxForm If (vehicle.Axles.Count < 2) Then Return Nothing End If - rdyn = vehicle.Axles.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _ - .Select(Function(da) DeclarationData.Wheels.Lookup(da.Tyre.Dimension).DynamicTyreRadius) _ - .Average() + rdyn = vehicle.Axles.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _ + .Select(Function(da) DeclarationData.Wheels.Lookup(da.Tyre.Dimension).DynamicTyreRadius) _ + .Average() End If If (rDyn.IsEqual(0)) Then Return Nothing -- GitLab