Two customers service queue

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 882
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Two customers service queue

Post by Impatient »

Summary

The "two customers service queue" acts like a queue with a in-built feature to remove the item at the front of the queue (and any other item in the queue). Items stay in the queue, as long as requests for service are active. To achieve that, instead of storing n values (in this case 2), it stores one value and listens if requests for service are active. By behaving like that, it is also a queue from which items can be deleted, I would say.



Application

I created this circuit for twin train unloading stations. I wanted the trains to be unloaded in sequence, not concurrently. Concurrent unloading often led to a cut stream of resources, when the trains left around the same time.

API

2csq.api.jpg
2csq.api.jpg (242.77 KiB) Viewed 2585 times
Requests are made by sending any positive continuous value to the connection points for customers one and/or two (A1, A2).

The information of who has to be serviced at the moment, can be read from the continuous output of the memory cell (OUT) (value 0 -> customer 1, value 1 -> customer 2).

Demo


The bp uses mod "creative items" https://mods.factorio.com/mod/CreativeItems .
Fuel the trains and set them to automatic.

The demo features twin unloading stations and 4 trains with various sized cargo. The signals, which are sent to the circuit to make requests for service are the cargo counts from the train stations. This way, the trains will continue to request service until they are empty. The entities, controlled by the output, are the belts in front of the splitter (rather than the unloading inserters, to ensure a continuous stream of resources).

2csq.demo.jpg
2csq.demo.jpg (216.14 KiB) Viewed 2535 times



Behavior

The two customers are serviced in the sequence in which their requests arrive. The service for the customer at the front of the queue continues until it withdraws its request for service. Then the other customer is serviced, if it has a request active.

Dual truthtable
Detailed description, explanation of dual truthtable

Internals

Internals
Last edited by Impatient on Mon Oct 07, 2019 2:16 pm, edited 3 times in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 882
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Two customers service queue

Post by Impatient »

I changed the description to make it more clear what this design does.

nog
Inserter
Inserter
Posts: 32
Joined: Wed Mar 04, 2015 12:13 pm
Contact:

Re: Two customers service queue

Post by nog »

I use the same system you show, but I managed the trick to alternatively unload trains in a way more simple than your solution.

dual_platform_station_1.png
dual_platform_station_1.png (604.7 KiB) Viewed 2482 times
dual_platform_station_2.png
dual_platform_station_2.png (904.81 KiB) Viewed 2482 times

1 wagon gives a fully compressed express belt.




I use the train ID from the station. When a train starts its departure from its station, the signal goes to zero, switch off the output belt from that station and switch on the belt from the other station, thus there is no lost of compression.
The logic is very simple : I use an SR latch as a binary memory cell, when train starts from station A gives a set signal (S), when train starts from station B gives a reset signal (R), belt from station A is active when S=0, belt from station B is active when S=1.
Last edited by nog on Tue Oct 08, 2019 9:33 am, edited 1 time in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 882
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Two customers service queue

Post by Impatient »

How does it behave, if a train leaves from station A, thus belts for station B are activated, but there is no train at station B and the next train arrives at station A again?

I tested your design and it works nicely. (One red wire was set up wrong.) I see how smart you set up the S-R. Very nice!

nog
Inserter
Inserter
Posts: 32
Joined: Wed Mar 04, 2015 12:13 pm
Contact:

Re: Two customers service queue

Post by nog »

Thanks. I don't really remember the "gymnastics" in use when the train flow is not optimal, the design is a few years old now. All I can say now is the design is rock solid and bug free, it was hardly tested and massively used. By the way, you absolutely need no flaws in the belt compression to achieve perfect balanced unloading and synchronized empty wagons, the better is to use input lane balancers.

And sorry for the little wire bug, I extracted the station from a save and cleaned it to make it more readable, but I forgot to put the red wire between the station and the inputs of the combinators (as you can see on the screenshots). I realized it and changed the BP urgently, but too quickly. :?

BP is correct now.

Post Reply

Return to “Combinator Creations”