JeffRA

If I can do something myself then that's my preferred route so when I needed a program to produce a switching list I decided to write it myself. A few years ago I would have likely written in in the BASIC programming language but as time has moved on I decided to write it in Python, a more modern language.

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
JeffRA

The program design

For the design, I decided to make it data-driven as much as possible. I did this by using a text file to define the industries, the cars, and the frequency of pickups and deliveries. This needs to be done only once. The programme reads it in and uses it as a basis for producing randomized car movements.

Although I wrote the program to handle my particular layout needs which includes interchange tracks, it should be easy to use it for perhaps any small switching layout that has a local freight and a few industries. It is able to handle a larger number of industries and cars, though - it's just a matter of defining them in the text file.

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
JeffRA

Defining the industries

For a simple example, here is my definition of two industries: a freight house and a team track. Note: lines beginning with "#" are ignored by the program and so are useful for comments.

# ----------------------------------------------------------------
# FREIGHT HOUSE
#  Handles customers' long-distance freight
#  Input  by road;  Output by rail
#  Input  by rail;  Output by road
# ----------------------------------------------------------------
# Business Name; percent served, number of bays
Freight House;100;1
# In/Out (I or O); Car pool (U=Unspecified); Type of rolling stock requested
# (e.g. BX for boxcar);  Optional car contents, destination name and destination location
I;U;BX;LCL freight;Grand Rapids Yard;Grand Rapids, MI
I;U;BX;LCL freight;Milwaukee Yard;Milwaukee, WI
I;U;BX;LCL freight;Chicago Yard;Chicago, IL
I;U;RF;LCL freight;Chicago Yard;Chicago, IL
O;U;BX;LCL freight;Grand Rapids Yard;Grand Rapids, MI
O;U;BX;LCL freight;Milwaukee Yard;Milwaukee, WI
O;U;BX;LCL freight;Chicago Yard;Chicago, IL
O;U;RF;LCL freight;Chicago Yard;Chicago, IL

# ----------------------------------------------------------------
# TEAM TRACK
#  Handles customers' LCL freight
#  Input  by road;  Output by rail
#  Input  by rail;  Output by road
# ----------------------------------------------------------------
# Business Name; percent served, number of bays
Team Track;100;1
# In/Out (I or O); Car pool (U=Unspecified); Type of rolling stock requested
#  (e.g. BX for boxcar);  Optional car contents, destination name and
#  destination location
I;U;BX;LCL freight;Grand Rapids Yard;Grand Rapids, MI
I;U;BX;LCL freight;Milwaukee Yard;Milwaukee, WI
I;U;BX;LCL freight;Chicago Yard;Chicago, IL
O;U;BX;LCL freight;Grand Rapids Yard;Grand Rapids, MI
O;U;BX;LCL freight;Milwaukee Yard;Milwaukee, WI
O;U;BX;LCL freight;Chicago Yard;Chicago, IL

 

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
JeffRA

Defining the cars

Here's my definition of a few cars:
# ----------
# RAIL CARS
# ----------
# Car type/description; Car pool; Industry being served; Day
#  Car type. E.g.:
#   BX-Boxcar; CB-Caboose; FB-Bulkhead flat; FC-Container flat
#   GN-Gondola; HC-Covered hopper; HP-Hopper; PC-Passenger car; RF-Reefer;
#   SC-Stock car; TC-Tank car; TE-Tank car (Exxon); TF-Trailer flat;
#   TG-Tank car (Gulf); TH-Tank car (Hopper); TW-Tank car (Wyandotte)
#  Car description: - Length in feet Owner, Reporting mark and colour
#  Car pool (U=undefined)
#  Industry where currently located (99 means none)
#  Status (0 means "car free for use")
#  Car situation (from "9-car ordered" through "0-car free")

BX-40' Penn 564274 Brown;U;99;0;0
BX-50' GTW 591450 Brown;U;99;0;0
BX-50' NKP 85499 Brown;U;99;0;0
CB-35' CN 470 Brown;U;99;0;0
RF-50' SPLX-4226 Silver;U;99;0;0
HC-36' GTW 315060 Blue;U;99;0;0
HP-40' EJ&E 70127 Black;U;99;0;0
TE-38' Exxon GATX 46312 Silver;U;99;0;0

 

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
JeffRA

Sample output switching list

This excerpt shows what the output looks like for the simple case described above - a few cars, a freight house and a team track. Note that during the first two dispatch days the cars were ordered and were heading in.

Dispatch Day 3

  Wayfreight pickup
    None
  Wayfreight deliver
     0 BX-40' Penn 564274 Brown to Team Track
      (supplying empty)

    Cars on the layout
      Freight House
        no car
      Team Track
         0 BX-40' Penn 564274 Brown

Dispatch Day 4

  Wayfreight pickup
    None
  Wayfreight deliver
     1 BX-50' GTW 591450 Brown to Freight House
      (LCL freight from Milwaukee Yard in Milwaukee, WI)

    Cars on the layout
      Freight House
         1 BX-50' GTW 591450 Brown
      Team Track
         0 BX-40' Penn 564274 Brown

Dispatch Day 5

  Wayfreight pickup
    None
  Wayfreight deliver
    None

    Cars on the layout
      Freight House
         1 BX-50' GTW 591450 Brown
      Team Track
         0 BX-40' Penn 564274 Brown

Dispatch Day 6

  Wayfreight pickup
     0 BX-40' Penn 564274 Brown from Team Track
      (LCL freight to Grand Rapids Yard in Grand Rapids, MI)
  Wayfreight deliver
    None

    Cars on the layout
      Freight House
         1 BX-50' GTW 591450 Brown
      Team Track
        no car

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
JeffRA

Wrapup

Comments are welcome.

It would be interesting to have the program run information from someone else's layout to see how it performs. Anyone interested?

 

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
jeffshultz

Looks interesting...

Right now I'm getting too invested in STS to want to try something else, but I do have some questions.

I'm not sure that this is exactly a switch list (although it could be used as one), as it looks more like instructions for a Yardmaster, tell him these cars need to go to these locations, at which point he uses his own knowledge of what trains exist to assign them to those trains as appropriate. Unless the list posted is intended for one train, and we just don't see that in the excerpt.

But yeah... it definitely looks interesting.

orange70.jpg
Jeff Shultz - MRH Technical Assistant
DCC Features Matrix/My blog index
Modeling a fictional GWI shortline combining three separate areas into one freelance-ish railroad.

Reply 0
JeffRA

Re: Looks interesting...

Thanks, Jeff.

It may well be that I'm using wrong terminology since I am not any sort of an expert on rail topics. My aim was to describe the cars making up a local freight (I called it a wayfreight), which industries the local freight is to deliver them to and what pickups, if any, there are for it to return with.

Of course with the very simple example I gave, the local freight has only one or two cars to handle... not much of a train!

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
David Husman dave1905

Program

You might want to do a little more research and refining before having other people try it.

You might want to search for "switch lists" to see how they are structured and pick up on the verbiage used by railroads.  That will help improve the look and "feel" of your application.

FYI :  LCL goes to the freight house.  LCL means "less than car load" which  means shipments less than a ton or two.  LCL goes to the frieght house so the agent can unload the shipments for his station and hold them for the customer to pick up and going the other waay the agent recieves small (less than a couple tons) shipments, bills them and hold them in the freight house until a LCL car is spotted and then loads them into the LCL car for forwarding.

 A team track is for customers who ship or receive car load freight but don't have their own track.  Typically they are small customers that ship only a few cars a month or year.

Dave Husman

Visit my website :  https://wnbranch.com/

Blog index:  Dave Husman Blog Index

Reply 0
JeffRA

Re: Program

Thanks, Dave for the useful comments.

I had to laugh when I read your comment about team track. It's so obvious that it makes me despair sometimes. I'm sure that it's knowledge that I once had but needed a refresher. Thanks.

I could probably save myself some grief if I don't refer to my program's output as a "switch list". If I wanted it to be more of a switch list then I should at least organize it around businesses rather than cars.

Back to the drawing board.

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
David Husman dave1905

On the layout

I am wondering what the purpose of the "on the layout" listings are for?

If I have 200 cars, and only 20 of them are on trains, why would I need a list of the other 180 cars on the layout every session?

The switch list should only have the cars the train is going to handle.  If the cars are on the layout, but the local isn't going to pick them up or set them out, then they don't need to be on the list.

Now you may want a separate "inventory" or track list that lists the location of every car sorted by location (and possibly a second list sorted by car initial and number showing location) to use as a check for the owner to verify where things are between sessions.

Dave Husman

Visit my website :  https://wnbranch.com/

Blog index:  Dave Husman Blog Index

Reply 0
JeffRA

Re: On the layout

Dave,

The "on the layout" listing is really a check sheet and not part of the switch list. I am building a 4' x 2' N-scale switching layout so "on the layout" refers to only the cars that are at industries. All other cars are on the cassette staging tracks and not "on the layout". The list is so that after completing the switching I can check that the final result agrees with the list as a check that the switching has been done correctly. I will be new to switching and felt that this might initially be useful. If not (which is likely once I've run a few), I will remove it.

The program does produce a list of all cars and their locations sorted by car and also by location although I didn't show it in the example. Like the "on the layout" listing I will have to determine whether I need them once my layout is capable of operation. Up to now, all my switching has been done in my head or on paper!

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
pierre52

JMRI Ops

Jeff

If it were me I would try setting up JMRI ops for your layout.  That would achieve a couple of things.  Firstly you could establish if this free program could save you a bunch of time in trying to re-invent the wheel.  Second, even if the program doesn't meet your needs, it might give you a steer in the required inputs/outputs when writing your own.

Peter

The Redwood Sub

Reply 0
JeffRA

Re: JMRI Ops

Thanks, Peter.

I do try to keep up with JMRI and its capabilities, including ops. It's a great program and free! What more could you ask for? And it has steered me in the right direction more than once. E.g. the program I wrote to operate my trains and program CV's.

But for me, using a ready-made program is like using a ready-made layout. It's a hobby and if I have the capability, I like to do it myself. Yes, most of the time re-inventing the wheel!

....Jeff (N scale, DCC++)

Nova Scotia, Canada.

Reply 0
Reply