0
Under review
Finding X lowest values
I'm trying to put together a Task to run a pool circulation pump only on the hours when the electricity cost is the lowest. I can get the prices from nordpoolspot.com API. I end up with 24 Doubles, one for each hour of the day. But I have not managed to figure out a way to filter out the lowest values.
For instance I need to run the pump for 6 hours every day. So at every hour I need a way to check "Is this current hour one of the 6 cheapest hours for today?"
Any ideas?
Customer support service by UserEcho
I still have not managed to find a way to achieve this, however I'm using a temporary "good enough" solution. I'm calculating the average of the days power cost and then checking to see if current hours cost is below average. If it is, it counts as one of the "safe" hours.
The only problem is, when I need to run the pump for longer than there are hours with below average costs in a given day. For that case I'm currently just logging an error message saying "The pump was asked to run for X hours, but it only ran for Y hours yesterday." To give me a heads up should this happen.
the trick is to find the highest value of the X cheepset hours and then you can check if the actual hour price is <= this price. To finde this reverence price will be a tough one.
Max
Hello,
do those "cheaper hours" start every day at the same time? When do you receive your prices from your API?
Regards.
The prices get fetched at 00:00 every day and that is when I reset the "Hours ran today" variable for the circulation pump. So it's all a clean slate.
Hello,
since this is a more advance technical question and will require additional work, please create a ticked in our Comfortclick ticketing system.
To open a ticket:
We'll get back to you in the shortest possible time.
Regards
That's ok. The reason for this question was to see if something like that is currently possible. It's not important enough for me to have you guys do custom work on it. I just enjoy pushing the boundaries of new systems and see what I can get away with :)
so you want to take 24 random values and put them into a order from lowest to highest right?
Push the boundries and just do 24 x 24 min/max/average calculations :D
But actually we need a function that takes random values and realignes them into a order from highest to lowest or other way around :) Thank you comfortclick
This woud be an easy task with an script language or an API for custom tasks.
More advanced logic ands up quite messy with the simple generic Tasks.
Best regards Max