Thursday, 2 April 2020

So the world changes AGAIN!

As at Monday I had a 2m x 1m Marklin 3 rail German/Swiss themed layout. As of now - nothing! Asking the wife what we might do now we were in lockdown, she said, with a smirk - how about taking that railway down that clutters up our (her) bedroom?
Well, six bankers boxes later and it was all done and dusted. All the good stuff in their own boxes, all the track bumped into one box and the structures in another.

That's where the Pennstadt and Valdorf used to reside.
A bit of pleading has got her to agree a small switching layout so, after 2 years of Marklin, I am back to US outline but this time in N Scale. 4' x 10" with a small staging track.
Not quite what I expected of the week. Mind you, she couldn't complain so, like the government, funds have been made available. Lucking my local hobby shop (and DCC specialists) are still taking orders and even delivering locally!
7 Peco points, 1 crossover, 5 yards of track and 7 Tortoise point motors. I have an Atlas EMD DCC equipped switcher coming and soon about 10 freight cars. Should give me lots of fun. It will sit on the back of my desk - a 5'3" x 2' 8" monster!

The railroad will sit at the back, where the small paint rack is. with the staging reaching out over the left hand end as and when required. I have an ECoS DCC controller so everything should work really nicely.

This is the proposed layout from Anyrail. The layout is based on Kanakee Belt RR as seen in the March 2020 issue of Continental Modeller.

Tuesday, 17 March 2020

Connecting Houses for lighting

I  have solved most of my problems:

Software - rewrote the lok allocation methods and now it works pretty much as I want it.
Lighting of coaches - not really solved but a "work in progress" for when I get more funds available.
Derailments - I bought a 7203 box of 50 close coupling heads. I replaced most of the Roco wagons and everything was going well. I then replaced the coaches and had lots of issues. It seems that the coaches are now too close! I replaced them with standard Roco couplers and now  everything seems to run pretty well. I would have used my spare relex couplers but my V60 telex coupling system doesn't really like relex couplers.

My next step is to do a deep clean of the track as there are parts where the loks just stop and need to be got across a few inches of dead track. Mostly, this is where I can't reach so I am going to take the board down and get to all the parts that I can't currently get to. This should solve the final issue.

Now on to my current project

Lighting and Houses

I have three Faller houses and a Faller Butcher/Bakers.

All have lighting installed. When I built the layout I made sure that there was a 5 volt bus ready for lighting buildings. When I started on the little village, I installed four sets of 5v wires ready to connect to the house wiring. To do this, I used some micro connectors. What I didn't realise was that there were two different types of connector. It shouldn't have mattered because the houses would sit ok as the sets of connectors were in good places for the layout of the village. However, I then bought a Kibri signal box that took up one of the sites. Hence, I have had to repaint the baseboard and  re-position the four houses. Now the connectors don't match!

I wasn't keen on cutting everything back and soldering up connections.I don't really like getting the soldering iron out except at my work desk. I have some heat connectors - a wire in each end - cramp up both ends and then heat the connector up with a blow torch. In fact, the blow torch is much more manually controllable than the soldering iron. It has a decent handle so would never be dropped. If I did, the flame would to out. It has a firm base so it stands firm.

When I was putting the power busses together, I used what are called "Lever Nut Wire Connectors". These provide extremely firm wire connections. I have used the version that is designed for distribution of power - 

In this occasion, I wanted some line connectors and found a pack of 15 on Amazon.

A quick trimming of the wires - both from the 5v bus and the houses - and then one of these connectors between each house and its feed should make it nice and easy for the start of the village.

More to come!

Monday, 13 January 2020

Troubles, troubles and more troubles

It's been a time of strife over the last few weeks. Often, I was tempted to stop what I was doing and find another hobby - well, not really but almost!

OK, so what were the problems.
  1. My software seemed to be unable to do anything correctly
  2. Lighting coaches created lots of issues
  3. Derailments that were too regular.


My software is intended to provide a series of suitable train consists to give me a lot of interest and variety. However, the random allocaters of loks and wagons was failing miserably. I started out trying to fix the problems but then broke all my own commercial programming rules and - basically - tried to hack my way to a working program. On realising what I was doing, I stepped back - went to an earler version and rewrote the way these things were allocated. It took a couple of weeks of frustration before I sorted it out. It still isn't perfect but, currently, it is usable. Needs more work though.

Lighting Coaches

I would like to get all of my coaches lit but I can't find a system that I am happy with. I have tried four ways:

  1. Fit a slider and pickups; fit a rectifier and power a string of LEDs. Use Viessmann conductive couplers to get the power to other coaches.
  2. Fit a slider and pickups; fit a decoder and power a string of LEDs controlled by a function on the decoder. Use Viessmann conductive couplers to get the power to other coaches.
  3. Fit a slider and pickups; Viessmann LED fittings. Use Viessmann conductive couplers to get the power to other coaches.
  4. Fit Layouts4U battery power and latching reed switches.Use Viessmann conductive couplers to get the power to other coaches.
None of these worked because of my incompetence, basically.

First off, it didn't occur to me that fitting Viessmann couplers would shorten the distance between the coaches. One of my coach sets is comprised of "Expert" Piko ones and these are full scale length. However, individually, this is how it panned out.
  1. The worked OK except for two things. The way the keep-alive works meant that when the coach lost power from the track, the battery took over and the lights shone brighter. Not quite what I wanted. Also, my local DCC man - Kevin at Coastal DCC - only had one unit in stock. I tried communicating with the manufacturer - Express models but never got any answer to my e-mail - not good.
  2. Using a decoder didn't get very far as, firstly I blew one up so I had to buy a second to test the installation. Secondly, I was fitting it to my push-pull set so had to take the Piko decoder out (that controlled the lights on the end of the control cab). Once I had the ESU LokPilot fitted, it broke the way that the coaches worked with the lok. I now had to configure the coach lights using DCC and then switch to MFX to get the consist going between the lok and the coach set. Again, I had the problem of the coaches and couplers.
  3. I bought some Viessmann strips and put them into my Piko coaches - wrong! Realised that they still wouldn'y go around the curves. Broke the strips up taking them out and couldn't find a way to reconnect everything so it all went into the bin. Good setup though. The strip includes a rectifier and a brightness control. Still needs a slider though so conductive couplers.
  4. This seems to be the best was to go. However, I think that I must have had some faulty reed switches. Using a magnet, you should be able to turn the coach on and off. However, every time that I turned the coach off, it would come back on as I pulled the magnet away. I did find, later, that some that I put into my Rheingold coaches along while ago all worked fine. This is the way I will go for future investigations and it is cheap and doesn't require a slider.


The last problem came from the new Piko Hobby red/cream coaches. As these were shorter than the Piko push pull coaches, I assumed that they would go around OK but they kept derailing at the s-curve at the front of the layout. I was showing my wife what was happening when she mentioned that the track seemed to dip at that point. On investigation, it appeared that the levels between the two boards were wrong. Using the electric raise and lower mechanism, I raised the main desk just a tiny amount until everything showed level and, lo and behold, the coaches went around OK. On u to my eagle eyed wife!

Thursday, 14 November 2019

Lighting goes in with a new station

Now that some of the basic scenery is down, I can concentrate a bit on the details. First off, I had to install a station. There are to be two platforms in my station for Valdorf. I already had a couple of station buildings that I had made from previously obtained kits. One of them fitted in so that was my basis. However, it was only a building so I had to get some platforms for two types of train.

There are two passenger trains that are due to arrive in Valdorf. One is the push-pull train made up of the Marklin E141 with three Piko coaches - one of which is a cab unit. The second is a local train that is made up of some 4-wheeled coaches and a BR24. The E141 train is quite long as the three Piko coaches are full length. One of my platform  tracks was amply long enough for it and the other track fitted the BR24 nicely. The platforms were to come from Faller - kit 120105. I ordered one of these from my local hobby shop and soon got to work.

It turned out that the platform was too long for my situation. Plus it was very wide. The width was an issue as there is little room on the other side of the station tracks for a full width platform due to the goods arrival track being there. This has a couple of consequences. Firstly, I am going to have to narrow the other kit, when it comes and secondly, with a narrow kit there is no room for the subway entrance so I had to cut the subway out of the first kit as well. As I have alluded to it, the second kit has been ordered but not yet arrived. The first kit went together very nicely. I painted it to mask all the glue marks. MEK is a very efficient glue and doesn't affect the surrounding surfaces but does leave a bit of a shine. The platforms got painted in my new Marklin track colour and the roof got a couple of coats of Neutral Grey but not enough to make it looks perfect.

Lighting! I am a big fan of lighting as my wife likes the effect give by the railway in the bedroom when she goes to bed at night. We leave the railway on whilst we read our books before laying down. Couldn't be better. I ran a couple of dark wires up the supports of the roof - brown and black and then painted them the base gray. The wires power a few LEDs cut from a long strip. Each is wired apart from the next to give a good spread of light. Then I added a couple of LED street lights to the end of the platform. Lastly, I fished out one of my packs of cheap figures bought off EBay. You get 100 figures for £3.89. They are not brilliantly painted but, en-mass, they look the part. I put a lot of them on the platform and, when lit up, it looks very good to my eyes.

Wiring everything up was very easy because of the the 5V power bus that I installed under the board at the beginning. Every light has a pair of connectors close by. I moved on to put the goods shed in. This was built for the the previous layout and fitted in very nicely. It also has an LED strip installed. Next, I fished out the LED street lights that, again, were from the previous layout. These were bought from Amazon at around £6 for 10 per style. I have some standard two light street units plus some high level station yard lights.

I needed somewhere for unloading oil wagons from the local goods train. Vollmer had a nice little unit - their 45527 kit.

Lastly, I wanted to put a couple of signals in to add some more technical interest. Knowing nothing about German signalling, I just pushed ahead! I got hold of a couple of Veissmann 4011 colour lights. I was told that they should be ground signals but, if I did that, they would be hidden by the trains so I went for the normal ones. I am running these off my ECOS through an ESU SwitchPIlot. 

(the camera changes the colour but they are actually both showing red)

They are "hand" changed as desired. I did think about making them automatic but that would take some of the fun out. I have subsequently found out that I should have red/green-amber signals because of the point work following the signal. This is to indicate to the driver that he is to take care! I will see what I can do when my budget recovers from the recent bout of purchases.

I am working on the station car park for my next project. I also have some Wills coal yard kits and a Kibri signal box on the way so plenty to get on with.

Friday, 8 November 2019

First level of scenery goes in

I am a keen fan of Woodland Scenics. I find that their approach to a total scenery product line means that I don 't have to move too far out of their range. This time, I decided to go a bit further and purchase their static grass system. I purchased their Static King grass dispenser and a pile of grass products ranging from 2mm to 7mm grass up to 12mm straw.

I already have their tree making kit along with bags of clump foliage so I was ready to go. Well not quite, as I also wanted to use some of their accent products - these are brightly colour shaker products to providing highlights. In addition, I had a pile of trees that I had brought with me from my model shop days so there is a mix between the pre-made and those made myself.

What I wanted to do first was to cover the edges between the boards and the back scene. I had made the back scene by simply painting some foamcore with blue emulsion paint. I bought five sample jars of paint from B&Q - brown, grey, white, green and blue. B&Q mix these colours up for you. I, eventually, went back for one special colour - I had them scan a piece of C-Track so that I could touch up the sides of the track if the ground works marked them. They have saved this colour on their computer so I can always get another pot. These pots contain 236ml and cost £3.00!

There was only 2" on the left had edge so I could only put a row of trees and some bushes but on the other end there was plenty of room for more scenery.

Here is the left side. You can see the join between the main board and the 1m2 board- which is removable.

As you can see. I had more scope on the right hand side.

Note the daisies and dandelions!

The problem across the back is that there is no room at all for any scenic work so it all has to be in front of the track. I like to see trains running between trees anyway. Here is the left hand side along the back. This area will become a farm with cows, etc, on the grass. The grass is a combination of various greens and the 12mm straw mentioned earlier.

It is difficult to do much around the front loop as I had to keep this tight so that I didn't impinge too much on Valerie's dressing table top. I have already taken a big chunk of it! This meant that all I could do was run some bushes around to give a bit of texture to the board. The big area in the middle with be the town and the fun fair.

You will notice that I have put some mixed grey scatter down between the parallel tracks to cover the baseboard. This is very cheap from Javis (around £1 per bag) but I found it to be excellent.

The next job is to build the station. See next time.

Thursday, 31 October 2019

One program to bind them all

A couple of years ago I completed a B.Sc. with the Open University. I started this is 1974 so it took me some time, although I took a 33 year break where technology changed a bit! In 1975 they taught me Basic but at the time I was working as a trader in the City so didn't see the use until I started writing software for my own trading rooms. As a result of this, after 20 years as a trader I broke out and started my own software company.  I have now spent the last 34 years making a living writing software or managing software projects.

My final year at the OU comprised a project management course. I used this to develop a three tier cloud based car routing system for US based freight cars. This comprised a back end "Key-Value" database (in the cloud), a dedicated web server and a mobile phone front end where all the output looked like conductor generated switch lists. Subsequent to finishing the course, I disposed of all my US outline HO stuff and went into UK based N gauge. I found that the steam locos in this gauge were extremely fragile and I had to return more than I kept, eventually, disposing of all of that stock as well. Due to restrictions on space, once my 93 year old mother in law took over my hobby room, I moved into my current Marklin set up. I am now on my second layout and have developed a train management program to define random trains within the scope of a set of defined objects.

As I am getting on with my layout almost too quickly - I can spend up to 5 hours, 5 days a week, if I care too, I have decided to go back and hone the software and, in the process, describe it for anyone out there that would be interested. If you are a keen programmer then pin your ears back; if not, then have a go. You may learn something - smile.

Background software

The backbone of an software is the programming language that is used in the development. Although this shouldn't change how the program looks and acts, it has a bearing things like speed of development, complexity and so on. Some languages are highly complex making the likelihood of bugs to increase. I have been committed to developing using Object Oriented (OO) techniques in 29 out of the 43 years that I have been able to program. My development language of choice for OO is Smalltalk - a development environment created at Xerox Parc in the early 1980s. There are a few Smalltalk environments available but for many years I have been committed to that which started out at IBM's VisualAge and is now marketed and developed by Instantiations, in Oregon, USA. In order to develop web based software, I use the Seaside framework that is popular across a wide variety of Smalltalk dialects.

Ever since I had my own model shop and had to develop complex sales and web systems for that, I have used what is known as a "Key-Value" database (KV). This, as the title suggests, stores an object (the value) into a "bucket"under a keyword. It gets more complex than that but not much more. Originally, I developed my own ad-hoc version. For my OU course, I used a 3rd party package called Riak. This has a drawback for my ongoing use in that it requires a Unix box to run. Whilst I could maintain one of these during my OU course, I didn't want to have to keep it going permanently. It wasn't helped by the company that owned Riak shutting down. I returned to my original idea and developed, what I call, my Tiny Key Value DB - TinyKV. This is an extremely compact version of a KV written wholly in Smalltalk and thus easily integrated into my proposed software.

The software with no name

Normally, software packages have names but as this is a personal thing, I haven't got round to giving it one. Let's call it PVDB (Pennstadt-Valdorf Database)? So, what does it do.

Using a web interface, the software generates a string of trains that "could" be run over my current railway. I say "could" because there is no compulsion, unlike my OU software where, if you didn't run a train, all of the freight cars would be in the wrong place when the next one came along! So, it suggests a train. If you like it, you run it, if you don't you skip it. There is an option to record the train but this is so you can run a train and leave it in a station whilst other trains happen. Then, when you bring the train back, you can release it. It is all very simple to operate. Plus, being run through a web interface, I can run it on a tablet by the railway rather than having to lug a laptop around.

To back this up, there is a database that contains information about all the locos and wagons plus a list of possible trains. Using a bunch of random generators (RGs), a possible train is created using a chosen lok and a number of wagons. Through the use of the RGs, the lok, the number of wagons and the chosen wagons all may change from run to run. Plus, as each train may have any of three destinations, there is a lot of variation as the list of trains is run through.

What does PVDB know then?

It has access to data about each Lok, wagon and train, plus it has an area in the DB to store created trains; i.e. those that are recorded. The original data was created as a series of comma seperated files created on a spreadsheet. These were read in, an object created for each item in the list and then each was saved into the DB.

Lok Data

Each lok has the following stored:
lokNumber - for display purposes
lokName - unique
nationality - to define which wagons or coaches are suitable - currently only German or Swiss are recorded.
usage - defines the type of train that this lok can be used on.
inUse - a flag to show if it is currently saved in a recorded train (and, thus, cannot be used for another train until released)
id - a numeric value that is used to define the image of the lok.
key - the data value that is used to access any item in the bucket. For loks, this is #lokName.

Wagon Data

Wagon data is as follows:
id - a numeric value that is used to define the image of the wagon. This is also used where multiple wagons of the same type are available - e.g. Swiss dumper wagons - there are 6 in the database. Each wagon carries a sticker underneath with its id printed thereon.
usage - defines the type of train that this wagon can be used on.
nationality - to define which wagons or coaches are suitable - currently only German or Swiss are recorded.
usage - defines the type of train that this wagon can be used on.
inUse - a flag to show if it is currently saved in a recorded train (and, thus, cannot be used for another train until released)
key - the data value that is used to access any item in the bucket. For wagons, this is #idString, i.e. a character representation of the id - 1 = '1' and so on.

Train Data

Train data is as follows:
train - unique identifier of train type
category- defines the type of train.
lokType - self explanatory
frequency - out of 1 - 10 - determines how often this train type is used (subject to random selection - see later)
maximum - out of 1 - 10 - determines the maximum number of wagons/coaches in the train
minimum - out of 1 - 10 - determines the minimum number of wagons/coaches in the train

Creating a train

When the program starts, it builds a list of 50 trains. It takes the list of trains and using the frequency of each adds them to the list. Thus, each train type will appear multiple times subject to each trains frequency setting.The process for example, 2 would mean that for every set of trains, this one would appear twice and so on. With the current database, this results in a list of 54 trains with each type  spread randomly across the list.  Trains are processed in order. When the whole list has been used, a new set of trains will be built, with each type occurring in a different place in the list.


There are three destinations available for trains, depending on type, etc. These are Pennstadt, Hennersdorf and Valdorf. Coming out of the storage, trains can leave going left or right. If they go left, they have a choice of circulation and returning (Hennersdorf) or entering the station (Valdorf). If they take the right hand, they can only circulate (Pennstadt). The circulating trains will make a few circuits of the track and then return to the storage. Trains for Valdorf will enter the station. Passenger trains will have their locos released and placed on the outgoing end (or, if a cab coach train) just sit there until time to leave). Goods trains will be split up and processed into the goods shed, coal depot or oil depot as appropriate. Only trains with "local" or "Inter"  in their train type can have Valdorf as a destination.

Displaying a train

Each train will be displayed along with images of the wagons:

Managing Trains

As can be seen from the above screen shot, there are some options along the bottom of the screen:
Reload - create and display the next train without saving this one.
Save Train - This marks the train as persistent and saves it as a "Created Train". This means that the lok and wagons are reserved for this train and cannot be used for other trains. If the system tries to create another train which requires the same lok as this train, that new train will be skipped.
Save to Log - saves the train to the log file for debugging purposes
Cancel Train - discards the train and returns to the main menu.

Managing Created Trains

Once a train has been created; i.e. saved, the lok and wagons cannot be reused until the train is deleted.  Going to the Show Created Trains option on the main menu gives a list of current saved trains. Should one of these have been returned to storage, it can be reset which deletes the train and releases the lok and wagons back into the pool.
There are circumstances when you may wish to release just some of the wagons and lok. If, for instance, there is a local goods in Valdorf station, the lok might return to storage with only some of the wagons, leaving others in the goods yard. Under these circumstances, only the lok and the returned wagons need be released. When the next local goods comes it, it may return with these other wagons, in which case they can now be marked as returned. 
If the situation gets a bit complicated, there is a reset button that will clear everything out.

How does it all work in reality

It actually works very well. It is uncomplicated, fast and easy to use. It is almost bug free (just one that I know about). What it does is make the running of trains subject to a proper random process. Without it, I find that I run the trains that are on the layout and never swap them out. Too lazy, I guess. Using the program forces me to run different trains and to stick to the three destination protocol. There are two current issues that make it not quite great. My local passenger train lok is going back to Marklin to be fixed and I, currently, don't have any lok to run the local goods train service. My budget has run out but it will sort itself out in December when I have some software consultancy money coming from the USA. Let's hope that the pound tanks by then (that's the currency trader in me speaking!).

Monday, 28 October 2019

Planning the track layout

The idea of the new layout was to provide for a double track main line with one station and access to storage. This involved negotiating a further 1 square meter from my wife. If fact, she was quite amenable to the whole thing and gave up a part of her dressing table top to make the plan work. It also involved moving her bedside cabinet under the railway so overall she was very kind.

The extra real-estate was required because the outside track had to be R2 sized and this would result in a lot less room if I was to go the route using only the 2 square metres that I had previously. As it happened, the top of the dressing table (or at least the small amount that I had garnered) was great for supporting the new extension. I will show how it all looks later in the blog.

I now had to come up with a plan to use the new space. There were a few druthers (as our friends in the USA call them); i.e. wants rather than constraints. My three main wants were

  1. To have the double track main line
  2. To have access in both directions to the storage tracks
  3. To rationalise the station to suit a small terminus with a few local trains
The double track would also allow for main line trains to traverse and leave without any problems.

The track plan was worked out using Anyrail 6. Not everything connected perfectly but the minor issues shown up by the software were easily sorted with a bit of wiggle in the real world.

My first plan, and one that I actually laid, was as follows:

This provided for a two track passenger station, a goods arrival track and two local goods sidings.

There were two things wrong with this. Firstly, at A, there was no way to get any wagons into here unless the delivery loco pushed them there. The local shunter would always be on the wrong end. Secondly, the third uncoupler at the front of the second main track of the station would never be used, so it was moved to the third incoming line. I did think about putting a release crossover in but the available track left would be very short, plus I didn't have a budget for two more digital points!

My next attempt looked like this.

It now came to light, after running a few trains, that there was no way for a main line train with right hand running; i.e on the inside loop, to get back out to the wye to use the storage. This required a rethink. Fortunately, my friend Adrian - from whom I buy a lot of my Marklin stuff, came up with a  couple of points, motors and decoders so I could put a second crossover into the main line.

The above still shows the uncoupler in the wrong place but I sorted that as well. Now we have a layout where, using right hand running, there can be two trains on the main line and a shunter shunting in the yard. Admittedly, trains running on the inner track have to reverse run from the wye to the crossover at the rear. To avoid crashes, the crossover is protected by a colour light signal - the signal controls a dead section just in front of it so, when red, the track is dead. Additionally, any train that wants to leave the station must reverse run until they get back to that crossover.

It isn't perfect but it will let me run three types of train - main line leaving the wye to run clockwise; main line leaving the wye to go anti-clockwise and local trains leaving the wye to go to the station. I have had to create an extra name for the train routing. Pennstadt is clockwise, Valdorf is the station and, the new one, Hennersdorf is anti-clockwise. Pennstadt gets its name from our surname - Pennington; Valdorf from my wife's name - Valerie; Hennersdorf after my wife's favourite golden retriever, Henry (always known as Henners).

That's about all for now. Just note that the one square metre board is totally removable. Also, the main board can be rotated across the desk with the "dangling" end over the edge of the desk supported on two temporary legs. Thus, I can get to all parts of the layout whilst in my office chair - crucial given the state of my arthritis!

Finally, as promised, here are a couple of shots of the new extension. As you can see, it rests on the dressing table top. The basic support for the railway is an "electric" desk which supports the main board. This desk is 1600 x 800 in size and has an electric mechanism for raising and lowering the desk height. This was supplied to my by the Open University as part of their disability support when I was completing my B.Sc. This means that I can get the height of the desk to be exactly the same as the dressing table top. It makes everything nice and easy and very firm.

The separation line is along the demarcation between the brown and the white. The two holes in the top of the brown side are for power to the two fairground rides as the main open part of this board will be the fairground.