Wouldn't that make the luminator take up to 6.4 seconds to react to input?
it would make the luminator use 1eu every 6.4 seconds
Wouldn't that make the luminator take up to 6.4 seconds to react to input?
it would make the luminator use 1eu every 6.4 seconds
Nope. If the storage >0 (which is the case with 99), Luminator wont turn off :3
Doesn't matter anyways, though, as the Luminators will be reworked once more. Found a way to use "dynamic" (as in brightness-scale, not colorful) lightning.
Very cool, I look forward to seeing this new implementation in action.
Display More-snip-
Didn't need the windy explanation. I can see what it's doing. Do you think if I couldn't see what it's that I could have derived 0.25eu/t in the first place? No. The only reason conceivable for doing it the way he's done it is if EU's are coded as integers (thus, no decimals). In the long run, the result is the same. However, in the short term, there appears to be a problem. I have a suspicion that if EUs could handle decimals, and he DID code it as 0.25EU on EVERY tick, then we wouldn't be having this problem. To answer your previous quandry, THIS is how fractional EUs are handled.
I really should crack open the IC2 source. This isn't a hard problem to solve. -_-
On another note, this does explain my setup. I have a single solar panel powering 3 luminators. This functions, but it doesn't last the whole night (1/3 of the night). And that makes perfect sense given 0.25eu/t. A single solar panel will be able to power 2 luminators effectively through the entire night, in perfect harmony (the luminators draining all power just as the sun comes up for the next day)
[EDIT]
Decompiled IC2 and poked around for a minute... found the code. As I thought, the "ticks" that drive the energy consumption of the luminators are locally handled. It would probably be best if this was changed to check (globaltime % 4 == 0). That way, ticks will continue to pass whether the luminator has energy or not, and they will continue to consume energy at the desired rate.
[EDIT2]
Here's the problem:
As alblaka has mentioned before (elsewhere, probably), luminators are made up of two blocks. The blocks that emit light and the blocks that don't. The luminators that emit light are initialized with "ticker = -1". As soon as you put the luminator down, it executes this code:
Thus, ticker moves up to "0" and the check returns true. That means it must consume 1EU, which has already been passed to it from the solar attached to the cable. Once that happens, energy will equal 0, and it must then turn off. Here's the kicker. To turn off, this luminator is REMOVED and replaced with an "off luminator tile". That luminator tile is then given 1EU, which turns it "on", so it needs to be removed again and replaced with a BRAND NEW luminator, starting at "ticker = -1".
Repeat.
What does this mean? It means what I said BEFORE! The reason for the flickering is BECAUSE of the transition between the on and off state, thus a buffer of w/e EU is not going to fix the problem. Just substitute "0EU' with "99EU" and "1EU" with "100EU" above and you're looking at what would happen if a buffer was given.
The only fix is to fix the root problem here, either have luminators run off of a global ticker, offset the current ticker (to start at 0 and thus make its first check on the fourth tick instead of the first tick), or change it so you're not replacing blocks to turn the light on/off. Or if you REALLY want to use a buffer, make it turn on at something more than 1EU from the "off" amount (Example: 100EU = on, 98EU=off)
Though, if you ask me (and you're not, I know), the easiest way to fix the problem is just to change
this:
to this:
offsetting the ticker, so that the first check will occur on the third tick instead of the first (could make it "2", but figured a bit of room for the solar to pass another EU would be best)
[EDIT 3]
Last edit, I promise!!!
If you guys need a workaround in the meantime, you can overcome the bug by placing a batbox in between the solar and the luminator, allow a bit of time for the luminator to charge... then take the batbox out and hook the luminators straight up to the solar. Works like a champ!
the Batbox in between to let the luminator charge up seems a lot more work than simply right clicking on the luminator with an RE-Battery to give it a little charge.
The buffer would work because while you are replacing the "1" with "100", you are not replacing the "0" with "99"
it turns on at 100, but still only turns off at 0. so it's once again the same as charging it a little with a batbox or with an RE-Battery.
I'll try to make my posts less windy...
The issue is, Luminators use 1 EU every "time % 4 == 0" tick. Which implies the actual first one.
This was Alblaka shedding light on it =)
its a simple breakdown of what is actually happening.
0.25eu/tick is different from 1eu/4ticks specifically because 0.25eu/tick is not what the luminator draws.
i do not know how fractions of eus are handled in IC2, which is a shame, because water generators really confuse me because of it. i know they work, but i don't know how. same with wind turbines.
regardless of whether anyone understands me or not, the simple fact is. until Alblaka thresholds the energy required to turn a luminator on, you can fix the flickering by using an RE Battery to apply a startup charge yourself. as long as the luminator never runs out after that point, it wont flicker.
That is how you count decimals using only integers, my friend. If you look at what you just said with just a dash of dimensional analysis, you're repeating yourself.
1eu/4ticks . . .
Numbers only: 1/4 = 0.25
Units only: eu/tick = eu/t
1eu/4ticks = 0.25eu/t
AH, but see, I'm not repeating myself
1eu/4 ticks is this
tick1 - 1eu consumed
tick2 - 0eu consumed
tick3 - 0eu consumed
tick4 - 0eu consumed
tick5 - 1eu consumed
tick6 - 0...
tick7 - 0...
tick8 - 0...
tick9 - 1...
you get the pattern
0.25eu per tick would be different
its all in how its programmed
the luminators are programmed to work at 1eu consumed every fourth tick, not 0.25 eu per tick
and since they use an eu on the tick they turn on, it means the eu that comes in to turn them on gets used up before they get a second eu, so they turn off again.
This apparently happens no matter how many 1eu sized ticks of energy solar panels give it, (i haven't tested using >20 solar panels.)
unless you use a RE-Battery on the light to give it a small boost, it will continue turning on and off every time it gets that first 1eu
It's not using 0.25eu/t its using 1eu/4ticks
the thing is, it starts counting the moment it turns on, using 1eu on tick 0, then 1eu on tick 4, and so on
but when it turns off, that counter resets
so it turns on and is at tick 0 again, causing it to use 1eu immediately
the two other fixes i could think of would be to make it wait a tick before turning off,
or changing the timer to use 1eu on ==1 or ==2 instead, but neither of these would prevent flickering in an out of power situation
the threshold would. from my limited understanding, it sounds like the best fix, and makes sense in an "power on requiring extra power to exist, even if its not used" kinda way
Don't try to understand the mechanics based on the 5% i revealed in here.
The issue is, Luminators use 1 EU every "time % 4 == 0" tick. Which implies the actual first one.
If now a solar provides 1 EU, the luminator will switch to on, consume 1 EU and then turn off again, because it's on 0 EU, which will as well reset the timer (and cause it to actually eat 1 EUt).
There are probably better ways to fix this up, but telling it to only turn on after receiving at least will fix this issue without creating new ones.
I like the threshold idea, it sounds like it would solve most issues that could cause flickering, especially if someone has more luminators than their power sources can handle.
I'm pretty sure he means it will turn on at 100eu, but will stay on til it hits 0.
That way, if its going to flicker, it will be a slow flicker
EDIT: seems to work fine if you get the luminator started with an RE-Battery, once its on, it charges up from the solar panel without issue. it seems the act of turning on the luminator uses up the 1 eu that the solar panel sends to it, so it turns off immediately cause its then at 0 before the next eu comes in, but once you get it charged a little, energy usage is as expected. this is just my observation from testing, hope it helps.