Savefile for train testing

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Savefile for train testing

Post by aaargha »

What is this?
This is the save file where I've built setups to test various train related things, most notably the 4-way intersection tests. Now that the multi-lane setup is completed, and seems to be usable and reliable enough, it's time to release it so people can test their stuff without having to rely on me being available to do it. I'll of course still look at and test any submissions in the comparison thread, this just allows people to test as they design, and also review my setups.

Anyway, take a look around, try the different setups, and "steal" anything that looks good. I'll be happy to answer questions or provide further explanation about any of the setups if needed.

Final advice before you load it up: don't move, keep calm, zoom out and enjoy the show for a while :D
aaarghas train test map.zip
(14.87 MiB) Downloaded 757 times
Requirements
Factorio 0.15.18 - version save was created in.
Creative mode 0.3.5 - needed for all setups to even run, you can still look around without it but nothing will work
Automati train deployment 0.1.0 - needed to make the multi-lane throughput tester work.

This is what the save was created with, newer versions will probably work fine as well.

Mods also used in the save but are optional:
Foreman 2.0.4 - import pre 0.15 blueprints, flip blueprints
Infinizoom 0.1.1 - zoom out to be able to place large blueprints
Screenshot camera 0.4.0 - take pictures

Usage
Some controls that are shared between most setups:
The controls for a setup can usually be found by the train stop named CONTROLS.
Most setups are controlled by a constant combinator outputting iron/copper plates.
If there is no power to the setup just put down an active power source by a nearby super substation.
If there is an inserter with some rail signals dropped around it it is a reset switch, usually for counters, just rotate it to reset things.
See below for each areas special controls.

Areas
Map
Multi-lane throughput test
Can handle 2- to 8-lane RHD or LHD intersections. Has support for 10 different profiles to test different train lengths, wagon compositions, fuel types, or distributions of left/right/no turns. Currently only 3 are in use and more can be added if needed. For more details on changing the trains please see the Automatic train deployment forum thread.

In the controls area the things on hazard concrete are the things you probably want to mess with. The green signal combinator is used to launch the trains, just turn it off to get things moving. Use R to toggle between LHD and RHD (only selects the correct counters). Use P to select which testing profile to use, only 1-3 are provided.

Results are available on the medium pole on the hazard concrete (detailed train count can be seen on the two poles just above it, useful if it goes above 1k).

To set up a test simply clear out the previous intersection, make room for the one you want to test then extend the in-/output rails to the intersection (a few trains left over from earlier tests may run now, this is normal and happens when using rails not part of the previous run). Make sure the connections are symmetrical and that you use the same ones in all directions, ex: if you choose the outermost rail as input you must also use that one as output. Also make sure that the output blocks are properly sized. The trains automatically adapts to LHD or RHD intersections and which rails are in-/output. Next you want to select which profile to use, turn R on (RHD) or off (LHD) to use the correct counters, then turn of the -10k green signal to launch the trains. To reset the counters and timers just rotate the inserter once.

2-lane throughput test
Old throughput tester can handle 2-lane LHD and RHD intersections. Use signal R to decide between LHD and RHD.

The red wire is used for control signals, the green for results. Locomotive is the number of trains that has left the intersection, M is time passed in minutes and R is trains per minute rounded down.

Spread around it are the results of some old tests.

Deadlockomatic
What started it all. Inspired by how /u/Yoyobuae used to wreck intersections by exploiting the path changing bug.

To test path changing deadlocks, can do one train straight to left/right, and two train straight to left/right. Can handle both RHD and LHD intersections, just move the trigger chain signal to the correct rail.

The signals E and W control which directions the trains are to be released from. L and R decide of a right or left turn should be executed (only use one at a time).

The copper plate signal launches the trains, turn it off to reset for nest test. If both trains end up on the same side just toggle it on and off once quickly.

Stacker test
Testing how to make starvation free stackers. Final design is to the right, it only works when all the stations the stacker leads to has the same name.

Throughput test
Comparing the throughput of RoRo vs terminus stations.

Bypass test
Exploring how to fix problems with a bypass lane.

Omni station test
The idea is that depending on what the train brings to the station it will get loaded with different things. Inspired by a reddit post that I can't seem to find. It used some kind of pre station to decide which items to load instead of looking at the unloaded cargo.

Unloader design
Design to try to get as many blue belts from a wagon as possible (while still being reasonably sized).

Disable station test
Small setup to try to figure out what happens when you disable stations in different circumstances.

Station select test
Setup to test how far out a train would look for a new station if the closer one was already occupied, got bored at 3k tiles :)

Path changer
A small device that makes any train travelling through it re-evaluate its path.

Inserter test
Trying to precisely control inserters picking from mixed belts using circuit controlled filters before override stack size was a thing.

Fluid mix test
Test to create station that can handle mutiple fluids, supports 3 different fluids per cart.

Priority test
Used to try to figure out which train would get access to a shared block first. Current guess is lowest train ID first, so I guess in build order.

Signalling guide
Made for the post here about optimizing signals in an intersection.

6-lane design/test
Some pieces of my part of an old collaboration project with /u/RattlemBones.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 108
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: Savefile for train testing

Post by db48x »

Amazing. There are a lot of toys on this map.
User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Savefile for train testing

Post by 5thHorseman »

This is an amazing resource. Thank you for making it available!
pieppiep
Fast Inserter
Fast Inserter
Posts: 170
Joined: Mon Mar 14, 2016 8:52 am
Contact:

Re: Savefile for train testing

Post by pieppiep »

What happens if for example the path north to east is not available for whatever reason? Will this test just count how many trains throughput is available in all other directions?
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

pieppiep wrote:What happens if for example the path north to east is not available for whatever reason? Will this test just count how many trains throughput is available in all other directions?
The counters won't have any problems, they just count how many trains reach the exits. What will be a problem though is if you don't adjust the possible destinations of the trains that spawn, if a train spawns that wants to take a path it can't it will prevent new trains from spawning on that lane. So if you, for example, want to test a 3-way crossing instead of a 4-way you'd need to create a new profile where you don't include one side as a possible destination.

It might be possible to add better support for this in the mod but I'm not really sure of a good way of handling that at the moment.
User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Savefile for train testing

Post by 5thHorseman »

I feel like I'm not smart enough to use this map.

How much of that multi-lane area is what you were testing, and how much of it is the thing being tested? What's the best way to get the trains out of the way first? In the OP you say there may be "some" left over and they'll get out of the way. In my experience they're littered throughout the area and even if they're on rails, they continually read "no path" until I remove them.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

5thHorseman wrote:I feel like I'm not smart enough to use this map.

How much of that multi-lane area is what you were testing, and how much of it is the thing being tested? What's the best way to get the trains out of the way first? In the OP you say there may be "some" left over and they'll get out of the way. In my experience they're littered throughout the area and even if they're on rails, they continually read "no path" until I remove them.
The first thing you'll want to do, before you start tearing things down, is to head down to the controls by the south spawner and turn on the -10k green signal constant combinators. That will stop new trains from spawning and the trains already in the test area should drain off as they reach their destinations. Once there are no more trains travelling you can deconstruct the intersection, build your new one, connect the rails to the spawners, select which profile you want to use and then start the trains by turning off the green signal constant combinator.

The leftover trains mentioned in the OP will be waiting in the spawners for the lanes that were not used in the previous test, I only mention them as they can come blasting through when you're connecting the spawners to the intersection you want to test and that that is expected behaviour.

If anything is still unclear, don't hesitate to ask.
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

I've hit a bit of a snag trying to get this to work (But see edit at bottom). I'm on the latest Factorio version at this time, 0.15.28, and I've tried both the latest Creative Mode, 0.3.7, and the exact version used in the save, 0.3.5 -- but either way I get an error when attempting to load the save:
Notice
Attempt to remote call outside an event.
stack traceback:
(square)__creative-mode__/control.lua:73: in main chunk
I really, really don't want to mess about with trying a downgrade of my Steam install of Factorio itself, as all my games were last saved with the current version, not to mention that would lose the 0.15.27 chain signal rerouting fix... And on the Factorio website, the experimental releases only go back to 0.15.23. I don't know what else to try, though. I guess I could back up my saves and stuff, install 0.15.18 through steam, copy it somewhere else, and then reinstall 0.15.28 maybe...

Any suggestions? Or an updated version of the map?

(I will admit that even without creative mode installed, loading it up and being right smack in the middle of that Flower Mk3 for several waves of trains to pass by in each direction is an interesting experience. I love how they end up crossing in groups like that!)

Edit: It turns out that the map will load correctly on version 0.15.23 with the latest Creative Mode! I haven't tested any other versions, but apparently the change that broke it happened between .23 and .28 -- I don't know if re-saving it and then loading that in .28 will help...
Patashu
Fast Inserter
Fast Inserter
Posts: 130
Joined: Mon May 08, 2017 11:57 pm
Contact:

Re: Savefile for train testing

Post by Patashu »

There was a change to modding in .27: 'Fixed that mods could do remote calls outside of events when the game isn't in a valid state.'

This breaks any mod that does this as part of normal operation, including Creative Mode. Until the author of Creative Mode fixes the mod, you won't be able to use it in .27 on.
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

Thanks for the info, Patashu! I don't usually pay as much attention to the 'modding' sections of the patch notes since I've never worked on one for this game. Fortunately I do have a working test setup running now on this alternate .23 install.

Aaargha: I had wanted to test some expanded interchanges sized for 2-6-2 trains... But it took over an hour of frustration to figure out how to get it to spawn trains again after changing the templates! I finally realized that any modification of the parked trains caused them to no longer count as properly parked at the station, requiring all 48 templates to not only be expanded but also manually reversed and then switched back to automatic so they'd park themselves properly as P was cycled to activate their stations!

Got it working, and it turns out that greater train length is going to reduce the trains per minute count just as a natural consequence of being able to fit fewer trains on the same amount of track, regardless of their acceleration.

After figuring that out I decided to try the expanded interchange with the shorter trains the rest of the testing posted in the other thread has been done with, so I took the blueprint into an unmodified copy of the map and rebuilt it there... and suddenly it's gone from barely 50 TPM to nearly 80, even without adjusting any signals! After some careful work on that, the result on P1 was 82 TPM, significantly higher than either of my prior 2-lane interchanges that I based it on. Wow! Maybe I should post this design on your testing thread? :D

Edit: When to use P2 or P3 should probably be mentioned too. I think I've finally managed to puzzle it out based on the probabilities listed in your testing thread and the configurations of the template trains -- P2 has 35% right and 15% left, and P3 has the opposite, and the testing thread says that your set 2 LHD tests have 35% left turns, so that's P3, and RHD have 35% right turns, making that P2. (Turns out this 82 TPM thing still gets 77 on P3!)
evildogbot100
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Dec 18, 2016 3:02 pm
Contact:

Re: Savefile for train testing

Post by evildogbot100 »

How do I tweak the chance for each train direction?
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

The twelve template trains at each end -- or at least, the eight which don't have equal chances of going to each station -- have a "cargo > X" wait condition setting for each station other than the one they're being spawned from (which always has another, different condition). The X assigns the percent chance of being directed to that station. Actually, I don't know if they have to add up to 100 or could be any ratio, but three values which add up to 100 like the defaults for P2 and P3 are a safe bet. If you're looking for it in the list to assign a new wait condition it's listed as "item count" instead of "cargo", and you just leave the item type blank and the comparison on greater-than.
TBTerra2
Inserter
Inserter
Posts: 49
Joined: Wed Apr 05, 2017 12:57 pm
Contact:

Re: Savefile for train testing

Post by TBTerra2 »

as can be seen in the 4 way intersection thread, we are starting to get silly large junctions that dont fit on the grey anymore, does anyone know how to make more grey area?
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

Yeah, that's done using the creative mode magic wand, configured (using the menu in the upper left) to create "lab tile" (there are several shades of grey) and then dragging out an area just like using blueprints and deconstruction. I ended up moving out some of the power poles that were crossing diagonally around the corners of the test area too, in order to make even more room. :D
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

Oh man, things sure did happen while I was away from civilisation. The save seems to be working again, at least when on Factorio 0.15.30 and Creative mode 0.3.9. I'm glad you guys managed to figure stuff out and also that, for once, it was not my stuff that broke :)
Tallinu wrote:Aaargha: I had wanted to test some expanded interchanges sized for 2-6-2 trains... But it took over an hour of frustration to figure out how to get it to spawn trains again after changing the templates! I finally realized that any modification of the parked trains caused them to no longer count as properly parked at the station, requiring all 48 templates to not only be expanded but also manually reversed and then switched back to automatic so they'd park themselves properly as P was cycled to activate their stations!
Yeah, this is probably the most annoying part of the mod currently. At the moment I'm not really planning on changing it, while it is a bit finicky it is a good way to make sure that the correct train gets selected as source. The "snap to station" feature when building locomotives that was added pretty recently also makes this much less of a problem as you don't need to drive the trains around any more.
Tallinu wrote:Edit: When to use P2 or P3 should probably be mentioned too. I think I've finally managed to puzzle it out based on the probabilities listed in your testing thread and the configurations of the template trains -- P2 has 35% right and 15% left, and P3 has the opposite, and the testing thread says that your set 2 LHD tests have 35% left turns, so that's P3, and RHD have 35% right turns, making that P2. (Turns out this 82 TPM thing still gets 77 on P3!)
This is right on the money. I'll add a blurb about this in the OP. I'll also take a look at your posts in the testing thread, I just have to catch up :)
evildogbot100 wrote:How do I tweak the chance for each train direction?
Like Tallinu said the probability is determined by the wait condition, however it is only percentage based if you make the numbers add up to 100, it really is used as relative weights, default (no condition) is 100. For example if station A has "cargo > 1", B has "cargo > 200", and C has "cargo > 1000": B will be 200 times more likely than A to be chosen as destination, and C is 5 times more likely than B and 1000 times more likely than A. In a "perfect" world spawning 1201 trains will send one to A, 200 to B, and 1000 to C.
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

aaargha wrote:The "snap to station" feature when building locomotives that was added pretty recently also makes this much less of a problem as you don't need to drive the trains around any more.
Unfortunately I'm not sure that actually helps. I know it doesn't if you're modifying an existing template train so that you don't have to recreate the schedule settings from scratch. Any time I make changes to a train that was properly set up and working, it changes out of automatic mode and doesn't start working again just by turning it back on, I have to reverse it and then turn it on and cycle P through the various templates once they'r all done to get them to re-park themselves correctly.

And even then I ran into yet another weird issue that I had to work around yesterday when I was testing a template train with zero cargo wagons (and a whole lot of rear-facing locomotives) to compare the acceleration of long, heavy trains on straight tracks (against one with wagons instead of the rear locos). It turned out that the trains were advancing to their "next stop" after parking at the template station (due to having zero cargo space, therefore cargo was full and the wait condition was met), and not having the template train stations as their current destination, even if they are still parked there, is apparently another thing that will make it not work. Adding a circuit network wait condition which would never be satisfied (due to circuit signals not being sent to the train) in addition to the "full cargo inventory" with an "AND" mode managed to get it running though.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

Hmm that's strange, it works fine for me. Note that it won't update right away if that profile is not selected but once it is it should be usable.

Anyway, I'll look into making the setup easier. Removing the need for the train to be parked at the station (standing in roughly the right spot with the station as destination would be enough) is easy and won't break things but, by itself, is not too helpful. I feel that also removing the need for having the input stop as destination (and the train in automatic for that matter) would be better, that way you could just build the train by the station and you'd be done. That change is also easy to make but it would break all current setups, which is something I'd really like to avoid.

What I'll do is see if I can make a migration script that will update old setups to the new way of doing things, while also informing the player of the changes made. If I can't get that to work I'll add an opt-in mod setting to use the relaxed conditions, but this is more of a last resort.

If you don't want to wait for me (this will break all your current setups now and likely once again when I update the mod) you can remove a few lines in control.lua: 220, 218, 129 and 121. At least I think those are the only ones that would need changing. EDIT: there are a few other places that also need fixing it seems so don't do this:)

If I don't run into any major issues, knock on wood, the updated version should be out later today or tomorrow.
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

The new version of the mod is up, source trains no longer need to be waiting at the station, they just need to be in roughly the correct spot. The source schedule should not contain the input stop, only stops that the new train should visit.

This means that there should be no more driving, making sure that the input station is the destination, making sure that the wait condition for the input station is never true, or setting the train in auto. From now you should only need to build the train roughly where it would park when waiting (easy with snap to station, though you have quite a bit of leeway) and then give it the schedule that the new train should have (easy with copy paste).

I've included migration code that should update any currently working setup to the new system , what it does is remove the current destination from the schedule on any train parked in a position that would make it a possible source train. Hopefully that should solve things, it seems to for the test map at least.
User avatar
Tallinu
Fast Inserter
Fast Inserter
Posts: 143
Joined: Sun Jun 14, 2015 8:14 am
Contact:

Re: Savefile for train testing

Post by Tallinu »

That is going to make it so much easier to change or create new templates.

Also, I've just noticed something interesting and useful about the way signals work when placed on both sides of a track, which could be used to simplify your counters, completely avoiding the need to send an R signal to switch between them.

Only signals facing the direction a train is travelling will turn yellow! Signals facing the opposite direction will go directly from green to red. This means that if you test for yellow instead of red, you will automatically count only outgoing trains, regardless of which side they are driving on, since you've only wired up the signals facing in the outgoing direction. With no need to handle an R signal, I believe an entire row of combinators could potentially be removed from each counter assembly... Although it seems like they are currently serving as signal isolators as well, keeping eight separate counters, one on each track, from reading each other's signals. But really, as long as R is no longer a factor, you only need one actual counter on each wing, taking input from all of the pulse generators on each track. That means as many as 15 combinators might be removed from each wing, leaving just one counter and eight pulse generators, and removing the need to worry about setting R correctly in the process.

Actually, you do still need one more combinator right after the one counter in each wing to prevent it from receiving signals from the counters on the other wings and adding them up. If the locomotive signal was being sent back on the red wire channel that has to be hooked up to the counter anyway it wouldn't be an issue, but since both red and green have to be connected, one has to be signal-isolated to prevent it from entering the counter's feedback loop. Easy enough, changing all the wiring just to remove one combinator per wing with no other benefit would be a bit silly. :)

Actually actually, you technically only need one central counter, collecting pulses from all the pulse generators. But the changes I've already made on a copy of the map work fine so I'm not going to keep messing with it right now. :D
Blueprint String for Updated Counter Areas
And while I'm at it, I've been using the fixed-point math implementation of the rate calculation system that somebody else posted, and it works great. No more having to wait for the minute figure to tick over to get a brief window where the calculation is accurate! Here's a blueprint of the whole control area with R removed and that system in place. It includes the substation so that all the wires will hook up properly, but deconstruct most of the old circuitry before placing it since a few unnecessary combinators have been removed.
Control Area Update
aaargha
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: Savefile for train testing

Post by aaargha »

Nice find on the counters, removing R is pretty neat, not sure if I'll bother with the rest but we'll see :)

I took a look at the fixed point suggestion when it was posted and adapted some parts of it into the controls, updates every second instead of every minute. If I remember it correctly there were some errors in the constants for the final division and/or modulus operations, so if you want the correct decimals you may want to take a look at those. Otherwise the most "notable" improvement I've made to the measurements is to automatically save the train count at the 15 min mark, I may look into automating more of it so that it automatically turns on/off as well, but we'll see.

I think I'll release an updated map (I'll keep the old one available) pretty soon once I've finish up the single line max throughput measurements and made sure that the deadlockomatic is truly obsolete. For the new version I'll probably also delete most of the map except the throughput tester to keep things lean. I'd also recommend doing that if you're having UPS problems when testing intersections, there are a few ms to save on creative mode updates by removing all the auto-fill/duplicating/void chests and other creative mode entities.
Post Reply

Return to “Railway Setups”