Sign in to follow this  
Followers 0
Michael Lloyd

MINC returns zero with non-zero input?

6 posts in this topic

I have set up three STX routines to capture Min/Max/Average poll times for my ClearSCADA apps. Basically I set up a notted "hearbeat" contact that the scada system writes to. When the input is off, a 10 minute timers starts. When it turns on (one scan) the timer resets to 0 and the input is turn off with an unlatch command. It's a simple little one rung comm fail routine. If comm is out for more than 10 minutes the station automatically shuts down. Just above the timer rung I have a rung that moves Timer.ACC to a DINT called PollTime.Raw Now to the "problem". I want to display min, max, and average poll times for each station on our HMI. Max is working perfectly. Min always returns a zero. And I haven't gotten to MAVE yet to see what's wrong, if anything, with it. Out and In are enabled. Here's the entire STX routine. It's called every scan PollTime.Current := PollTime.Raw / 1000.0; PTMIN.In := PollTime.Current; PTMIN.Reset := OFF; PTMIN.ResetValue := 60.0; MINC(PTMIN); PollTime.Min := PTMIN.Out; PTMAX.In := PollTime.Current; PTMAX.Reset := OFF; PTMAX.ResetValue := 2.0; MAXC(PTMAX); PollTime.Max := PTMAX.Out; MAVE(PTAVG); PollTime.Avg := PTAVG.Out; Does anyone see any flies on this?

Share this post


Link to post
Share on other sites
I'm going to leave this because sometimes one man's DUH is another man's OH! It's always zero because the timer gets zero'd out when the Heartbeat bit turns on. I need to point it to the MAX value and read the minimum value for MAX... 4.2 milliseconds after I hit post the little 1/4 watt led lightbulb in my head came on

Share this post


Link to post
Share on other sites
Well shoot... That didn't and couldn't work. MINC still returns a zero with a non-zero input and besides that it's not going to tell me the "true" minimum value. I really only need current, max and average so I guess I'll be happy with that Edited by Michael Lloyd

Share this post


Link to post
Share on other sites
One last update. Even though I'm clearing the Heartbeat bit in the next rung it is apparently staying on long enough to read when the timer.acc value is zero. So... Min = 0. Interestingly enough it doesn't do this in every PLC but once it sees a 0 minimum value it is zero forever. I added a One Shot and that solved the problem I think I'll add a reset button so that I can reset min/max. If I don't I won't be able to see the results of any changes that we make on the server side And if you are wondering why I'm even bothering, poll times have steadily increased as we've added to the system. We use ClearSCADA, Kepware (for AB CLX and SLC PLC's), and AES (Modbus devices) to poll 26 stations. Some stations have multiple PLC's (If I remember right the largest has 5 PLC's) and multiple OMNI flow computers (4 or 5 max). Comm is TCP/IP thru T1, DSL, Wireless DSL, and Cell Modem depending on where the station is and it's size. Right now I'm seeing 30 - 40 seconds between polls on the large stations. I want to see no more than 5s. I think it's because of the Heartbeat write that we are doing (more specifically HOW we are doing it) but until now I didn't have the tools to see what would affect the poll time. Onward thru the fog...

Share this post


Link to post
Share on other sites
I can't help, but I do like the info, keep going. I 'm sorry that no one has helped you out, but maybe you can save a future soul.

Share this post


Link to post
Share on other sites
When I started doing this I forgot that i had set the scripts that write to the Heartbeat to varying values, some as high as 60 or 70 seconds. So, if I have a script that writes a 1 every 30s my "poll time" is going to be 30+lag seconds. That was throwing me off. I've tweaked the timing on all of the sites so poll times aren't "great" as far as the routine goes but at least I can tell what's going on. T1 poll setting - 3s. I had this at 1s and it worked fine but there's enough lag in the network that I was getting some over runs. Wired DSL poll setting - 5s and still getting some over runs Wireless DSL (Jim Bob's DSL service) poll setting - 15s and sometimes that's being generous so over runs here too. Cell Modem poll setting - 10s. Surprisingly this one isn't bad. There are 26 station on this merry go round and to date we have logged over 1.15 million historical points in the database. I gotta hand it to Control Micro, ClearSCADA pulls the database pretty quickly

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0