[Circuit Network] Resettable Timer?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
glaazo
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 28, 2016 8:31 am
Contact:

[Circuit Network] Resettable Timer?

Post by glaazo »

While making a station for my red circuit factory, I came across a small limitation of "Inactivity" timer on stations. Meanwhile it is extremely useful in many cases, the minimum timer of 5 seconds resulted in a weird issue. As the items are unloaded into buffer chests, the the same items are simultaneously drawn out of buffer chests, until to a point where only 1 or 2 items are unloaded every now and then. That resets the "inactivity" timer on the station and what ends up happening is that the train will sit on the station slowly unloading 1-2 items every couple of seconds. :|

Simplest solution? Circuit network that links activity on unloading inserters to the station. The drawback is that I have never used the combinators ever beforehand, so I'm diving into this blind. :roll:

The plan is to have a very short resettable timer (about 2-3 fast inserter cycles long), that as soon as the rate at which the items are unloaded falls and fails to reset the timer before it reaches its limit, a signal is sent to the station to send the train off. :idea:

So far I managed to make a timer that can be set off with an item signal, but I have no idea how to make it resettable. :?
My efforts so far
Any help or advice from circuit network gurus is greatly appreciated! :ugeek:

zebediah49
Fast Inserter
Fast Inserter
Posts: 119
Joined: Fri Jun 17, 2016 8:17 pm
Contact:

Re: [Circuit Network] Resettable Timer?

Post by zebediah49 »

My best shot, given that I'm going to sleep and can't prototype this right now --
  • constant combinator A outputs 1 <var>, for some <var> of your choice
  • decider combinator B outputs <red circuits> == 0 to <var2> (This could be done with a arithmetic instead)
  • arithmetic combinator C outputs <var> * <var2> to <var>
  • decider combinator D outputs <var> > <threshold> to <control>, where <threshold> is your choice of how long to wait [in ticks], and <control> is your train control variable.
It should work if you connect the inserter, all inputs and outputs of combinators, and train station all together.

Theory: C (powered by A) will act as your integrator, integrating <var>. However, when a red circuit pulse comes from the inserter, B will flip from outputting 1 to 0 on <var2>. This will cause the integrator to reset back to zero. Meanwhile, D is just testing if you've gone over the threshold time.

User avatar
glaazo
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 28, 2016 8:31 am
Contact:

Re: [Circuit Network] Resettable Timer?

Post by glaazo »

Thank you zebediah for your help! :) Your prototype does work, although I did notice that one of the signals would increment indefinitely until the inserter was activated again, not sure whether that would be a problem or not. But nonetheless, I tweaked it a bit to suit the need a bit better. ;)
Screenshot
The settings are as follows:
  • decider combinator A: outputs <red circuit>==0 to <var2>
  • decider combinator B: outputs 1 to <var1> if <var1> < <threshold>
  • arithmetic combinator C: outputs <var1> * <var2> to <var1>
  • instead of a separate 'tester' combinator, the lamp (or the train station) tests for <var1>==<threshold>

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [Circuit Network] Resettable Timer?

Post by siggboy »

I have two suggestions how to solve your problems (oh and I agree that the minimum of "5 seconds" for the inactivity is too long; you should make a thread in Ideas and Suggestions to allow this to be set down all the way to 1 second):

Solution 1: don't use inactivity, but use the content of the buffer chests as the condition. So, for example, let's assume you have 12 buffer chests in total. The buffer is being loaded with stuff while the station is not occupied. Now a train comes and empties the buffer (loads it into the wagon). At some point the buffer will be empty but the upstream will keep replenishing it, albeit slowly -- and your inactivity condition never triggers.
So, instead of waiting for inactivity, simply make the train leave when the buffer goes below a (low) threshold, let's say fewer than 50 items per chest (600 items total with a buffer of 12 chests).

Solution 2: use a throughput counter on the inserters. viewtopic.php?f=8&t=29679#p190249
That counter can be connected to a belt, but also to an inserter that outputs the hand content in "pulse mode". You can set the sampling "window" to be rather short, and then just use a condition to make the train leave when the total inserter throughput goes below a certain level.

Solution 1 is probably more practical.

Now for the resettable timer: zebediah's idea was correct, but it can be implemented in a much simpler way:

Have a constant combinator output "Red Circuit = -1; Yellow = 1"
Connect it to a decider combinator that is set to "Red Circuit < 0 => Output Yellow (input count)". Connect the input to the constant combinator and the output back to the input.

The decider will now count up yellow until it gets a "Red Circuit" signal in its input. Then it will reset back to zero.

Now simply connect the inserters with "Read hand content (pulse)" to the input of the decider. Then you can see from the yellow signal how many ticks ago the last activity was on the inserter.
foo.gif
foo.gif (2.2 MiB) Viewed 4710 times
You might have to safeguard against the train leaving immediately when it enters the station, it depends on the setup.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Post Reply

Return to “Gameplay Help”