Idsrule The Rail Models !



An important competitive development has been the perfection of intermodal freight transport systems, in which highway truck trailers or marine shipping containers are set on railroad flatcars. In North America and Europe they have been the outstanding growth area of rail freight activity since World War II. For the largest U.S. railroads, only coal now generates more carloadings per annum than intermodal traffic.

New Rail Models - All Scales Blue Point Manual Turnout Controller Blue Point Flex Link Starter Kit & Parts Blue Point Installation Instructions - Part 1 (Turnout not attached to layout yet) Blue Point Installation Instructions - Part 2 (Turnout installed on layout) Blue Point Installation Instructions - Part 3 (Tur. Company Information. Rail Scale Models 514 Angel's Way Lane Horse Shoe, NC 28742 +1 248-421-6276. Perpustakaan digital universitas telkom. Disini tersedia informasi seluruh koleksi pustaka yang dimiliki universitas telkom yang terbuka dan dapat dipinjam oleh publik. - is editor based game, where you can build your own railways layouts. This game is virtual form of your model railroads. Now you can run your trains also in computers without any costs in thousands of different layouts. Start right away using the numerous supplied libraries featuring more than 6500 elements including the track systems for many popular model railroad brands and model scales: From T (1:450) and Z (1:220) up to IIm (1:22,5). Additional libraries include scalable accessories like signals, houses, trees, electric components & symbols for all scales.

In overload intermodal transport the economy of the railroad as a bulk long-distance hauler is married to the superior efficiency and flexibility of highway transport for shorter-distance collection and delivery of individual consignments. Intermodal transportation also makes use of rail for the long haul accessible and viable to a manufacturer that is not directly rail-served and has no private siding.

The

Development

Initially, the emphasis in North America was on the rail piggybacking of highway trailers on flatcars (TOFC), which the Southern Pacific Railroad pioneered in 1953. By 1958 the practice had been adopted by 42 railroads; and by the beginning of the 1980s U.S. railroads were recording more than two million piggyback carloadings a year. In Europe, few railroads had clearances ample enough to accept a highway box trailer piggybacked on a flatcar of normal frame height. As shipping lines developed their container transport business in the early 1960s, European railroads concentrated initially on container-on-flatcar (COFC) intermodal systems. A few offered a range of small containers of their own design for internal traffic, but until the 1980s domestic as well as deep-sea COFC in Europe was dominated by the standard sizes of maritime containers. In the 1980s an increasing proportion of Europe’s internal COFC traffic used the swapbody, or demountable, which is similar in principle to, but more lightly constructed, cheaper, and easier to transship than the maritime container; the latter has to withstand stacking several deep on board ship and at ports, which is not a requisite for the swapbody. As its name suggests, the swapbody has highway truck or trailer body characteristics.

The container took on a growing role in North American intermodal transportation in the 1980s. American President Intermodal decided that containers originating from Pacific Rim countries to destinations in the Midwest and eastern United States were better sent by rail from western seaboard ports than shipped through the Panama Canal. To optimize the economics of rail landbridging, the shipping line furthered development of lightweight railcars articulating five low-slung well frames on each of which containers could be double-stacked within, or with minimal modification of, the vertical clearances of the principal route between West Coast ports and Chicago. At the same time, the shipping line marketed containers off-loaded in the east as the medium for rail shipment of merchandise from the east to the western states. This was influential in stimulating new interest in the container as a medium for domestic door-to-door transportation. Other shipping lines copied American President’s lead; railroads enlarged clearances to extend the scope of double-stack container transportation to the eastern and southern seaboards (Canadian railroads followed suit); and in the later 1980s both double-stack operation and the container’s share of total North American intermodal traffic rapidly expanded.

Operations

The overhead costs of COFC and TOFC are considerable. Both require terminals with high-capacity transshipment cranage and considerable space for internal traffic movement and storage. TOFC also has a cost penalty in the deadweight of the highway trailers’ running gear that has to be included in a TOFC train’s payload. Two principal courses have been taken by railroads to improve the economics of their intermodal operations. One is to limit their transshipment terminals to strategically located and well-equipped hubs, from which highway collection and delivery services radiate over longer distances; as a result, the railroad can carry the greater part of its intermodal traffic in full terminal-to-terminal trainloads, or unit trains. The other course has been to minimize the tare weight of rail intermodal vehicles by such techniques as skeletal frame construction and, as in the double-stack COFC units described above, articulation of car frames over a single truck. Even so, North American railroads have not been able to make competitively priced TOFC remunerative unless the rail component of the transit is more than about 1,000 km (600 miles).

Two different managerial approaches to intermodal freight service have developed in the United States. Some of the major railroads have organized to manage and market complete door-to-door transits themselves; others prefer simply to wholesale intermodal train space to third parties. These third parties organize, manage, and bill the whole door-to-door transit for an individual consignor.

Given the shorter intercity distances, European railroads have found it more difficult to operate viable TOFC services. The loading of a highway box trailer on a railcar of normal frame height without infringing European railroads’ reduced vertical clearances was solved by French National Railways in the 1950s. The answer was a railcar with floor pockets into which the trailer’s wheels could be slotted, so that the trailer’s floor ended up parallel with that of the railcar. Even so, there were limitations on the acceptable height of box trailers. Other railroads were prompted to begin TOFC in the 1960s when the availability of heavy tonnage cranes at new container terminals simplified the placing of trailers in the so-called “pocket” cars. Initial TOFC service development was primarily over long and mostly international trade routes, such as from the Netherlands, Belgium, and northern Germany to southern Germany, Austria, and Italy.

In 1978 the West German government decided to step up investment in its railways for environmental and energy-saving reasons. Its plans included a considerable subsidy of railroad intermodal operation, including TOFC. Similar support of intermodal development, for the same reasons, was subsequently provided for their national railways by the Austrian and Swiss governments. The German railroad (and also Scandinavian railroads) has more generous vertical clearances than the European norm. Whereas other European mainland railroads, even with pocket cars, can only operate TOFC over a few key trunk routes, the German Federal Railway Authority could use the financial support to launch TOFC as well as COFC service between most of its major production and consumption areas.

The Germans, followed by the Austrians and Swiss and then other European countries, developed a particularly costly intermodal technology called “Rolling Highway” (Rollende Landstrasse), because it employs low-floor cars that, coupled into a train, form an uninterrupted drive-on, drive-off roadway for highway trucks or tractor-trailer rigs. Rolling Highway cars are carried on four- or six-axle trucks with wheels of only 36-cm (14-inch) diameter so as to lower their floors sufficiently to secure the extra vertical clearance for highway vehicles loaded without their wheels pocketed. Platforms bridge the gap between the close-coupled railcars. To allow highway vehicles to drive on or off the train yet enable a locomotive to couple to it without difficulty, the train-end low-floor cars have normal-height draft-gear headstocks that are hinged and can be swung aside to open up the train’s roadway. Truck drivers travel in a passenger car added to the train.

In the face of growing trade between northwestern and southeastern Europe, Austria and Switzerland have imposed restraints on use of their countries as a transit corridor by over-the-highway freight to safeguard their environments. Primarily to provide for increase in intermodal traffic, and in particular Rolling Highway trains, the Swiss parliament approved a government plan to bore new rail tunnels on each of its key north-south transalpine routes, the Gotthard and the Lötschen. The Lötschberg Base Tunnel, the world’s longest overland tunnel—a 34.6-km (21.5-mile) rail link—took eight years to build, and when full rail service began in 2007, it slashed the train journey between Germany and Italy from 3.5 hours to less than 2 hours. The 57-km (35-mile) Gotthard Base Tunnel—an even more ambitious project—was opened June 1, 2016, and was the longest and most deeply set rail tunnel in the world. Both tunnels are much longer than older tunnels located higher up in the summit passes, and their tracks are free of the summit routes’ steep gradients and sharp curves on either side of their tunnels.

Passengerintermodals

To save motorists the negotiation of mountain passes, especially in winter, two Swiss railroads shuttle drive-on, drive-off trains for automobiles between terminals at the extremities of their transalpine tunnels. This practice has been elaborated for Channel Tunnel rail transport of private automobiles, buses, and trucks between Britain and France. The tunnel’s rail traffic is partly conventional trains, but it has been bored to dimensions that allow auto transporter trains to employ cars of unprecedented size. Consequently, these trains are limited to shuttle operation between terminals on the British and French coasts. The fully enclosed double-deck cars for automobile traffic measure 5.5 metres (18 feet 4 inches) high and 4 metres (13 feet 5 inches) wide; the latter dimension allows room for automobile passengers, who are carried in their vehicle, to dismount and use the car’s toilet or auto-buffet while the train threads the tunnel. The transporter cars for buses and trucks are single-deck.

Idsrule The Rail Models !Thomas Clark SheddGeoffrey Freeman Allen

I’m glad people liked the introduction to Rails; now you scallawags get to avoid my headaches with the model-view-controller (MVC) pattern. This isn’t quite an intro to MVC, it’s a list of gotchas as you plod through MVC the first few times.

Here’s the big picture as I understand it:

  • The browser makes a request, such as http://mysite.com/video/show/15

  • The web server (mongrel, WEBrick, etc.) receives the request. It uses routes to find out which controller to use: the default route pattern is “/controller/action/id” as defined in config/routes.rb. In our case, it’s the “video” controller, method “show”, with the id parameter set to “15″. The web server then uses the dispatcher to create a new controller, call the action and pass the parameters.

  • Controllers do the work of parsing user requests, data submissions, cookies, sessions and the “browser stuff”. They’re the pointy-haired manager that orders employees around. The best controller is Dilbert-esque: It gives orders without knowing (or caring) how it gets done. In our case, the show method in the video controller knows it needs to lookup a video. It asks the model to get video 15, and will eventually display it to the user.

  • Models are Ruby classes. They talk to the database, store and validate data, perform the business logic and otherwise do the heavy lifting. They’re the chubby guy in the back room crunching the numbers. In this case, the model retrieves video 15 from the database.

  • Views are what the user sees: HTML, CSS, XML, Javascript, JSON. They’re the sales rep putting up flyers and collecting surveys, at the manager’s direction. Views are merely puppets reading what the controller gives them. They don’t know what happens in the back room. In our example, the controller gives video 15 to the “show” view. The show view generates the HTML: divs, tables, text, descriptions, footers, etc.

  • The controller returns the response body (HTML, XML, etc.) & metadata (caching headers, redirects) to the server. The server combines the raw data into a proper HTTP response and sends it to the user.

It’s more fun to imagine a story with “fat model, skinny controller” instead of a sterile “3-tiered architecture”. Models do the grunt work, views are the happy face, and controllers are the masterminds behind it all.

Many MVC discussions ignore the role of the web server. However, it’s important to mention how the controller magically gets created and passed user information. The web server is the invisible gateway, shuttling data back and forth: users never interact with the controller directly.

SuperModels

Models are fat in Railsville: they do the heavy lifting so the controller stays lean, mean, and ignorant of the details. Here’s a few model tips:

Using ActiveRecord

The code < ActiveRecord::Base means your lowly User model inherits from class ActiveRecord::Base, and gets Rails magic to query and save to a database.

Ruby can also handle “undefined” methods with ease. ActiveRecord allows methods like “find_by_login”, which don’t actually exist. When you call “find_by_login”, Rails handles the “undefined method” call and searches for the “login” field. Assuming the field is in your database, the model will do a query based on the “login” field. There’s no configuration glue required.

Defining Class and Instance Methods

Class and instance methods can cause confusion.

user (lowercase u) is an object, and you call instance methods like user.save.

User (capital U) is a class method – you don’t need an object to call it (like User.find). ActiveRecord adds both instance and class methods to your model.

As a tip, define class methods like User.find_latest rather than explicitly passing search conditions to User.find (thin controllers are better).

Using Attributes

Regular Ruby objects can define attributes like this:

Here’s the deal:

  • attr_accessor :name creates get and set methods (name= and name) on your model. It’s like having a public instance variable @name.
  • Define method name=(val) to change how @name is saved (such as validating input).
  • Define method name to control how the variable is output (such as changing formatting).

In Rails, attributes can be confusing because of the database magic. Here’s the deal:

  • ActiveRecord grabs the database fields and throws them in an attributes array. It makes default getters and setters, but you need to call user.save to save them.
  • If you want to override the default getter and setter, use this:

Idsrule The Rail Models Ford

ActiveRecord defines a “[]” method to access the raw attributes (wraps the write_attribute and read_attribute). This is how you change the raw data. You can’t redefine length using

because it’s an infinite loop (and that’s no fun). So self[] it is. This was a particularly frustrating Rails headache of mine – when in doubt, use self[:field].

Never forget you’re using a database

Rails is clean. So clean, you forget you’re using a database. Don’t.

Save your models. If you make a change, save it. It’s very easy to forget this critical step. You can also use update_attributes(params) and pass a hash of key -> value pairs.

Reload your models after changes. Suppose a user has_many videos. You create a new video, point it at the right user, and call user.videos to get a list. Will it work?

Probably not. If you already queried for videos, user.videos may have stale data. You need to call user.reload to get a fresh query. Be careful — the model in memory acts like a cache that can get stale.

Making New Models

There’s two ways to create new objects:

  • User.new makes a new object, setting attributes with a hash. newdoes not save to the database: you must call user.save explicitly. Method save can fail if the model is not valid.
  • User.create makes a new model and saves it to the database. Validation can fail; user.errors is a hash of the fields with errors and the detailed message.

Notice how the hash is passed. With Ruby’s brace magic, {} is not explicitly needed so

becomes

The arrow (=>) implies that a hash is being passed.

Using Associations

Quick quiz, hotshot: suppose users have a “status”: active, inactive, pensive, etc. What’s the right association?

Hrm. Most likely, you want belongs_to :status. Yeah, it sounds weird. Don’t think about the phrase “has_one” and “belongs_to”, consider the meaning:

  • belongs_to: links_to another table. Each user references (links to) a status.
  • has_one: linked_from another table. A status is linked_from a user. In fact, statuses don’t even know about users – there’s no mention of a “user” in the statuses table at all. Inside class Status we’d write has_many :users (has_one and has_many are the same thing – has_one only returns 1 object that links_to this one).

A mnemonic:

  • “belongs_to” rhymes with “links_to”
  • “has_one” rhymes with “linked_from”

Well, they sort of rhyme. Work with me here, I’m trying to help.

These associations actually define methods used to lookup items of the other class. For example, “user belongs_to status” means that user.status queries the Status for the proper status_id. Also, “status has_many :users” means that status.users queries the user table for everyone with the current status_id. ActiveRecord handles the magic once we declare the relationship.

Using Custom Associations

Suppose I need two statuses, primary and secondary? Use this:

You define a new field, and explicitly reference the model and foreign key to use for lookups. For example, user.primary_status returns a Status object with the id of “primary_status_id”. Very nice.

Idsrule The Rail Models Rc Airplanes

Quick Controllers

This section is short, because controllers shouldn’t do much besides boss the model and view around. They typically:

  • Handle things like sessions, logins/authorization, filters, redirection, and errors.
  • Have default methods (added by ActionController). Visiting http://localhost:3000/user/show will attempt to call the “show” action if there is one, or automatically render show.rhtml if the action is not defined.
  • Pass instance variables like @user get passed to the view. Local variables (those without @) don’t get passed.
  • Are hard to debug. Use render :text => 'Error found' and return to do printf-style debugging in your page. This is another good reason to put code in models, which are easy to debug from the console.
  • Use sessions to store data between requests: session[:variable] = “data”.

I’ll say it again because it’s burned me before: use @foo (not “foo”) to pass data to the view.

Idsrule The Rail Models Trains

Using Views

Views are straightforward. The basics:

  • Controller actions use views with the same name (method show loads show.rhtml by default)
  • Controller instance variables (@foo) are available in all views and partials (wow!)

Run code in a view using ERB:

  • <% ... %>: Run the code, but don’t print anything. Used for if/then/else/end and array.each loops. You can comment out sections of HTML using <% if false %> Hi there <% end %>. You get a free blank line, since you probably have a newline after the closing %>.

  • <%- ... %>: Run the code, and don’t print the trailing newline. Use this when generating XML or JSON when breaking up .rhtml code blocks for your readability, but don’t want newlines in the output.

  • <%= ... %>: Run the code and print the return value, for example: <%= @foo %> (You did remember the @ sign for controller variables passed to the view, right?). Don’t put if statements inside the <%=, you’ll get an error.

  • <%= h ... %>: Print the code and html escape the output: > becomes >. h() is actually a Ruby function, but called without parens, as Rubyists are apt to do.

It’s a bit confusing when you start out — run some experiments in a dummy view page.

Take a breather

The MVC pattern is a lot to digest in one sitting. As you become familiar with it, any Rails program becomes easy to dissect: it’s clear how the pieces fit together. MVC keeps your code nice and modular, great for debugging and maintenance.

In future articles I’ll discuss the inner details of MVC and how Rails forms work (another headache of mine). If you want a jumpstart on the nitty gritty, browse the Rails source and try to follow the path of a request:

Idsrule The Rail Models N Scale

Models
  • WEBrick server modified to call the Rails routing library and dispatcher.
  • Rails Dispatcher actually creates the controller and passes it data.
  • ActionController Base defines many functions, including those to call a controller action (using appropriate defaults), render text, and return a response.

But all in good time my friends — I’ll explain it as I understand it. And if you had any forehead-slapping moments with MVC, drop me a note below.

Other Posts In This Series