## Ideal clock

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.
MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

### Ideal clock

(Note: This thread contained a synchronizer between clock and in-game time only. I allready complete my final version of clock so i updated this thread into this).

I made a special clock. Here is the beauty...
clock.png (542.62 KiB) Viewed 4688 times
##### What it does
It simply set a two signals that means Hours and Minutes (signal H and signal M) onto green network connected into high pole. The trick is that whole clock include synchronization with in-game time and reset the time into 0:00 when midnight is reached. The word "ideal" means that there is absolute accuracy in term of ticks. So you obtain any time exactly at the nearest tick related to that time. After you craft this clock, you have to wait for the first midnight after moment when accumulators was fully charged for the synchronization signal.

As extra ability, lamps switch into yellow when all hour is reached for one minute duration (in-game time) and switch into pink when midnight is reached (synchronization).

Note: The poles must be conected between them by copper wire but all mechanism must be separate from any source of energy! Its completely self-administering. You can use the high pole for time distribution at green network. There is no spam of anything in the green output except the H and M signals and whole mechanism is also invulnerable on any outher signals sets into green output.
Its hard to explain all the parts . Some parts may looks really weird. The problem is that whole mechanism simply must have 60kW solar with 30kW power output and 2 accumulators. It was quite hard to reduce originally 17 combinators mechanism into 15 combinators version which with three lamps gives 30 kW exactly. That is the reason for many strange operations. Note that this stuff has practically no error in tick precision! So when the midnight signal is set, the clock reset time not exactly into midnight but into moment few ticks before. The amount of tick-shift is exactly equal to signal delay due to combinators. Lamp colorizing doesnt consume any extra combinator. It is just extra ability with no harm on original optimized version. The whole clock looks pretty simple hovewer the teory behind the absolute accuracy will consume pretty long manual .
##### Blueprint string

Code: Select all

``````H4sIAAAAAAAA/91YQW+jOBj9KxXHWeiCSdJUsxzaucxlD53JqaMRcsFprTE2MqbbKOK/j4EkhRB7bGijVTlUSvGH7fe+733PTtkFYQkkF3G0RVRggVERbbcU
ZihyIMfiKUMCJ17CsgdMoWDccXNWyHGMRtuXyAvdjfxzOa/cFHOUNP+fuQmjgjMSP6An+IwZj7av34rly7T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orian calendar.

Gertibrumm
Fast Inserter
Posts: 162
Joined: Fri Jun 03, 2016 6:54 pm
Contact:

### Re: Ideal clock

MBas wrote:Note that this stuff has practically no error in tick precision![/b][/color] So when the midnight signal is set, the clock reset time not exactly into midnight but into moment few ticks before. The amount of tick-shift is exactly equal to signal delay due to combinators.
Since you reset exactly into the right tick count, how about not worrying on future resets once the first midnight was reached, as you said it is precise enough for that. this might be good for monitoring the game time, or other things like random number generator, or just gregorian calendar

MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

### Re: Ideal clock

I use it for my personal watch.

I agree that there is no reason for repetetive synchronizing. I just use it for "control" that there is no fake tick per day or per month or something
watch.png (1.6 MiB) Viewed 4536 times

Bizz Keryear
Long Handed Inserter
Posts: 87
Joined: Thu Oct 22, 2015 5:08 am
Contact:

### Re: Ideal clock

Sorry, to resurrect this thread, but for once it is for a good reason.
I love this clock and it would be a shame if it is lost.
Questions:
1. Does it still work? I assume it does, but you never know if some changes broke it.
2. Could you be so kind and replace the old Blueprintstring (from the mod) to one the vanilla one?
If you still have the old save that, that should be easy, otherwise I ( or better someone else who is better than me) would have to reengineer it and post the new Blueprint below. (and I still think updating the blueprint in OP would be better)

Medic5700
Burner Inserter
Posts: 9
Joined: Mon Jul 02, 2018 2:12 am
Contact:

### Re: Ideal clock

It seems to still work, and here is a vinilla blueprint

MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

### Re: Ideal clock

Wow it still exists . Thanks for positive feedback. It still works as i just tested.

Medal to one who realize why it works . I rembember only the idea but it was hardly optimized.

IGotBaconSoda
Burner Inserter
Posts: 15
Joined: Thu Mar 24, 2016 7:45 pm
Contact:

### Re: Ideal clock

Thanks for resurecting this Bizz, and thank you MBas for the initial idea.
It inspired me to make my own:

I call it: Practically Time (v2.0)
since it's not count-perfect due to inaccurate division. 25000/24 is not an integer, for example--If anyone could help with dealing with the integer division I'd greatly appreciate it. (I hope its not simply amplifying signal by a GCF or something).
(Well now I see where the 900000 came from in your initial clock.)

Crystal--The medium pole that is connected to the accumulator, and everything it touches.
Decoder/Display--Takes "C" from the crystal, and decodes it into meaningful information--"Time".

Prelude: The accumulator has to start from 0 at some point
Instructions: Stamp the blueprint, remove the solar panel and any external power sources around the "crystal", wait for the lights to turn off (accumulator dead), then place the solar panel back. That is a "hard reset" for the crystal (it relies on a perfect day-night cycle). Connect the big power pole to external power, wait a full game day, and the clock will be sync'd.

And the blueprint:

MBas, gotcha by 4 lights
*crystal doesn't output "meaningful" data like H, M

Also thanks to Dave McW for the display blueprints (you can find more user-friendly versions and descriptions in "Digital Displays, Yay!" topic).

MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

### Re: Ideal clock

In my solution, i need to have 30kW output exactly (in other word, half of one full solar panel power). I have a switch in there which set a one tick signal exactly where the accumulator hit 87 percent of energy. I do this for a reason becouse it perfectly fit to how much energy i lost from the moment where solar power goes under 30kW. So, here is the math...

30kW is handy point becouse it is exactly in the midle of nightfall. Now the funny part became. I need to integrate whole power during discarge from this moment to the midnight. And it is exactly 12.5% of accus capacity. The thing suprised me is the fact that the game compute the energy loss very precisely. The integratinon is actually easier than it looks. During a nightfall, the power loss start from 0 to 30 kW. So the average value of discharging is 15kW during nightfall. So we have 625kJ loss per night fall. During a night, we have a 30kW loss it is another 625kW (you need to use half of the night duration only since mignight is in the middle). 1250kJ loss should correspond to the 12.5% from full capacity of 2 accumulators (2×5MJ).

There is one issue as i remember. After many tests i realize, that 87% of acc state is hit exactly when you fall into 87.5%. Not to 87% exactly. The value is rounded so the moment when you come from 88 to 87 is at stat 87.5%. And this is exactly what i seekiing for - the moment when tha acc leave 88% to lesser value... (note: this is actually the reason, why i need to have accumulator state on xx.5% value exactly)

Regard to my foundings, its suprised to me that you found a solution for 42kW output. This is exactly the one problematic value becouse its exactly average power of one solar panel during whole day. So you never reach bottom or top and monitoring of your accus depends on initial value. In my solution, you are sure that you always start with proper value. There could be some rounding isuues if you use another way.

I am also not very sure about the "absolute accuracy" of your system.

BTW, i use some trick as well regard to fact, that signal is delayed per some thicks in combinators trougtput...

Well, i think i will stop theorize and have a look on your stuff

Some relevant parameters are given from https://wiki.factorio.com/Game-day

IGotBaconSoda
Burner Inserter
Posts: 15
Joined: Thu Mar 24, 2016 7:45 pm
Contact:

### Re: Ideal clock

MBas wrote:
Mon Jan 07, 2019 9:02 pm
In my solution, i need to have 30kW output exactly (in other word, half of one full solar panel power). I have a switch in there which set a one tick signal exactly where the accumulator hit 87 percent of energy. I do this for a reason becouse it perfectly fit to how much energy i lost from the moment where solar power goes under 30kW. So, here is the math...

...

BTW, i use some trick as well regard to fact, that signal is delayed per some thicks in combinators trougtput...

Well, i think i will stop theorize and have a look on your stuff

Some relevant parameters are given from https://wiki.factorio.com/Game-day
I honestly did it by trial and error and excel. I used bob's game clock to help sync mine through different parts of the 24 hour period on game speed .1, as I have multiple "delays" in my system I can vary. (That reminds me, I can reduce my decoder by one combinator most likely)

First I found when I could reliably capture a time just before midnight, I think when the accumulator ticks down from 43% to 42% (as shown in UI) happens at 23:5x. Simple to output a pulse when that happens.

I take this pulse and use it to reset "clock 1"
I decide when "clock 1" = x and start a new clock: starting at 00:00*. I do that in "clock 2" after a decider for the delay.
*it actually ticks slightly before, so the display circuit has time to output values correctly (I've wired this in two delays, can be reduced)

Beyond that, I bet you can figure it out by inspection. But that's the kind of writing on the wall behind it.

Edit: Made one change (T=36 to T=26) in crystal, and removed the "redundant" delay in the decoder. Added a 1-tick delay in the decoder to make the hours tick-perfect, and made the display more legible.

Your idea behind using 30kW (or less power in general) might lend to a smaller "crystal", but I'll hold off on miniaturization. I'm currently satisfied with my build.

MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

### Re: Ideal clock

When i made this, i start with one rule - to make a synchronized clock with in-game time on one tick precision accuracy. No exceptions . I realize later that this achievement is not so easy if you hunt the last tick exactly, but the fact that it is possible just force me to finish it .

Anyway, i must say that your display is really impressing. That piece is definetly some hard work of someone who really knows programming.