Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

fix: change comparison in segment lookup function

parent d9281e65
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using TUGraz.VectoCore.Exceptions;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Models.Declaration
......@@ -45,12 +46,15 @@ namespace TUGraz.VectoCore.Models.Declaration
public override Segment Lookup(VehicleCategory vehicleCategory, AxleConfiguration axleConfiguration,
Kilogram grossVehicleMassRating, Kilogram curbWeight)
{
if (grossVehicleMassRating < 7.5.SI<Ton>()) {
throw new VectoException("Gross vehicle mass must be greater than 7.5 tons");
}
var row =
SegmentTable.Rows.Cast<DataRow>().First(r => r.Field<string>("valid") == "1"
&& r.Field<string>("vehiclecategory") == vehicleCategory.ToString()
&& r.Field<string>("axleconf.") == axleConfiguration.GetName()
&& r.ParseDouble("gvw_min").SI<Ton>() <= grossVehicleMassRating
&& r.ParseDouble("gvw_max").SI<Ton>() > grossVehicleMassRating
&& r.ParseDouble("gvw_min").SI<Ton>() < grossVehicleMassRating
&& r.ParseDouble("gvw_max").SI<Ton>() >= grossVehicleMassRating
);
var segment = new Segment {
GrossVehicleWeightMin = row.ParseDouble("gvw_min").SI().Ton.Cast<Kilogram>(),
......
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