It is currently March 28th, 2024, 11:30 am

Max/Min Internet Up/Down - not sure what to do

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Hi, I have a rather detailed internet monitor.
It captures up and down and displays it with a line graph.
It also displays the numerical values in real time.

What I think should be rather obvious, is to capture the maximum and minimum numerically, and hold that value until it is exceeded or receded.

The Measures would be calc Measures, if my reckoning is correct, but I am just a flop at maths.

Any recommendations or examples are welcome.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Max/Min Internet Up/Down - not sure what to do

Post by mak_kawa »

In general, maximum and minimum values can be obtained by comparing current value and stored Min. and Max. values, like this;

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=192,192,192,192

[Variables]
MaxValue=0
MinValue=1000

[someMeasure]
Measure=Calc
Formula=Random
LowBound=0
HighBound=1000
DynamicVariables=1

[measureMax]
Measure=Calc
Formula=[someMeasure]-#MaxValue#
IfConditionMode=1
IfCondition=#CURRENTSECTION#>0
IfTrueAction=[!SetVariable MaxValue [someMeasure]]
DynamicVariables=1

[measureMin]
Measure=Calc
Formula=[someMeasure]-#MinValue#
IfConditionMode=1
IfCondition=#CURRENTSECTION#<0
IfTrueAction=[!SetVariable MinValue [someMeasure]]
DynamicVariables=1

[meterCurrentValue]
Meter=String
MeasureName=someMeasure
X=5
Y=5
W=150
H=20
Text=Current value: %1
DynamicVariables=1

[meterMaxValue]
Meter=String
X=5
Y=25
W=150
H=20
Text=Max value: #MaxValue#
DynamicVariables=1

[meterMinValue]
Meter=String
X=5
Y=45
W=150
H=20
Text=Min value: #MinValue#
DynamicVariables=1
Of course, using Max() and Min() built-in functions is possibly more smart. :-)

I am afraid that if this is not what you want...
Last edited by mak_kawa on December 3rd, 2019, 10:24 am, edited 1 time in total.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Thanks mak_kawa

The solution I found given your example is this:

Code: Select all

[Variables]
m=>
n=>

[MeasureUpMax]
Measure=Calc
Formula=MeasureUpMax > MeasureOUT2 ? MeasureUpMax : MeasureOUT2
DynamicVariables=1

[MeasureUpMin]
Measure=Calc
Formula=MeasureUpMin #m# MeasureOUT2 ? MeasureUpMin : MeasureOUT2
DynamicVariables=1

[MeasureDnMax]
Measure=Calc
Formula=MeasureDnMax > MeasureIN2 ? MeasureDnMax : MeasureIN2
DynamicVariables=1

[MeasureDnMin]
Measure=Calc
Formula=MeasureDnMin #n# MeasureIN2 ? MeasureDnMin : MeasureIN2
DynamicVariables=1

[SwitchUp]
Measure=Calc
Formula=0 < MeasureNetOut ? 1 : 0
IfAboveValue=0
IfAboveAction=!SetVariable m <

[SwitchDn]
Measure=Calc
Formula=0 < MeasureNetIn ? 1 : 0
IfAboveValue=0
IfAboveAction=!SetVariable n <
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Whoops. Had to fix something:

Code: Select all

[MeasureUpMax]
Measure=Calc
Formula=MeasureUpMax > MeasureOUT2 ? MeasureUpMax : MeasureOUT2
DynamicVariables=1

[MeasureUpMin]
Measure=Calc
Formula=MeasureUpMin #m# MeasureOUT2 ? MeasureUpMin : MeasureOUT2
DynamicVariables=1

[MeasureDnMax]
Measure=Calc
Formula=MeasureDnMax > MeasureIN2 ? MeasureDnMax : MeasureIN2
DynamicVariables=1

[MeasureDnMin]
Measure=Calc
Formula=MeasureDnMin #n# MeasureIN2 ? MeasureDnMin : MeasureIN2
DynamicVariables=1

[SwitchUp]
Measure=Calc
Formula=0 < MeasureOUT2 ? 1 : 0
IfAboveValue=0
IfAboveAction=!SetVariable m <

[SwitchDn]
Measure=Calc
Formula=0 < MeasureIN2 ? 1 : 0
IfAboveValue=0
IfAboveAction=!SetVariable n <
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Grr.
It's still not right.

Min values seem to change for a bit then they get stuck on zero.

Stuck now...

[edit]
peculiar behaviour ensues...

toying around again - things seem to go rightly for a bit then they sort of freeze - max at a random number and low at zero...
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

fancy net.rar
(1.64 KiB) Downloaded 5 times
This is the whole thing - it should be complete - requiring no images or outside resources other than SpeedFan.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Max/Min Internet Up/Down - not sure what to do

Post by balala »

Mor3bane wrote: December 3rd, 2019, 7:40 am What I think should be rather obvious, is to capture the maximum and minimum numerically, and hold that value until it is exceeded or receded.
But the minimum always is 0, no? I mean that when refreshing the skin, both the [MeasureIN2] and [MeasureOUT2] measures are equal to zero, so there will be no other minimum value than 0.
Getting the maximum is much logical and beside the posted methods another one would be this:

Code: Select all

[MeasureUpMax]
Measure=Calc
Formula=( Max ( MeasureUpMax, MeasureOUT2 ))
;DynamicVariables=1

[MeasureDnMax]
Measure=Calc
Formula=( Max ( MeasureDnMax, MeasureIN2 ))
;DynamicVariables=1
No need to set the dynamic variables, so I commented out the appropriate options.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Well the idea behind the switching less than / greater than operator was proposed by kenz0 here https://forum.rainmeter.net/viewtopic.php?t=4555#p30987

It seems to work if you did not try my skin out - everything functions rather well - however after some time the values for the min values just freeze, then at random the max values also fail to register - i have no idea why - i am not sure if it is programmatic or intrinsic to rainmeter base code.

I will try your suggestion balala, since the max values seem to fail either way - that is if the <> idea is flawed or my base formulae are.

Getting the min value to update after a rise and fall in constant usage would be awesome - so that if the min does reach zero - it picks up again after rising then falling-not-to-zero-again forever.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Max/Min Internet Up/Down - not sure what to do

Post by balala »

Mor3bane wrote: December 3rd, 2019, 1:33 pm Well the idea behind the switching less than / greater than operator was proposed by kenz0 here https://forum.rainmeter.net/viewtopic.php?t=4555#p30987
Yes, but there only the maximum value is calculated. As I said, I don't think there is a way to get the minimum value, because it always will be zero.
Mor3bane wrote: December 3rd, 2019, 1:33 pm It seems to work if you did not try my skin out - everything functions rather well - however after some time the values for the min values just freeze, then at random the max values also fail to register - i have no idea why - i am not sure if it is programmatic or intrinsic to rainmeter base code.
Please post the whole code of your skin. Simply copy it entirely and paste it here. I'd like to check it.
Mor3bane wrote: December 3rd, 2019, 1:33 pm Getting the min value to update after a rise and fall in constant usage would be awesome - so that if the min does reach zero - it picks up again after rising then falling-not-to-zero-again forever.
Good idea, will try to make it to properly work and later will be back with a possibility, if I find any.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Max/Min Internet Up/Down - not sure what to do

Post by Mor3bane »

Code: Select all

[Rainmeter]
Update=400
AccurateText=1
DynamicVariables=1
DragGroup=one

[Variables]
inusage=Val7
outusage=Val8
incurrent=0
intotal=0
outcurrent=0
outtotal=0
m=>
n=>

;==================================Styles=========================

[TextStyle]
FontFace=Segoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1

[TextStyle1]
FontFace=Segoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[AllStyle]
FontSize=14
FontWeight=100
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1

[RightStyle]
StringAlign=Right

;==================================Measures=========================

[MeasureNetIn]
Measure=NetIn
updatedivider=10

[MeasureNetOut]
Measure=NetOut
updatedivider=10

[MeasureNetInC]
Measure=NetIn
Cumulative=1

[MeasureNetOutC]
Measure=NetOut
Cumulative=1

;===================================Calculations====================

[ValK]
updatedivider=-1
Measure=Calc
Formula=2048

[ValIn]
Measure=Calc
DynamicVariables=1
Formula=MeasureNetIn/1.05

[MeasureIN]
Measure=Calc
Formula=ValK > [ValIn] ? 0 : ValIn
DynamicVariables=1
IfAboveValue=10241
IfAboveAction=!SetVariable NetDC 100,255,100,255
IfBelowValue=10240
IfBelowAction=!SetVariable NetDC 255,255,255,255

[ValOut]
Measure=Calc
DynamicVariables=1
AverageSize=#avg#
Formula=MeasureNetOut/1.05

[MeasureNetInCumulative]
Measure=Calc
Formula=MeasureNetInC/6

[MeasureNetOutCumulative]
Measure=Calc
Formula=MeasureNetOutC/6

[MeasureOUT]
Measure=Calc
Formula=ValK > [ValOut] ? 0 : ValOut
DynamicVariables=1
IfAboveValue=1025
IfAboveAction=!SetVariable NetUC 100,100,255,255
IfBelowValue=1024
IfBelowAction=!SetVariable NetUC 255,255,255,255

[MeasureIN2]
Measure=Calc
Formula=MeasureIN
DynamicVariables=1

[MeasureOUT2]
Measure=Calc
Formula=MeasureOUT
DynamicVariables=1

[MeasureUpMax]
Measure=Calc
Formula=( Max ( MeasureUpMax, MeasureOUT2 ))

[MeasureUpMin]
Measure=Calc
Formula=MeasureUpMin #m# MeasureOUT2 ? MeasureUpMin : MeasureOUT2
DynamicVariables=1

[MeasureDnMax]
Measure=Calc
Formula=( Max ( MeasureDnMax, MeasureIN2 ))

[MeasureDnMin]
Measure=Calc
Formula=MeasureDnMin #n# MeasureIN2 ? MeasureDnMin : MeasureIN2
DynamicVariables=1

[SwitchUp]
Measure=Calc
Formula=0 < MeasureOUT2 ? 1 : 0
IfAboveValue=0
IfAboveAction=[!SetVariable m <]

[SwitchDn]
Measure=Calc
Formula=0 < MeasureIN2 ? 1 : 0
IfAboveValue=0
IfAboveAction=[!SetVariable n <]

[Val5]
updatedivider=-1
Measure=Calc
Formula=0

[Val6]
updatedivider=-1
Measure=Calc
Formula=1

;=======================================Text Meters=================

[MeterTextSpeed]
UpdateDivider=-1
Meter=String
X=1115
Y=-3
MeterStyle=TextStyle1
StringAlign=right
Text="Speed"

[MeterTextMax]
UpdateDivider=-1
Meter=String
X=1155
Y=-3
MeterStyle=TextStyle1
StringAlign=left
Text="Maximum"

[MeterTextMin]
UpdateDivider=-1
Meter=String
X=1266
Y=-3
MeterStyle=TextStyle1
StringAlign=left
Text="Minimum"

[MeterTextUP]
Meter=String
X=922
Y=20
StringAlign=left
Text="UP"
FontColor=#NetUC#
DynamicVariables=1
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[MeterTextDN]
Meter=String
X=922
Y=40
StringAlign=left
Text="DN"
FontColor=#NetDC#
DynamicVariables=1
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[UpSpeed]
Meter=String
updatedivider=1
MeasureName=MeasureOUT2
X=1145
Y=17
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[TextUpMin]
Meter=String
updatedivider=1
MeasureName=MeasureUpMin
X=1365
Y=17
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[TextUpMax]
updatedivider=1
Meter=String
MeasureName=MeasureUpMax
X=1255
Y=17
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B
DynamicVariables=1

[DnSpeed]
Meter=String
updatedivider=1
MeasureName=MeasureIN2
X=1145
Y=37
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[DnData]
Meter=String
updatedivider=1
MeasureName=MeasureDnMin
X=1365
Y=37
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[DnSession]
updatedivider=1
Meter=String
MeasureName=MeasureDnMax
X=1255
Y=37
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

;======================================End Text=====================

;======================================Connectivity=================<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

[MeasureInternetConnect]
Measure=Plugin
Plugin=CheckNet
ConnectionType=Internet
Disabled=0
Substitute="^1$":"CONNECTED","^-1$":"OFF LINE"
RegExpSubstitute=1

[MeterTextConnect]
Meter=String
MeasureName=MeasureInternetConnect
Fontsize=20
FontFace=Astronaut
AntiAlias=1 
StringAlign=Center
X=1024
Y=60
InlineSetting=Color | #Orange#
InlinePattern=(?i)^OFF Line
StringAlign=Right
FontColor=105,255,105,255

[MeasureType]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_TYPE

[MeterType]
Meter=String
MeasureName=MeasureType
Fontsize=20
FontFace=Astronaut
InlineSetting=Case | UPPER
AntiAlias=1 
StringAlign=Left
FontColor=105,255,105,255
X=1195
Y=60
Text=%1
LeftMouseDownAction=
DynamicVariables=1

;=====================================Lines=========================

[MeterGraph2]
Meter=Line
MeasureName=MeasureOUT2
MeasureName2=MeasureIN2
X=0
Y=1
H=100
W=92
LineCount=2
LineWidth=4
LineColor=75,75,255,255
LineColor2=75,255,75,255
Autoscale=1
AntiAlias=1
UpdateDivider=5
TransformationMatrix=10; 0; 0; 1; 0; 0
TransformStroke=Fixed

;=========================================Boxes=====================

[LowerHoriz]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=0
Y=102
H=1
W=1366
LineColor=255,255,255,255

[TopLine]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=0
Y=0
H=1
W=1366
LineColor=255,255,255,255

[Line1]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-79
H=100
W=466
LineColor=255,255,255,155

[Line2]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-59
H=100
W=466
LineColor=255,255,255,155

[Line3]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-39
H=100
W=466
LineWidth=2
LineColor=255,255,255,155

[Line4]
UpdateDivider=-1
;Meter=Line
MeasureName=Val5
X=911
Y=-19
H=100
W=466
LineColor=255,255,255,155

[Bar1]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,155
H=60
W=1
X=1025
Y=1

[Bar2]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,155
H=100
W=1
X=1150
Y=1

[Bar3]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,155
H=60
W=1
X=1260
Y=1

[Bar4]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,155
H=100
W=1
X=911
Y=1

[Bar5]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,155
H=100
W=1
X=920
Y=1

[MeterImageClick]
Meter=Image
W=105
H=60
X=921
Y=20
DynamicVariables=1
LeftMouseUpAction=[!Refresh]
SolidColor=0,0,0,1
Post Reply