The log and short is I want to calculate (and therefore log to feed) the minimum of (feed1, feed2) over time. But I can’t find any operator in the drop downs to do it.
The why since perhaps there is another way - I want to show how much my hot tub is consuming from the grid ( have solar pv), so if I’m pulling 1.5KW from the grid and my hot tub feed is showing 2KW then I want to log 1.5KW, if I was pulling 3KW from the grid then I’d only want to log 2KW since that is the portion of my energy being bought that is being used by the hot tub. Obviously I’d only allow positives for cases where no hot tub or I’m exporting.
Which emonCMS are you using? I think it’s not possible with emoncms.org, but if it’s your local emonCMS, then it might be possible using comparison functions with the conditional jump instructions, if >, skip next combined with GOTO on the next line, etc.
Edit:
I thought you might be able to do it with emoncms.org, but I can’t see how to cater for the case where the two are equal. The steps below output zero if the two are equal, which is not what you want. So I think I was right, it’s not possible with emoncms.org.
Say the Inputs are A and B, both assumed positive.
(Note that we advocate fetching from a Feed rather than an Input, due to timing considerations. )
Process list A:
× -1
+ feed B
[This gives you B - A, if it’s negative, B is the smaller; if positive, A is the smaller]
allow positive
[value here is -A or zero]
× -1
Log to feed
Reset to ZERO
- input B
+ Input A
[This gives you +A - B, if it’s negative, A is the smaller; if positive, B is the smaller]
allow positive
[value here is -B or zero]
× -1
Log to feed
Subtract: Grid (results in negative number if Grid is bigger)
Allow negative (so positive numbers become zero)
Add: Grid (results in the minimum of the two outputs)
Log to feed
When Grid is the larger value, the Subtract and Adds cancel out leaving just the HotTub.
When Grid is smaller, then “Allow negative” throws away the HotTub value leaving just the Grid.
Edit: local hosted emoncms have “min by input” and “max by input”:
Limits the current value by the last value from an input as selected from the input list. The result is passed back for further processing by the next processor in the processing list.
I think you need “Max by feed” here, i.e. limit Hot tub to be no greater than Grid. If Grid is the smaller, then that will be the value logged. If Hot tub is smaller, then it won’t be affected.
(The terminology is confusing)
Yes quite confusing. Ok I’ve changed my test to max by feed, certainly has gone to zero now, just need a very big cloud now to prove it will log usage. Still not sure if I should have feeds or virtual here, certainly finding the virtual is great in once entering a new calculation I want to track that I have all historic data calculated also instead of only future data like a real feed.