I have spent much of the day setting up my system and I am finding the on several occasions I need the ability to take the output from one "log to feed" to a new input, but it does not appear that I can do that.
As an example, I have a solar generation output that I have applied a "+" and "x" calibration to. I also had a power consumption input that I had applied a "+" and "x" calibration to. Now I want to do NET Power by subtracting the Solar from the Consumption. To do that I subtract the Solar from the consumption, but that is the Solar input, not the calibrated Solar. I can reapply the "+" calibration but I cannot reapply the "x" calibration.
I solved that for now by applying the calibration in the sketch, but it would be quite handy if I could just use the feed that is already calibrated as a new input.
Any suggestions. Am I missing something?
Ken Nicely
Re: Is there any way to create and input from a feed "Log to Feed"
I've often thought that it would be useful to have a 'clear' process function, which would stop the previous values from being carried forward in the process chain. If we did we could insert a 'clear' after the '+', 'x' etc 'log to feed', and then add '+ input' to further process the same input and subsequently log it to a different feed.
Does that make sense?
Paul
Re: Is there any way to create and input from a feed "Log to Feed"
Yes, that would be similar and also helpful. I might just have to learn PHP better.
Ken
Re: Is there any way to create and input from a feed "Log to Feed"
Ken - Only yesterday I posted a feature request to use feeds in calcs http://openenergymonitor.org/emon/node/4299 It would make emoncms far more versatile. nice to know I'm not the only one thinking along these lines.
Paul - You can reset a feed using allow positive followed by allow negative (basically allow nothing) then add input to start afresh, Schism took this idea and created a reset process for emoncms see http://openenergymonitor.org/emon/node/3915.
I am using emoncms.org currently so cannot use it but if you see attached, I reuse inputs several times. the grey areas mark the resets.
Paul
Re: Is there any way to create and input from a feed "Log to Feed"
Good thinking Paul!
Re: Is there any way to create and input from a feed "Log to Feed"
I think there is a strong argument for using feeds in input processing, if you agree please post a comment here as I'm sure it's not an easy task but if there is enough support then who knows?
Paul
Re: Is there any way to create and input from a feed "Log to Feed"
For using a +feed or -feed I modified in module Input the file process_modell.php
The Function get_process_list()
I added two lines
$list[29] = array(_(" + feed"),ProcessArg::FEEDID,"add_feed",0,DataType::UNDEFINED,"Input"); // Klaus 24.2.2014
$list[30] = array(_(" - feed"),ProcessArg::FEEDID,"sub_feed",0,DataType::UNDEFINED,"Input"); // Klaus 24.2.
you also have to define this two functios
public function add_feed($feedid, $time, $value)
{
$last = $this->feed->get_timevalue($feedid);
$value = $last['value'] + $value;
return $value;
}
public function sub_feed($feedid, $time, $value)
{
$last = $this->feed->get_timevalue($feedid);
$myvar = $last['value'] *1;
return $value - $myvar;
}
thats it . After that you can add or substract a feed ID
Sorry but I am not php programmer. I program since 35 years in assembler
Re: Is there any way to create and input from a feed "Log to Feed"
perfect, I've added your code in, and added divide by and multiply by feed.
Re: Is there any way to create and input from a feed "Log to Feed"
thanks Trystan,
sorry but how do I get or where do I get this modified version?
In git development ? Do you have a link.
Up to now I do not really understand this git and how it works but I try!
Klaus
Re: Is there any way to create and input from a feed "Log to Feed"
Thanks guys the new functions are just what we needed !
I have just edited my local copy with the changes for now, when will they reach a released version? and will they be available on emoncms.org?
If possible would you include one more line
$list[33] = array(_("Reset to ZERO"),ProcessArg::NONE,"reset2zero",0,DataType::UNDEFINED,"Misc");
with the function
public function reset2zero($arg, $time, $value)
{
$value = 0;
return $value;
}
This would eliminate having to use allow positive and allow negative together to reset a processing chain. its a small difference but combined with the new feed functions it makes the process chains very easy to read. (see attached)
Along with the new button links to the individual feed visualizations and on-screen feed values this really is so informative and has become a pleasure to use.
Paul
Re: Is there any way to create and input from a feed "Log to Feed"
I just want to say thanks for the quick response on this. I implemented the +/- feed this evening and it works great. It is amazing how little code had to be added to make this happen.
A big thumbs up to KlausA!
Ken