Hello,
I don't see a way to do an absolute value on EmonCMS?
I tried "Signed to unsigned" but it seems to give me some really funky values.
Thanks
M
Archived Forum |
|
EmonCMS - Absolute?Submitted by madas on Thu, 20/11/2014 - 16:53Hello, I don't see a way to do an absolute value on EmonCMS? I tried "Signed to unsigned" but it seems to give me some really funky values. Thanks M » |
Re: EmonCMS - Absolute?
Try:
Allow negative
× -2
+ input [the same one]
... [any other processing]
Log to Feed
Re: EmonCMS - Absolute?
I have positive and negative values - this will only fix the negative values?
Re: EmonCMS - Absolute?
Are you sure?
Re: EmonCMS - Absolute?
Do I need to log to the feed prior to the "allow negatives" in order to get the positives in the feed?
Re: EmonCMS - Absolute?
No. Why should you? What would that put into the feed?
Re: EmonCMS - Absolute?
Ah - i understand it now. Thanks for the help
Re: EmonCMS - Absolute?
In case anyone reading this thread later does not understand, this is what happens:
Say the input value is +123:
Allow negative
the value is not allowed, so zero is passed forwards.
× -2
zero × -2 = zero is passed forwards.
+ input [the same one]
0 + +123 = 123 is passed forwards.
... [any other processing]
Log to Feed
123 is sent to the feed.
Now say the input value is -321:
Allow negative
the value is allowed, so -321 is passed forwards.
× -2
-321 × -2 = +642 is passed forwards.
+ input [the same one]
+642 + -321 = 321 is passed forwards.
... [any other processing]
Log to Feed
321 is sent to the feed.
Had the input been logged to feed immediately, before 'allow negative', then two values would have been sent to the feed in succession, first the original value and then the absolute value.
Re: EmonCMS - Absolute?
This was super helpful, Robert. Thanks.
Would you happen to know of a location where all of the feed options are explained in detail? With examples, perhaps?
Re: EmonCMS - Absolute?
Unfortunately, I don't believe it exists. I have said for some while that the documentation for emonCMS needs improvement. All I can suggest is that you either take the code apart to see what it does, or test various commands and observe the result.
In general, each function accepts a value, operates on it and passes a changed value forward to the next. But there are exceptions.