Closed WJSchakel closed 2 months ago
The following code parses parameters w and vMax. As one can see, a copy-paste error makes the width value (in meters) be used for the maximum speed (in km/h). The valueWidth
variable is used in the second part, rather than valueMaxV
. This code is only used if OTS parameters are present in the fos file.
ValueData valueWidth = getParameterData(ParameterDefinitions.VEHICLE_GROUP_ID, "w").value.get(vehicleTypeNumber);
Generator<Length> width =
(valueLength instanceof ScalarData) ? () -> Length.instantiateSI(((ScalarData) valueWidth).value())
: getDistribution((DistributionData) valueWidth, stream, Length.class, LengthUnit.SI);
ValueData valueMaxV = getParameterData(ParameterDefinitions.VEHICLE_GROUP_ID, "vMax").value.get(vehicleTypeNumber);
Generator<Speed> speed =
(valueMaxV instanceof ScalarData) ? () -> new Speed(((ScalarData) valueWidth).value(), SpeedUnit.KM_PER_HOUR)
: getDistribution((DistributionData) valueMaxV, stream, Speed.class, SpeedUnit.KM_PER_HOUR);
There is actually a second error, as the code regarding width also has:
(valueLength instanceof ScalarData)
Both issues have been solved.
When using a fos file with parameters for OTS, traffic is very slow.