Tuesday, 28 March 2017

TrafficControl: Debugging Train::move Method (part 1)

The bug is that the trains seems not to follow their Travel Plans. A Travel Plan is a list of adjacent stations that the train shall visit before the train stops.

For the network file "Network_LundSuburb-ThreeTrains", the program seems to work. The three trains follow their travel plans.
  • Hedy_Lamarr shall start in Hjärup -> Lund -> Gunnesbo -> Lund -> Stangby (STOP)
  • Ada_Lovelace shall start in Gunnesbo->Lund -> Stångby (STOP)
  • Marie_Curie shall start in Lund -> Gunnesbo -> Lund (STOP)
Time Hedy_Lamarr Ada_Lovelace Marie_Curie Comment
0 Hjärup Gunnesbo Lund
1 HjaLunN GunLunS LunGunN
2 HjaLunN Lund Gunnesbo
3 HjaLunN LunStaN GunLunS
4 Lund LunStaN GunLunS
5 LunGunN LunStaN LunGunS
6 LunGunN LunStaN Lund (Stop)
7 Gunnesbo LunStaN Lund (Stop)
8 LunGunS Stangby (Stop) Lund (Stop)
9 Lund Stangby (Stop) Lund (Stop)
10 LunStaN Stangby (Stop) Lund (Stop)
11 Stangby (Stop) Stangby (Stop) Lund (Stop) Expected behavior


When using a network file with tracks in both directions, (Lund_Coordinates.txt), the program warns that it can't add tracs to Travel Plans:

INFO : Adding track to trainroute << Need to print what station to add. The first station (LundC) was added!
INFO : "Hedy_Lamarr" has 100 seats. 0 are taken.
: Train is at station "Hjaerup"
: TrainRoute, index: 0 :
2 : "Lund_C"
^ Current ^
ERROR : Train::addTrackToTrainRoute Error: negative number specified. <<Why wasn't the program able to addGunnesbo?

INFO : "Hedy_Lamarr" has 100 seats. 0 are taken.
: Train is at station "Hjaerup"
: TrainRoute, index: 0 :
2 : "Lund_C"
^ Current ^
INFO : Adding track to trainroute <<This time, LundC was added to travelPlan. The program isn't designed to handle two consecutive entries of the same station in TravelPlan
INFO : "Hedy_Lamarr" has 100 seats. 0 are taken.
: Train is at station "Hjaerup"
: TrainRoute, index: 0 :
2 : "Lund_C"
^ Current ^
2 : "Lund_C"<< Hjaerup should have been before LundC in the travelPlan
INFO : Adding track to trainroute << Staangby was added to travelPlan
INFO : "Hedy_Lamarr" has 100 seats. 0 are taken.
: Train is at station "Hjaerup"
: TrainRoute, index: 0 :
2 : "Lund_C"
^ Current ^
2 : "Lund_C"
3 : "Staangby"


For the train Ada_Lovelace, that issue wasn't seen. For the train Marie_Curie, the issue came when adding Gunnesbo station to the travelPlan. In the network file, the Gunnesbo station seems to be ok.

In the next blog post, I'll add extra prints to show what happens when trying to add Gunnesbo station to travel plans.


Thursday, 23 March 2017

TrafficControl: Four Commits and a Bug

I pushed the code with the dynamic QML stations, code cleanup and fixes to the KML parser to the CuteTrains GitHub repo  in four commits (one of them since I'm still on the Git learning curve and two of them are simply bad planning from my side). 

The fixes to the KML parser (trackStationConnector.py) considers the direction of the track in the file name. 

The code cleanup is an attempt to follow the C coding style according to https://www.gnu.org/prep/standards/html_node/Writing-C.html

When running three trains on the bigger network file (Skane_Coordinates.txt), I notice that the trains doesn't follow the travel plans. I know that the train::move part of the program is a mess and needs refactoring. 

I'll focus on debugging the issue with the trains inability to follow the travel plan in future blog posts.

Thursday, 16 March 2017

TrafficControl: Adding QML Components Dynamically

To be useful, TrafficControl needs to present the stations on an interactive map. The program logic is currently implemented in C++ with some Qt Graphical User interfaces using model-view relations.

The original presentation of the stations and tracks, that were imported from a KML file.

A part of the user interface will be based on QML, that imports a map from OpenStreet maps. QML is a design language where one can add graphical elements easily. I will describe a simple QML demo program later and publish it on my github account. 

The challenge for me has been to add components in QML dynamically from C++, when stations or tracks are found. The placemarks below are from Google Earth/KML.

The yellow placemarks are representing stations.
The stations has been identified and their coordinate has been sent to the QML part of the program,

The stations has been identified by trafficControl and dynamically added as circles

Some of the next steps will be:
  • Modifying the different stations individually
  • Adding tracks
  • Adding trains
  • Showing status when hovering the mouse pointer over the items
  • Modifying the components regarding their statuses
  • Investigating model/view for QML map items

Saturday, 11 March 2017

TrafficControl: Resuming...


When resuming the project, I've seen that the tile issue with tiles that aren't shown seem to be unstable. Some zoom levels work but not others. Qt Blog has addressed that issue and discussed solutions to the issue:
http://blog.qt.io/blog/2017/03/09/provisioning-openstreetmap-providers-in-qtlocation/

I also installed Microsoft Visual Studio, and used that compiler. No missing DLLs and much quicker compilation. I assume the reason is that MSVC is more adopted to the Windows 10 workstation that I'm using than MinGW that I used before.

The next blog post will describe a breakthrough in TrafficControl!

Thursday, 23 February 2017

Trains: Great Railways of the World

A very special person in my life gave me a very inspiring book.

The author, Mark Ovenden has a passion for graphic design and shares my interest in railways.


The book contains hundreds of railway maps from different eras and all continents except for Antarctica (the South Orkney islands had a small railway).





Thursday, 16 February 2017

Some of my projects

For the last six months, I've been focusing on other projects than trafficControl.

In my genealogy project, I've reached the 16th century, an achievement I'm proud of. My ancestors were mainly farmers, fishermen, ship pilots and smiths from the western parts of Sweden. The church records dates back to the 17th century, but there are recordings about a poor farm on Brännö, outside Gothenburg. That island had a very dramatic history, I'll write more about that in future blog posts.

At work, I'm in a very interesting development project on the road to 5G. With that project, I get good experience from software development.

On a personal level, I and my girlfriend are in another project that will be very challenging and very rewarding. In a way, it is related to the genealogy project. 

I'll continue with the trafficControl project but on a sporadic pace. 


Monday, 19 September 2016

Trains: Station House for Sale in Hurva

Slightly less than a 30 minutes bus ride  from Malmö (unfortunately the rails were removed long ago), a old railway station is for sale. The house has been a B&B in the past and has been for salequite recently:

Image acquired from Wikipedia (CC BY-SA 3.0) 
It will take some passion, work and time (and tracks) to make the house a station again.

The station was built 1865 as a part of YEJ (Ystad to Eslövs Järnväg) that closed 1981.
The blue line indicates the tracks that once were connecting Eslöv with Bjärsjölagård, Tomelilla and finally Ystad.


My refusal to give real estate agents free marketing prevents me from posting the housing ad on the blog. Real estate agents are welcome to post on their own blogs.

Links: