Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Minecarts and T-Junctions  (Read 3159 times)

WanderingKid

  • Bay Watcher
  • The Overfiend
    • View Profile
Minecarts and T-Junctions
« on: July 25, 2013, 01:12:32 am »

This more likely belongs in the 'How does minecart?' thread, but that's been dead over a year and I'm not feeling overly necromancish today.

Here's the short version... I want to enter a T-Junction from the side.  Preferably with a consistent turn radius and without power of any form.  If I have to run power it'll detract heavily from the 'ease of use' concept I'm trying to do.

So, here's the issue in shorthand.  If you have a T-Junction like so, and you're entering from the left (heading westbound):

  ||
  ||
  ||
 O|=======
  ||
  ||
  ||


Your cart will do one of two things.  If O = Open space, you derail.  I haven't gotten the cart slow enough (and continued moving) yet to find out what speed it won't derail the T-Junction at.  It's somewhat less than 20k, which is push speed for a cart.

If O = Wall, the cart stops dead.

Why is this important?  Because I'm trying to do something like this:


All leave this direction.
^
||
||
||
|===== Cart 1
||
||
|===== Cart 2
||
||
|===== Cart 3


Because I don't know when/if Carts 2/3 are departing (and this is a short sample, I'm thinking more like 8-10 of these), a simple switch on outbound cart 1's track to lift a bridge and hit a turn may cause some traffic jams, as bridge raising/lowering seems a bit sporadic when hit by cart switches, but I may have simply not done enough experimentation.

So, for those who have done the science before me, has anyone figured out a way to make a switchless track that can handle T-Junction style inputs?  At this point I'd be willing to impulse ramp up the carts and 'drop' them in the right direction, but my understanding is that when a cart drops a z-level via flight (instead of track ramp) it loses forward momentum.  Because they're all going the same direction, In theory something like the following could work where they derail across the corners:


^
||
||
L=====
||
||
L=====
||
||
L=====


... but I'm wondering how well that's worked for others in the past?

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Minecarts and T-Junctions
« Reply #1 on: July 25, 2013, 03:37:23 am »

My findings for track switching:

Bridge: powerless, slow because of the activation delay, reliable, but I don't know what happens when the bridge is switched with a cart on top. Nothing good I guess...

Derailing: powerless, reliable, but you need impulse/down ramps to accelerate the cart above 50k IF you want to derail off a corner onto a straight track, and you have to be careful with fast carts because they will slam into the wall if you want to send them into a downramp afterwards. I have not yet found the perfect way to do it, the testing I did with a spiral ramp indicates that there's something to do with corners, the cart seem to "remember" for a few tiles that it left a corner, and won't enter a ramp, but shotgun instead. Science is needed there.
Two methods are possible: Either block the derail path with a door, or use a track stops that slows down carts that you don't want to derail. Door based is easier to build, for track stops you need to regulate cats speeds -very- precisely.


Roller based: powered, fastest switching, possible to do instantly, my preferred method because you can switch off the trackswitch with a second pressure plate linked to a second gear, so for example it's possible to do a track switch that separates empty carts from full ones based on weight. First p.plate activates a gear next to the roller, a second p.plate cuts power to the first gear, then for 100 ticks the switch sleeps until the plates reset.
Problems: the cart needs to be going slower than the roller speed, otherwise it will just ignore it, and you need to build walls to block the cart from going off track, because a perpendicular roller will send the cart at ~45 degrees without a wall covering the angle. And when a cart is off the track this way it won't rerail even if there's a valid track in it's path.

Floor hatch instead of bridge does not work, it acts as a track tile instead.

That's partly why I started making my minecart speed calculator, because you need to know the speed of the cart to switch reliably.


If I understand correctly what you are trying to build, this may help with ideas:

First (outdated) plans for a production floor with the first version for a station design.
https://dl.dropboxusercontent.com/u/36491887/production_floor_plan.png
Color codes
gray: track system
red: power system
yellow: loop doors
orange: living rooms, 42/modul
purple: stockpiles
brownish: workshops, dining room, statue garden

This covers 3z levels with stockpiles and cart stations on the 1st and 3rd floor, 2nd z level contains the power connections, axles, workshops. This is supposed to be a standalone burrow.

https://dl.dropboxusercontent.com/u/36491887/launching_loop_6.png
And this is the 6th design for a minecart station that can automatically launch, stall and receive empty minecarts if you build the proper pressure plates. Tested, 100% reliable. There are 2 security features to stop carts from colliding, LOOPSYS and Local LOOP, both are designed to keep the MED roller from activating, so the cart stays in the small loop driven around by the LOW roller waiting for a green signal. Roller speeds and the position of the walls are important, any other speed and the cart derails.

Of course this design needs very complex logic gates to make it automatic:
https://dl.dropboxusercontent.com/u/36491887/logic_board.png

Logic board is two memory cells coupled together - shown on the right. The sequence on the left shows how the logic circuit switches the tracks/trackstops along its route. We have 4 pressure plates signals/route along the tracks, PP1 switches GA, PP2 switches GB after the cart reached it's destination dumping track stop, PP5 switches GD and resets the system, and PP4 switches off the catching roller of the station - unnecessary, but minimizes the chance of capturing a cart that we don't want. PP2, PP5 are weight adjusted, they only give a signal when they detect the cart to be empty. I can see that the numbering is a bit off. :)

Production floors are connected by a spiral ramp that spans the whole fort from top to the magma see. Any cart that's full and launched by a push will wait for a "green signal" that's controlled by the security loops, find it's dumping track stop and return to it's launching station.
« Last Edit: July 25, 2013, 04:37:15 am by fricy »
Logged

WanderingKid

  • Bay Watcher
  • The Overfiend
    • View Profile
Re: Minecarts and T-Junctions
« Reply #2 on: July 25, 2013, 03:51:33 am »

Well, I found a reliable way of pushing carts, I think, onto the same track, from the equivalent of a multi-track magazine.  Finalizing testing on that, it steals heavily from the impulse ramp idea without the impulse part.  I just want to confirm re-rails itself when it trips over a derail, particularly after your above comment.

My minecart multi-splitter is non functional with bridges right now, unless I can find a way to overlap a pressure plate and a track stop.  They obstruct one another as buildings.  I'm looking into abusing the T-Junction design as a stopper for the cart, but leaving it on the track.  That'll keep it from turning off into never never land and I can park it right on the pressure plate I want.  Another option includes leaving a 'dead' cart on the track stop and just bouncing the new cart into it, but I still end up with a rail dead-head that way so it's not my preference.

Yeah, I'm going to try adjusting the test structure for using the T-Junction to force a stop on a pressure plate yet allowing for the cart to remain 'tracked'.  Back to my basic minecart science.  Really hoping this works... it would seriously simplify massive ore and stone deliveries over significant Z.

Larix

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #3 on: July 25, 2013, 04:27:40 am »

Unless i misunderstand, you don't actually want the carts to switch, but rather to join a common track?

Your diagram with the Track corners instead of t-junctions should do exactly what you want; carts coming from south will simply 'skip' their unconnected track ends and continue in a straight line, following the north branch of the corner. This isn't proper derailing after all - derailing is specifically what happens when a cart enters a track _corner_ from one of the 'legal' input directions and is going so fast that it ignores the corner. That only happens at speeds >50k. A cart encountering a 'dead end' like a cart coming from south going straight north and finding a tile with a W-E (or a SWE junction) has no unique legal exit direction and will simply 'jump track'. I'm not aware of any speed requirement or friction penalty for this behaviour, the cart pretty much pretends there's an ordinary SN track there.

Carts will 'thread into' the main track by following the track corners, carts already on the S-N track will simply continue straight north when encountering the corners.

Actual track switching, i.e. making a cart 'choose' between two possible directions can be done, as said above, most reliably and bug-free with rollers (requires power), with bridges (slow operation, minecart gets thrown and stopped (or crushed) if it's on top of the bridge while it switches) or via hatch covers (requires changing levels - hatch covers on top of flat track corners are ignored, the cart will follow the corner). Switching via hatch cover must be done by hatch covers over 'holes', preferably containing track ramps, and the more reliable method takes a lot of operation speed, either from rollers again or from abusing the ramp glitches - cf. my 'ridiculously overblown abacus' thread, all computation there is based on ramp-glitch powered carts switched through hatch covers over track ramps. You can combine the methods, e.g. a roller switch pushing the cart up a ramp with a hatch on top - the cart's exit path will depend on whether the roller is on _and_ on the open/close state of the hatch.

Switching with rollers can be done without adjacent walls:

.|
.|..
.L--
.|..
.|

The cart enters from the south and the roller is supposed to switch it between north and east outputs. The roller must be put on top of the corner or north of it and must push from north to south, i.e. _against_ the incoming cart's movement direction. If the cart isn't going extremely fast (100k+), the roller will switch its movement to southward, at the roller's speed. The cart will follow the southern direction and take the track corner, leaving to the east. This even works with a one-tile roller sitting right on top of the track corner, the cart is treated as though it entered the tile from the north when it's affected by the roller.
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Minecarts and T-Junctions
« Reply #4 on: July 25, 2013, 04:47:19 am »

My minecart multi-splitter is non functional with bridges right now, unless I can find a way to overlap a pressure plate and a track stop.  They obstruct one another as buildings. 
Yeah, it's not possible, only one of them/tile. Would be so much easier though. :)

Switching with rollers can be done without adjacent walls:

.|
.|..
.L--
.|..
.|

The cart enters from the south and the roller is supposed to switch it between north and east outputs. The roller must be put on top of the corner or north of it and must push from north to south, i.e. _against_ the incoming cart's movement direction. If the cart isn't going extremely fast (100k+), the roller will switch its movement to southward, at the roller's speed. The cart will follow the southern direction and take the track corner, leaving to the east. This even works with a one-tile roller sitting right on top of the track corner, the cart is treated as though it entered the tile from the north when it's affected by the roller.

Niiiice. I guess a 6 tile long roller could even switch max speed carts. Have you tried it?

WanderingKid

  • Bay Watcher
  • The Overfiend
    • View Profile
Re: Minecarts and T-Junctions
« Reply #5 on: July 25, 2013, 04:50:10 am »

Cool, I think you're right, I think I'm going to want to use hatches in my splitter component.

Short form of intended final result: I want to build a multi-cart circuit from point A to point B, with carts able to go to any of the available stop stations when they return on the circuit.  Admittedly I'm trying to keep my questions a bit more discreet in their particular concern so that I don't get overwhelmed, but the end idea is something like this:


          r==========¬
          r==========¬
          r==========¬
          r==========¬
          r==========¬
         ||          ||
         ||          ||
         ||          ||
          L==========/


So, basically it'll have 5 (or more) loading bays in one area, swing down through a second, dump off (and perhaps split for a return load delivery, or not), and then load into whatever bay happens to be available at the time.

EDIT: I meant to ask, do you have a link handy for the track switch via hatch bit?  Helps if I have something to work off of.

EDIT 2: After some research on pressure plates, I may have an answer, though it might be a bit odd.  Will require derail speeds and on/off gears to control bay allowances, as those are the only perma-toggle items that I can include in the loop.

Larix

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #6 on: July 25, 2013, 05:35:36 am »

I'm afraid i haven't produced a proper document for it yet, it really seems like i've invented (or possibly re-invented, you never know) the very concept.

The simplest approach towards a hatch switch would be this:

Side view:
  H__
__/#
H is the hatch cover over the opening of the ramp; to work as a switch, it must be connected via mechanism. Cart moves from left to right, and back to the left when hatch is closed.

Top view with the crucial 'false' output branch, a track corner.
U
R
L->
|
|

Cart enters from south, treats the north-east corner L like plain straight track and tries to go up the NS track ramp R. There's a hatch cover over the opening of the ramp, on the level above. If the hatch is open, nothing spectacular happens, the cart just goes up the ramp and continues on the level above (U). If the hatch is closed, the cart cannot go up the ramp but rather bumps into the wall, picks up speed in the opposite direction by accelerating 'down' the ramp, and follows the track corner, leaving to the east. A simple binary switch, but it introduces all the FUN of handling vertical movement of minecarts. It can be frustrating to troubleshoot such a design. I heartily recommend playing with it and trying out stuff, but if you want to get a minecart system operational, roller switches are better for your sanity.
Logged

Repseki

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #7 on: July 25, 2013, 06:38:36 am »

@fricy, awesome automated system. I of course now must fail at creating it in game.

Do you have everything dumping at a single stock floor, or are there magical ways of sending the carts to different dump stops?
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Minecarts and T-Junctions
« Reply #8 on: July 25, 2013, 07:03:36 am »

@fricy, awesome automated system. I of course now must fail at creating it in game.

Do you have everything dumping at a single stock floor, or are there magical ways of sending the carts to different dump stops?

The general concept and design problems are discussed in this topic, I don't have the final plans yet, because I need a reliable regulated  ramp spiral to build it, and for that I started to put together a minecart speed calculator, which is still unfinished, so plans are on hold at the moment... I want to build a spiral ramp that regulates minecart just below derail speed, and by switching off a trackstop the cart will derail out of the spiral on the floor I want it to. The idea is to have 8 launching stations and any number of receiving stations/burrow + 1-2 launching stations at mining floors. On the plan the left side is the launching part, right side is the receiving.

The "magical way" to send the cart to different stops depends on getting the cart out of the spiral at the right z level, only having one full minecart in the system at any given time (plus any number of empty ones), and activating the right dumping track stop at the right time. These depend on weight adjusted pressure plates, and some clever design in the logic circuits.

The material/power requirements are of course crazy: Last calculations just for building the driving logic for 5 burrows with 8 automated cart lanes/burrow comes to about 1000 gears, 150 ropes and 40 wood, maybe more, depending on how you connect the memory cells. And that's !without! any linking. So guess. :) Plus the stations, security circuits, etc.
Power usage is: about 600 for the logic board, +8/spiral z levels + the stations (I don't know.).
It's a megaproject in itself.
« Last Edit: July 25, 2013, 07:18:03 am by fricy »
Logged

Repseki

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #9 on: July 25, 2013, 07:08:42 am »

Well then, I guess I'll wait to see how things turn out, good luck getting things working.
Logged

Larix

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #10 on: July 25, 2013, 09:15:27 am »


I guess a 6 tile long roller could even switch max speed carts. Have you tried it?

I didn't have that much speed available, but a cart that went down a straight forty levels (and seemed to be moving at well over 100k, probably around 150k) was switched at the third roller tile.

I just followed a descending cart in single steps and the movement pattern gets pretty strange - somewhere around z30, the cart alternated between spending a step on a level and moving down two levels at once. This happened four or five times in a row, until the cart had picked up enough speed to descend a full level on the 'off' steps, too. When it arrived on the bottom level, it moved one tile on the first step and _three_ on the second.
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Minecarts and T-Junctions
« Reply #11 on: July 25, 2013, 09:38:44 am »


I guess a 6 tile long roller could even switch max speed carts. Have you tried it?

I didn't have that much speed available, but a cart that went down a straight forty levels (and seemed to be moving at well over 100k, probably around 150k) was switched at the third roller tile.

I just followed a descending cart in single steps and the movement pattern gets pretty strange - somewhere around z30, the cart alternated between spending a step on a level and moving down two levels at once. This happened four or five times in a row, until the cart had picked up enough speed to descend a full level on the 'off' steps, too. When it arrived on the bottom level, it moved one tile on the first step and _three_ on the second.

If you are using DFhack r3 there's a minecart watcher script in the hack/scripts/devel folder that can tell you the exact speed of the minecart if you set up a keyboard shortcut for it. (calling the script from the console does not work.) So using this script I logged a lot of data, and I can confirm that this skipping happens on ramps and straight tracks also, and this means a cart -can and will- fly through track stops without slowing down. It starts around 160k speed which takes around 18-20 straight ramps to achieve (depending on the starting speed). Highest speed roller from z153 will skip first from 135-»133, medium from the same levels will skip first 134-»132, then it will skip randomly, sometimes one tile, sometimes 2, and other times it spends 2 ticks on the same level. I don't know the logic behind it yet.


So back to topic: according to my logs 40 z levels on a straight ramp is ~245k speed. 3x highest roller is 150k speed. I need to test this, sounds strange, not to mention that some skipping »should« happen.
« Last Edit: July 25, 2013, 09:57:37 am by fricy »
Logged

Larix

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #12 on: July 25, 2013, 10:14:28 am »

I deleted DFHack after one too many crashes in the military menu.

[fiddles with forum search]
Ah, here we are: in the
'quantifying minecart physics' thread, the poster electrobadger noted the following:
Quote
[item 16] Reverse roller running. If a cart tries to go the wrong way through a reverse roller, its velocity is decreased by 1 as it exits the tile. If the velocity goes negative (the cart would be travelling back the way it came, i.e. in the direction of the roller) it is immediately accelerated to the above roller speed. Crucially, this means a Highest speed roller can never launch a cart the wrong way through a Lowest speed roller.

If this works exactly as advertised, i'd like to add that three tiles of roller should be able to put even the fastest minecart in reverse. Just put a single trackstop on the 'switch' corner or bump the cart against a wall and you have a powerful (and power-consuming) brake.

The velocity above is given in tiles/step, i.e. a velocity decrease of 1 means 100 000 conventional units. If the cart was actually moving at 240k+ (somewhere around that, there was a corner track ramp in there, but a single one of these doesn't seem to have unusual effects), then 3 roller tiles -> - 300 000 speed = speed turns negative on the third reduction and cart reverts, gets switched out of the straight line.
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Minecarts and T-Junctions
« Reply #13 on: July 25, 2013, 12:40:48 pm »

Hmmm, possible, up to know I had trouble understanding what electrobadger meant with "1 velocity". That post was made before the exact mechanisms for cart behavior was researched properly. Could be a powerful break indeed, it was scary seeing a max speed cart passing 7 highest track stops and slam into the wall, if rollers work this way they are much better for stopping them.

And what do you mean by a 'single corner ramp not having the usual effect'? As far as I know corner ramps only decrease speed by -10/tick plus -1000 upon leaving the tile. So first c.ramp is the usual +4890 + -1000, and only the ramps following it are bugged?
I have not played with them this far.

@WanderingKid: sorry for hijacking your thread, it happens sometimes. :)

Larix

  • Bay Watcher
    • View Profile
Re: Minecarts and T-Junctions
« Reply #14 on: July 25, 2013, 01:16:11 pm »

Free-moving carts on a spiral made of corner ramps often derail - although there are only ramps to move on. At some point they go off the track, slam into walls and lose their cargo. The spirals i tried were perfectly functional, a guided cart passed them without complaint. They just couldn't be used with 'push'. I haven't had problems with corner ramps if there were only one or two of them, and they were at least 5 tiles/levels apart.

I've no idea what causes the derailing, the tracks were all ramp, and long _straight_ ramp courses are safe enough for dwarfs to ride. It almost seems like the carts ended up moving diagonally at some point.
Logged