Need advice on meta points
I have two meta points P1 P2 that get logged when and if 2 input context points P1a, P2a are logged on change (they increment). I now want a third meta point P3 that logs the value of either P1 or P2 context points whenever either are logged. Only p1 or p2 can be logged at any one timestamp controlled at the source.
My issue is real time and history recalculation must both work and I can get real time to work but not a history with the correct timestamp on p3.
var timestamp = Number(CONTEXT.getTimestamp());
if (Math.abs(timestamp - Number(p1.time)) < 1000)
p3 += p1.value;
if(Math.abs(timestamp - Number(p2.time)) < 1000)
p3 += p2.value;
This logs all data and p1 or p2 updates p3 CONTEXT when either is logged and they are only logged if their CONTEXT points have logged and this only happens when they have changed. So the plan is that p3 will log the value and timestamp of either p1 or p2 whichever triggers the update. So far I cannot get this to work. Any advice would be helpful.
phildunlap last edited by
It's not super clear to me why it is doing what it is doing from what you described. It looks like p3 could be the sum of the value if there were logged values within 1 second of each other? I'm surprised everything is in Number() constructors too, you shouldn't need to do that.
How're the timestamps in the history calculation wrong? It will use the timestamp of the point that triggered execution unless
TIMESTAMPis assigned, and that applies to history calculations too.
The time of p1a and p2a are controlled by a controller and uses system mode to increment one register or the other so it should not trigger together. I changed the CONTEXT update from logged to update on the p3 and this has made a difference I see after a single point test. times are lining up. now so I am re-running a few months across several hundred points to see the outcome. Input meter values are time correct, so when it finished and I will look close at the data timestamps and report back.
phildunlap last edited by
I changed the CONTEXT update from logged to update on the p3 and this has made a difference I see after a single point test. times are lining up.
There is no difference between the update types for history generation. I actually just opened a git issue on account of that, since the 'Changes' update event isn't really honored in history generation.
Can you please let me know what happened with this git issue?
I'm working on a meta data point that works during a synchronization.
Jared Wiltshire last edited by
@andrewh I am not sure which issue exactly Phillip was referring too -