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.
Re: Configurable Activity Detector
Posted: Sat Jun 01, 2024 10:56 pm
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.
Re: Configurable Activity Detector
Posted: Sat Jun 01, 2024 11:50 pm
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.
Re: Configurable Activity Detector
Posted: Sun Jun 02, 2024 9:09 am
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 ?
Re: Configurable Activity Detector
Posted: Sun Jun 02, 2024 12:21 pm
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 (119.47 KiB) Viewed 1106 times
Screenshot 2024-06-02 141959.png (118.65 KiB) Viewed 1106 times
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 !
Re: Configurable Activity Detector
Posted: Tue Jun 04, 2024 9:08 am
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?
Re: Configurable Activity Detector
Posted: Tue Jun 04, 2024 6:26 pm
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.