Predicting and re-writing the future

Hi,

So now I’m getting into my stride. I have MELCloud (for Air Source Heat Pump), pwws (for weather) and CurrentCost (for power) up and running. I’ll apologise every time I mention those because it means I didn’t buy any hardware from you…sorry.

I already have scripts that do things like predicting when the heat pump needs to come back on (and in fact it will turn it on). When I incorporate solar (not much point since October!) I’ll be doing more predictions.

I can see that with PHPFINA I can write up to the current time and I can re-write history. With PHPTIMESERIES I can write future values but I don’t seem to be able to re-write the past or the future.

As you can imagine, my predictions will be changing as time goes by, the code will incorporate new data and re-write the prediction for Tuesday when it starts seeing how the solar is panning out on Tuesday for example.

So I’m wondering if I’m just missing something and that there is a way to write future values and re-write them. Of course I could create a new feed for each prediction run (e.g. the “as at 09:00” prediction feed) but that’ll complicate the graphing and dashboards.

FYI I was testing this by just pushing lots of values in to “/input/post” with varying “time” values.

Thanks

David Bowen

(ps searching for previous discussions on this came up blank, but it did reveal lots of other interesting conversations :slight_smile: )

Of course I should have read the help “Learn” topic first:

https://learn.openenergymonitor.org/electricity-monitoring/timeseries/History

which pretty much answers my question by indicating that I can’t change the values in PHPTIMESERIES.

I’m still unclear why I can’t write into the future with PHPFINA though.

This should be possible, are you using a self hosted version of emoncms?

How far into the future?

IIRC there is a hard coded window of -4or5yrs to +48hrs. When I was playing with nrel data I had to edit the source locally to post timestamps more than 48hrs ahead, I may of posted about it in the thread I linked.

Aha. I thought you might say that. Knowing that it’s possible I tried doing it again. I was able to push values, even a year in the future, and it said “ok”.

Previously I was reviewing the feed content in the Graphs. In the last few days I’ve become better at using the API. I still can’t see the values in the graphs, however you can see them in the feed screen in this screenshot:

I’ve also been able to pull it back from the API with the correct value and timestamp.

I’m self-hosted with a recent git-pull from master:

Git:
URL : GitHub - emoncms/emoncms: Web-app for processing, logging and visualising energy, temperature and other environmental data
Branch : * master
Describe : 10.2.0-6-gf4b9c015

So it looks like the engine is happy, it’s just that I can’t see it in the graphs (even if I fiddle with the time window to show the future of course!). Notably the autoscale on the y-axis is -1 to +1 and the “Show statistics” part says there are no readings.

Whilst it’s a bit disappointing that I can’t see the numbers in the graph, at least I can use the engine to do what I need. Notably I’ve been able to alter values in the future trivially using /input/post and not needing to know the value pre-existed and use /input/update.

So I may come back with more diagnosis of the graph problem later, but it’s not pressing at the moment. For example, my algorithm can post “when will the heat pump come back on” and then I can show that as a timestamp in an app or dashboard.

Thanks for encouraging me to try a more unusual test.

Also, thanks for chatting about things in the forum Paul and Trystan. Seeing your other posts has saved me asking about ten questions. You wouldn’t guess from all the posts I keep putting up anyway :slight_smile:

David Bowen

I’m collecting future data for weather and solar forecasts, and bypassed the whole input and feed system by using MYSQL Timeseries which I then update directly via SQL. How naughty!

REPLACE INTO feed_X (time, data) VALUES ($time, $data)

I also push the “current” value into the feed table, for use in dashboards, etc.

UPDATE feeds SET time = $time, value = $data WHERE id = X

While I should probably use the proper mechanisms, this seems to work well enough. I have no problem with the graphs either.

1 Like