Sign in to follow this  
Followers 0
ahsan1820

How to take average analog input data when values are not so stable.

10 posts in this topic

hi I have to take average of my analog input data from analog input module FX 2N-2AD using with FX1N plc. As I cant treat REAL NUMBERS in FX1N ,as far as I know .please tell me program code for GX IEC Developer.

Share this post


Link to post
Share on other sites
You can sample analog input several times, and then calculate their mean. I'd done this before, and It works. By the way, FX-2DA can be used by FX1N? The manual dosen't mention it.

Share this post


Link to post
Share on other sites
averaging is the same regardless if you use floating points or not. btw, why don't you let card do the averaging for you? manual even gives you code sample: http://eleceng.dit.ie/jmcgrory/FXPLC/FX2n_PLC_Manual%202AD.pdf

Share this post


Link to post
Share on other sites
yes it gives averging option but it involves Real numbers and as into my observation i did not find REAL nimbers handling in FX 1N series ,please let me know if i am wrong.

Share this post


Link to post
Share on other sites
I skimmed through the FX1N manual for you, so don't take this as a fact, just as a advice. The manual doesn't speak about REAL, it does talk about FLOAT. This should be good enough. The manual is "FX1N, FX1S, FX2N, FX2NC programming manual" - JY992D88101, chapter 4.15 Kind regards, Maikel

Share this post


Link to post
Share on other sites
The averaging in the card has nothing to do with the REAL number format or the PLC. It's internal to the card, and the value in the register you read from the module is ALWAYS an integer.

Share this post


Link to post
Share on other sites
Hi I have write the given code in GX IEC developer as shown in the attached picture,but it gives me the error type mismatched .According to manual all D114 D118 etc are 32 bit integers but when i am trying to put them in DINC DADD DMOV they are giving error Edited by ahsan1820

Share this post


Link to post
Share on other sites
D registers are all 16 bits. To make 32-bit data, they simply use 2 consecutive addresses. Try creating labels and setting them as double. I always hated GX IEC Developer.

Share this post


Link to post
Share on other sites
Hi, I had a couple of very nervous temp sensors one time, so I made a small function block to handle that problem (attached). This block has also been used to change a target value slowly when the operator jumps between different values. Example when using it with a temperature in °C The temperature (as I use it) is in integer format with one decimal, eg: 125 is representing 12,5°C in my program. The ramp up and down change is then given in 10'th of a second. If the constant 10 is used for one of the inputs, will the temperature change be 0,1°C per second. If the constant 5 is used for one of the inputs, will the temperature change be 0,2°C per second. You can select if you'd like a quick ramp up and a slow one down. TimedRamp.zip

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