DRAFT V0.3
Please Email rjljr2@yahoo.com if you have any suggestions, or want to help out on this new project.
J-Car is being implemented in Java / Jython
As of Nov 29 2003, a working prototype is still not ready. I am going to be prototyping this with Jython, and perhaps much of the code will remain Jython, except the core. I am not finding a lot of time to work on this project. But I am poking away at it. If you like the ideas, feel free to steel them and beat me to it, or email me and help.
J-Car is a computer program that generates switchlists for a model railroad. The distinguishing features of J-Car are: J-Car is open source, J-Car uses a simple but robust 'model' of shipping, and J-Car is free.
J-Car starts with a database of sidings, cars, and train schedules, from which it produces a switch-list for each train. Sidings are of a couple of different types: Yards, Industry, and Interchanges. In J-Car, interchanges are just a special kind of industry siding if they are 'dummy' interchanges, and they are special kinds of yards if they are 'live' interchanges. The database contains the following information:
Industry / dummy siding:
· Input car types, loads and weights.
· Output car types, loads and weights.
· Siding length in cars
Yard:
· Capacity in cars
Cars:
· Car type (determines the possible loads)
In the above list, the weights refered to are those used by the random generator to select cars and destinations. More heavily weighted output car types will be more likely to be selected for car orders, and more heavily weighted input car types will be more likely to be selected as the destination for a car order. This is to allow some user impact on the industries 'rate of production'.
J-Car is a 'car-centric' generator. This means it doesn’t worry about rates of production or consumption of industries (which would be more realistic, but cumbersome) but rather concentrates on individual cars and where they will go. The reason to use such an approach is that there is no way it can get stuck, and it looks and feels just like a system based on production rather then cars.
J-Car is not real time. J-Car generates switch lists for one operating session, however long that may be. For each session, a single car has only one route, or 'car order'. This may need several moves, on several trains, but in the end the car starts at some particular place and ends at some other particular place.
The way J-Car works is that first, J-Car chooses some fraction of the cars on the layout are for movement for that session. This fraction is user selectable, and some cars on some sidings will be more likely to get car orders then others, according to one of the properties of sidings. For each car that will move, we find a suitable destination for that car. Which destinations are suitable depends on where the car starts, and what kind of car it is. For example, if the car is a hopper sitting at a grain silo, a suitable destination is any industry that will accept grain (including interchanges). If the car is a hopper sitting at a bread factory, it is an empty and so should get a car order to go to a yard, or to any industry (or interchange) that will accept an empty hopper. If the car is at a yard, the system assumes it is either empty or full, and will include both types of destinations for possible delivery. There are likely to several possible destinations. In such a case, the final destination is chosen at random, again using weighting that depends on the destinations siding's properties. Legal car orders are summarized below:
Empty car to any yard.
Empty car to industry / (dummy) interchange that accepts that type of car.
Full car to industry/ (dummy) interchange that accepts that load.
Dummy interchanges are handles as just another industry, while live sidings as just another yard.
Once the car orders are generated, routes need to be generated. Each car order (at random) is selected for route generation, and then a route is generated for that car. A route is nothing but a sequence of trains that will switch the cars to their destination. A car may make multiple train moves by being dropped off at yards between its initial and final destination. J-Car will find all possible routings (using the user supplied train schedule) to get the car to its destination. If there are several possible routings, the route will be chosen at random, with shorter routes more heavily weighted. Note that trains and sidings have limits, so as the car orders are translated into routes, some routes may fill up, making it harder to find routes for later cars. In such a case where there are no routes due to the lack of an available train or full sidings, then J-Car will consider partial routes that move the car (to a yard) closer to its final destination.
The intention of the above method is to appear realistic without being realistic. It is hoped that this 'monte carlo' approach will create a lively system.