Configurable Activity Detector

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Binoculars
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Wed Dec 02, 2020 6:17 pm
Contact:

Configurable Activity Detector

Post by Binoculars »

Hello factorian friend,

Have any of you designed an “activity detector”?

I am looking for a machine that sends a signal when a production is inactive for X seconds, for example if it does not detect anything on the conveyor for 30 seconds. In the same way that you can configure a train to leave a station in the event of inactivity.

I thank in advance those who will participate or share their creations.
Tertius
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Configurable Activity Detector

Post by Tertius »

Yes, this can be implemented by using a decider combinator as counter. It counts from 0, and as reset condition use a signal obtained from the environment near the machine you intend to monitor. For example reading the hand of the output inserter of an assembling machine or the belt piece under the inserter. If the counter gets bigger than some threshold, it means it hasn't been reset for that amount of time, which means the output inserter and its assembling machine was inactive for this amount of time.
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Configurable Activity Detector

Post by Illiander42 »

If you're using a belt, you will want it in "pulse" mode, which outputs a signla when an item moves onto it.
Binoculars
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Wed Dec 02, 2020 6:17 pm
Contact:

Re: Configurable Activity Detector

Post by Binoculars »

Thank you for your feedback. However, I don't think I will be able to put your knowledge into practice. It's quite unclear to me in this case.


Do you have an example perhaps ?
Tertius
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Configurable Activity Detector

Post by Tertius »

This example activates red lights after 600, 700, 800, 900 ticks of inactivity of the output inserter.
Use the blueprint and investigate the settings of the output inserter, of the two combinators and of the lamp conditions.

The combinator works as tick counter. It has its output looped back to the input, so it gets as input what was its output the previous tick. Additionally, a C=1 signal is fed by the constant combinator as input. Both inputs are added implicitly, so the decider computes C=C+1 as output every tick as long as the condition in the decider is true. The condition is iron wheels=0, so as soon as the inserter is grabbing an iron wheel, the counter gets reset, which is a sign of assembler activity. If the inserter isn't grabbing wheels any more, the counter doesn't get reset and the C value increases. The first lamp will activate if C>600, or 600 ticks, which is after 600/60 = 10 seconds. The other lamps will activate after slightly longer timeouts.

To investigate ("debug") the behavior of circuits, use the map editor by entering /editor in the console. In the "clock" tab of the map editor menu, you're able to start/stop the time, as well as advance just single steps and investigate the circuit state after every single step.
Screenshot 2024-06-02 141425.png
Screenshot 2024-06-02 141425.png (119.47 KiB) Viewed 812 times
Screenshot 2024-06-02 141959.png
Screenshot 2024-06-02 141959.png (118.65 KiB) Viewed 812 times


Binoculars
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Wed Dec 02, 2020 6:17 pm
Contact:

Re: Configurable Activity Detector

Post by Binoculars »

I don't think I would have thought of this solution and I didn't think it would be so simple in the end.

Thank you so much !
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Configurable Activity Detector

Post by Illiander42 »

Tertius wrote: Sun Jun 02, 2024 12:21 pm To investigate ("debug") the behavior of circuits, use the map editor by entering /editor in the console. In the "clock" tab of the map editor menu, you're able to start/stop the time, as well as advance just single steps and investigate the circuit state after every single step.
Wait, what?
Tertius
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Configurable Activity Detector

Post by Tertius »

Yes, that's better than the pause function of the real game. You can halt and single step all action while doing everything as if the game was running: looking, scrolling, building, inspecting, changing things. Only if you want to see how the game will behave after all changes, you need to continue the time.
Post Reply

Return to “Gameplay Help”