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.
Configurable Activity Detector
-
- Long Handed Inserter
- Posts: 79
- Joined: Wed Dec 02, 2020 6:17 pm
- Contact:
Re: Configurable Activity Detector
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.
-
- Filter Inserter
- Posts: 521
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: Configurable Activity Detector
If you're using a belt, you will want it in "pulse" mode, which outputs a signla when an item moves onto it.
-
- Long Handed Inserter
- Posts: 79
- Joined: Wed Dec 02, 2020 6:17 pm
- Contact:
Re: Configurable Activity Detector
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 ?
Do you have an example perhaps ?
Re: Configurable Activity Detector
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.
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.
-
- Long Handed Inserter
- Posts: 79
- Joined: Wed Dec 02, 2020 6:17 pm
- Contact:
Re: Configurable Activity Detector
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 !
Thank you so much !
-
- Filter Inserter
- Posts: 521
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: Configurable Activity Detector
Wait, what?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.
Re: Configurable Activity Detector
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.