Container free space signal

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

mrvn
Smart Inserter
Smart Inserter
Posts: 5723
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Container free space signal

Post by mrvn »

TL;DR
Container should have an output signal for the number of free slots in the container.
What ?
I'm suggesting the following changes for Mode of operation for chests:
  • Read contents
  • Read contents (stacks)
  • Report space for items
  • Report space for items (stack)
    ---
  • Report empty slots as <name of signal>
The first 4 options would be radio buttons, only one of them can be selected, and output the respective signals. E.g. space for iron plates is reported as iron plates signal.
The last option should be selectable in parallel with one of the others and the signal (default S) can be chosen by the user.

It would be nice if a container reported space for all possible items as it would be difficult (impossible?) to separate no signal (container doesn't have any of an item) and 0 space for an item.

Space for items should honor filtered slots. A slot filtered for iron plates would count as 100 iron plates space (when empty) but would not be counted for e.g. copper ore. An empty container can therefor have different free space for each item (even counting stacks).

The report of free space in stacks should round down. That way a full stack can be added when the container says there is space for one. There might be more space but never less.

For train stops similar additions should be made to report the train contents (or lack thereof). Same goes for tanks and fluids.
Why ?
To make more efficient trains I'm enabling the station only when the buffer chests have enough free space to unload a full load. For this I need to sum up the amount of space in a chest according to the stack size of the item and then subtract the size of a wagon load, again depending on the stack size of the item. And when I change the number of type of chests I have to recompute the value all over again. It would be nicer if the chests would output the amount of items that can still be added. It would also be nice to get the number reported in stack sizes. That way the circuit condition could be specified independent of the item stack size and chest size.

In this example the condition for receiving Iron Ore would be "Circuit Condition: Iron Ore >= 40" for a full load.

With the circuit conditions independent of the buffer chests and item stack size the train stations can be blue printed without having to compute and adjust the condition every time and buffer chests can be upgraded over time without breaking the circuits.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Container free space signal

Post by ssilk »

How would it be if there would be a new circuit signal "stacks left"?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

mrvn
Smart Inserter
Smart Inserter
Posts: 5723
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Container free space signal

Post by mrvn »

It would solve part of the suggestion.

But what would that report for containers with filters. You might have 20 stacks left for iron platesm, 10 stacks left for copper plates and 10 stacks left for general use.

I do think that reporting this using the normal signals and by selecting it in mode of operations is the better way to go.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Container free space signal

Post by ssilk »

I think the stack filters are there to be filled completely. No need to count them. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

mrvn
Smart Inserter
Smart Inserter
Posts: 5723
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Container free space signal

Post by mrvn »

But how many of them are still free?

I commonly have all stacks in a wagon filtered (or none). For that the stacks free would always say 0 even if the wagon is empty. Not useful.

nljr
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue May 30, 2017 2:32 am
Contact:

Suggestion: Chests should output the number of empty slots

Post by nljr »

TL;DR
When connected to a logic network, there should be an option for chests and boxes to output the number of empty slots.
Why ?
Creating a wiring network to tell how much space there is available in a chest is complicated and depends partly on what's actually in it. For train stations, it's frequently beneficial to shut off stations that are already very full. It doesn't matter how much is in the station, so much as it matters how much empty space there is.
What ?
Chests should have an option when wired into a logic network similar to how a robot port reports the number of bots and available bots on a configurable signal. So I could set a chest, for instance, to output "E" to represent the number of empty slots. Or "1", "2" and "3" for the chests serving one car of a train.

Factoruser
Fast Inserter
Fast Inserter
Posts: 167
Joined: Tue Sep 16, 2014 5:48 pm
Contact:

Re: Suggestion: Chests should output the number of empty slots

Post by Factoruser »

Good idea. New signal: empty slots, and maybe a different container-circuit-mode.

coderatchet
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Mar 07, 2017 10:05 am
Contact:

Re: Container free space signal

Post by coderatchet »

I'm trying to create a circuit that calculates free space (for ltn purposes) in order to set limits for requests, this would be a great feature.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Container free space signal

Post by ssilk »

But in LTN you already have stack thresholds!? It Calculates the needed amount itself. Or I misinterpret the use case...

And I think there is this viewtopic.php?f=6&t=62189 "Each" Signal Choice as Stack Size Control Signal

I like that suggestion more, because it is much more flexible.

I think it so for example: a new combinator device where the incoming signal is the output for its stack size. Incoming “copper ore, 2132”, outgoing “copper ore, 50”. More incoming signals -> more outgoing stack sizes. And there might be a switch to take only the highest input value and generate only one output.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Yandersen
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Sun Jun 30, 2019 6:54 am
Contact:

Re: Container free space signal

Post by Yandersen »

Supporting the suggestion - reporting the number of filled\empty stack slots would be useful. I think limits should not be taken into account.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Container free space signal

Post by ssilk »

(Reread and found that I wrote much more, but somehow forgot to submit :? )

That post above describes the general function of that new combinator. This post introduces a new signal to change the functionality a bit:

A) chest sends out a new signal “container stacks”, for downward compatibility it takes a checkbox to be marked in the chest, to do that.
B) both, “container stacks” signal plus content of chest goes into that new combinator. In that case, instead of outputting stack size for each item, it outputs the number of stacks stacks for each item (as described above). Plus a “remaining stacks” signal.


That sounds complicated and is also for this (in my eyes very special) case. But it enables to calculate much more, when I create the “container stacks” signal myself. For example I can calculate the amount I can fill up a wagon, without having the wagon available. It also has the advantage, that this (non-constant) signal is only created, when really needed, saves cpu.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

VampireSilence
Inserter
Inserter
Posts: 28
Joined: Wed Feb 03, 2021 7:54 am
Contact:

Chests export the number of free slots

Post by VampireSilence »

TL;DR
Make a new entry "Read free inventory slots" under "Circuit connection" and return this as a multiple of letter "F".
Image

What ?
When building train bases it's a common example, that you fill some boxes with ressources (like ores) by train, then smelt it, and the results get filled in other boxes itself. Now you have to read the contents of your boxes, know the number of your boxes, etc., to ultimately calculate if a train should bring more ressources or get the results at the other end. This could be much easier. If we were able to simply connect all boxes to the ressource station and give it a "F > 0" enabling condition, everything would be handled and a train could start bringing ore. Of course there are many different approaches for that specific situation and they all are handled differently, but this is only a single example and i bet there are way more of it.

Why ?
- Less combinators for a range of setups
- Less calculations
- Less UPS needed
- More lazyness for builders ;)
Last edited by ssilk on Fri Apr 22, 2022 4:15 am, edited 2 times in total.
Reason: Changed topic to Factorio specific words

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Chests export the number of free slots

Post by ssilk »

merged with a similar enough thread
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

keleios
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Apr 22, 2016 7:55 am
Contact:

Re: Container free space signal

Post by keleios »

A thousand times this.

I am playing Space Exploration mod at the moment and it has this feature for the cargo rockets so you can use circuits for this purpose so it isn't too hard to make a requestor rocket loop.

I just tried to do this with a spaceship for an automated route and found it is very difficult to determine when the space ship is full or empty with the vanilla container signals. Huge arrays of filtering for hundreds of items seem to be the only way. Something like this:
viewtopic.php?t=57055

I have an idea for detecting when empty, but full is still challenging.

vangrunz
Long Handed Inserter
Long Handed Inserter
Posts: 84
Joined: Tue Dec 26, 2017 1:26 pm
Contact:

Re: Container free space signal

Post by vangrunz »

As I workaround, I made a circuit that determines if a chest is empty, and if not, a lamp is lit. So you may start unload your train only if there're a certain amount of empty chests available.
2023-03-10_190128_cr.png
2023-03-10_190128_cr.png (514.87 KiB) Viewed 4426 times
2023-03-10_190131_cr.png
2023-03-10_190131_cr.png (504.62 KiB) Viewed 4426 times
2023-03-10_190249_cr.png
2023-03-10_190249_cr.png (511.01 KiB) Viewed 4426 times
Not the whole thing about reporting empty stacks, but useful in some cases.

mrvn
Smart Inserter
Smart Inserter
Posts: 5723
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Container free space signal

Post by mrvn »

Usually you are interested in the free space of buffer chests. When they are empty then it's far too late to order a refill. So checking for empty is of little value I fear.

Generally what I want to know is the time when the buffer chests have enough free space to unload a cargo wagon. So when the buffer chests used per wagon have 40 free slots then the train station is enabled to make the next train appear.

And really I do mean "number of free slots" here. I don't care about partial stacks or number of items. If the chests have 40 free slots then I know I can unload a cargo wagon of 40 slots for sure. Anything else is just to complex and is basically irrelevant in an automated setting. For single item chests I can check the item count to see how much more items the chest can hold. But then I have to adjust that for each use case to the items stack size. Having a signal that's already in units of stacks would be oh so helpful.

vangrunz
Long Handed Inserter
Long Handed Inserter
Posts: 84
Joined: Tue Dec 26, 2017 1:26 pm
Contact:

Re: Container free space signal

Post by vangrunz »

Not completely sure if that would meet your setting:

MicroController

For Liquids, there's a mod...

Unfortunately, I've not found any solution, neither vanilla nor mods, that would satisfy your request. :|

mrvn
Smart Inserter
Smart Inserter
Posts: 5723
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Container free space signal

Post by mrvn »

vangrunz wrote:
Mon Mar 20, 2023 6:02 pm
Not completely sure if that would meet your setting:

MicroController

For Liquids, there's a mod...

Unfortunately, I've not found any solution, neither vanilla nor mods, that would satisfy your request. :|
This can not be modded as it absolutely tanks the performance. This can only be done from LUA in a mod and you would have to check and recompute every chest every tick or close enough to that. It absolutely does not scale to thousands of chests. This is something that has to be done on the C++ side to perform.

Roflhouse42
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Nov 10, 2023 7:28 pm
Contact:

Chest Output Signals

Post by Roflhouse42 »

Currently, chests output the contents of the chest only. Please expand the chest output options. Examples of features that could be useful:
  • Output a constant value. Output 1 from each chest could be used to count chests or outputting the maximum capacity of the chest could be used to dynamically scale the total capacity of a set of chests.
  • Output number of empty slots. Useful for calculating empty space. Different way of solving the current capacity problem.
  • Output a signal if item count is lower than constant(amount missing or just 1). Like inserters but because it's emitting a signal it could be used to control additional logic like requesting a train. This is mainly a quality-of-life thing as you can do the same with existing combinators it's just a lot of wiring.
Why? The primary motivation is for building an unloader station. You need to know the total number of items that the train stop can hold. You don't want to over request trains otherwise they will have to wait until the stop uses up its content.

How much space is left is a function of Stack Size, Stacks per chest, and number of chests all multiplied together minus current contents. In vanilla, it's a massive pain to figure out max space and to manually enter it for each train station depending on what you are unloading. With the addition of the selector combinator, we can automatically get the stack size and stacks per chest is a constant. This massively helps but the final piece could also be automated, counting the number of chests attached to a signal wire.

The number of chests is dependent on number of wagons per train and if you are unloading from both sides. This can be hardcoded in a bigger blueprint but it would be nice if the logistics figure that out.

Roflhouse42
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Nov 10, 2023 7:28 pm
Contact:

Re: Chest Output Signals

Post by Roflhouse42 »

Also same for fluid tanks for the same reason of calculating max capacity

Post Reply

Return to “Ideas and Suggestions”