It is currently April 18th, 2024, 5:14 am
Calculate Min,Max Value of a measure
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Calculate Min,Max Value of a measure
I'd like to get Min and Max value of a measure(sensor) to show on a skin. For instance, the values of Min/Max temperature, Min/Max Power draw etc. in a session.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Calculate Min,Max Value of a measure
Sorry jsmorley, but I don't think this is the right answer to Pul53dr1v3r's question. At least from what I've understood...
To get the largest value is simple. Eg in the following code, [MeasureCalc] returns a value between 1 and 100 and [MeasureMax] returns the largest value achieved so far:Pul53dr1v3r wrote:I'd like to get Min and Max value of a measure(sensor) to show on a skin. For instance, the values of Min/Max temperature, Min/Max Power draw etc. in a session.
Code: Select all
[MeasureCalc]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=1
HighBound=100
[MeasureMax]
Measure=Calc
Formula=( Max ( MeasureCalc, MeasureMax ))
Code: Select all
[MeasureCalc]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=1
HighBound=100
[MeasureMin]
Measure=Calc
Formula=( Min ( MeasureCalc, MeasureMin ))
To make it to properly work, you have to use a trick. Replace the Formula option of the [MeasureMin] measure, with this one: Formula=( Min ( MeasureCalc, 100 )). This formula avoids the measure to always return 0, but it's not the correct one, so you have to replace it after the first update of the measure. So, add the following option to the [MeasureCalc] measure: OnChangeAction=[!SetOption MeasureMin Formula "(Min(MeasureCalc,MeasureMin))"]. After the first update of the [MeasureCalc] measure, this option will replace the Formula option of the [MeasureMin] measure, which will start to return the lowest value achieved so far.
If you couldn't follow everything I've described above, here is the whole code:
Code: Select all
[Rainmeter]
DynamicWindowSize=1
Update=1000
[Variables]
[MeasureCalc]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=1
HighBound=100
OnChangeAction=[!SetOption MeasureMin Formula "(Min(MeasureCalc,MeasureMin))"]
[MeasureMin]
Measure=Calc
Formula=( Min ( MeasureCalc, 100 ))
Group=MinMax
[MeasureMax]
Measure=Calc
Formula=( Max ( MeasureCalc, MeasureMax ))
Group=MinMax
[MeterMinMax]
Meter=STRING
MeasureName=MeasureCalc
MeasureName2=MeasureMin
MeasureName3=MeasureMax
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Val: %1#CRLF#Min: %2#CRLF#Max: %3
Now which answer is what you wanted: what I've described, or jsmorley's one?
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Calculate Min,Max Value of a measure
besfore I do anything, just to say that I don't need a percentual value at all. Here is a formula I used to get the Max value with, but not sure how good it is as the same is used for net speed peak measure.
Code: Select all
[MeasureMaxPowerDraw]
Measure=Calc
Formula=Max(Max(PSUPowerUsage, PSUPowerUsage), #MaxPowerDraw#)
IfConditionMode=1
IfCondition=((MeasureMaxPowerDraw > #MaxPowerDraw#) && (MeasureMaxPowerDraw < 134217728))
IfTrueAction=[!SetVariable MaxPowerDraw ([MeasureMaxPowerDraw])]
DynamicVariables=1
Code: Select all
[Variables]
MaxPowerDraw=0
.
.
.
[PSUPowerUsage]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\FinalWire\AIDA64\SensorValues
RegValue=Value.PPSU
UpdateDivider=2
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Calculate Min,Max Value of a measure
In your code I see how the max value is returned (by the [MeasureMaxPowerDraw] measure), but what measure returns the Min value (which is 0, according to the image)?Pul53dr1v3r wrote:besfore I do anything, just to say that I don't need a percentual value at all. Here is a formula I used to get the Max value with, but not sure how good it is as the same is used for net speed peak measure.
Also note that the Max(PSUPowerUsage, PSUPowerUsage) part of the Formula of the [MeasureMaxPowerDraw] measure is perfectly useless. It always returns a value equal with [PSUPowerUsage], because the largest value between PSUPowerUsage and PSUPowerUsage is always PSUPowerUsage!
Also not sure who talked here about percentual values?
Although I don't have the needed software to can check, I think the following code should work:
EDIT: The following code is fixed. Previously the !SetOption bang of the OnChangeAction option of the [PSUPowerUsage] measure was mistaken. Sorry...
Code: Select all
[PSUPowerUsage]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\FinalWire\AIDA64\SensorValues
RegValue=Value.PPSU
UpdateDivider=2
OnChangeAction=[!SetOption MeasureMin Formula "(Min(PSUPowerUsage, MeasureMin))"]
[MeasureMin]
Measure=Calc
Formula=( Min ( PSUPowerUsage, 134217730 ))
Group=MinMax
[MeasureMax]
Measure=Calc
Formula=( Max ( PSUPowerUsage, MeasureMax ))
Group=MinMax
Please check this code and let me know if they do.
Last edited by balala on November 13th, 2017, 8:02 pm, edited 2 times in total.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Calculate Min,Max Value of a measure
It just was my bad try.balala wrote: In your code I see how the max value is returned (by the [MeasureMaxPowerDraw] measure), but what measure returns the Min value (which is 0, according to the image)?
As far as the new solution is concerned, I've removed "134217730" from the code and have made this:
Code: Select all
[PSUPowerUsage]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\FinalWire\AIDA64\SensorValues
RegValue=Value.PPSU
UpdateDivider=2
OnChangeAction=[!SetOption MeasureMinPowerDraw Formula "(Min(PSUPowerUsage,PSUPowerUsage))"]
[MeasureMaxPowerDraw]
Measure=Calc
Formula=( Max ( PSUPowerUsage, MeasureMaxPowerDraw))
Group=MinMax
[MeterMaxPowerDrawValaue]
Meter=String
MeasureName=MeasureMaxPowerDraw
MeterStyle=styleRightText
FontColor=255,255,255,50
FontSize=7
Text="Max: %1W"
X=195
Y=82
Autoscale=1
ToolTipText=Max Power Draw
;Min_Power
[MeasureMinPowerDraw]
Measure=Calc
Formula=( Min ( PSUPowerUsage, MeasureMinPowerDraw))
Group=MinMax
[MeterMinPowerDrawValaue]
Meter=String
MeasureName=MeasureMinPowerDraw
MeterStyle=styleRightText
FontColor=255,255,255,50
FontSize=7
Text="Min: %1W"
X=195
Y=99
Autoscale=1
ToolTipText=Min Power Draw
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Calculate Min,Max Value of a measure
I don't think so. The Min should show always 0.Pul53dr1v3r wrote:The Max works OK, but the Min shows current Power Usage...
I think I explained above why. Just leave there the 134217730 value and give it a new try.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Calculate Min,Max Value of a measure
The same with the number. Just showing the current value.
Edit: The Min value can never be 0, neither close to 0 when the PC is Turned On. The lowest value (wattage) I've ever got was 29 W, in idle.
Edit: The Min value can never be 0, neither close to 0 when the PC is Turned On. The lowest value (wattage) I've ever got was 29 W, in idle.
Last edited by pul53dr1v3r on November 13th, 2017, 8:30 pm, edited 1 time in total.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Calculate Min,Max Value of a measure
You're right, I just realized why. I edited my previous code.Pul53dr1v3r wrote:The same with the number. Just showing the current value.
And here is your code, fixed, too:
Code: Select all
[PSUPowerUsage]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\FinalWire\AIDA64\SensorValues
RegValue=Value.PPSU
UpdateDivider=2
OnChangeAction=[!SetOption MeasureMinPowerDraw Formula "(Min(PSUPowerUsage,MeasureMinPowerDraw))"]
[MeasureMaxPowerDraw]
Measure=Calc
Formula=( Max ( PSUPowerUsage, MeasureMaxPowerDraw ))
Group=MinMax
[MeterMaxPowerDrawValaue]
Meter=String
MeasureName=MeasureMaxPowerDraw
MeterStyle=styleRightText
FontColor=255,255,255,50
FontSize=7
Text="Max: %1W"
X=195
Y=82
Autoscale=1
ToolTipText=Max Power Draw
;Min_Power
[MeasureMinPowerDraw]
Measure=Calc
Formula=( Min ( PSUPowerUsage, 134217730 ))
Group=MinMax
[MeterMinPowerDrawValaue]
Meter=String
MeasureName=MeasureMinPowerDraw
MeterStyle=styleRightText
FontColor=255,255,255,50
FontSize=7
Text="Min: %1W"
X=195
Y=99
Autoscale=1
ToolTipText=Min Power Draw
Sorry for the inconveniences, I hope this time everything is ok. It was my fault.
Please check this code and let me know if it is.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Calculate Min,Max Value of a measure
balala wrote: Please check this code and let me know if it is.
That's it. Works as it should. Thx once more!