Overall Design

The system designed is of course influenced by the external factors of the garden itself and the track components from which the railway will be built. The garden area chosen is approximately 10m x 4m on two levels:

Figure 1. The Garden for the Railway

The Garden for the Railway

Both levels are substantially flat[12] with a step of about 250mm between, so it should be possible to climb a connecting embankment. (Generally gradients should be less than 1 in 40 and certainly no more than 1 in 25). The area was surveyed (marked by the red survey points shown above) and a simplified plan of the garden drawn up:

Figure 2. The garden plan

The garden plan

I decided that the railway would be built at SM32 gauge/scale, also known as 16mm. The track has a gauge of 32mm, and is taken to represent a 2ft narrow-gauge line[13] so the scale is 16mm to the foot or 1:19. As such, models of narrow-gauge locomotives are large enough to be totally steam-powered. The tracks themselves would not carry electrical power — all engines would be self-powered, and remotely controlled. The commercially available track had a small set of points of different tightness and flexible track sections of some 900mm length. This meant that apart from the fixed-design points, the rest of the track could be freeform, subject of course to a recommended minimum turn radius, which whilst being dependent upon locomotive wheelbase, would be about 900-1000 mm.

The original design consists of five major sections:

As far as the software mix is concerned, the top-level XHTML document contains some constant background components and div containers which will be populated, a script element containing a very small set of global JavaScript functions, for primary control of animations and mapping from screen to SVG co-ordinates, and an invocation of Saxon-JS with a precompiled program from an XSLT source of some 20 files and perhaps some 3000 source lines. This program takes as input a file containingg definitions of the garden, possible layouts and locomotives. Textural styling is supported by a set of associated (static) CSS files.

There are a number of (Javascript) libraries for supporting SVG effects and animation, and pretty much all the written guides to advanced SVG use a combination of some of these, but I wanted to explore how much could be done almost entirely in XSLT3.0. All the programming is limited to XDM data types, XHTML, SVG, CSS and XSLT3.0 with Saxon-JS interaction extensions, with a minimum of (perhaps a dozen) globally defined small JavaScript functions, mostly to invoke,query and stop SVG animations.



[12] Only when laying out the track bed did it become apparent that several elevation changes O(50mm) existed on the upper level.

[13] Many of the UK's little trains, such as the Ffestiniog and the Talyllyn, run on 1' 11½" gauge track