Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 320 bug graphical timetable streckengrafik renders only one trainrun segement #325

Conversation

aiAdrian
Copy link
Collaborator

@aiAdrian aiAdrian commented Oct 24, 2024

Description

This change fixes the problem if a trainrun does not have a continuous path from the start to the destination, i.e. if sections are missing in the path that should continuously connect the nodes from the start to the end. These holes are artifacts that can occur during drawing if the train has not been drawn correctly or has not yet been fully drawn. So there can always be a train run that has "holes" along the path, i.e. missing train run sections along the path, e.g.
A - B - C ---- missing --- E - F - G --> also no section between C and E.

The solution to the problem - described above - is proposed in this fix: The trainrun has two parts: [(A B), (A C)] and [(E F)(F G)]. The trainrun is now interpreted as two separate train runs. The network diagram provides no information as to whether the missing part is between C - E, C - D - E, or another possible variant. Thus the best assumption we can make here is that each part of the train run can be interpreted as a single trainrun.

(In principle, however, this should not occur in a perfect Netzgrafik.)

image
Example Netzgrafik

image
Graphical timetable

Issues fixed

The issue was fixed in the graphical timetable (Streckengrafik) within the TrainrunSection collector. All trainruns are now selected using the default iteration, which starts at the top-left end and traverses through the trainrun. Previously, if a trainrun had more than one segment the old version only collected a "random" trainrun part. This has now been fixed.

Additionally, the cumulativeTimePropagation for the trainrun had a similar issue, which caused other problems in the graphical timetable. This has also been resolved. Each trainrun segment is now interpreted as a single trainrun and is propagated separately.

The trainrun part issue was as well found in the pearlsview - it's as well resolved.
image

Checklist

  • This PR contains a description of the changes I'm making
  • I've read the Contribution Guidelines
  • I've added tests for changes or features I've introduced
  • I documented any high-level concepts I'm introducing in documentation/
  • CI is currently green and this is ready for review

@aiAdrian aiAdrian linked an issue Oct 24, 2024 that may be closed by this pull request
3 tasks
@aiAdrian aiAdrian requested a review from SergeCroise October 25, 2024 15:37
@aiAdrian
Copy link
Collaborator Author

aiAdrian commented Oct 28, 2024

Iterator pattern for iterating through all trainrun parts seperatly

getForwardTrainrunPartIterator(trainrunSection : TrainrunSection) {
      // find both start nodes ( N1 - N2 - N3 - N4 ) => N1 , N2
      const bothEndNodes =
        this.trainrunService.getBothEndNodesFromTrainrunPart(trainrunSection);
        
      // get start / end node from Top/Left -> Botton / Right 
      const startForwardNode = GeneralViewFunctions.getLeftOrTopNode(
        bothEndNodes.endNode1,
        bothEndNodes.endNode2,
      );
     
      // get start trainrun section -> forward direction/orientation 
      const startTrainrunSection = startForwardNode.getStartTrainrunSection(
        trainrun.getId(),
      );

      // create forward iterator
      const iterator: TrainrunIterator = this.trainrunService.getIterator(
        startForwardNode,
        startTrainrunSection,
      );
  return iterator;
}


simpleTrainrunAllPartsIterator(trainrun: Trainrun) {
    let alltrainrunsections =
      this.trainrunSectionService
        .getAllTrainrunSectionsForTrainrun(trainrun.getId());

    while (alltrainrunsections.length > 0) {
      // traverse over all trainrun parts
       const iterator= getForwardTrainrunPartIterator(alltrainrunsections[0]);

      while (iterator.hasNext()) {
        // move iterator forward
        const currentTrainrunSectionNodePair = iterator.next();

        // get data 
        const trainrunSection = currentTrainrunSectionNodePair.trainrunSection;
        const node = currentTrainrunSectionNodePair.node;

      ...
        user
        defined
        data
        processing
      ...

        // filter all still visited trainrun sections
        alltrainrunsections = alltrainrunsections.filter(ts =>
          ts.getId() !== trainrunSection.getId()
        );
      }


    }
  }

@aiAdrian aiAdrian self-assigned this Oct 28, 2024
@aiAdrian aiAdrian added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Oct 28, 2024
@aiAdrian aiAdrian merged commit 790f53b into main Oct 28, 2024
7 checks passed
@aiAdrian aiAdrian deleted the 320-bug-graphical-timetable-streckengrafik-renders-only-one-trainrun-segement branch October 28, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Graphical timetable (Streckengrafik) renders only one trainrun segement
2 participants