AB Reset HSC and storing values

AMH94

Member
Join Date
Mar 2021
Location
Denmark
Posts
9
Hi.

So I finally got my HSC to work with the RA_HSCPlugin thanks to @PLC Pie Guy .

I'm using an AB 2080-LC20-20QWB with a 2080-MOT-HSC extension module.

My next challenge is to get the HSC counter, to measure the flowrate of my flow meter. My meter when at max usage is 100hz/100 pulses pr second, and that's when the flowrate is 15/Liter pr minute. I've done some thinking and my idea as of now, is to reset and store the value of the counter every 1 second.

After 1 second the value determines the flow by simple math. 66pps = 66% usage = 66% of max flow which is 15L = 15 x 0,66 = 9,9 L/Pr minute. The math is super simple, but the execution is not..

I have absolutely no idea how to reset the counter and store/forward the values to a calculation every second. I have tried multiple functions and looked in parameters for a solution, but with no luck.

I've also tried the build in HSC functions, but have not been able to make them work.

I'm trying to attach some pictures in the post.

https://imgur.com/a/QjKLfMw
QjKLfMw
 
Last edited:
I do not have CCW so this is just how I would do it.
Create 1 1 second pulse (oneshot) for example, AND NOT Timer.DN TImer 1s
Then use this pulse to copy the contents of the HSC to a variable then reset the HSC.

This is what I mean, however, you need to call the HSC function after the logic if resetting the HSC count is done in the HSC function i.e. init or reset etc.

HSC.png
 
No, don't reset the HSC. Just calculate the difference once per second and accumulate that value separately if you want a running totalizer that you can have as an offset to match a physical register. If your calculation results in a large negative number, then the HSC has rolled over so you need to add the rollover value back into your result.

To calculate the flow rate in units per minute, just multiply that difference measured each second times 60.

Let the HSC accumulator run freely. I am not a CCW user but in general any attempt to reset the HSC runs the risk of missing pulses during the execution of the reset command.
 
Pay attention to that last post from @OkiePC


For example, say the actual rate is 10L/min, so the frequency is 66.66666666667Hz (;)). Ignoring the non-deterministic nature of the timer and any other noise, the PLC counts 66 pulses during the first second and reset the timer, throwing away the 2/3 of a pulse, and declare 9.9L/min. It gets the same during each of the next two and throws away another few fractions of a pulse. So it counts 198 pulses over three seconds, during which 200 actually occurred. That's only a 1% error, but what if it's running at 1L/min i.e. 6.6666667Hz. Now the PLC has counted 18 pulses over two seconds when there were actually 20, and it's off by 10% (.9L/min instead of .1L/min).
 
How do you throw away a fraction of a pulse, these are edge triggered so it is either throw away one or none. this would be an interesting pulse counter?.
Lets put it in perspective what exactly does the OP want an indication of flow or an accumulative amount or both. what accuracy do they want.
 
So, I have just ran my program on an FX3U, I injected my signal generator into the high speed input at 100hz (checked it with my frequency counter).
The logic uses a high speed timer (also tried using the internal clock) to snapshot the counter & store it in an array of 26 variables, summed them up & divided by 25 (only used integer), as you can see the counts did vary by one on occasions but overall the accumulated value was 2601, the result turns out to be 100, although in a float this would be 100.038.... So due to slight variations in the count the average was pretty close within 0.04 counts per 100.
I also created a loop just to increase the scan time somewhat, the result was about the same within 1 pulse per 2600. I watched this over a period of about 20 minutes & the results were pretty accurate, the reset of the HSC according to the documentation should be within a few microseconds so the chance of a pulse occurring during this short period six of one & half a dozen of the other & this turned out to be the case.

HSC.png
 
How do you throw away a fraction of a pulse, these are edge triggered so it is either throw away one or none. this would be an interesting pulse counter?.
Lets put it in perspective what exactly does the OP want an indication of flow or an accumulative amount or both. what accuracy do they want.

If you take a snapshot of the accumulator, then reset it, you run the risk of missing a pulse in the tiny gap between those two instructions.

On a 10kHz pulse, this will happen and it could amount to enough error to be bothersome. At 100Hz, it will probably be very rare to lose a pulse. But there's no need to take that risk at all by just letting the HSC do its thing and just working with snapshots of the accumulator differences each time the PLC needs to measure a rate or accumulate (separately) the delta in pulses.
 
Yes I already stated that it is possibly loss of one or none, on my trial I noticed probably due to using a timer it did lose one but on others gained one after 20 minutes the total error at 100hz was so negligible, however, I do agree that keeping the counter accumulating is best if needing a totalizer, however, reading the OP's reply he wishes to reset the count & appears to only want a flow rate.
 

Similar Topics

Have some project that we used the micrologix 1400 and a encoder to measure the rate in feet per minute and yards per minute. In the 1400 program...
Replies
2
Views
2,270
Hi I use hsc in cp1e .i set hsc5 in setting and see the value in a324 and i set the type to software reset but i can not reset the value pleasehelp
Replies
2
Views
1,423
Here is my dilemna. I have a 1756 HSC with 1000ppr encoders on each channel. I am using them for positional control on a carriage driven by a...
Replies
3
Views
3,276
Hello friends, I am using Omron CP1E-N60DT1-D PLC with Pepperl Fuchs tvi50n rotary encoder 1000ppr. In CX-programmer 9.03 i have made following...
Replies
2
Views
2,733
I've got an issue with resetting a counter to 0 on a Micrologix 1500 with a 1769-HSC card. The preset is configured in the IO configuration for 0...
Replies
3
Views
4,866
Back
Top Bottom