Hi All,
We basically want to calculate our pump rate over any given timespan. This is a pretty pressing analysis we need done so any help would be greatly appreciated. Some quick information about the processing of the machine and digestion pump…
- We have a digestion tank that crushes up food into a sludge like material and pumps it to a cure tank.
- The pump from the digestion tank to the cure tank is not on all the time, but we send the data to Ubidots showing when it is on. This is represented with a 1 (on) and 0 (off).
- We are recording the weights of the digestion tank constantly.
- The digestion tank is ‘fed’ through a sequence that records feed weights.
- We are imagining the pump rate over any given timespan (set by the dashboard time) as the following:
Pump Rate (over any given timespan) = [WeightFIRST – (WeightLAST - ∑ Feed Weights)] / Pump Runtime
Where
WeightFIRST = The first weight in the data set for the specified period of time
WeightLAST = The last weight in the data set for the specified period of time
∑ Feed Weights = The sum of all the feed weights in the data set for the specified period of time
Pump Runtime = The amount of time the pump has been on for the specified period of time
I think we have the Pump Runtime down, using the following…
previousValue = shift( digpumpstatus, -1)
previousTime = shift( digpumpstatus.timestamp, -1)
actualValue = digpumpstatus
actualTime = digpumpstatus.timestamp
dV = actualValue – previousValue
dT = actualTime – previousTime
where(dV==-1,dT)
My large questions are is there a way to grab the WeightFIRST and WeightLAST for any given timestamp? This would literally just have to be the first digestion weight in the timespan and the last digestion weight in the timespan. Also, it seems pretty simple but we’d also need a sum of all the feed weights for any given timespan. I also attached a picture of the calculation.
Thanks,
Paul
Hello, @psalibe
I hope you’re well,
I believe my colleague Sebastian shares the following answer already, I copy the content here as well inside quotes:
In this case since you’d like to obtain the Pump rate for a specific time span (selected by the Dashboard), the combination of an HTML and an UbiFunction is needed.
The HTML would be quite simple, a button that once pressed obtains the Dashboard’s timespan and then executes an UbiFunction which obtains the data for the variables and calculates the Pump rate according to the expression that you shared. Then, the calculated value would be sent to a variable, and it could be shown in the Dashboard through any widget. I think it’s worth mentioning that if the Dashboards Timespan changes or just when new data of the Weight variables arrive, then the HTML’s button would have to be pressed so that it updates the calculated value.
If you think that this is maybe a little too manual, then we could make the HTML constantly do this process (say every 20 seconds), but please be aware that the quicker the frequency of the updating, the more UbiFunctions and Dots are consumed.
we’ll be attentive to your thoughts.
Regards,
-Santiago
Hi Santiago,
I had sent an email out to both David and support, I saw that Sebastian got back to me saying they had received and I would hear back when they get some time to respond, but don’t think I ever got that message from him. Where would I see that?
Regardless, thanks for getting back to me on this. We have a couple professional development tasks on queue right now that we are waiting to hear back on (from I believe Cris). This will likely be one for down the line - just wanted to see if there was a way of doing this currently.
Appreciate the help
Hello to anyone reading this thread,
I’d like to add that through Synthetic Variables it isn’t possible to select a specific Timespan for the calculations, so the request made by psalibe isn’t possible through Synthetic Variables.
Best regards,
Sebastián