Looking for a specific combinator setup

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Looking for a specific combinator setup

Post by Losash »

Hello. Tried myself, but failed, I get signal flickering...

I need logic setup for a train unloading spot.
I have a constant combinator with various products in various quantities as signals. Name those as (I).
Unloading spot has logistic network nearby, and I'm reading contents of this network. Name those contents as (II).
I also expect that there will be some kind of multi-signal partial-reset-ready memory cell which is going to contain signals of items, which are currently unloaded. Name those contents as (III).

The logic for every signal amoung all the signals performs as following:
1) Checks if (I) > (II). This means that there is not enough of this item in the network. If that's the case, it starts outputting this signal constanly, if it doesn't do this already (sets it in (III) if it's not set there).
2) Checks if (II) > 2 * (I). This means that there is more than twice as enough of this item in the network. If that's the case, it stops outputting this signal constanly, if it does this (resets it in (III) if it's set there).

So, I believe you need (III) for this task, because I want "not enough of this item" be as some kind of trigger, which flips on untill there will be more than twice enough of this item. But I can't do this (III) and 1) 2) logic.

At the end I'm willing to use the output to flip on filter inserters in the station itself, and ultimately request supply train to stop at this station, if there is at least one signal on. But that's other story and I believe I'll be able to do that myself.

astroshak
Fast Inserter
Fast Inserter
Posts: 239
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Looking for a specific combinator setup

Post by astroshak »

If I am reading you properly, you want a global circuit network that signals supplies throughout the factory, as well as individual logistics network signals that you then use to call for trains to unload when the logistics network supply gets low?

I’m not sure that you really need the global supply signal.

For each supply train, set up Stack Filter Inserters (and possibly slot lock the Passive Providers or Storage Chests that you unload to, to avoid oversaturation at the station) so that you don’t get the wrong stuff offloaded. Have a Constant Combinator with the negative desired amounts of items wanted in this network. Connect that to a Roboport that reads the Logistics Network contents. Connect to the train station, and have it enabled whenever Anything < 0.

If you want to you could try to set the Stack Filter Inserter filters dynamically, but I’ve found that’s either more trouble than its worth, or that its simpler to just set the filter for one item and only have up to 12 item types per cargo wagon.

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

astroshak wrote:
Tue May 12, 2020 12:38 pm
If I am reading you properly, you want a global circuit network that signals supplies throughout the factory, as well as individual logistics network signals that you then use to call for trains to unload when the logistics network supply gets low?
No, not like that. You get distracted by the train aspect. This is not the problem here.

Imagine you just have a train, which frequently passes trough this train station and always contains, say, 25 different resources in some quantities, but they are always the same. You don't call it by circuit network, let's say it just rolls around from time to time.
Imagine that at this train station you sometimes need some of those exact resources, because their quantities dropped below certain margin. Then it starts stopping there, unloading only those, which are needed, by stack filters. If none of the resources are needed, it just rolls through without stopping.

The problem is that I want it to track those margins in a more complex way than the simple one you describe:
astroshak wrote:
Tue May 12, 2020 12:38 pm
Have a Constant Combinator with the negative desired amounts of items wanted in this network. Connect that to a Roboport that reads the Logistics Network contents. Connect to the train station, and have it enabled whenever Anything < 0.
I don't want trains to constantly stop there because some resource constantly gets slightly below the margin, to get more effective with my trains.
Therefore I want logic like I said it in the topic start: trigger that resource call untill it will get twice the amount I need. Then the trigger is flipped, and the next time this resource will be called again will happen relatively later in time.

Resource types never change with time. So yes, theoretically, I can do this with some 25 routine SR latches or something, but I want to get a smarter solution, one, which will eat resource list from a constant combinator, and won't be restricted by a pile of latches. I know how to do a multi-signal memory cell. But here the problem is that to set a new memory state in (III), I need to read contents of (I), (II) and (III) to pile up a new resulting signal pack, and as I read (III) to set (III) it obviously gets self-recursion and flickers.

astroshak
Fast Inserter
Fast Inserter
Posts: 239
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Looking for a specific combinator setup

Post by astroshak »

Losash wrote:
Tue May 12, 2020 1:20 pm
Imagine you just have a train, which frequently passes trough this train station and always contains, say, 25 different resources in some quantities, but they are always the same. You don't call it by circuit network, let's say it just rolls around from time to time.
Imagine that at this train station you sometimes need some of those exact resources, because their quantities dropped below certain margin. Then it starts stopping there, unloading only those, which are needed, by stack filters. If none of the resources are needed, it just rolls through without stopping.

The problem is that I want it to track those margins in a more complex way than the simple one you describe:
astroshak wrote:
Tue May 12, 2020 12:38 pm
Have a Constant Combinator with the negative desired amounts of items wanted in this network. Connect that to a Roboport that reads the Logistics Network contents. Connect to the train station, and have it enabled whenever Anything < 0.
I don't want trains to constantly stop there because some resource constantly gets slightly below the margin, to get more effective with my trains.
Therefore I want logic like I said it in the topic start: trigger that resource call untill it will get twice the amount I need. Then the trigger is flipped, and the next time this resource will be called again will happen relatively later in time.
Apparently not what you are looking for, but you can accomplish this in the manner I described.

Just have the unloading chests (Passive Providers, Storage Chests, whatever you are using) set to allow more than just what you put in the Constant Combinator.

Carrying around 400 Walls, with the chest set for 2 stacks, and the CC set for -100, or -50, will bring the train back when you reach that lower threshold, but the train will still try to fill the offloading chest. Its all in how you are using and set things up.

That said, enabling/disabling the station is the only way to really “call” for a train (at least in Vanilla). Otherwise, the train attempts to visit one of each station named in its schedule, in order. I’m sure you’ve noticed this, but if you have two stations named Iron Drop Off the train will pick one, and that will satisfy its Iron Drop Off entry in its schedule.

You can either have a train roll on through (so called Dummy stations used for controlling routing) or have a train stop and offload stuff, but as far as I know you cannot combine the two into one station. That’s why I’d recommended the setup I did.

As far as combinators go, Network I’s Constant Combinator can simply be set to a negative value. If II > I then the resulting item signal is positive. If I > II, then the resulting signal is negative. If there is no signal, then the value is zero (I = II). If you are dead set on using positive numbers in the CC, then you will need to do a signal conversion by taking in one signal and outputting that value in a different signal (such as the lettered virtual signals) to avoid simply having the CC signal added to the Logistics Network signal.

Beyond that, you are simply enabling the train station based upon the differences of I and II. I’m not sure how you would go about setting the filters dynamically, as (stack) filter inserters can get hung up on negative numbers and not change the filters. That’s why I’d recommended slot limiting the chests you are offloading into, and having those be for one item (each) specifically.

While I’m not sure exactly how to do what you specifically wanted to do, the way you wanted to do it, what I’d recommended accomplishes the goal of calling for a resupply, with whatever buffer you build into it.

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

astroshak wrote:
Tue May 12, 2020 4:36 pm
Carrying around 400 Walls, with the chest set for 2 stacks, and the CC set for -100, or -50, will bring the train back when you reach that lower threshold, but the train will still try to fill the offloading chest. Its all in how you are using and set things up.
Man, I know that you are trying to help, but I really don't know how to specify better. What you are trying to suggest is not going to work for me. You don't account for situation when lower threshold for some resource is several times larger than the maximum amount of this resource one train can deliver, and to deliver twice that threshold you will need more than one train. There is no way of understanding that you need second one, third one, and so on, without a memory cell, which constantly remembers that the demand is not met yet. And this memory setup is what I'm asking for.

astroshak
Fast Inserter
Fast Inserter
Posts: 239
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Looking for a specific combinator setup

Post by astroshak »

There is that. If the train has enough to meet the minimum threshold but not to deliver enough to make the buffer you want, then no, you won’t get the buffer you want. You’d need larger trains, perhaps? Or, if its a matter of ore, have the drop off station be a unique station name and have a train or several dedicated to it and it alone?

I know - that’s what you are trying to avoid... Hopefully someone else will chime in and provide better advice for you.

Impatient
Filter Inserter
Filter Inserter
Posts: 577
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Looking for a specific combinator setup

Post by Impatient »

If I understand your specifications correctly, then you want to unload an item of type (i) if the amount of that item (Xi) is below a minimum threshold (Xi < Ximin) and stop unloading if it is above a maximum threshold (Xi > Ximax). Is that correct?

Other questions are:
If (n) is the number of different item types on a train, does each train only transport one type of item (n=1) or several different types (n>1)?
In case each train only transport one type of item, does each item type have its own unloading station or do trains with different item types all unload at the same station?

quyxkh
Filter Inserter
Filter Inserter
Posts: 850
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Looking for a specific combinator setup

Post by quyxkh »

Here's the basic idea:
snap@T1247247=896x976-44.25-5,z2.jpg
snap@T1247247=896x976-44.25-5,z2.jpg (72.3 KiB) Viewed 531 times


It uses a constant hysteresis (I arbitrarily picked 400 items) to keep the circuit simple.

The constants bin shows the negated "want" values, it's wired to the logistic net readout and an Each < 0 ⇒ 1 Each, wired to the hysteresis Each * -400 ⇒ Each feedback. So the top decider output is "I want these items". The train stop's set read-train-contents and Enable If Anything = 1, so it's wired to open if it wants anything that isn't already there.

The bottom pair of deciders are Each > 0 ⇒ 1 Each wired to the train stop (on a separate circuit), so it's 1 Each of anything actually on the train, wired to an Each = 2 ⇒ 1 Each also wired to the top decider, 1 Each of what the stop wants. Anything the stop wants and the train has makes it to the set-filters unloading inserters.

If you want different hysteresis values for different items you'll have to split the want-these signals out manually with the Each = 2 ⇒ 1 Each trick, or similar, to load the different values needed.

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

Impatient wrote:
Wed May 13, 2020 1:18 am
If I understand your specifications correctly, then you want to unload an item of type (i) if the amount of that item (Xi) is below a minimum threshold (Xi < Ximin) and stop unloading if it is above a maximum threshold (Xi > Ximax). Is that correct?
Yes, that is correct, with a small clearification: if the train fully unloads it's contents of (i), and (Xi < Ximax) after that, train leaves, and station waits for the other train to come, still holding a signal that it wants that item (i). Just to make it clear again.
Impatient wrote:
Wed May 13, 2020 1:18 am
If (n) is the number of different item types on a train, does each train only transport one type of item (n=1) or several different types (n>1)?
Each train transports many types of items, but those types are the same with all the trains, and their type variety is itentical to variety in (I) in the topic start.

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

astroshak wrote:
Wed May 13, 2020 12:19 am
If the train has enough to meet the minimum threshold but not to deliver enough to make the buffer you want, then no, you won’t get the buffer you want. You’d need larger trains, perhaps?
That's the point. One of the items I am going to need in my actual task is reinforced concrete. Min treshold for it can be probably set for like 80k in my case. Double this treshold is 160k. There is no way one train will be able to supply that, nor there is a way such quantities can be controlled through chest filtering.
I never said that my trains will always be able to meet minimum treshold. but the rate at which resource theoretically can be unloaded at this station is going to far exceed consumption rate.

Imagine the station has 90k of concrete, and drones constantly lay this concrete at a rate of 1k per minute. After 10 minutes, it is going to call for this resource. It will be unloaded at a span of 30 minutes and will eventually reach 160k. Then this resource will be considered "fine" for another 80 minutes.

Impatient
Filter Inserter
Filter Inserter
Posts: 577
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Looking for a specific combinator setup

Post by Impatient »

Losash wrote:
Wed May 13, 2020 2:26 am
Impatient wrote:
Wed May 13, 2020 1:18 am
If I understand your specifications correctly, then you want to unload an item of type (i) if the amount of that item (Xi) is below a minimum threshold (Xi < Ximin) and stop unloading if it is above a maximum threshold (Xi > Ximax). Is that correct?
Yes, that is correct, with a small clearification: if the train fully unloads it's contents of (i), and (Xi < Ximax) after that, train leaves, and station waits for the other train to come, still holding a signal that it wants that item (i). Just to make it clear again.
Impatient wrote:
Wed May 13, 2020 1:18 am
If (n) is the number of different item types on a train, does each train only transport one type of item (n=1) or several different types (n>1)?
Each train transports many types of items, but those types are the same with all the trains, and their type variety is itentical to variety in (I) in the topic start.
Ok, with these specifications you need the following components:
One S-R latch (S-R stands for Set-Reset) for each type of item. It is set if (Xi<Ximin) and then constantly outputs a signal. Let's call that signal the unload signal for item type i (Ui). The S-R latch is reset (not outputing Ui after reset) when (Xi>Ximax)

For the mixed train station you have several options. Either you use filter inserters which are all connected to the cable the U signals are on - that way they will all unload the item type(s) which are currently requested by the factory - and sort the unloaded items with filter splitters (or more filter inserters, constantly set to a specific item type) later. Or you unload specific item types onto specific belts at the wagon right away. That is a more simple way to unload and a bit slower (as not all inserters can unload every type of item).

Returning to the S-R latch setup. For the S-R itself google "factorio s r latch" and you will find articles. There is a spartanic implementation with just one decider and a comfortable one with 2 deciders. 'Talking about the spartanic one from now on. It has its output connected to its input and is configured with (if i > 0 then output i = 1). On the output side you can read the Ui signal. To the input side you send the S and the R signals. You send Si to the S-R latch when (Xi<Ximin) where Si has just to be Si > 0 for the S-R to start outputing Ui constantly. You send Ri to the S-R when (Xi>Ximax). Ri always has to be negative (any negative value of i will do). If Ri is sent to the S-R the condition ( i > 0 ) will fail and the S-R will stop outputing Ui. I think you are good enough to create the setups to release the S and the R signals yourself. Just be aware of the wire colors. The cable network the U signal is on should not be anyhow connected to the cable network the S and R signals are on (obviously). But all U signals (Ui) can be on the same cable network.

If you are not fuzzy enough yet, just ask. I can throw more variable names and condition formulas at you.

The last thing is ... I wonder if it is really true what I wrote, that you need one S-R setup for each item type or if all of them can be handled by one single S-R using the EACH pseudo signal. Let's think it through. If the S-R is configured with (if EACH>0 then output EACH = 1) and you funnel all the S and all the R signals to the input,it still should work. I am pretty positive.
And maybe you also need just one setup to create the S and the R signals when you use EACH. But if you need to know about that, then you have to reply first. 'Not inputing more brain unless you really need it.

;-)

Impatient
Filter Inserter
Filter Inserter
Posts: 577
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Looking for a specific combinator setup

Post by Impatient »

Ah, and the train condition has to be "inactivity" for the unloading station. That way if it is out of one type of item, it will leave although it has items of other types still on board.

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

Impatient wrote:
Wed May 13, 2020 5:12 am
Ok, with these specifications you need the following components:
One S-R latch (S-R stands for Set-Reset) for each type of item.
You missed my first responce at this topic after the topic start:
Losash wrote:
Tue May 12, 2020 1:20 pm
Resource types never change with time. So yes, theoretically, I can do this with some 25 routine SR latches or something, but I want to get a smarter solution, one, which will eat resource list from a constant combinator, and won't be restricted by a pile of latches. I know how to do a multi-signal memory cell. But here the problem is that to set a new memory state in (III), I need to read contents of (I), (II) and (III) to pile up a new resulting signal pack, and as I read (III) to set (III) it obviously gets self-recursion and flickers.
Coming back to your post:
Impatient wrote:
Wed May 13, 2020 5:12 am
The last thing is ... I wonder if it is really true what I wrote, that you need one S-R setup for each item type or if all of them can be handled by one single S-R using the EACH pseudo signal.
That is exactly what I was trying to do myself and couldn't do it, so I started this topic. Maybe I had a wrong approach trying it, but ehh... Your text explanation on the approach didn't really help me get it.
I also need to check what quyxkh made, I'm looking sceptical as there is just 4 combinators, but I can't check it now because I'm not at home.

mergele
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sat Aug 20, 2016 5:45 am
Contact:

Re: Looking for a specific combinator setup

Post by mergele »

So you want an SR-Latch that works on each if understand you correctly?
The basic shape is the same as here https://wiki.factorio.com/Tutorial:Circ ... er_version, except the decider combinator does EACH > 0 OUTPUT 1 EACH,
The restriction is that S and R signals must be 1 or -1 and should not occur at the same time. Not a problem in this case.
Put your (I) and (II) through a seperate EACH > 0 OUTPUT 1 EACH, (II) then through a EACH * -1 => EACH and feed this to the bove version of the RS latch.

If a signal on (I) is > 0 the latch will start outputting 1 for this signal until it get's a -1 for this signal (which in this case would be delivered through (II).


PS: That is actually a good idea for doing base supplies, I think I'm gonna put that into use myself.

Impatient
Filter Inserter
Filter Inserter
Posts: 577
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Looking for a specific combinator setup

Post by Impatient »

Yeah, I skimmed just over the op, before I asked about specifics. My bad. Reading your op and your first answer I believe you already have all the parts figured out. Then the only remaining problem is how to piece them all together, I guess?
I made a proof of concept to see if and how fast I can do it. Save and BP attached. Both use mod Creative Items for energy and resource wells and sinks
( https://mods.factorio.com/mod/CreativeItems ).


Edit: By using pseudo signal EACH, only one combinator setup is required for an arbitrary number of item types (4 for the logic and 2 which ouptut Ximin and Ximax).

Edit 2: And that can further be reduced by one combinator I believe, when Ximin and Ximax are output as negatives and the logic is adjusted accordingly. But for showcasing the solution they are output as positives in the poc.
Attachments
poc.zip
(3.43 MiB) Downloaded 22 times

Losash
Inserter
Inserter
Posts: 25
Joined: Sun May 08, 2016 5:06 am
Contact:

Re: Looking for a specific combinator setup

Post by Losash »

Impatient wrote:
Wed May 13, 2020 4:10 pm
I made a proof of concept to see if and how fast I can do it.
Edit 2: And that can further be reduced by one combinator I believe, when Ximin and Ximax are output as negatives and the logic is adjusted accordingly. But for showcasing the solution they are output as positives in the poc.
Sorry for the late reply, just had time to check your blueprint. I've tested, it seems to be working!
Thank you! You did exactly what I was asking for! I see you used some unusual latch, I'll take my time to understand how it works for the future, thanks for providing names of variables.

To quyxkh: I've downloaded your solution too, it is trickier to check if it does similar things, because it is different in that it does not multiply minimum threshold, I may try to understand what it does later though. It is valuable to me in a way I don't understand how it works in the first glance.

gGeorg
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Jun 19, 2019 8:06 pm
Contact:

Re: Looking for a specific combinator setup

Post by gGeorg »

Losash wrote:
Tue May 12, 2020 1:20 pm
Imagine that at this train station you sometimes need some of those exact resources, because their quantities dropped below certain margin. Then it starts stopping there, unloading only those, which are needed,
I was solving same issue. It took me a while to solve all the details. But now you can see the result. Perhaps it do what suits you. :idea:
Main features:
-set your needs by Constant combinators marked "SET"
-station Enables ( call a train ) when less half of set value is present. e.g. prevent premature call
- it unloads exact amount of asked supply, not more
-it rise an alarm when supply train leaves station without fill the need, so you might click alarm icon and investigate
-you can call train or disable station manaly by combinators Switch on combinators marked "CALL" or "DISA"
-it also delivers oil and provide garbage collector feature by one wagon
-it also fills (or take out) robots directly into roboport
It is fun to watch loadin / unloading action of various products.
Image

You only need to make yourself a loading station.
If you would like mine let me know.

Schaeberlej
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Jun 26, 2020 6:59 pm
Contact:

Re: Looking for a specific combinator setup

Post by Schaeberlej »

I also made a generic train station mostly for Kitch in his recent train series on YouTube https://www.youtube.com/watch?v=mxUVtNUPLIc, where he also explains the main concept of this station. I'll use it for my further building stations, I think.
I guess you could cram the combinators nearer together, but I think it's good to understand the concept of a station with SR-Latch and request option.
Also I added an option to request different items from each wagon. Or you just add for each wagon the filer inserters and the boxes and connect them with the wires and set the amount for the station.

There are multiple configuration options:
  • Obviously the requested amounts. Set in the combinator top left.
  • In the Arithmetic Combinators right left to the requests you can set in the upper combinator the min multiplicator and in the lower one the multiplicator to fill up to.
  • The 2 T in the constant combinator is there to send by default a red signal to the station, which will get false in the same tick the other conditions are evaluated.
  • If you don’t want to use the combinator to send to the Train, if something is still unloading you can deconstruct the lowest [Each > 0 => Output red signal] combinator and the T-Constant Combinator
  • If you want to use a roboport to insert the robots into I would disable the other combinators by sending them a negative amount of the robots, so the condition will not meet the other inserters.
Factorio Generic Train Stop.png
Factorio Generic Train Stop.png (2.05 MiB) Viewed 99 times

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users