Totalizer value clearing at Download

I have noticed that the Analog Totalizer value clears when the Strategy is edited and downloaded. Is there a way to prevent this from occurring? This makes it challenging to make code edits without torpedoing the totalizer value for whatever period of time it is recorded over.

I removed “Set Analog Totalizer Rate” from the Powerup chart, and the GetClearAnalogTotalizerValue commands, so programmatically, the Totalizer should not be resetting?

GROOV-EPIC-PR1, IMAI-8, PAC Control R10.3d

Odd.
I have been using the code (Mary wrote for me) since day zero and have done a billzion downloads to that controller and never had it reset.

Here is how I have it setup.

The code is just in a chart that loops all the time. There is nothing in my powerup chart other than a bunch of ‘start chart’ commands.
The code itself is just 2 lines (You don’t need the third line - 0.14 is cents per kWh in my case).
You set the analog totalizer rate and you get the value.

The most important thing is that your totalized variable must be persistent. Is yours set up that way?
Note that if you don’t have your variable set as persistent, it will still reset when you re-download the strategy the first time after setting, but it should not reset after that.

I am sorry I can’t post my code as that would be helpful. different network, crazy controls, etc…

I initially had set the totalizer rate in the powerup chart. I was concerned that each time it started the program, it was resetting the totalizer. I removed the totalizer rate command from powerup and tested it separately to verify that repeatedly setting the totalizer rate doesn’t affect the totalizer unless you set it to 0.0 and back. Your code also demonstrates this.

I am using Mary’s “UpdateWeeklyMonthlyYearlyTotals” Subroutine to accomplish daily, monthly, and annual totals. For testing purposes I am triggering the sub every two minutes simulating a new day and was using GetClearAnalogTotalizerValue to read the value into a float variable (not persistent, because it is a new value each day not a running total) to pass into the sub. I verified that this chart was not running by default when first called. (The conditional statement uses a persistent time value, so it is not restarting at zero and triggering the GetClear command by default) I also verified this is not occurring by putting a log message inside the conditional to verify it is only occurring when desired.

I can not find a setting for the Analog Input to make it persistent? I would assume that would be the case as it is supposed to be running on the IO controller. Does this work differently on an Epic then on a Brain?

Additionally, I just added a series of totalizer reads in the powerup chart. The first GetAnalogTotalizerValue reads a totalizer value consistent with just prior to downloading. I immediately read again and it is already reset.

I have double/triple checked that I don’t have any GetClear commands hiding anywhere…

I removed all the Start Chart commands from the powerup chart to eliminate any possible cause. I read the totalizer, delay for 10ms and read the totalizer again. the first read is good, the second read is 0.

Sounds like I need to roll my sleeves up and test this on a groov…

EDIT, don’t forget, you don’t want or need the analog input to be persistent. That would be a very bad thing, analog totalizing is looking at the area under the input over time. It makes no sense for the analog input to be persistent, it already is… Its measuring the analog voltage/power all the time… its how long its at each measurement point that is being totalized… Ok, off to download to an EPIC.

Huh, Ok, so groov EPIC handles this command differently than SNAP PAC…

Thanks for your patience while we did the sanity check.

I will start going over it with the software engineers, but in the mean time, here is a pretty straightforward workaround that I have used many times in the past…

First, for every groov I/O unit you have analog values on them that you want to totalize, double click on them and remove their Enable comms check mark.

Next, in your powerup chart, add a new block, call it what ever you want, I went with init…
Add (at least) two instructions.

For each of your I/O units that have analog values you need to totalize, add the ‘Set I/O Unit Configured Flag’ command. Be sure and call out each I/O unit as you have it configured in your strategy tree. (All the ones you took the check mark out of - probably just the one local unit).

Lastly, you still need to communicate to the I/O, so add the command ‘Enable communication to all I/O units’.

Whats going on here?
When you do a download, the controller sees the check box in the I/O unit and it initializes it, this is resetting the analog totalizer value.
By not putting that check mark in, the controller skips that init step… But without it, the control engine is not sure what to do with the I/O unit, so the power up chart command instructs the control engine that the I/O unit configured flag is set true, so its all good to use.
Lastly, since we have not (yet) enabled communications to the I/O unit, we do it in the powerup chart.

That should get you downloading without torpedoing the totalizer value every time.
(I tested it a bunch of times on my EPIC with no problems after clearly seeing it reset every time before applying the workaround).

1 Like

Wow, that is good to know. Does that explain why I get the “Boot ID from I/O unit doesn’t match…” every time I download and run the strategy?

No, that is a different groov Easter egg… (seriously, don’t get me started).

Does this work around apply to RIOs with features (like counters) that we are accessing from PR1s?

I would need to test each and get back to you. (Clearly 30+ years of experience accounts for nothing anymore [grin])

Okay thanks - I have that specific situation with a counter, but the project isn’t live with the customer yet so I haven’t checked if the counter is getting reset every time, but that would be something I need to fix if it does.

I have the gear on hand to test EPIC to RIO so can do it shortly, just preparing for the HiveMQ webinar at the moment;
https://www.opto22.com/community/events/webinar-introduction-to-mqtt-sparkplug-plug-n-p

Great! Thank you for following up on that. unfortunately I won’t be able to try it out on the hardware until next week (COVID…), but it sounds like you found the smoking gun.

Interesting that it is able to get one read in before resetting. must be the communication timing between the IO controller and the main controller. This is assuming that is how the EPIC is structured…?

@philip Yup, can confirm, the RIO counter input is cleared with a download.

Can also confirm that the same work around works for RIO.

The count of 16+ survives the download if you take the Enable check mark out of its I/O config screen and set its config flag in the powerup chart.

1 Like

Okay, thanks for checking. Is this something that will be fixed in a future release so we don’t have to do this or will this be SOP from now on?

When an IO unit gets a module added/changed, it would be nice if the existing counters or whatever else were not cleared.

BTW - couldn’t join the HiveMQ webinar since it was at 100 participants - will it be posted to watch later?

Sorry for the delay. I was hoping answer with both the EPIC and RIO aspects… Its a bit more complicated for the EPIC, so that will have to wait some more… BUT, for the RIO the answer is yes. SOP.

We need to reset/re-config the RIO every PAC Control download because of the multi-function capability.
I won’t go into it, but yeah, you will need to do that little disable/set configure flag/enable dance for each RIO in your strategy so that counters etc don’t get reset. (Note, I have not tested changing a point type on the RIO mid strategy - you might have to let the re-config happen in that case).

Yeah, sorry about the webinar. Zoom did not upgrade the seats from 100.
Watch it here (Worth it for the RIO, Influx, Grafana Sparkplug mashup).

Working great! Thanks.

(initially I was scratching my head because I had used the “Enable Communication to All I/O Points” because it pops up first when typing in the command… But I recovered before reporting failure and causing mass confusion!)

1 Like

Awsome, thanks for dropping back and letting us know you are up and running. (And thanks for carefully following the instructiona!)

1 Like