[2.0.21] Train Count including trains leaving the station.
-
- Burner Inserter
- Posts: 11
- Joined: Fri Nov 15, 2024 5:45 am
- Contact:
[2.0.21] Train Count including trains leaving the station.
What did you do?
I use a train station's "Read Train Count" signal to start harvesting fruit when a train is approaching. And stop when the number of fruits harvested reaches the amount the train can carry. By using OR decider to enable the agriculture towers when the train count signal is more than 1 and the amount of fruit in the inserters, chests, belt and the train contents is lower than certain number.
What happened?
The harvest did start and stop properly, however the harvest starts again as soon as the train leaves because the train leaves so the station is no longer reading the train contents, but the train count still remains to be 1. This behaviour lasts until the train reaches the next station.
What did you expect to happen instead? It might be obvious to you, but do it anyway!
The train count should drop to 0 when the train leaves the station, as per the description it says it outputs the number of train that is coming to the station including stopped trains, which should not include trains leaving the station.
Does it happen always, once, or sometimes?
It always happens.
I use a train station's "Read Train Count" signal to start harvesting fruit when a train is approaching. And stop when the number of fruits harvested reaches the amount the train can carry. By using OR decider to enable the agriculture towers when the train count signal is more than 1 and the amount of fruit in the inserters, chests, belt and the train contents is lower than certain number.
What happened?
The harvest did start and stop properly, however the harvest starts again as soon as the train leaves because the train leaves so the station is no longer reading the train contents, but the train count still remains to be 1. This behaviour lasts until the train reaches the next station.
What did you expect to happen instead? It might be obvious to you, but do it anyway!
The train count should drop to 0 when the train leaves the station, as per the description it says it outputs the number of train that is coming to the station including stopped trains, which should not include trains leaving the station.
Does it happen always, once, or sometimes?
It always happens.
Re: [2.0.21] Train Count including trains leaving the station.
That is intended, the train is considered in station until it leaves its block.
-
- Burner Inserter
- Posts: 11
- Joined: Fri Nov 15, 2024 5:45 am
- Contact:
Re: [2.0.21] Train Count including trains leaving the station.
If that's the case, that should be mentioned in the description. It mentions trains GOING to the station, where including stopped trains is explicitly mentioned but not trains still in the block.
Re: [2.0.21] Train Count including trains leaving the station.
I agree with bountygiver.
This seems like a bug.
I'm trying to use the feature to automate the balance of requesting and supplying train stations.
Subtracting one from the requesting train stations whenever a train is en-route to supplying train station.
Then removing the request from the requesting train station when a train is en-route to that station.
With the feature working as it currently is it's impossible to do this as the train count sums to two, even though only one train is on the tracks.
It's impossible to distinguish a train en-route versus a train blocking the station as the train ID also resets to 0 when the train is leaving.
In what use-case would it be beneficial to have the feature working as it currently is?
I can't personally find any.
I can however see an ocean of automation possibilities if this feature was "fixed".
This seems like a bug.
I'm trying to use the feature to automate the balance of requesting and supplying train stations.
Subtracting one from the requesting train stations whenever a train is en-route to supplying train station.
Then removing the request from the requesting train station when a train is en-route to that station.
With the feature working as it currently is it's impossible to do this as the train count sums to two, even though only one train is on the tracks.
It's impossible to distinguish a train en-route versus a train blocking the station as the train ID also resets to 0 when the train is leaving.
In what use-case would it be beneficial to have the feature working as it currently is?
I can't personally find any.
I can however see an ocean of automation possibilities if this feature was "fixed".
Re: [2.0.21] Train Count including trains leaving the station.
Reimerboi wrote: Thu Dec 12, 2024 10:25 am In what use-case would it be beneficial to have the feature working as it currently is?
FFF-389 wrote: Fri Dec 15, 2023 12:00 pm The problem is that once the train decides to leave the station, it instantly clears the reservation of the train limit, while still physically blocking the stop. This lets another train start its journey toward the stop, while there might not be enough space to wait without blocking the mainline.
So we fixed it, so the train will only give up its reservation once it leaves the block with the train stop.
Re: [2.0.21] Train Count including trains leaving the station.
I don't see why train count should read the number of trains counting towards the train limit.
No where does it say this.
It literally says, "Reads the number of trains going to this particular train stop. Includes the stopped train."
If we could at least read the train ID while it’s blocking, we could determine if the train count was indicating incoming trains. But even that creates other challenges, like reliably determining if a train is actually docked at the station.
No where does it say this.
It literally says, "Reads the number of trains going to this particular train stop. Includes the stopped train."
If we could at least read the train ID while it’s blocking, we could determine if the train count was indicating incoming trains. But even that creates other challenges, like reliably determining if a train is actually docked at the station.
Re: [2.0.21] Train Count including trains leaving the station.
Check out this blueprint, it may be of some use (start the things by setting the stop's train limit to nonzero; have alt-mode enabled):Reimerboi wrote: Thu Dec 12, 2024 10:25 am It's impossible to distinguish a train en-route versus a train blocking the station as the train ID also resets to 0 when the train is leaving.
Re: [2.0.21] Train Count including trains leaving the station.
I also agree this is a very inconsistent behavior of train stops.
Train count counts incoming trains, trains stopped and waiting at leave condition, and trains stopped matching leave condition that have nowhere to go. Train ID is present when train is stopped at the station waiting for its condition. Same is true for signals from train. And lastly, including Muche reading of signals (thanks!), red signal is when train is in the block (obviously, but included for completeness).
The inconsistency arises from trying to determine what is actually a stopped train, as after hours of fiddling, I can't find a reliable way to determine it in the context of loading station I describe at the end.
* Train is in the block (i.e. red signal) doesn't mean that its stopped, it could be just entering.
* Train count > 0 doesn't mean that there is a train stopped, as there could be incoming one from far away. There's also opposite problem, where train count = 0 where there is an train waiting for having somewhere to go.
* Train ID and signals from the train also doesn't work, as described above train could be stopped, counted by train count, but still not give these two.
The preferred solution would be to allow reading Train ID and maybe signals from the train that is stopped but had its leave condition met. This seems natural.
The train station I want to create is straightforward - load chests by bots amount of items that will be loaded completely by the trains that are scheduled. So essentially load in chests [C = number of scheduled trains to this station]*[S = stack size] - [L = number of items already loaded into stopped train] . The obvious solution is to take train count as C, and train contents from the station plus contents of inserter hands as L, and this should be it. But this doesn't work, as the train 'leaving nowhere to go' still counts for C, but doesn't produce train contents for station.
The next step was to include Muche part with rail signal, to check if train count on station > 0, and stopped train id = 0 and rail signal before station is red, as this is raw indicator for 'train is stopped and nowhere to go', but is inconsistent in two ways - a) another train is scheduled from far away and current train is actually leaving, b) train is entering the block. Both of these are read as the same and the hack doesn't work.
I've attached a distilled save file with the station and with Muche blueprint for reference.
Train count counts incoming trains, trains stopped and waiting at leave condition, and trains stopped matching leave condition that have nowhere to go. Train ID is present when train is stopped at the station waiting for its condition. Same is true for signals from train. And lastly, including Muche reading of signals (thanks!), red signal is when train is in the block (obviously, but included for completeness).
The inconsistency arises from trying to determine what is actually a stopped train, as after hours of fiddling, I can't find a reliable way to determine it in the context of loading station I describe at the end.
* Train is in the block (i.e. red signal) doesn't mean that its stopped, it could be just entering.
* Train count > 0 doesn't mean that there is a train stopped, as there could be incoming one from far away. There's also opposite problem, where train count = 0 where there is an train waiting for having somewhere to go.
* Train ID and signals from the train also doesn't work, as described above train could be stopped, counted by train count, but still not give these two.
The preferred solution would be to allow reading Train ID and maybe signals from the train that is stopped but had its leave condition met. This seems natural.
The train station I want to create is straightforward - load chests by bots amount of items that will be loaded completely by the trains that are scheduled. So essentially load in chests [C = number of scheduled trains to this station]*[S = stack size] - [L = number of items already loaded into stopped train] . The obvious solution is to take train count as C, and train contents from the station plus contents of inserter hands as L, and this should be it. But this doesn't work, as the train 'leaving nowhere to go' still counts for C, but doesn't produce train contents for station.
The next step was to include Muche part with rail signal, to check if train count on station > 0, and stopped train id = 0 and rail signal before station is red, as this is raw indicator for 'train is stopped and nowhere to go', but is inconsistent in two ways - a) another train is scheduled from far away and current train is actually leaving, b) train is entering the block. Both of these are read as the same and the hack doesn't work.
I've attached a distilled save file with the station and with Muche blueprint for reference.
- Attachments
-
- InconsistentTrainBehavior.zip
- (792.71 KiB) Downloaded 22 times
Last edited by nivertius on Sat Dec 28, 2024 12:40 pm, edited 1 time in total.
Re: [2.0.21] Train Count including trains leaving the station.
Train count including departing trains is working as intended. Primary explanation i was given to implement this was following scenario:
Here you have an outpost that has capacity of up to 3 trains and so the limit on the train stop would be set to 3 and the entire design is made to work under assumption that there will never be more than 3 trains in this contraption. Blue train however is leaving causing the train stop to no longer be considered full and so a red train is able to arrive causing the original blue train to become stuck. I am not going to argue about signalling since there is one extra signal that made the red train able to enter intersection without leaving it because that is not the point, main point is that the outpost was designed for 3 trains and there are now 4 trains it needs to handle.
Here you have an outpost that has capacity of up to 3 trains and so the limit on the train stop would be set to 3 and the entire design is made to work under assumption that there will never be more than 3 trains in this contraption. Blue train however is leaving causing the train stop to no longer be considered full and so a red train is able to arrive causing the original blue train to become stuck. I am not going to argue about signalling since there is one extra signal that made the red train able to enter intersection without leaving it because that is not the point, main point is that the outpost was designed for 3 trains and there are now 4 trains it needs to handle.
Re: [2.0.21] Train Count including trains leaving the station.
Thank you for the reply. This is understandable and makes sense.
So maybe rather than not counting train that is leaving the station in the train station circuit condition "train count", the solution is as I mentioned above - allow reading train ID or its cargo when it is still at the station "having nowhere to go"? And just to be clear by that I mean a train that had met his departure condition, but never moved since it because the destination station is full (or maybe no path also).
I understand this is not exactly bug as described by the OP, but making this consistent would allow the OP to create circuit that would solve his issue. If you'd like I can make a separate bug (is it a bug?) or feature request.
So maybe rather than not counting train that is leaving the station in the train station circuit condition "train count", the solution is as I mentioned above - allow reading train ID or its cargo when it is still at the station "having nowhere to go"? And just to be clear by that I mean a train that had met his departure condition, but never moved since it because the destination station is full (or maybe no path also).
I understand this is not exactly bug as described by the OP, but making this consistent would allow the OP to create circuit that would solve his issue. If you'd like I can make a separate bug (is it a bug?) or feature request.
Re: [2.0.21] Train Count including trains leaving the station.
It seems to me you've incorporated only half of the available inputs - signal before the station.nivertius wrote: Sat Dec 28, 2024 12:02 pm The next step was to include Muche part with rail signal, to check if train count on station > 0, and stopped train id = 0 and rail signal before station is red, as this is raw indicator for 'train is stopped and nowhere to go', but is inconsistent in two ways - a) another train is scheduled from far away and current train is actually leaving, b) train is entering the block. Both of these are read as the same and the hack doesn't work.
There is also the signal after the station - it is green for incoming/stopped train, yellow/red for leaving train.
In my testing, when a train decides to leave the station, signal2 turns yellow the same tick train id T becomes 0, so it seems to be a reliable way to distinguish an entering train (T=0,signal1=red,signal2=green) from a leaving one (T=0,signal1=red,signal2=yellow) - see states 6 & 7 in my circuitry.