Friday, April 10, 2015

My revised freight handling computer program

I first developed a freight handling program for my indoor 00 railway just over ten years ago. It was based on a relational database (4D) which I got free of charge on the cover disk of a computer magazine. When I ventured into the garden, I adapted this program for the increased number of stations and rolling stock (see Computerised freight operations). This served me well for a few years, but the freebie program would only work on Windows XP and I couldn't afford to buy the licence for the more recent version of the program. I kept running the program on my antiquated desktop computer but it was beginning to show its age.

Recently, I stumbled across Livecode. This is an open source programming environment based on HyperCard, which was developed by Apple many (many) years ago. I was great fan of Hypercard at the time and lamented its passing when Apple ceased to support it. I downloaded the free 'community' edition of the application and was delighted that, after some experimentation, I was able to dust off my dormant programming skills and started developing a LiveCode version of my freight management program. It is now finished - well that's to say, it's now working and earning its keep. I'm not sure it will ever be 'finished' as, like my railway, I will probably keep tweaking, amending and updating it.

As with the previous version, this one features two core databases - one which records all the locations on the railway:

 and one which records all the wagons on the railway.

The crux of the system is the grid which determines the percentage likelihood of the wagon travelling to and from each location. The coal wagon shown above has a 20% likelihood it will travel from BM (Beeston Market) to, say, Peckforton (PK) but it will never travel from Bulkeley (BY) to anywhere else but Beeston Market (BM).

This closed van, by contrast, is likely to travel to and from a variety of locations on the line.

The drop-down list which is prominent on this record shows that the relative length of each wagon can also be recorded, as well as its current location on the system.

 The 'card' for each wagon can be printed out as hard copy and a summary listing all the wagons and their present locations can also be printed.

Update 18 / 04 / 2015
I have now added a further print-out to the wagon summary - the wagons can be printed out by location. I have found this print-out helps when checking that wagons are in their correct locations at the start of an operating session.

To generate traffic on the system, this screen is used. Clicking the 'Create Train' button will generate a semi-randomised train, based on the weightings for each wagon. In this example, several wagons are travelling from BM down the line to various other locations. For example, the Closed Van (CL06) is travelling from PK to BK (as we saw above, closed vans are more likely to travel to and from any location on the system). Refinements from the previous (XP) version now include the ability to decide how busy the system can be at that particular moment and also whether or not time is included for unloading the wagons. I was finding, on the previous version, that sometimes a wagon would be delivered to a particular location by, say, the Down pick-up goods, only to find it would immediately be required to return on the next Up train - which seemed to me somewhat unprototypical.

Clicking the 'Accept' train button instructs the database to move the relevant wagons to their new locations thereby keeping track of what is where.

The trains can be printed out in one of two formats. With the original program, the wagons could only be printed in the order in which the trains are generated - which is actually in order of priority; the most urgent wagons appearing at the top of the list and the least urgent at the bottom:

However, I was finding that this format was sometimes a bit confusing when I was out in the garden, trying to shunt the various wagons on to or off the train. It has been known for the train to arrive at a station only to find a required wagon was not picked up at the previous station. Some with which the controller (Fat or otherwise) would not be at all pleased. And so, I devised a clearer print-out for shunting purposes at each station.

This indicates which wagons need to be pick-up and dropped off at each location, making life a lot easier.

As the weather has been particularly clement the past few days, I have had the opportunity to try out the new system and so far, have been very pleased with the result.

A day's freight operations

Manning Wardle 0-6-0ST, Harthill, starts off proceedings by delivering the stock to their starting positions at the beginning of the session. Here she is approaching Beeston Castle.

 On the final leg, she is just leaving Bulkeley on her way down to the terminus at Bickerton.

Arriving at Bickerton

 She then returned up the line running light to Beeston Market.

 She then took on duties in charge of the Down pick-up goods. Here, she is just leaving Beeston Market station at the start of her journey.

Further down the line, she is just leaving Bulkeley on her way to the other terminus at Bickerton.

 After shunting at Bickerton, she starts back up the line.

Shunting at Bulkeley......

..... and then on towards Peckforton.

Approaching Peckforton......

...... where she engages in some more shunting .......

..... before dropping off a van at the Mill Siding.

And then on towards Beeston Castle.

Later in the day, Barclay 2-4-0T, Beeston, takes the afternoon mixed down the line. Here she is approaching Peckforton, crossing the River Gowy.

On the way back up the line, between Bickerton and Bulkeley.

Approaching Peckforton with a couple of timber wagons for the sawmill.

She is about to enter the main terminus at Beeston Market.

 At the end of the day, Harthill goes back down the line to collect the wagons from each location to return them to the storage sidings.

The labels remind me where the stock was located so it can be returned there at the start of the next session.

I have seen quite complicated stock management programs, but my principle in developing this one was to keep things simple. I find that having an element of weighted randomisation makes life interesting on the railway. I sometimes have trains running with an unexpected mix of rolling stock - and have to spend a while figuring out the best way to shunt the train at the intervening stations - do I drop off wagons on the way Down the line or wait until the train travels back Up when shunting into the trailing sidings is easier? And life would be so much easier if those wretched timetabled passenger trains didn't keep getting in the way!

10 comments:

Unknown said...

Hi,

I remember reading with interest about your freight handling system the first time round. I like the simplicity of the random weighting. Would you be willing to share the program?

Cheers,

Martin

GE Rik said...

Hi Martin
Sure. I've posted the program in the downloads section of the GScaleCentral forum. That's the easiest place to acquire it. I think you'll need to sign up to the forum first - but it's free and you don't get hassled with messages.

Rik

GE Rik said...

Hi Martin
I've just uploaded the most recent version to the GSC forum. It might take a day or so for it to be approved by the forum manager. It should be in the downloads area shortly.
Rik

Unknown said...

Great, thanks Rik!

GE Rik said...

The download section has now disappeared from GSC and so I have created downloads on Dropbox for PC and Apple computers. The program is self-contained and should run on most computers without modification. I'm sorry, but I have not produced an app for Android or iPhone.
Mac download - https://www.dropbox.com/s/mng6nbv4tzohzr6/Freight%20Man%20v2-31%20Mac.zip?dl=0
PC download - https://www.dropbox.com/s/lwieqf7teamrbwg/Freight%20Man%20v2-31%20Win.zip?dl=0

Rik

Unknown said...

Hi Rik,

Loved your article in GR this month. I've have been working on a similar idea, having complied a similar program in HyperCard years ago, and switching to LiveCode recently. I'd actually started working on it just a few weeks ago and then saw your article.

I tried downloading the file using the link. Sadly, my computer won't allow me to open the file. Is it possible you could send it to me direct as a LiveCode file?

I really like what you've done with it - some very elegant solutions there!

I've written a loco that records each loco's run, with train size, length of run, issues - it becomes a whole record of the loco's use, with modifications, repairs and so on all logged. I wrote an article on it for 16mm Today about a year ago, although it is considerably improved since then. I'm happy to share it by return email.

Regards,

Greg Oehm.

GE Rik said...

Hi Greg
Happy to let you have the file. Rather than posting my email address on here and getting loads of spam, you could join the gardenrails.org forum and we could communicate via private message through that.

Rik

David said...

Hi Rik,

Thank you for this superb freight management program, and congratulations on your article in the August 2021 of Garden Rail. I downloaded the software and your program earlier this week and I am hooked! The facility to create freight trains has added another dimension to operations on my layout based on the RhB in the Lower Engadin.

David

Unknown said...

Thanks Rik.  Done.  I'm - maybe redundantly - Greg Oehm.  Looking forward to mchatting more about this.  I like what you've done.
Cheers,
Greg.

GE Rik said...

Thanks David
Glad it worked ok and you're enjoying using it. Good to hear there's at least one other person out there who gets a kick out of freight handling.

Rik