Jump to content

Calculate energy cost for your computer!


ludocus
 Share

Recommended Posts

I made this, because.... I was interested! :)

Well.. it's very simple but (I think) very usefull :).

Here it is:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.12.0
 Author:         ludocus

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Opt('TrayMenuMode', 1)
Opt('OnExitFunc', '_exit')
$seconde = ('0.043859649122807017543859649122807'/3600)
$c = TrayCreateItem('Calculate..')
$e = TrayCreateItem('Exit.......')
$timer = TimerInit()

While 1
    sleep(100)
    $tMsg = TrayGetMsg()
    Switch $tMsg
        case $c
            _energie()
        
        Case $e
            Exit
   
    EndSwitch
   
   
WEnd

func _exit()
    $time = Round((TimerDiff($timer)/1000))
    $cash = $time*$seconde
    msgbox ( 32, 'Calculate energy', 'This program was running for '&$time&' seconds'&@CRLF&'the energie cost of that is:  '&$cash)
    Exit
EndFunc

func _energie()
    $time = Round((TimerDiff($timer)/1000))
    $cash = $time*$seconde
    msgbox ( 32, 'Calculate energy', 'This program was running for '&$time&' seconds'&@CRLF&'the energie cost of that is:  '&$cash)
EndFunc

Enjoy

Comments are welcome :)

Edited by ludocus
Link to comment
Share on other sites

I don't think that 1 minute will cost 0.80 cent. If so my father would be a millionar.

1 = 0.80

60 = 48.00

48.00 * 7 (that's how long my computer is on) = 336 euros per day.

in a week that would be 3252 euros, and in a year 122,304 euros. (a little bit too much)

Thats a lot for one computer. (And we have three computers in our house)

Link to comment
Share on other sites

if you could find a way to read PC's power voltage you'll get more accurate readings, not all PCs waste same amount of energy.

P.S. and not all countries has the same energy costings (you can make this like input on first start of your prog. "1kw = xx euros" xx = editable :))

P.S.S. I like the idea of the prog, it would be cool if you could make it more accurate :)

good luck :)

Link to comment
Share on other sites

if you could find a way to read PC's power voltage you'll get more accurate readings, not all PCs waste same amount of energy.

Yep. Pretty useless to try and put a price on energy usage based only on time running...

In other words, you need to take into account the wattage of the power supply, amount of peripherals being used, type of software being run, etc... Running a CPU under full load conditions is going to draw a lot more current than a CPU basically idling. If you are playing a 3D video game, your CPU and your graphics card are going to be working much harder than if you are running a word processing application. (higher current draw, more wattage burned, therefore higher cost) A simple 'timer' for both situations just doesn't cut it...

It's a bit like calculating gas consumption based purely on mileage, but not taking into account the vehicle doing the driving. It should be obvious that per mile, a small hybrid vehicle driving on a flat road is going to burn far less fuel than a large pickup pulling a fifth-wheel trailer (large recreational trailer) up a hill. Per mile, you're looking at a huge different in actual energy used! Looking at mileage without taking into consideration the actual engine size, load size, and even operating conditions gives you zero indication of the actual cost of the energy used...

Link to comment
Share on other sites

true... but my thingie is just about what your computer spends on energy..

if you have your computer on stand by or something it's less.. of course..

but this is between lowest and max (kwh)..

and of course the price per kwh changes for every house...

but as I said this is about what people pay for a kwh.. ( 0,22 / kWh)

I am dutch and I got my knowledge about this subject here: http://www.milieucentraal.nl/pagina?onderwerp=Computers

570 hours (active use) is 114 kwh wich costs: 25,-

2184 hours (stand-by) is 175 kwh wich costs: 38,-

6006 hours (sleeping) is 48 kwh wich costs: 11,-

of course I could use the cpu usage to try to get the price..

but I just did it this way.. the about cost of energy for your computer..

but thanks for replieing :)

Link to comment
Share on other sites

  • 3 weeks later...

I think the main variable in the computers consumption of electrical current is the monitor (and the muscle graphic cards) depending on size and simple background color depends how much your monitor (which I think is the main energy leech) will use electricity.

About the background color:

Apparently on a CRT monitor ALL white screen means large energy consumption. Because of the way they function black is just not "drawing anything" but on LCD TFT monitors black color just means that every transitor is powered/lit but so are the "dimmers/blockers" => more energy.

As for the power supply i dont think that IT on its own has a lot to do with consumption for instance i have 450W UPS and it was working just fine while i had my old graphics card and monitor but i still had a 750W power supply, but now when the power goes out it works for like 1s and then wham => graphics card + larger monitor make it go :P

So to sum it all up :P

Ludocus program does the average but if you would like to pinpoint it down (a bit) i think the graphics card and monitor should be taken in to consideration. Ill try to find some comparative chart or something on how much energy those cost so maybe we can make something of it.

Good job keep it up bro :)

----------------------------------90% of teens today would die if Myspace,Bebo + FaceBook had a system failure and was completely destroyed. If you are one of the 10% that would be laughing, copy and paste this to your signature.----------------------------------Code to win, 'till you die, 'till the compiler dies from your linesCode to win, take it all, just keep coding till you fallDay by day, codin' all the way, I'm not cavin' inLet another App begin, code to win

Link to comment
Share on other sites

  • 4 months later...

Hello Ludocus,

I've found fine your script so I make little script with your script for have cash cost in real time an exemple here :

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Opt('TrayOnEventMode', 1)
Opt('TrayMenuMode', 1)
Opt('GuiOnEventMode', 1)

TrayCreateItem("Quit")
TrayItemSetOnEvent(-1,"_Exit")
$TIMER = TimerInit()

$SEC=('0.043859649122807017543859649122807'/3600)
$win=GUICreate("Ca$h Timer  <d3montools>",260,80,-1,-1,$WS_CAPTION,BitOr($WS_EX_APPWINDOW,$WS_EX_TOOLWINDOW))
$TIME=GUICtrlCreateLabel("TIMER : STARTING...",5,5,250,30)
GUICtrlSetFont(-1,20)
$CASH=GUICtrlCreateLabel("CASH : STARTING...",12,45,250,30)
GUICtrlSetFont(-1,20)
GUISetState()

While 1
    sleep(250)
GUICtrlSetData($TIME,"TIMER : "&Round((TimerDiff($timer)/1000)))

If Round((TimerDiff($timer)/1000))<10 Then
GUICtrlSetData($CASH,"CASH : < 0.00012 ")
Else
$CASHSL=StringLeft(Round((TimerDiff($timer)/1000))*$SEC,7)
GUICtrlSetData($CASH,"CASH : "&$CASHSL&" ")
EndIf
WEnd


Func _Exit()
Exit
EndFunc

And final version with count cash off all process and clock with hour,min,sec

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Opt('TrayOnEventMode', 1)
Opt('TrayMenuMode', 1)
Opt('GuiOnEventMode', 1)

TrayCreateItem("Ca$h")
TrayItemSetOnEvent(-1, "_SHOW")
TrayCreateItem("")
TrayCreateItem("Quit")
TrayItemSetOnEvent(-1, "_Exit")
TraySetToolTip("Ca$h...")
$TIMER = TimerInit()

$SEC = ('0.043859649122807017543859649122807' / 3600)
$win = GUICreate("Ca$h Timer  <d3montools>", 260, 80, -1, -1, -1, BitOR($WS_EX_APPWINDOW, $WS_EX_TOOLWINDOW))
GUISetOnEvent($GUI_EVENT_CLOSE, "_HIDE")
$TIME = GUICtrlCreateLabel("TIMER : STARTING...", 5, 5, 250, 30)
GUICtrlSetFont(-1, 20)
$CASH = GUICtrlCreateLabel("CASH : STARTING...", 12, 45, 250, 30)
GUICtrlSetFont(-1, 20)
GUISetState()

While 1
    Sleep(250)
    If Round((TimerDiff($TIMER) / 1000)) < 60 Then
        GUICtrlSetData($TIME, "TIMER : " & Round((TimerDiff($TIMER) / 1000)) & " SEC")

    ElseIf Round((TimerDiff($TIMER) / 1000)) > 60 _
            And Round((TimerDiff($TIMER) / 1000)) < 3600 Then
        $MIN = Round((TimerDiff($TIMER) / 1000)) / 60
        $MINT = StringLeft($MIN, 5)
        GUICtrlSetData($TIME, "TIMER : " & $MINT & " MIN")

    ElseIf Round((TimerDiff($TIMER) / 1000)) > 3600 Then
        $HOUR = Round((TimerDiff($TIMER) / 1000)) / 3600
        $HOURT = StringLeft($HOUR, 5)
        GUICtrlSetData($TIME, "TIMER : " & $HOURT & " HOUR")
    EndIf

    $PC = ProcessList()
    $CASHT = StringLeft(Round((TimerDiff($TIMER) / 1000)) * $PC[0][0] * $SEC, 7)
    GUICtrlSetData($CASH, "CASH : " & $CASHT & " ")

    TraySetToolTip(GUICtrlRead($TIME) & @CRLF & GUICtrlRead($CASH))
WEnd


Func _Exit()
    Exit
EndFunc  ;==>_Exit

Func _HIDE()
    GUISetState(@SW_HIDE, $win)
EndFunc  ;==>_HIDE

Func _SHOW()
    GUISetState(@SW_SHOW, $win)
EndFunc  ;==>_SHOW

Have fun ^^ :mellow:

Edited by FireFox
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...