Skip to content

Commit fe0b9d7

Browse files
committed
Indicate error attempting to export a train skipping tracks
1 parent 741e09d commit fe0b9d7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/simulation/TrainTrajectory.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,23 @@ cda_rail::sim::TrainTrajectory::convert_to_vss_format(
331331
const Network& network_bidirec) const {
332332
if (instance_r.get().allow_reversing)
333333
throw std::runtime_error(
334-
"Converting solutions that allow reversing to VSS compatible solution "
335-
"is not yet supported, since position can't be easily represented in "
336-
"distance from starting point.");
334+
"Cannot export to VSS compatible solution. "
335+
"Converting solutions that allow reversing is not yet supported. "
336+
"Position can't be easily represented as covered distance.");
337+
338+
if (instance_r.get().get_max_train_speed() >
339+
instance_r.get().get_shortest_track())
340+
throw std::runtime_error(
341+
"Cannot export to VSS compatible solution. "
342+
"Max train speed is higher than smallest track size. "
343+
"Trains can skip tracks which is not representable as a 'Route'.");
337344

338345
const Network& network_unidirec = instance_r.get().network;
339346

340347
if (network_unidirec.number_of_vertices() !=
341348
network_bidirec.number_of_vertices())
342349
throw std::invalid_argument(
350+
"Cannot export to VSS compatible solution. "
343351
"Networks must be the same except in uni/bidirectional format.");
344352

345353
Route route;

0 commit comments

Comments
 (0)