Closed xarses closed 6 years ago
Just to make sure, mind re-testing this with a raw pullSignal to make sure there's not just something triggering events every so often (leading to a busy-ish wait)? Thanks.
I've tested this in numerous ways using raw computer.pullSignal using different levels of sleep periods using os.sleep() in openos using event.pull in openos
And in all cases I am definitely seeing 10% the energy usage when sleeping vs working
Why was this happening to xarses? The only reason I could see this not work for xarses is if his machines were busy receiving signals. A signal will cause the machine to wake up from the pulSignal (or sleep) even for a cycle, it is possible that the robots/microcontrollers were actually handling signals, and if they are handling signals when the "is running" check occurs, then the energy savings will not be made
it is also possible that we've fixed something in this area -- it has been about a year and a half. though that does seem unlikely to me, but possible
[Story time, read below for issue] After plopping down my first micro controller (and fighting to get it running) I found that it appears to be using way more power than I thought it should. According to something (probably walla) said that is has 10,000 RF energy and it used about 1200 during the night cycle (it has a solar generator)
According to my config it has 1,000 power and a consumption of 0.1/t. Night cycle is ~10 min so about 12,000 ticks. If we multiply our consumption and power by 10 to get 1 unit usage per tick we end up with. 10,000 power, usage 1/t. So if there was no energy conservation, we would have run out of power before the sun came up. We only used 88%.
[story end]
but before I sat down and looked all this up I figured, what about computers? what about robots? The robots seem to use less power in a event.pull loop.
so I sat down and ran this test on a robot and computer (both in lua terminal)
computer.energy() event.pull(100) computer.energy()
While the computer started with 11327 and ended with 10985 using 387 energy. With a base usage of 1/t + some noise (0.05/character/t) for the screen. given the screen had about 50% full (50_16_0.5=4000.05 = 20 ) We should have consumed (21/t * 200 = 4200) and with a sleep bonus multipler of 0.1 (4200 \ 0.1 = 420) so no we are about correct
100 * 20 (tps) = 200
We can see that in the robot we started with 34797 and ended with 34695 to use 102 energy With a base usage of 0.25/t * 200 we should have used 50 energy before invoking the sleep bonus (0.1 * 50 = 5) we could have used 5 energy sleeping for 100 seconds, instead we used 100 energy