1

I am trying to draw and define the classes in UML for the following problem.

An Information System of Metro Railway

Design the part of the conceptual scheme of the above system that will allow me to register the stations (by distinguishing between interchanges and terminals), the interconnection of the stations (ie the network topology) and the distances (in kilometers of the railway line) they divide.

Each train moves in a line by running consecutive routes, ie moving between prescribed extreme pairs of stations, which are not necessarily the same on each route (Eg Bronx - Manhattan, Brooklyn - Queens). Each route has a specific time of arrival and stay at each station. The actual arrival times at each station may differ from the programmed ones, as well as the speed of traffic between stations.

My first thought is that the main classes should be:

Metro Line, Metro Station, Metro Route, Metro Route Stop, Metro Train

And I am struggling how to represent the scheduled and real times.

Christophe
  • 68,716
  • 7
  • 72
  • 138
giorgionasis
  • 394
  • 1
  • 7
  • 17
  • How about Planned Stop and Actual Stop? – Jim L. Mar 18 '19 at 12:18
  • 1
    the real time at which a metro reach/quit a station is probably just an attribute of type _date&time_ of the Train, updated during the execution. The same for the scheduled time because it is updated depending on the events. For me that do not really need specific class(es) if this is the question. Are you sure there is a programmed time planned days/months in advance ? – bruno Mar 18 '19 at 12:35
  • Be assured that time table construction and representation is far more complex than one might think of in first place. Real time departure management is even far more complex (it needs well trained operators for those systems). As long as you are in some university environment just keep it simple... – qwerty_so Mar 19 '19 at 12:49
  • @ThomasKilian I agree. I will provide my final uml diagram to help others – giorgionasis Mar 19 '19 at 13:49

2 Answers2

1

Lets look at the classes, which are rather obvious:

  • Metro line is a set of Metro routes
  • Metro route is associated with a sequence of Metro stations
  • Metro route is defined by two extreme Metro stations
  • Train runs on Metro routes

Each route has a specific time of arrival and stay at each station.

This implies that routes are not something general (e.g. Brooklyn - Queens), but something very specific (e.g. Brooklyn - Queens starting at 15:03).

Furthermore, as several Metro routes may use the same Metro station, and as a Metro route is composed of several Metro stations, we have a many to many association between those two classes. The time and stay neither depend solely on the route, nor solely from the station. So the best would be to see it as a property of an association class:

enter image description here

The fact that you have a planned time and stay and an actual time and stay means that there are just two different properties. The position of each train between the stations tells us about the trafic.

Finally a more elaborate way to handle the different timings would be to consider a Time table class. The association between Metro route, Metro station and Time table would then be a ternary association, and a ternary association association class could hold the timing data (either planned for the planned table, or actual for the actual table; but you could also have several versions of the plan, and a version of the actual for every day of of the year. This would be completely flexible.

Now, if you are not comfortable with an association class, you can decompose the many-to-many association into two many-to-one associations with a middle class, which you could name Route stop.

Christophe
  • 68,716
  • 7
  • 72
  • 138
-1

Finally,

I come up with this design

enter image description here

Thank you very much

giorgionasis
  • 394
  • 1
  • 7
  • 17
  • 1
    Hhm... interesting. Because the narrative was ambiguous about routes and lines, since it is not clear if “consecutive” referred to the rains or the routes. But there are a lot of problems with this solution. First whatever the route finally is, it’s not a line. Then Time an Real are not correctly represented: a class cannot be associate with an association and be subject to three cardinalities. Trains do not have real time at station. Finally, it is very unclear what your schedule object would represent and how one specific schedule would be related the corresponding time. – Christophe Mar 22 '19 at 09:05
  • Maybe you should use a UML tool to do UML. This diagram does not look like valid UML. – Geert Bellekens Mar 22 '19 at 11:00